body {
    font-family: sans-serif;
    margin: 0;
    background: #fff;
    color: #333;
    padding-top: 60px;
}

.spacomic-header {
    background-color: #fc9d2f;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
}

.spacomic-header img {
    height: 50px;
    width: auto;
    margin-top: 4px;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #ccc;
    background: #fff;
}

.tabs button {
    flex: 1;
    padding: 0.5rem 0;
    background: #fff;
    border: 1px solid #5ac8fa;
    border-bottom: none;
    color: #5ac8fa;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tabs button i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.tabs button.active {
    background: #5ac8fa;
    color: #fff;
    font-weight: bold;
}

.tabs button:hover:not(.active) {
    background: #dff6ff;
}

.tab-content {
    display: none;
    /* padding: 1rem; */
    padding: none;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
}

.tab-content.active {
    display: block;
}

#tab-control {
    overflow-x: auto;
    white-space: nowrap;
    padding: 5px 0;
    background: #fff;
    display: flex;
}

#tab-control button {
    display: inline-block;
    margin: 0;
    padding: 8px 15px;
    background: #fff;
    border-top: 2px solid #f39a38;
    border-left: none;
    border-right: 2px solid #f39a38;
    border-bottom: 1px solid #ccc;
    color: #f39a38;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
    border-radius: 5px 5px 0 0;
}

#tab-control button.active {
    background: #f39a38;
    color: #fff;
}

#tab-control button:hover:not(.active) {
    background: #fff;
}

#folder-buttons button {
    margin-left: 1px !important;
    transition: background 0.3s, color 0.3s;
}

select,
input[type="text"],
input[type="date"],
input[type="option"],
textarea,
.input-wide {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff8dc;
    font-size: 1.1rem;
    width: 100%;
    box-sizing: border-box;
}

.input-wide {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff8dc;
    font-size: 1.1rem;
    width: 100%;
    box-sizing: border-box;
}

button {
    border-radius: 4px;
}

#view-select,
#sort-select {
    margin-left: 5px;
}

h2 {
    color: #fc9d2f;
    border-left: 5px solid #fc9d2f;
    padding-left: 8px;
    background: #fff;
    font-size: 1.4rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

h3 {
    color: #5ac8fa;
    border-left: 4px solid #5ac8fa;
    padding-left: 6px;
    background: #f8f8f8;
    font-size: 1.1rem;
    margin-top: 15px;
    margin-bottom: 5px;
    cursor: pointer;
}

#tab-bookshelf>div.book-item,
#tab-bookshelf>div.author-item {
    position: relative;
    background: #fff;
    cursor: grab;
}

#tab-bookshelf img {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* アイコンst */
.toolbar {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 10px auto;
    padding: 0 10px;
    box-sizing: border-box;
    justify-content: center;
}

.toolbar button {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.4rem;
    width: 40px;
}

.toolbar button:hover {
    color: #5ac8fa;
}

.icon-label {
    font-size: 0.6rem;
    margin-top: 2px;
    text-align: center;
}


#search-area,
#tag-area,
#author-area,
#view-area,
#sort-area {
    display: none;
    margin: 10px 0;
    background: #dff4ff;
    padding: 10px;
    border-radius: 8px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#search-area input {
    width: 100% !important;
    font-size: 1.0rem;
    padding: 8px;
    margin: 5px 0;
    box-sizing: border-box;
}

#tag-area select,
#author-area select,
#view-area select,
#sort-area select {
    width: 70%;
    font-size: 1.0rem;
    padding: 8px;
    margin: 5px 0;
    color: #5ac8fa;
    box-sizing: border-box;
    height: calc(1.2rem + 16px);
}

#sort-order-btn {
    font-size: 1.0rem;
    padding: 0px 15px;
    margin-left: 5px;
    background: #dff4ff;
    border: 2px solid #5ac8fa;
    color: #5ac8fa;
    border-radius: 5px;
    height: calc(1.2rem + 16px);
    cursor: pointer;
    vertical-align: middle;
}

