.tier-container {
    max-width: 1200px;
}

.tier-intro {
    margin-bottom: 1rem;
}

.tool-description--highlight {
    background: linear-gradient(135deg, #fff7ed, #fef3c7);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-weight: 500;
    color: #92400e;
}

.tool-description--highlight i {
    color: #f59e0b;
    margin-right: 0.3rem;
}

.tool-description--highlight strong {
    color: #b45309;
    text-decoration: underline;
    text-decoration-color: #fbbf24;
    text-underline-offset: 2px;
}

.tier-controls {
    display: flex;
    gap: 0.65rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tier-title-control {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.tier-title-control label {
    font-size: 0.92rem;
    color: var(--text-color);
    font-weight: 600;
}

.tier-title-input {
    width: min(420px, 62vw);
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.95rem;
    color: var(--text-color);
    background: #fff;
}

.tier-title-input:focus {
    outline: none;
    border-color: var(--teal-mid);
    box-shadow: 0 0 0 2px rgba(67, 180, 170, 0.15);
}

.tier-controls .tag-btn.is-busy {
    opacity: 0.72;
    pointer-events: none;
}

#shareOnTwitter {
    justify-content: center;
    text-align: center;
    gap: 0;
}

.tier-capture-area {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tier-capture-area.is-exporting-capture {
    padding: 16px;
    width: fit-content;
    max-width: none;
    margin: 0 auto;
}

.tier-capture-title {
    margin: 0;
    text-align: center;
    font-size: 1.45rem;
    line-height: 1.25;
    color: var(--text-color);
    font-weight: 700;
    white-space: pre-wrap;
    word-break: break-word;
}

.tier-board {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.tier-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    background: white;
    border-radius: 14px;
    padding: 0.7rem;
    box-shadow: var(--shadow);
}

.tier-label {
    --tier-label-width: 120px;
    width: var(--tier-label-width);
    min-width: var(--tier-label-width);
    border-radius: 10px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.45rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: width 0.16s ease, min-width 0.16s ease;
}

.tier-name-input {
    display: block;
    width: 100%;
    min-height: 40px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    color: white;
    text-align: center;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.35rem 0.4rem;
    outline: none;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
}

.tier-name-input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.tier-name-input:focus {
    border-color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.2);
}

.tier-order-controls {
    display: flex;
    gap: 0.35rem;
}

.tier-color-input {
    width: 100%;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    padding: 0;
}

.tier-order-btn {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.tier-order-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.7);
}

.tier-order-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tier-delete-btn {
    color: #ffd5d5;
    border-color: rgba(255, 160, 160, 0.65);
}

.tier-delete-btn:hover {
    background: rgba(255, 120, 120, 0.22);
    border-color: rgba(255, 180, 180, 0.9);
}

.tier-dropzone {
    flex: 1;
    min-height: 104px;
    border: 2px dashed var(--tier-zone-border-color, var(--border-color));
    border-radius: 10px;
    background: var(--tier-zone-bg-color, #f8fcfb);
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tier-dropzone.is-empty::before {
    content: attr(data-empty-text);
    color: var(--text-light);
    font-size: 0.85rem;
    margin: auto;
}

.tier-dropzone.drop-target {
    border-color: var(--tier-zone-active-border-color, var(--teal-mid));
    background: var(--tier-zone-active-bg-color, #edf8f6);
}

.tier-item {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    cursor: grab;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 40, 40, 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tier-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 70, 60, 0.24);
}

.tier-item:active {
    cursor: grabbing;
}

.tier-item img:not(.tier-item-overlay) {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gam-character-tier-page .tier-item {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}

.gam-character-tier-page .tier-item img {
    width: 96px;
    height: 96px;
    background: transparent;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 3px 8px rgba(0, 30, 30, 0.28));
}

.gam-character-tier-page .tier-item:hover {
    box-shadow: none;
}

.gam-character-tier-page .tier-item.drop-stack-target {
    outline: none;
    filter: brightness(1.1) drop-shadow(0 0 6px rgba(47, 142, 129, 0.8));
}

.gam-character-tier-page .tier-item.is-selected {
    outline: none;
    filter: brightness(1.05) drop-shadow(0 0 6px rgba(245, 158, 11, 0.8));
}

.gam-song-tier-page .tier-item.is-selected {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

.gam-character-tier-page .tier-dropzone.has-slot-lines {
    display: block;
}

.gam-character-tier-page .tier-slot-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.5rem;
}

.gam-character-tier-page .tier-slot-line + .tier-slot-line {
    margin-top: 0.5rem;
}

.gam-character-tier-page .tier-item.tier-item-stack {
    border-radius: 0;
    background: transparent;
    border: none;
    overflow: visible;
    box-shadow: none;
}

.gam-character-tier-page .tier-stack-frame {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.gam-character-tier-page .tier-item .tier-stack-icon {
    position: absolute;
    width: 96px;
    height: 96px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 5px rgba(0, 30, 30, 0.24));
}

.gam-character-tier-page .tier-board.is-exporting .tier-slot-line {
    gap: 8px;
}

.gam-character-tier-page .tier-board.is-exporting .tier-dropzone.has-slot-lines {
    display: block;
}

.gam-character-tier-page .tier-board.is-exporting .tier-slot-line + .tier-slot-line {
    margin-top: 8px;
}

.tier-item.is-dragging {
    opacity: 0.45;
}

.tier-item.drop-before {
    outline: 3px solid var(--teal-mid);
    outline-offset: 2px;
}

.tier-board.is-exporting .tier-color-input,
.tier-board.is-exporting .tier-order-controls {
    display: none !important;
}

.tier-board.is-exporting .tier-label {
    width: var(--tier-label-width);
    min-width: var(--tier-label-width);
    max-width: none;
    padding: 0.45rem;
    justify-content: center;
    gap: 0;
}

.tier-board.is-exporting {
    gap: 6px;
    width: fit-content;
    align-items: flex-start;
    margin-bottom: 0;
}

.tier-board.is-exporting .tier-name-input {
    display: none !important;
}

.tier-board.is-exporting .tier-row {
    width: fit-content;
    flex-direction: row;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.tier-board.is-exporting .tier-dropzone {
    border-width: 0;
    border-color: transparent;
    width: var(--export-tier-zone-width, auto);
    max-width: var(--export-tier-zone-width, none);
    flex: 0 0 var(--export-tier-zone-width, auto);
    gap: 8px;
    padding: 8px;
    flex-wrap: nowrap;
}

.tier-board.is-exporting .tier-dropzone.export-wrap {
    flex-wrap: wrap;
}

.tier-board.is-exporting .tier-dropzone.is-empty {
    justify-content: center;
}

.tier-board.is-exporting .tier-dropzone.is-empty::before {
    content: '';
    display: none;
}

.tier-board.is-exporting .tier-item {
    width: 96px;
    height: 96px;
}

.tier-name-export {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.35rem 0.45rem;
}

.tier-pool-section .tool-body {
    padding-top: 1rem;
}

.tier-pool-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.acacia-character-tier-page .acacia-game-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
    margin-bottom: 0.95rem;
}

.acacia-character-tier-page .acacia-game-tab {
    border: 1px solid #9cc7bf;
    border-radius: 999px;
    background: #eef7f5;
    color: #25514b;
    padding: 0.32rem 0.72rem;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.acacia-character-tier-page .acacia-game-tab:hover {
    background: #dff1ed;
    border-color: #78b7ab;
}

.acacia-character-tier-page .acacia-game-tab.is-active {
    background: linear-gradient(135deg, #147367 0%, #1f8a7b 100%);
    border-color: #0f6b60;
    color: #ffffff;
}

.acacia-character-tier-page .acacia-spoiler-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: #25514b;
    user-select: none;
    cursor: pointer;
}

.acacia-character-tier-page .acacia-spoiler-toggle input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #1f8a7b;
    cursor: pointer;
}

.acacia-character-tier-page #iconPool.song-pool {
    margin-top: 0.35rem;
}

.song-pool {
    min-height: 180px;
    max-height: min(420px, 45vh);
    overflow-y: auto;
}

.tier-disclaimer {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f6faf9;
    color: var(--text-light);
    font-size: 0.86rem;
    line-height: 1.6;
    text-align: center;
}

.x-share-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.x-share-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.x-share-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 26, 25, 0.45);
    backdrop-filter: blur(3px);
}

