/* 虛空深淵・無盡爬塔 */
.abyss-backdrop {
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(2, 2, 10, 0.92);
    backdrop-filter: blur(6px);
    padding: 0;
    touch-action: auto;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
}

.abyss-backdrop.hidden {
    display: none !important;
}

.abyss-modal {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(12, 8, 28, 0.98), rgba(4, 2, 12, 0.99));
    border: none;
    box-shadow: 0 0 80px rgba(120, 40, 200, 0.25);
    touch-action: auto;
    pointer-events: auto;
}

/* 深淵全屏時：主應用頂欄／底欄不攔截點擊 */
body.abyss-modal-open #screen-app > .app-header,
body.abyss-modal-open #screen-app > .side-nav,
body.abyss-modal-open .void-global-footer,
body.abyss-modal-open .void-chat-panel {
    pointer-events: none !important;
}

body.abyss-modal-open .abyss-backdrop {
    touch-action: auto;
}

.abyss-modal__cosmos {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 40% at 50% 0%, rgba(140, 60, 220, 0.2), transparent),
        radial-gradient(circle at 80% 90%, rgba(255, 80, 40, 0.08), transparent 50%);
}

.abyss-head {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid rgba(180, 100, 255, 0.2);
    text-align: center;
    background: linear-gradient(180deg, rgba(12, 8, 28, 0.99), rgba(8, 4, 18, 0.97));
}

.abyss-head__main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    padding: 0 5.5rem 0 0.5rem;
    text-align: center;
}

.abyss-head__title {
    margin: 0 0 0.35rem;
    font-family: Orbitron, 'Noto Sans TC', sans-serif;
    font-size: clamp(1.15rem, 2.8vw, 1.55rem);
    font-weight: 900;
    color: #f5e6ff;
    letter-spacing: 0.04em;
    text-align: center;
}

.abyss-head__floor {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #ff8844;
    text-align: center;
}

.abyss-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin: 0.35rem 0 0;
}

.abyss-floor-type {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.abyss-floor-type--elite {
    border-color: rgba(126, 232, 255, 0.45);
    background: rgba(126, 232, 255, 0.12);
    color: #9de8ff;
}

.abyss-floor-type--boss {
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.14);
    color: #ffd56a;
}

.abyss-floor-reward {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
}

.abyss-head__best {
    margin: 0.35rem 0 0;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.6);
}

.abyss-formation-stats {
    margin: -0.15rem 0 0.35rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.abyss-head__actions {
    position: absolute;
    right: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.abyss-btn {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.abyss-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 180, 100, 0.45);
}

.abyss-btn--rank {
    border-color: rgba(255, 209, 102, 0.45);
    color: #ffd56a;
}

.abyss-btn--close {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.abyss-body {
    position: relative;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(400px, 520px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.65rem 1rem;
    padding: 1rem 1.15rem 1.15rem;
    overflow: hidden;
    min-height: 0;
}

.abyss-formation {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
}

.abyss-roster {
    grid-column: 2;
    grid-row: 1 / -1;
}

.abyss-action-bar {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
}

.abyss-powers-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

@media (min-width: 900px) {
    .abyss-head {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0.65rem 1.15rem;
    }

    .abyss-head__main {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 0.35rem 0.85rem;
        text-align: center;
        flex: 1 1 auto;
        width: 100%;
        padding: 0 5.5rem;
    }

    .abyss-head__title {
        margin: 0;
        flex: 0 0 auto;
        font-size: 1.25rem;
        white-space: nowrap;
    }

    .abyss-head__floor {
        flex: 0 0 auto;
        font-size: 1.02rem;
    }

    .abyss-head__meta {
        flex: 1 1 100%;
        margin: 0;
        justify-content: center;
    }
}

.abyss-section-title {
    margin: 0 0 0.55rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
}

.abyss-formation {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(180, 100, 255, 0.25);
    background: rgba(0, 0, 0, 0.35);
}

.abyss-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(128px, 1fr));
    gap: 0.7rem;
    width: 100%;
}

.abyss-slot {
    position: relative;
    aspect-ratio: 3 / 4;
    min-height: 168px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    color: inherit;
}

.abyss-slot.is-filled {
    border-style: solid;
    border-color: rgba(180, 100, 255, 0.45);
}

.abyss-slot__empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.25);
}

.abyss-slot__art {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center top;
}

.abyss-slot__art .card-picker-art-img,
.abyss-slot__art .abyss-slot__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.abyss-slot__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent 55%);
}