#sort-order-btn:hover {
    background: #bdeaff;
}

/* アイコンend */


/* bookshelf_display st */

.author-item {
    display: inline-block;
    margin: 5px;
    width: calc(25% - 10px);
    box-sizing: border-box;
    text-align: center;
    border: 1px solid #ccc;
    cursor: pointer;
}

.author-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 100%;
    aspect-ratio: 1/1;
}

.grid-cell {
    background: #eee;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-name {
    font-size: 12px;
    margin: 5px;
}

.author-single {
    width: 100%;
    aspect-ratio: 3/4;
    background: #eee;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.author-single img {
    width: 48%;
    height: auto;
    margin: 1%;
    object-fit: contain;
}

#tab-bookshelf>div[data-item-id^="9"] .book-image-area img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.author-single img:first-child:only-child {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-text {
    text-align: center;
}

.book-item {
    display: inline-block;
    box-sizing: border-box;
    text-align: center;
    border: 1px solid #ccc;
    cursor: pointer;
    margin: 5px;
    width: calc(100% / 3 - 10px);
    /* 初期3列用、JSでcolumns変更時に都度CSS更新でもOK */
}

.book-item.text-mode {
    width: 100%;
    border: none;
    text-align: left;
}

.book-inner {
    width: 100%;
}

.book-image-area {
    width: 100%;
    aspect-ratio: 3/4;
    background: #eee;
    overflow: hidden;
    position: relative;
}

.book-image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-star {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: orange;
    color: white;
    font-size: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.book-title {
    font-size: 12px;
    margin-top: 5px;
}

/* 検索・タグ・作者など → 選択中は水色 */
.toolbar button.active:not(#toggle-edit) i,
.toolbar button.active:hover:not(#toggle-edit) i {
    color: #00aaff !important;
}

.toolbar button i.fa-check {
    color: #f39a38;
}

/* 編集モードのとき本が揺れる */
@keyframes shakeAnim {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(2deg);
    }

    50% {
        transform: rotate(0deg);
    }

    75% {
        transform: rotate(-2deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

#bookshelf-list>div.book-item .book-inner.shake,
#bookshelf-list>div.author-item .author-single.shake,
#bookshelf-list>div.author-item .author-grid.shake {
    animation: shakeAnim 0.6s infinite;
}

#bookshelf-list>div.book-item.dragging,
#bookshelf-list>div.author-item.dragging {
    opacity: 0.8;
    transform: scale(1.1);
    z-index: 999;
    transition: transform 0.2s, opacity 0.2s;
}

/* bookshelf_display end */


/* フッター */
.spacomic-footer {
    background: #f8f8f8;
    color: #555;
    font-size: 0.85rem;
    text-align: center;
    padding: 15px 10px;
    margin-top: 30px;
    border-top: 1px solid #ccc;
}

.footer-inner {
    margin-bottom: 8px;
}

.footer-inner a {
    color: #555;
    text-decoration: none;
    margin: 0 5px;
}

.footer-inner a:hover {
    text-decoration: underline;
}

.footer-copy {
    color: #aaa;
    font-size: 0.75rem;
}

/* フッター */


/* フォルダ管理 */
.folder-order-item {
    position: relative;
    padding-right: 30px;
    user-select: none;
}

.drag-handle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    color: #666;
}

.folder-order-item.dragging {
    opacity: 0.6;
    transform: scale(1.1);
}

.folder-order-item.gap-space {
    transition: transform 0.2s;
    transform: translateY(10px);
}

/* ボタン共通 */
.spacomic-btn {
    background: #f39a38;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    margin: 0.3rem;
    transition: background 0.3s;
}

/* 共通ボタン */
.spacomic-btn.blue {
    background: #fff;
    color: #5ac8fa;
    border: 1px solid #5ac8fa;
}

.spacomic-btn.blue:hover {
    background: #dff6ff;
}