.x-share-modal__panel {
    position: relative;
    width: min(520px, calc(100vw - 2rem));
    margin: max(6vh, 2rem) auto 0;
    background: linear-gradient(180deg, #ffffff 0%, #f5fbf9 100%);
    border: 1px solid #b8d8d1;
    border-radius: 16px;
    box-shadow: 0 24px 50px rgba(7, 36, 33, 0.24);
    padding: 1rem 1.1rem 1.05rem;
}

.x-share-modal__title {
    margin: 0 0 0.3rem;
    font-size: 1.1rem;
    color: #123c37;
    letter-spacing: 0.01em;
}

.x-share-modal__message {
    margin: 0;
    color: #2f5752;
    font-size: 0.94rem;
    line-height: 1.6;
}

.x-share-modal__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    font-size: 0.88rem;
    color: #2f5752;
    cursor: pointer;
}
.x-share-modal__option input[type="checkbox"] { cursor: pointer; }

.x-share-modal__actions {
    margin-top: 0.9rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.x-share-modal__btn {
    min-width: 110px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 1rem;
}

.x-share-modal__btn--sub {
    background: #e6f1ee;
    color: #2f5752;
}

.x-share-modal__btn--sub:hover {
    background: #d9ebe6;
}

.x-share-modal__btn--main {
    background: linear-gradient(135deg, #147367 0%, #1f8a7b 100%);
    color: #fff;
    border-color: #0f6b60;
}

.x-share-modal__btn--main:hover {
    background: linear-gradient(135deg, #0f685d 0%, #197e71 100%);
}

body.has-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .tier-controls {
        justify-content: flex-start;
    }

    .tier-title-control {
        width: 100%;
        margin-right: 0;
    }

    .tier-title-input {
        width: 100%;
    }

    .tier-row {
        flex-direction: column;
    }

    .tier-label {
        width: 100%;
        min-width: 0;
        max-width: 220px;
        padding: 0.55rem 0.8rem;
    }

    .tier-item {
        width: 84px;
        height: 84px;
    }

    .gam-character-tier-page .tier-item img,
    .acacia-character-tier-page .tier-item img {
        width: 84px;
        height: 84px;
    }

    .gam-character-tier-page .tier-item .tier-stack-icon,
    .acacia-character-tier-page .tier-item .tier-stack-icon {
        width: 84px;
        height: 84px;
    }

    .tier-dropzone {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .acacia-character-tier-page .acacia-game-tab {
        font-size: 0.82rem;
        padding: 0.28rem 0.6rem;
    }

    .acacia-character-tier-page .acacia-spoiler-toggle {
        width: 100%;
        justify-content: flex-start;
    }

    .x-share-modal__panel {
        margin-top: max(4vh, 1.25rem);
        padding: 0.9rem 0.9rem 0.95rem;
    }

    .x-share-modal__actions {
        justify-content: stretch;
    }

    .x-share-modal__btn {
        flex: 1;
        min-width: 0;
    }
}

/* ─── 学マス スキルカードTier表 ─── */

.gam-skill-card-tier-page .tier-item {
    border-radius: 8px;
    overflow: visible;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 40, 40, 0.14);
    position: relative;
}

.gam-skill-card-tier-page .tier-item img:not(.tier-item-overlay) {
    pointer-events: none;
    border-radius: 8px;
}

@font-face {
    font-family: 'GakNum';
    src: url('/assets/font/GakNumBold.otf') format('opentype');
    font-weight: bold;
    font-display: swap;
}

.tier-item-overlay {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}

.tier-item-badge-container {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    pointer-events: none;
    z-index: 2;
}

.tier-item-badge {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fefefe;
    font-family: 'GakNum', sans-serif;
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
}

/* ─── オーバーレイモーダル ─── */
.overlay-modal {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 0.5rem 0.65rem;
    min-width: 120px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.overlay-modal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.overlay-modal__title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.overlay-modal__options {
    display: flex;
    gap: 0.35rem;
}

.overlay-modal__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    cursor: pointer;
    padding: 4px;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
}

.overlay-modal__btn:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.overlay-modal__btn.is-active {
    border-color: #147367;
    background: #ecfdf5;
}

.overlay-modal__btn--wide {
    width: 100%;
    font-size: 0.7rem;
}

.overlay-modal__badge-section.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.overlay-modal__row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.overlay-modal__row-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #6b7280;
    min-width: 38px;
}

.overlay-modal__badge-section {
    border-top: 1px solid #e5e7eb;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.overlay-modal__badge-preview {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fefefe;
    font-family: 'GakNum', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.overlay-modal__btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gam-skill-card-tier-page .tier-item.is-selected {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

.gam-skill-card-tier-page .tier-item.drop-before {
    outline: 3px solid var(--teal-mid);
    outline-offset: 2px;
}

.skill-card-filter-tabs {
    margin-bottom: 0.75rem;
}

.skill-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.skill-filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #5a7a74;
    min-width: 4.5em;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}


.skill-filter-tab {
    border: 1px solid #9cc7bf;
    border-radius: 999px;
    background: #eef7f5;
    color: #25514b;
    padding: 0.32rem 0.72rem;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.skill-filter-tab:hover {
    background: #dff1ed;
    border-color: #78b7ab;
}

.skill-filter-tab.is-active {
    background: linear-gradient(135deg, #147367 0%, #1f8a7b 100%);
    border-color: #0f6b60;
    color: #ffffff;
}

.skill-filter-tab--sub {
    font-size: 0.82rem;
    padding: 0.25rem 0.6rem;
    font-weight: 600;
}

.skill-filter-tab--rarity {
    font-size: 0.82rem;
    padding: 0.25rem 0.6rem;
    font-weight: 600;
    border-color: #b0a8c7;
    background: #f3f0f8;
    color: #3e3558;
}

.skill-filter-tab--rarity:hover {
    background: #e8e2f3;
    border-color: #9588b5;
}

.skill-filter-tab--rarity.is-active {
    background: linear-gradient(135deg, #5c4b8a 0%, #7b68b6 100%);
    border-color: #4a3a78;
    color: #ffffff;
}

.skill-filter-row--idol {
    gap: 0.35rem;
}

.skill-filter-tab--idol {
    font-size: 0.78rem;
    padding: 0.22rem 0.55rem;
    font-weight: 600;
    border-color: #d4a8b8;
    background: #fdf2f6;
    color: #5a2d42;
}

.skill-filter-tab--idol:hover {
    background: #f8e0ea;
    border-color: #c78da3;
}

.skill-filter-tab--idol.is-active {
    background: linear-gradient(135deg, #a04468 0%, #c25a80 100%);
    border-color: #8a3858;
    color: #ffffff;
}

.skill-filter-count {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.15rem;
}

@media (max-width: 768px) {
    .skill-filter-tab {
        font-size: 0.82rem;
        padding: 0.28rem 0.6rem;
    }

    .skill-filter-tab--sub,
    .skill-filter-tab--rarity {
        font-size: 0.78rem;
        padding: 0.22rem 0.5rem;
    }

    .skill-filter-tab--idol {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    .skill-filter-label {
        font-size: 0.72rem;
        min-width: 4em;
    }
}