.abyss-slot__name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.35rem 0.28rem 0.42rem;
    font-size: 0.72rem;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.abyss-slot__power {
    position: absolute;
    left: 0;
    right: 0;
    top: 0.32rem;
    z-index: 2;
    font-family: Orbitron, sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    color: #ffe0a8;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.abyss-team-power {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem;
    border-radius: 10px;
    background: rgba(192, 132, 252, 0.12);
    border: 1px solid rgba(192, 132, 252, 0.32);
}

.abyss-team-power__label {
    font-size: 0.82rem;
    color: rgba(224, 200, 255, 0.9);
}

.abyss-team-power__value {
    font-family: Orbitron, sans-serif;
    font-size: 1.28rem;
    color: #e8d4ff;
    text-shadow: 0 0 12px rgba(192, 132, 252, 0.45);
}

.abyss-team-power__hp {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #9de8ff;
    text-align: center;
}

.abyss-team-power__hp.hidden {
    display: none;
}

.abyss-hint {
    margin: 0;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.52);
}

.abyss-guard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem;
    border-radius: 10px;
    background: rgba(255, 80, 40, 0.1);
    border: 1px solid rgba(255, 100, 60, 0.25);
}

.abyss-guard__label {
    font-size: 0.82rem;
    color: rgba(255, 200, 180, 0.88);
}

.abyss-guard__power {
    font-family: Orbitron, sans-serif;
    font-size: 1.2rem;
    color: #ff9966;
}

.abyss-guard__hp {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #ffb088;
    text-align: center;
}

.abyss-guard__hp.hidden {
    display: none;
}

.abyss-btn-start {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 900;
    color: #1a0820;
    background: linear-gradient(135deg, #c084fc, #ff6644);
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(180, 80, 255, 0.35);
}

.abyss-btn-start:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.abyss-guide {
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    flex: none;
    -webkit-font-smoothing: antialiased;
}

.abyss-rank-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    min-height: 0;
}

.abyss-guide summary {
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
    list-style: none;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.abyss-guide summary::-webkit-details-marker {
    display: none;
}

.abyss-guide ul {
    margin: 0.55rem 0 0;
    padding: 0;
    list-style-position: inside;
    text-align: center;
    line-height: 1.65;
}

.abyss-guide li {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.abyss-guide li strong {
    color: #e8d4ff;
    font-weight: 800;
}

.abyss-guide li + li {
    margin-top: 0.35rem;
}

.abyss-roster__head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.abyss-roster__head .abyss-section-title {
    margin: 0;
    grid-column: 1 / -1;
    text-align: center;
    justify-self: center;
}

.abyss-roster-filter {
    grid-column: 3;
    justify-self: end;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(192, 132, 252, 0.35);
    background: rgba(192, 132, 252, 0.1);
    color: rgba(224, 200, 255, 0.9);
    font-size: 0.66rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.abyss-roster-filter:hover {
    background: rgba(192, 132, 252, 0.18);
}

.abyss-roster-filter.is-active {
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.14);
    color: #ffd56a;
}

.abyss-roster-cap-hint {
    margin: 0 0 0.45rem;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    border: 1px dashed rgba(255, 209, 102, 0.28);
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(255, 220, 160, 0.85);
    text-align: center;
}

.abyss-roster-cap-hint.hidden {
    display: none !important;
}

.abyss-body--battle .abyss-roster {
    display: none;
}

.abyss-body--battle .abyss-rank-panel {
    display: none !important;
}

.abyss-body--battle .abyss-rank-sidebar {
    display: none !important;
}

.abyss-roster {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.abyss-roster__scroll {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.75rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.65rem 0.75rem 0.65rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(180, 100, 255, 0.22);
    background: rgba(0, 0, 0, 0.38);
    min-height: 0;
    max-height: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    pointer-events: auto;
}

.abyss-pick {
    position: relative;
    z-index: 1;
    aspect-ratio: 3 / 4;
    min-height: 168px;
    content-visibility: auto;
    contain-intrinsic-size: 145px 194px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(8, 6, 20, 0.9);
    cursor: pointer;
    padding: 0;
    color: inherit;
    transition: transform 0.12s, box-shadow 0.12s;
}

.abyss-pick:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(140, 60, 220, 0.25);
}

.abyss-pick.is-selected {
    border-color: #c084fc;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.45);
}

.abyss-pick.is-dead,
.abyss-pick[aria-disabled='true'] {
    cursor: not-allowed;
    filter: grayscale(0.85) brightness(0.45);
}

.abyss-pick.is-used {
    opacity: 0.45;
    pointer-events: none;
    transition: none;
}

.abyss-pick__art {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center top;
}

.abyss-pick__art .card-picker-art-img,
.abyss-pick__art .abyss-pick__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.abyss-pick__meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.38rem 0.3rem;
    font-size: 0.72rem;
    text-align: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.abyss-pick__power {
    position: absolute;
    left: 0;
    right: 0;
    top: 0.32rem;
    z-index: 2;
    font-family: Orbitron, sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    color: #ffe0a8;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.abyss-pick__dead {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    color: #ff8888;
    background: rgba(0, 0, 0, 0.55);
}

/* 排行榜 */
.abyss-rank-panel {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    bottom: 1rem;
    width: min(100%, 420px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(255, 209, 102, 0.35);
    background: rgba(8, 6, 20, 0.96);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    animation: abyss-rank-in 0.35s ease-out;
}

.abyss-rank-panel.hidden {
    display: none !important;
}

@keyframes abyss-rank-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.abyss-rank-panel__head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(255, 209, 102, 0.2);
}

.abyss-rank-panel__head h3 {
    margin: 0;
    flex: 1 1 auto;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 900;
    color: #ffd56a;
    padding: 0 1.75rem;
}

.abyss-rank-panel__close {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    cursor: pointer;
}

.abyss-rank-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem 0;
}

.abyss-rank-tab {
    flex: 1 1 0;
    padding: 0.45rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.abyss-rank-tab.is-active {
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.16);
    color: #ffd56a;
}

.abyss-rank-my {
    margin: 0.45rem 0.65rem 0;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: rgba(192, 132, 252, 0.1);
    border: 1px solid rgba(192, 132, 252, 0.22);
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(224, 200, 255, 0.95);
    text-align: center;
}

.abyss-rank-empty {
    padding: 1.25rem 0.5rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.88rem;
}

.abyss-rank-table-wrap {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0.5rem;
}

.abyss-rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: center;
}

.abyss-rank-table th {
    padding: 0.5rem 0.35rem;
    color: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 800;
    font-size: 0.8rem;
    white-space: nowrap;
}

.abyss-rank-table td {
    padding: 0.55rem 0.35rem;
    color: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.abyss-rank-table tr.is-me td {
    background: rgba(192, 132, 252, 0.12);
    color: #e8d4ff;
}

.abyss-rank-medal {
    font-size: 1.15rem;
}

.abyss-rank-team {
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
}

/* 戰鬥 */
.abyss-battle {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 2, 10, 0.88);
    padding: 1rem;
}

.abyss-battle.hidden {
    display: none !important;
}

.abyss-battle__stage {
    width: min(100%, 520px);
    padding: 1.25rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 100, 60, 0.35);
    background: rgba(8, 4, 16, 0.95);
    text-align: center;
}

.abyss-battle__round {
    margin: 0 0 0.85rem;
    font-family: Orbitron, sans-serif;
    font-weight: 900;
    color: #ff8844;
}

.abyss-battle__bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.abyss-bar {
    display: grid;
    grid-template-columns: 2.5rem 1fr 3rem;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
}

.abyss-bar__track {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.abyss-bar__fill {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7ee8ff, #c084fc);
    transition: width 0.35s ease;
}

.abyss-bar__fill--foe {
    background: linear-gradient(90deg, #ff6644, #ff9966);
}

.abyss-battle__log {
    max-height: 160px;
    overflow-y: auto;
    font-size: 0.72rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.abyss-battle__log p {
    margin: 0 0 0.3rem;
}

/* 結算 */
.abyss-result-backdrop {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 1rem;
}

.abyss-result-backdrop.hidden {
    display: none !important;
}

.abyss-result {
    width: min(100%, 400px);
    padding: 1.75rem 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 209, 102, 0.45);
    background: linear-gradient(165deg, rgba(24, 12, 40, 0.98), rgba(6, 4, 14, 0.98));
    text-align: center;
    animation: abyss-result-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.abyss-result--lose {
    border-color: rgba(255, 255, 255, 0.2);
}

@keyframes abyss-result-in {
    from { opacity: 0; transform: scale(0.9) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.abyss-result__icon {
    font-size: 2.75rem;
    margin-bottom: 0.35rem;
}

.abyss-result__title {
    margin: 0 0 0.45rem;
    font-size: 1.15rem;
    font-weight: 900;
    color: #fff8ec;
}

.abyss-result__sub {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 900px) {
    .abyss-backdrop {
        backdrop-filter: none;
        background: rgba(2, 2, 10, 0.96);
    }

    .abyss-modal {
        min-height: 0;
    }

    .abyss-head {
        flex-shrink: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding:
            max(10px, env(safe-area-inset-top, 0px))
            max(10px, env(safe-area-inset-right, 0px))
            10px
            max(10px, env(safe-area-inset-left, 0px));
    }

    .abyss-head__main {
        width: 100%;
        padding: 0 2.75rem 0 0;
        text-align: left;
    }

    .abyss-head__title {
        font-size: 1.05rem;
        line-height: 1.35;
        text-align: left;
    }

    .abyss-head__floor {
        text-align: left;
        font-size: 0.95rem;
    }

    .abyss-head__meta {
        justify-content: flex-start;
        gap: 0.35rem;
    }

    .abyss-floor-reward {
        font-size: 0.74rem;
        line-height: 1.35;
    }

    .abyss-head__actions {
        position: static;
        transform: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        margin-top: 0.15rem;
    }

    .abyss-btn--close {
        position: absolute;
        top: max(8px, env(safe-area-inset-top, 0px));
        right: max(10px, env(safe-area-inset-right, 0px));
    }

    .abyss-btn--rank {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.45rem 0.65rem;
    }

    .abyss-body {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
        padding:
            0.5rem
            max(10px, env(safe-area-inset-right, 0px))
            max(12px, env(safe-area-inset-bottom, 0px))
            max(10px, env(safe-area-inset-left, 0px));
        gap: 0.65rem;
    }

    .abyss-formation {
        flex: none;
        width: 100%;
        padding: 0.55rem 0.6rem;
        gap: 0.4rem;
        min-width: 0;
    }

    .abyss-slots {
        gap: 0.35rem;
    }

    .abyss-slot,
    .abyss-pick {
        min-height: 132px;
    }

    .abyss-hint {
        font-size: 0.76rem;
    }

    .abyss-roster {
        flex: none;
        width: 100%;
        min-height: 0;
        min-width: 0;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }

    .abyss-roster__scroll {
        flex: none;
        width: 100%;
        min-height: min(160px, 24vh);
        height: auto;
        max-height: min(52vh, 400px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        padding: 0.5rem;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        position: relative;
        z-index: 1;
    }

    .abyss-pick {
        position: relative;
        z-index: 1;
        min-height: 0;
        width: 100%;
        -webkit-tap-highlight-color: transparent;
    }

    .abyss-action-bar {
        flex: none;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        gap: 0.45rem;
        padding: 0.5rem 0.35rem 0.65rem;
        box-sizing: border-box;
        background: rgba(8, 4, 18, 0.55);
        border: 1px solid rgba(180, 100, 255, 0.22);
        border-radius: 14px;
        position: relative;
        z-index: 2;
    }

    .abyss-powers-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        width: 100%;
        max-width: 520px;
        margin: 0 auto;
    }

    .abyss-team-power,
    .abyss-guard {
        width: 100%;
        min-width: 0;
    }

    .abyss-btn-start {
        width: 100%;
        max-width: 520px;
        margin: 0 auto;
    }

    .abyss-team-power__value {
        font-size: 1.05rem;
    }

    .abyss-guard__power {
        font-size: 1.05rem;
    }

    .abyss-guide {
        display: block;
        width: 100%;
        font-size: 0.88rem;
        padding: 0.7rem 0.85rem;
    }

    .abyss-guide summary {
        cursor: pointer;
        padding: 0.35rem 0;
        font-size: 0.95rem;
        color: #fff;
    }

    .abyss-guide li {
        font-size: 0.88rem;
    }

    .abyss-rank-sidebar {
        width: 100%;
        order: 4;
    }

    .abyss-rank-panel {
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        width: auto;
    }

    .abyss-btn,
    .abyss-btn-start,
    .abyss-slot,
    .abyss-pick {
        touch-action: manipulation;
    }
}

@media (min-width: 1200px) {
    .abyss-body {
        grid-template-columns: minmax(420px, 540px) minmax(0, 1fr) minmax(300px, 360px);
    }

    .abyss-body.abyss-body--rank-docked .abyss-rank-sidebar {
        grid-column: 3;
        grid-row: 1 / -1;
        align-self: stretch;
        min-height: 0;
    }

    .abyss-body.abyss-body--rank-docked .abyss-rank-panel {
        position: static;
        flex: 1 1 auto;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        width: auto;
        min-height: 0;
        animation: none;
    }

    .abyss-body.abyss-body--rank-docked .abyss-rank-panel__close {
        display: none;
    }

    .abyss-head__actions .abyss-btn--rank {
        display: none;
    }

    .abyss-roster__scroll {
        grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
        gap: 0.8rem;
    }

    .abyss-slot,
    .abyss-pick {
        min-height: 184px;
    }

    .abyss-slots {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
        gap: 0.8rem;
    }
}
