/* ==========================================================================
   拟态残响 (Visual Novel & Roguelike Exploration Engine)
   母舰夜班冷光 · 观测仪式视觉样式
   ========================================================================== */

:root {
    --bg-space: #060913;
    --bg-panel: rgba(12, 19, 36, 0.88);
    --border-cyan: #38bdf8;
    --border-dim: rgba(56, 189, 248, 0.3);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #4ade80;
    --accent-purple: #c084fc;
    --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif;
    --font-display: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
    --font-hud: ui-monospace, "Cascadia Mono", "Consolas", "Courier New", monospace;
    --menu-ink: #efeae0;
    --menu-muted: #b8c4cf;
    --menu-steel: #7ecfe0;
    --menu-ember: #dcb07f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh; /* 适配移动端动态地址栏高度 */
    overflow: hidden;
    background-color: var(--bg-space);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 15px;
    touch-action: manipulation; /* 防止平台端与手机端双击误缩放 */
    -webkit-tap-highlight-color: transparent;
}

/* 隐蔽类 */
.hidden {
    display: none !important;
}

/* ==========================================================================
   1. 主菜单界面 (Main Menu) — 拟态残响 · 冷台×仪式×指挥桥
   ========================================================================== */
#screen-menu {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #05070c;
    position: relative;
    z-index: 100;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top, 0px)) 14px max(16px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

#screen-menu .menu-container {
    margin-top: auto;
    margin-bottom: auto;
}

.menu-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.menu-grid {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(110, 196, 216, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(110, 196, 216, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
    animation: menuGridDrift 28s linear infinite;
}

.menu-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 42% at 50% 28%, rgba(78, 140, 160, 0.16) 0%, transparent 62%),
        radial-gradient(ellipse 80% 55% at 50% 110%, rgba(180, 110, 55, 0.1) 0%, transparent 55%),
        linear-gradient(180deg, rgba(5, 7, 12, 0.2) 0%, transparent 30%, rgba(5, 7, 12, 0.55) 100%);
}

.menu-orbit {
    position: absolute;
    left: 50%;
    top: 22%;
    width: min(92vw, 720px);
    height: min(92vw, 720px);
    transform: translate(-50%, -42%);
    border: 1px solid rgba(110, 196, 216, 0.1);
    border-radius: 50%;
    box-shadow: inset 0 0 60px rgba(110, 196, 216, 0.04);
}

.menu-orbit::after {
    content: "";
    position: absolute;
    inset: 12%;
    border: 1px dashed rgba(212, 165, 116, 0.14);
    border-radius: 50%;
    animation: menuOrbitSpin 48s linear infinite;
}

.menu-ember {
    position: absolute;
    width: 2px;
    height: 2px;
    left: 52%;
    top: 18%;
    border-radius: 50%;
    background: var(--menu-ember);
    box-shadow:
        0 0 18px 4px rgba(212, 165, 116, 0.35),
        -120px 80px 1px 0 rgba(110, 196, 216, 0.5),
        160px 40px 1px 0 rgba(232, 228, 217, 0.35),
        40px 140px 1px 0 rgba(212, 165, 116, 0.4);
    opacity: 0.7;
}

.menu-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 28%;
    background: linear-gradient(180deg, transparent, rgba(110, 196, 216, 0.03), transparent);
    animation: menuScan 7.5s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes menuGridDrift {
    from { transform: translateY(0); }
    to { transform: translateY(48px); }
}

@keyframes menuOrbitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes menuScan {
    0%, 100% { top: 8%; opacity: 0.25; }
    50% { top: 58%; opacity: 0.55; }
}

.menu-container {
    width: min(92vw, 520px);
    padding: 2.6rem 1.6rem 1.7rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    text-align: center;
    position: relative;
    z-index: 1;
    max-height: calc(100dvh - 28px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
    animation: menuRiseIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes menuRiseIn {
    from { opacity: 0; filter: blur(8px); transform: translateY(14px); }
    to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.menu-hero {
    margin-bottom: 2.1rem;
}

.menu-brand {
    margin: 0 0 0.85rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 9vw, 3.55rem);
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    color: var(--menu-ink);
    line-height: 1.15;
    text-shadow: 0 0 40px rgba(110, 196, 216, 0.18);
}

.menu-lede {
    margin: 0 auto;
    max-width: 28em;
    font-family: var(--font-sans);
    font-size: clamp(0.92rem, 2.6vw, 1.02rem);
    font-weight: 400;
    line-height: 1.7;
    color: var(--menu-muted);
    letter-spacing: 0.04em;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.55rem;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.95rem;
    width: 100%;
    padding: 0.92rem 1.05rem;
    background: rgba(10, 14, 22, 0.55);
    border: 1px solid rgba(110, 196, 216, 0.18);
    border-radius: 2px;
    color: var(--menu-ink);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease;
    text-align: left;
}

.menu-btn:hover:not(:disabled),
.menu-btn:focus-visible:not(:disabled) {
    background: rgba(110, 196, 216, 0.08);
    border-color: rgba(110, 196, 216, 0.55);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
    outline: none;
}

.menu-btn.primary-btn {
    background: linear-gradient(90deg, rgba(110, 196, 216, 0.16), rgba(10, 14, 22, 0.4));
    border-color: rgba(110, 196, 216, 0.45);
}

.menu-btn.primary-btn:hover:not(:disabled),
.menu-btn.primary-btn:focus-visible:not(:disabled) {
    background: linear-gradient(90deg, rgba(110, 196, 216, 0.24), rgba(10, 14, 22, 0.45));
    border-color: var(--menu-steel);
}

.menu-btn.talent-menu-btn {
    border-color: rgba(212, 165, 116, 0.28);
}

.menu-btn.talent-menu-btn:hover:not(:disabled),
.menu-btn.talent-menu-btn:focus-visible:not(:disabled) {
    border-color: rgba(212, 165, 116, 0.7);
    background: rgba(212, 165, 116, 0.08);
}

.menu-btn.persona-menu-btn:hover:not(:disabled),
.menu-btn.persona-menu-btn:focus-visible:not(:disabled) {
    border-color: rgba(154, 168, 181, 0.65);
}

.menu-btn.menu-btn-quiet {
    opacity: 0.82;
}

.menu-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    border-color: rgba(148, 163, 184, 0.18);
    transform: none;
    box-shadow: none;
}

.menu-btn-ico {
    flex: 0 0 auto;
    width: 1.55rem;
    height: 1.55rem;
    color: var(--menu-steel);
    display: grid;
    place-items: center;
}

.menu-btn.talent-menu-btn .menu-btn-ico {
    color: var(--menu-ember);
}

.menu-btn-ico svg {
    width: 100%;
    height: 100%;
    display: block;
}

.menu-btn-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.menu-btn-text {
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--menu-ink);
}

.menu-btn-hint {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    color: var(--menu-muted);
}

.menu-system-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.55rem 0.7rem;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    color: rgba(154, 168, 181, 0.85);
    letter-spacing: 0.08em;
    line-height: 1.5;
    border-top: 1px solid rgba(110, 196, 216, 0.14);
    padding-top: 1rem;
}

.menu-sys-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--menu-ember);
    opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
    .menu-grid,
    .menu-orbit::after,
    .menu-scanline,
    .menu-container {
        animation: none !important;
    }
}

/* ==========================================================================
   2. 全屏黑屏文字推进 (开局Q1、傍晚时刻转场、遇害宣告黑屏立绘)
   ========================================================================== */
#screen-q1-black, #screen-evening-black, #screen-death-black {
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: absolute;
    top: 0; left: 0;
    z-index: 200;
    cursor: pointer;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.black-phase-badge {
    display: inline-block;
    padding: 6px 18px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

/* 遇害公布专属红光告警徽章 */
.death-phase-badge {
    display: inline-block;
    padding: 6px 20px;
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid #ef4444;
    color: #f87171;
    border-radius: 20px;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 14px;
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.5);
    animation: deathBadgePulse 2s infinite ease-in-out;
}

/* 平安夜专属绿光徽章与边框 */
.death-phase-badge.peaceful-badge {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.45) !important;
    animation: peacefulBadgePulse 2s infinite ease-in-out !important;
}

@keyframes peacefulBadgePulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
        border-color: #22c55e;
    }
    50% {
        box-shadow: 0 0 24px rgba(34, 197, 94, 0.75);
        border-color: #86efac;
    }
}

.death-portrait-frame.peaceful-frame {
    border-color: #22c55e !important;
    box-shadow: 0 0 32px rgba(34, 197, 94, 0.5), inset 0 0 16px rgba(0, 0, 0, 0.85) !important;
    animation: peacefulFramePulse 2.2s infinite ease-in-out !important;
}

@keyframes peacefulFramePulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.8);
    }
    50% {
        box-shadow: 0 0 36px rgba(34, 197, 94, 0.75), inset 0 0 20px rgba(34, 197, 94, 0.2);
    }
}

.death-victim-title.peaceful-title {
    color: #4ade80 !important;
    text-shadow: 0 0 15px rgba(34, 197, 94, 0.5) !important;
}

@keyframes deathBadgePulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
        border-color: #ef4444;
    }
    50% {
        box-shadow: 0 0 24px rgba(239, 68, 68, 0.85);
        border-color: #fca5a5;
    }
}

.black-screen-center {
    max-width: 720px;
    width: 85%;
    text-align: center;
    padding: 20px;
    margin-top: auto;
    margin-bottom: auto;
    max-height: none;
    box-sizing: border-box;
}

/* 2秒纯黑死寂悬念层 */
.death-suspense-layer {
    position: absolute;
    inset: 0;
    background: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.death-suspense-layer.fade-out {
    opacity: 0;
    pointer-events: none;
}

.death-suspense-icon {
    font-size: 2.8rem;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.9));
    animation: deathSuspensePulse 1.6s infinite ease-in-out;
}

.death-suspense-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.95);
    margin-bottom: 8px;
}

.death-suspense-sub {
    font-size: 0.92rem;
    color: #64748b;
    letter-spacing: 3px;
}

@keyframes deathSuspensePulse {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

.death-screen-center {
    max-width: 660px;
    width: 88%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    z-index: 5;
    transition: opacity 0.3s ease;
}

/* 死者内容容器：初始全黑隐匿 */
.death-content-hidden {
    opacity: 0 !important;
    transform: translateY(22px) scale(0.92) !important;
    filter: blur(14px) !important;
    pointer-events: none !important;
}

/* 2秒后渐渐浮现出死者 */
.death-content-revealed {
    animation: deathRevealGradual 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    pointer-events: auto !important;
}

@keyframes deathRevealGradual {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.92);
        filter: blur(14px) brightness(0.3);
    }
    40% {
        opacity: 0.5;
        filter: blur(6px) brightness(0.7);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0) brightness(1);
    }
}

/* 屏幕正中间展示死亡立绘：比例适合，不要太大也不要太小 (约 200px × 260px) */
.death-portrait-wrapper {
    margin: 8px auto 14px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.death-portrait-frame {
    width: 200px;
    height: 260px;
    max-width: min(200px, 45vw);
    max-height: min(260px, 35vh);
    border-radius: 16px;
    border: 2px solid #ef4444;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.65), inset 0 0 16px rgba(0, 0, 0, 0.85);
    overflow: hidden !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: deathFramePulse 2.2s infinite ease-in-out;
}

@keyframes deathFramePulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.5), inset 0 0 12px rgba(0, 0, 0, 0.8);
    }
    50% {
        box-shadow: 0 0 36px rgba(239, 68, 68, 0.85), inset 0 0 20px rgba(239, 68, 68, 0.25);
    }
}

.death-portrait-frame img,
.death-portrait-frame svg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 15% !important; /* 严格聚焦大头照与半身肖像 */
    display: block !important;
    filter: contrast(1.06) brightness(0.94);
}

.death-victim-title {
    color: #f87171;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
}

.death-text-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #e2e8f0;
    font-weight: 300;
    letter-spacing: 0.8px;
    min-height: auto;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
    margin-bottom: 6px;
}

.black-text-content {
    color: #ffffff;
    font-size: 1.45rem;
    line-height: 2.2;
    font-weight: 300;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    transition: opacity 0.3s ease-in-out;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.click-pulse-prompt {
    margin-top: 40px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 3px;
    animation: promptBlink 1.8s infinite ease-in-out;
}

/* ==========================================================================
   第四关专属：直接在星舰大地图上演示的异象转场动画
   ========================================================================== */
#screen-game.cinematic-mode .game-top-bar,
#screen-game.cinematic-mode #action-log-sidebar,
#screen-game.cinematic-mode #exploration-controls,
#screen-game.cinematic-mode #team-roster-deck,
#screen-game.cinematic-mode #sector-telemetry-hud,
#screen-game.cinematic-mode #stage-mission-card,
#screen-game.cinematic-mode .stage-map-floating-controls,
#screen-game.cinematic-mode #stage-toast,
#screen-game.cinematic-mode #vn-speaker-portrait {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.5s ease;
}

#screen-level4-cutscene.map-cutscene-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    overflow: hidden;
    pointer-events: auto;
}

.map-cutscene-blackout {
    position: absolute;
    inset: 0;
    background: #000000;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-cutscene-blackout.blackout-transparent {
    opacity: 0;
    pointer-events: none;
}

.map-cutscene-typography {
    font-size: 1.55rem;
    line-height: 2.3;
    letter-spacing: 4px;
    color: #f8fafc;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.55), 0 0 35px rgba(56, 189, 248, 0.35);
    text-align: center;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-cutscene-typography.show-text {
    opacity: 1;
    transform: translateY(0);
}

.map-cutscene-stage {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.map-console-focus-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* 动力操作台中心：卡罗专属NPC图标 (无文字/别写名字) */
.map-kaze-npc-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2.5px solid #60a5fa;
    background: rgba(30, 58, 138, 0.85);
    box-shadow: 0 0 25px rgba(96, 165, 250, 0.85), inset 0 0 12px rgba(96, 165, 250, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

.map-kaze-npc-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 玩家主视角光标与脉冲环 */
.map-player-perspective {
    position: absolute;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 15;
}

.map-player-ring {
    position: absolute;
    inset: -4px;
    border: 2.5px dashed #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.95);
    animation: spinPlayerRing 8s linear infinite;
}

.map-player-crosshair {
    position: absolute;
    inset: 0;
}
.map-player-crosshair::before,
.map-player-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(56, 189, 248, 0.8);
}
.map-player-crosshair::before {
    left: 50%;
    top: -8px;
    bottom: -8px;
    width: 2px;
    transform: translateX(-50%);
}
.map-player-crosshair::after {
    top: 50%;
    left: -8px;
    right: -8px;
    height: 2px;
    transform: translateY(-50%);
}

/* X 实体（图一图标） */
.map-entity-x {
    position: absolute;
    width: 76px;
    height: 76px;
    right: -130px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: 35;
    transition: right 2.6s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 1.4s ease;
    filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 35px rgba(239, 68, 68, 0.85));
}

.map-entity-x img {
    width: 100%;
    height: 100%;
    display: block;
    animation: pulseEntityX 2s infinite ease-in-out;
}

/* 移动至主视角且发生局部重叠时停下的类 */
.map-entity-x.approaching {
    opacity: 1;
    right: calc(50% - 38px - 28px); /* 贴近主视角，形成约 35% 重叠部分后停驻 */
}

@keyframes promptBlink {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(2px); }
}

/* ==========================================================================
   3. 游戏主页面 (Game Main Screen)
   ========================================================================== */
#screen-game {
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 60% 40%, #0d1527 0%, #050811 100%);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    box-sizing: border-box;
}

/* 顶栏 */
.game-top-bar {
    height: 52px;
    background: rgba(10, 15, 29, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    z-index: 50;
    flex-shrink: 0;
}

.top-left-status {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 6px;
    font-size: 0.88rem;
}

.location-name {
    font-weight: 600;
    color: #38bdf8;
}

.stamina-track {
    width: 110px;
    height: 10px;
    background: #1e293b;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stamina-bar {
    height: 100%;
    background: #38bdf8;
    transition: width 0.3s ease, background 0.3s ease;
}

@keyframes staminaBoostPulse {
    0% {
        filter: drop-shadow(0 0 0px #4ade80) brightness(1);
    }
    40% {
        filter: drop-shadow(0 0 12px #4ade80) brightness(1.5);
    }
    100% {
        filter: drop-shadow(0 0 0px #4ade80) brightness(1);
    }
}

.stamina-boost-pulse {
    animation: staminaBoostPulse 0.85s ease-out;
}

.stamina-num {
    font-family: var(--font-hud);
    font-size: 0.8rem;
    font-weight: bold;
    color: #e2e8f0;
}

.day-badge {
    color: var(--accent-gold);
    font-weight: 600;
}

.top-right-tools {
    display: flex;
    gap: 10px;
}

.tool-btn {
    padding: 6px 12px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--border-cyan);
}

/* 中部核心区域：左侧行动记录 + 正中立绘与探索面板 */
.game-center-viewport {
    flex: 1;
    min-height: 0;
    display: flex;
    position: relative;
    overflow: hidden;
    padding-bottom: 0; /* 对话框关闭时不占用多余空间，由底部 flex 容器自适应 */
}

/* 左侧行动记录流水栏 */
.action-log-sidebar {
    width: 320px;
    height: 100%;
    background: rgba(8, 12, 24, 0.85);
    border-right: 1px solid rgba(56, 189, 248, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.log-panel-header {
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--border-cyan);
    letter-spacing: 1px;
}

.log-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-list::-webkit-scrollbar {
    width: 5px;
}
.log-list::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

.log-entry {
    font-size: 0.82rem;
    line-height: 1.5;
    color: #cbd5e1;
    border-left: 2px solid rgba(56, 189, 248, 0.4);
    padding-left: 8px;
    animation: fadeIn 0.3s ease;
}

.log-time {
    color: var(--text-muted);
    font-family: var(--font-hud);
    font-size: 0.75rem;
    margin-right: 4px;
}

/* ========================================================================= */
/* 舞台全景战术大地图直绘交互层 (铺满主舞台作为动态科技背景) */
/* ========================================================================= */
.stage-map-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background: #050811;
    transition: background 0.6s ease, box-shadow 0.6s ease;
}

/* 阶段光感：视口边缘余辉（与 Canvas 色温罩叠加） */
.stage-map-viewport.atmosphere-evening {
    background: #0a0705;
    box-shadow: inset 0 0 90px rgba(251, 146, 60, 0.18);
}

.stage-map-viewport.atmosphere-night {
    background: #020106;
    box-shadow: inset 0 0 110px rgba(129, 140, 248, 0.14), inset 0 0 70px rgba(239, 68, 68, 0.12);
}

.stage-map-viewport.atmosphere-aftermath {
    background: #080305;
    box-shadow: inset 0 0 100px rgba(239, 68, 68, 0.22);
    animation: aftermathEdgePulse 2.6s ease-in-out infinite;
}

.stage-map-viewport.atmosphere-alert-flash {
    animation: mapAlertFlash 1.15s ease-out;
}

@keyframes aftermathEdgePulse {
    0%, 100% { box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.16); }
    50% { box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.32); }
}

@keyframes mapAlertFlash {
    0% { box-shadow: inset 0 0 0 rgba(239, 68, 68, 0); }
    18% { box-shadow: inset 0 0 140px rgba(239, 68, 68, 0.55); }
    42% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.2); }
    65% { box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.42); }
    100% { box-shadow: inset 0 0 90px rgba(239, 68, 68, 0.18); }
}

.stage-map-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

.stage-map-canvas:active {
    cursor: grabbing;
}

.stage-map-floating-controls {
    position: absolute;
    top: 10px;
    right: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 25;
}

.stage-floating-btn {
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid var(--border-cyan);
    color: #7dd3fc;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.76rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
    transition: all 0.2s;
}

.stage-floating-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

/* 屏幕轻量浮动交互提示条（局内备份层；真正显示以 #app-toast 为准） */
.stage-toast {
    position: absolute;
    top: max(48px, calc(12px + env(safe-area-inset-top, 0px)));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid var(--border-cyan);
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #f1f5f9;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 14px rgba(56, 189, 248, 0.35);
    backdrop-filter: blur(10px);
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: normal;
    max-width: min(92vw, 420px);
    text-align: center;
    opacity: 0;
    visibility: hidden;
}

.stage-toast.visible {
    opacity: 1;
    visibility: visible;
}

/* 手机/电脑通用常驻左上角轻量任务指示器 */
.stage-mission-card {
    position: absolute;
    top: 10px;
    left: 14px;
    width: min(250px, 68vw);
    max-height: 280px;
    background: rgba(10, 16, 32, 0.88);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.15);
    backdrop-filter: blur(10px);
    z-index: 25;
    transition: all 0.25s ease;
}

.stage-mission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--border-cyan);
}

.stage-mission-toggle {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.stage-mission-card.collapsed .stage-mission-toggle {
    transform: rotate(-90deg);
}

.stage-mission-card.collapsed .stage-mission-content {
    display: none;
}

.stage-mission-content {
    max-height: 210px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stage-mission-content .mission-item-card {
    margin-bottom: 0;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.stage-mission-content .mission-name {
    font-size: 0.78rem;
}

.stage-mission-content .mission-objective {
    font-size: 0.72rem;
    line-height: 1.35;
}

.stage-mission-content .mission-reward {
    font-size: 0.68rem;
}

.stage-mission-content .mission-realtime {
    font-size: 0.68rem;
    margin-top: 2px;
}

@media (min-width: 769px) {
    .stage-mission-card {
        display: none !important;
    }
}

/* 屏幕正中区域：立绘 + 探索操作盘 */
.stage-center-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    padding: 6px 12px;
}

/* 角色立绘展示插槽 */
.center-portrait-container {
    position: absolute;
    top: 15px;
    bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.center-portrait-container.portrait-hidden {
    opacity: 0;
    transform: translateY(20px);
}

.portrait-img {
    max-height: 100%;
    max-width: 380px;
    object-fit: contain;
}

/* 探索十字操作盘与微型雷达：蓝图已直绘于主舞台，完全隐藏冗余操作盘释放全屏视野 */
#exploration-controls,
.exploration-hud {
    display: none !important;
}

.hud-header {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.compass-cross {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.compass-mid-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compass-center-hub {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle, #0284c7 0%, #0369a1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
    font-size: 1.15rem;
}

.nav-btn {
    min-width: 125px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.nav-btn .dest-preview {
    font-size: 0.72rem;
    font-weight: normal;
    opacity: 0.85;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.nav-btn.active-dir {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(56, 189, 248, 0.1));
    border-color: var(--border-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.nav-btn.active-dir:hover {
    background: rgba(56, 189, 248, 0.35);
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: transparent;
}

/* ==========================================================================
   4. 底部全宽视觉小说对话框 (Visual Novel Box)
   ========================================================================== */
.vn-dialogue-wrapper {
    position: absolute; /* 绝对悬浮于舞台底部，彻底杜绝出现/隐藏改变主舞台尺寸与地图缩放比例 */
    bottom: 0;
    left: 320px;
    right: 0;
    width: auto;
    min-height: 120px;
    max-height: 155px;
    background: rgba(8, 13, 27, 0.96);
    backdrop-filter: blur(16px);
    border-top: 2px solid var(--border-cyan);
    box-shadow: 0 -8px 30px rgba(56, 189, 248, 0.18), inset 0 0 20px rgba(56, 189, 248, 0.08);
    padding: 18px 32px 14px 32px;
    cursor: pointer;
    z-index: 60;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.vn-dialogue-wrapper.vn-hidden {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* 对话框左上角动态人名标牌 */
.vn-name-badge {
    position: absolute;
    top: -16px;
    left: 40px;
    padding: 5px 22px;
    background: #090e1d;
    border: 2px solid var(--border-cyan);
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--border-cyan);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
    transition: all 0.3s ease;
}

.vn-text-content {
    font-size: 1.15rem;
    line-height: 1.85;
    color: #f8fafc;
    letter-spacing: 0.5px;
    min-height: 70px;
    max-height: 110px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    white-space: pre-line;
    word-break: break-word;
    padding-right: 22px;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.45) transparent;
}

.vn-text-content::-webkit-scrollbar {
    width: 5px;
}
.vn-text-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}
.vn-text-content::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.45);
    border-radius: 4px;
}

.vn-advance-indicator {
    position: absolute;
    bottom: 12px;
    right: 32px;
    color: var(--border-cyan);
    font-size: 1.1rem;
    animation: indicatorBounce 1.2s infinite ease-in-out;
}

.vn-advance-indicator.indicator-hidden {
    display: none;
}

/* 对话框左上角NPC立绘展示区 (用户要求：放置在左上角，且去除表情文字) */
.vn-corner-portrait-slot {
    position: absolute;
    left: 28px;
    top: -24px;
    z-index: 70;
    pointer-events: none;
    transition: all 0.25s ease-out;
}

.vn-corner-portrait-slot.portrait-hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
    pointer-events: none;
}

.corner-avatar-frame {
    width: 88px;
    height: 108px;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(12px);
    border: 2px solid;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.corner-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%; /* 锁定头部肖像核心 */
}

.corner-portrait-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    background: rgba(15, 23, 42, 0.9);
}

/* 当有角色立绘时，名字标牌与正文文字向右偏移排版，绝不遮挡 */
.vn-dialogue-wrapper.has-portrait .vn-name-badge {
    left: 130px;
}

.vn-dialogue-wrapper.has-portrait .vn-text-content {
    padding-left: 104px;
}

/* 隐藏屏幕正中旧立绘，以对话框左上角立绘为主 */
.center-portrait-container {
    display: none !important;
}

/* ==========================================================================
   0. 全屏资源加载进度屏 (Loading Screen) — 与主菜单同一视觉世界
   ========================================================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #05070c;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.45s ease;
    overflow: hidden;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px))
             max(16px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}

.loading-screen.loading-fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.boot-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.boot-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(110, 196, 216, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(110, 196, 216, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 65% 55% at 50% 45%, #000 15%, transparent 72%);
}

.boot-glow-a {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 50% 38% at 50% 36%, rgba(78, 140, 160, 0.2) 0%, transparent 60%);
}

.boot-glow-b {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 40% at 50% 100%, rgba(180, 110, 55, 0.1) 0%, transparent 50%);
}

.boot-scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 24%;
    background: linear-gradient(180deg, transparent, rgba(110, 196, 216, 0.04), transparent);
    animation: menuScan 6.5s ease-in-out infinite;
}

.loading-container {
    width: min(90vw, 420px);
    padding: 2.4rem 1.5rem 1.7rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: menuRiseIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-title {
    margin: 0 0 0.55rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 2.6rem);
    font-weight: 700;
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: var(--menu-ink);
    text-shadow: 0 0 36px rgba(110, 196, 216, 0.18);
}

.loading-subtitle {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--menu-muted);
    margin-bottom: 1.8rem;
    letter-spacing: 0.08em;
    line-height: 1.6;
}

.loading-progress-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.loading-progress-track {
    width: 100%;
    height: 2px;
    background: rgba(154, 168, 181, 0.18);
    border: none;
    border-radius: 0;
    overflow: hidden;
    position: relative;
    box-shadow: none;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(110, 196, 216, 0.35), var(--menu-steel) 55%, var(--menu-ember));
    border-radius: 0;
    transition: width 0.15s ease-out;
    position: relative;
    box-shadow: 0 0 12px rgba(110, 196, 216, 0.35);
}

.loading-progress-glow {
    position: absolute;
    right: 0;
    top: -3px;
    bottom: -3px;
    width: 8px;
    background: #fff8ee;
    border-radius: 0;
    box-shadow: 0 0 10px rgba(255, 248, 238, 0.7);
    opacity: 0.9;
}

.loading-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.76rem;
}

.loading-status-text {
    color: var(--menu-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 78%;
    text-align: left;
    letter-spacing: 0.04em;
}

.loading-percent-text {
    font-family: var(--font-hud);
    font-weight: 600;
    color: var(--menu-steel);
    font-size: 0.84rem;
    letter-spacing: 0.06em;
}

.loading-start-btn {
    margin-top: 1.6rem;
    width: 100%;
    padding: 0.95rem 1.1rem;
    background: linear-gradient(90deg, rgba(110, 196, 216, 0.18), rgba(10, 14, 22, 0.35));
    border: 1px solid rgba(110, 196, 216, 0.5);
    border-radius: 2px;
    color: var(--menu-ink);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    animation: bootCtaPulse 2.2s ease-in-out infinite;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.loading-start-btn:hover,
.loading-start-btn:focus-visible {
    border-color: var(--menu-steel);
    background: linear-gradient(90deg, rgba(110, 196, 216, 0.26), rgba(10, 14, 22, 0.4));
    outline: none;
}

.loading-start-btn:active {
    transform: scale(0.985);
}

.loading-start-mark {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--menu-ember);
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.7);
}

@keyframes bootCtaPulse {
    0%, 100% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28); }
    50% { box-shadow: 0 12px 34px rgba(110, 196, 216, 0.18); }
}

@media (prefers-reduced-motion: reduce) {
    .boot-scan,
    .loading-container,
    .loading-start-btn {
        animation: none !important;
    }
}

/* 遇害死亡立绘专属警报特效 */
.avatar-frame-dead {
    border-color: #ef4444 !important;
    animation: deathPulse 1.8s infinite alternate;
}

@keyframes deathPulse {
    0% {
        box-shadow: 0 0 14px rgba(239, 68, 68, 0.7), inset 0 0 8px rgba(239, 68, 68, 0.4);
    }
    100% {
        box-shadow: 0 0 28px rgba(239, 68, 68, 1), inset 0 0 16px rgba(239, 68, 68, 0.8);
    }
}

.dead-portrait-img {
    filter: contrast(1.05) brightness(0.95);
}

/* ==========================================================================
   5. 模态弹窗系统 (Modals)
   ========================================================================== */
/* 系统确认/提示弹窗：盖在其它局内 UI 之上，避免调用浏览器原生弹窗 */
.system-dialog-backdrop {
    z-index: 520;
    align-items: center;
}

.system-dialog-box {
    max-width: 420px;
    width: min(92vw, 420px);
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 28px rgba(56, 189, 248, 0.28), 0 12px 36px rgba(0, 0, 0, 0.75);
}

.system-dialog-message {
    margin: 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.system-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.system-dialog-actions .choice-btn {
    flex: 1 1 120px;
    min-height: 44px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 300;
    padding: max(12px, env(safe-area-inset-top, 0px)) 10px max(12px, env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: fadeIn 0.22s ease;
    box-sizing: border-box;
}

.modal-box {
    background: rgba(12, 18, 34, 0.98);
    border: 1px solid var(--border-cyan);
    border-radius: 12px;
    box-shadow: 0 0 35px rgba(56, 189, 248, 0.35), 0 10px 40px rgba(0, 0, 0, 0.8);
    padding: 16px 18px;
    max-width: 580px;
    width: 100%;
    position: relative;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
}

.modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal-choices,
.modal-footer-actions {
    flex-shrink: 0;
}

.modal-header h3 {
    color: #ffffff;
    font-size: 1.2rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #ffffff;
}

/* ==========================================================================
   5b. 停电始发地合闸确认弹窗 (Power Restore Modal)
   ========================================================================== */
.power-restore-box {
    max-width: 520px;
    border: 1.5px solid #0ea5e9;
    box-shadow: 0 0 35px rgba(14, 165, 233, 0.4), 0 10px 40px rgba(0, 0, 0, 0.85);
    background: radial-gradient(circle at 50% 20%, rgba(14, 165, 233, 0.12) 0%, rgba(10, 16, 32, 0.98) 75%);
}

.power-restore-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.3);
}

.power-title-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.power-status-pulse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(234, 179, 8, 0.2);
    border: 1.5px solid #eab308;
    color: #facc15;
    font-size: 1.25rem;
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.5);
    animation: pulsePower 1.5s infinite alternate;
}

@keyframes pulsePower {
    from {
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
    }
    to {
        transform: scale(1.08);
        box-shadow: 0 0 22px rgba(234, 179, 8, 0.85);
    }
}

.power-restore-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.power-alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    padding: 8px 12px;
}

.power-warning-badge {
    color: #f87171;
    font-size: 0.82rem;
    font-weight: bold;
    white-space: nowrap;
}

.power-warning-info {
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.35;
}

.power-breaker-visual {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
}

.power-switch-slot {
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.power-voltage-meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.voltage-label {
    font-size: 0.72rem;
    color: #94a3b8;
}

.voltage-val {
    font-family: var(--font-hud);
    font-size: 0.95rem;
    font-weight: bold;
    color: #f87171;
}

.voltage-val.text-green {
    color: #4ade80;
}

.power-lever-icon {
    font-size: 1.3rem;
    color: #38bdf8;
    animation: flashLever 1.2s infinite;
}

@keyframes flashLever {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; transform: scale(1.1); }
}

.power-desc-text {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 0;
}

.power-confirm-btn {
    width: 100%;
    background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%) !important;
    border-color: #38bdf8 !important;
    font-size: 0.95rem;
    font-weight: bold;
    padding: 12px 16px;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
    transition: all 0.2s ease;
}

.power-confirm-btn:hover {
    box-shadow: 0 0 24px rgba(14, 165, 233, 0.7);
    transform: translateY(-1px);
}

/* ==========================================================================
   5b. NPC 日记翻页弹窗 (Diary Reading Modal)
   ========================================================================== */
.diary-modal-box {
    max-width: 480px;
    border-color: #38bdf8; /* 动态被JS覆盖为NPC主题色 */
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.3), 0 10px 40px rgba(0, 0, 0, 0.8);
}

.diary-modal-header {
    gap: 10px;
}

.diary-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.diary-npc-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.03em;
}

.diary-page-indicator {
    font-size: 0.78rem;
    color: #64748b;
}

.diary-body {
    padding: 0 2px;
}

.diary-page-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
    padding-bottom: 8px;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.diary-page-content {
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.85;
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 4px;
    white-space: pre-wrap;
    /* 青色细滚动条 */
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.5) transparent;
}

.diary-page-content::-webkit-scrollbar {
    width: 4px;
}

.diary-page-content::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.5);
    border-radius: 2px;
}

.diary-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(56, 189, 248, 0.18);
    padding-top: 10px;
    margin-top: 10px;
    gap: 10px;
}

.diary-nav-btn {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 0.88rem;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    flex: 1;
}

.diary-nav-btn:hover:not(:disabled) {
    background: rgba(14, 165, 233, 0.3);
    color: #ffffff;
}

.diary-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .diary-modal-box {
        max-width: 100%;
    }
    .diary-page-content {
        max-height: 180px;
    }
    .diary-nav-btn {
        font-size: 0.82rem;
        padding: 6px 10px;
    }

}


.modal-intro {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 18px;
}

/* 第一关新手教程弹窗 */
.tutorial-backdrop {
    z-index: 460;
}
.tutorial-modal-box {
    max-width: 520px;
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 0 32px rgba(251, 191, 36, 0.22), 0 10px 40px rgba(0, 0, 0, 0.8);
}
.tutorial-header {
    gap: 10px;
}
.tutorial-header h3 {
    color: #fde68a;
    font-size: 1.12rem;
}
.tutorial-badge {
    margin-left: auto;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.45);
    border-radius: 999px;
    padding: 3px 10px;
    background: rgba(251, 191, 36, 0.12);
    white-space: nowrap;
}
.tutorial-body-text {
    color: #e2e8f0;
    font-size: 0.98rem;
    line-height: 1.75;
}
.tutorial-body-text strong {
    color: #fde68a;
}
.tutorial-progress {
    margin-top: 14px;
    font-size: 0.78rem;
    color: #94a3b8;
    letter-spacing: 0.04em;
}
.tutorial-choices {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

/* =========================================================================
   第一关可视化 Coach Mark（聚光灯镂空 + 旁白气泡）
   ========================================================================= */
.coach-overlay {
    position: fixed;
    inset: 0;
    z-index: 470;
    pointer-events: none;
}
.coach-overlay.coach-blocking {
    pointer-events: auto;
    background: transparent;
}
.coach-overlay.hidden {
    display: none !important;
}
.coach-spotlight {
    position: fixed;
    z-index: 471;
    border-radius: 12px;
    border: 2px solid rgba(251, 191, 36, 0.95);
    box-shadow:
        0 0 0 9999px rgba(2, 6, 14, 0.72),
        0 0 0 3px rgba(251, 191, 36, 0.35),
        0 0 28px rgba(251, 191, 36, 0.45);
    pointer-events: none;
    transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
    animation: coach-pulse 1.6s ease-in-out infinite;
}
.coach-overlay.coach-click-target .coach-spotlight {
    /* 允许点击镂空下的真实控件 */
    pointer-events: none;
}
@keyframes coach-pulse {
    0%, 100% { box-shadow: 0 0 0 9999px rgba(2, 6, 14, 0.72), 0 0 0 3px rgba(251, 191, 36, 0.35), 0 0 22px rgba(251, 191, 36, 0.4); }
    50% { box-shadow: 0 0 0 9999px rgba(2, 6, 14, 0.68), 0 0 0 5px rgba(251, 191, 36, 0.55), 0 0 36px rgba(251, 191, 36, 0.65); }
}
.coach-finger {
    position: fixed;
    z-index: 473;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.8), 0 2px 6px rgba(0, 0, 0, 0.85);
    pointer-events: none;
    animation: coach-finger-bounce 0.9s ease-in-out infinite;
    transform-origin: center top;
}
@keyframes coach-finger-bounce {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(8px); opacity: 0.85; }
}
.coach-tooltip {
    position: fixed;
    z-index: 474;
    width: min(360px, calc(100vw - 28px));
    max-height: min(52vh, 420px);
    max-height: min(52dvh, 420px);
    padding: 16px 18px 14px;
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.97), rgba(8, 12, 22, 0.98));
    border: 1px solid rgba(251, 191, 36, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(251, 191, 36, 0.12);
    pointer-events: auto;
    color: #e2e8f0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
}
.coach-tooltip-badge {
    display: inline-block;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 999px;
    padding: 2px 9px;
    background: rgba(251, 191, 36, 0.1);
    margin-bottom: 8px;
}
.coach-tooltip h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #fde68a;
    font-weight: 700;
}
.coach-body {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #cbd5e1;
    max-height: min(28vh, 220px);
    max-height: min(28dvh, 220px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.coach-body strong {
    color: #fde68a;
}
.coach-tooltip-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.coach-progress {
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.04em;
}
.coach-next-btn {
    flex-shrink: 0;
    min-width: 96px;
    padding: 8px 14px !important;
    font-size: 0.88rem !important;
}
.coach-overlay.coach-click-target .coach-next-btn {
    display: none;
}
.coach-target-live {
    position: relative;
    z-index: 472 !important;
}

@media (max-width: 720px) {
    .coach-tooltip {
        width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px;
        max-width: none;
    }
}

.choice-btn {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.choice-btn.primary {
    background: rgba(14, 165, 233, 0.3);
    border-color: var(--border-cyan);
    color: #ffffff;
}
.choice-btn.primary:hover {
    background: rgba(14, 165, 233, 0.5);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}
.choice-btn.primary:active {
    background: rgba(14, 165, 233, 0.62);
    transform: scale(0.98);
}

.choice-btn.secondary {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--text-muted);
}
.choice-btn.secondary:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #ffffff;
}
.choice-btn.secondary:active {
    background: rgba(71, 85, 105, 0.9);
    color: #ffffff;
    transform: scale(0.98);
}

.choice-btn.pass-btn {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
}
.choice-btn.pass-btn:hover {
    background: rgba(148, 163, 184, 0.3);
}
.choice-btn.pass-btn:active {
    background: rgba(148, 163, 184, 0.4);
    transform: scale(0.98);
}

/* 地图大图展示与双模式切换 */
.map-modal-box {
    max-width: 900px;
    width: 96%;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 14px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 全屏沉浸模式 (手机全屏与桌面超宽全屏) */
.map-modal-box.map-fullscreen {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    padding: 8px !important;
    margin: 0 !important;
    border: none !important;
}

.map-tab-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.map-tab-btn {
    padding: 6px 12px;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
}
.map-tab-btn:hover {
    color: #ffffff;
    border-color: var(--border-cyan);
}
.map-tab-btn.active {
    background: rgba(14, 165, 233, 0.35);
    border-color: var(--border-cyan);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* 地图行进动态状态横幅 (DoTween 动效时展示) */
.map-move-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    margin-bottom: 8px;
    background: rgba(14, 165, 233, 0.16);
    border: 1px solid var(--border-cyan);
    border-radius: 8px;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
    animation: bannerFade 0.25s ease;
}

.map-move-banner.hidden {
    display: none !important;
}

.map-move-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: #f0f9ff;
    letter-spacing: 0.8px;
}

.map-move-sub {
    font-size: 0.78rem;
    color: rgba(224, 242, 254, 0.7);
    letter-spacing: 0.5px;
}

@keyframes bannerFade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.map-view-container {
    width: 100%;
    flex: 1;
    min-height: 220px;
    max-height: 68vh;
    max-height: 68dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #050811;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    overflow: hidden;
    padding: 0;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.8);
    position: relative;
}

.map-modal-box.map-fullscreen .map-view-container {
    max-height: none !important;
    height: 100% !important;
}

/* 触屏与鼠标专属悬浮工具条 */
.map-floating-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.map-floating-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #ffffff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    user-select: none;
    -webkit-user-select: none;
}

.map-floating-btn:hover {
    background: rgba(14, 165, 233, 0.35);
    border-color: #38bdf8;
    transform: scale(1.06);
}

.map-floating-btn:active {
    transform: scale(0.95);
}

.live-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none !important;
    cursor: grab;
}

.live-canvas:active {
    cursor: grabbing;
}
.full-map-image {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    display: block;
    margin: auto;
}
.map-view-container.pan-mode .full-map-image {
    max-width: none !important;
    max-height: none !important;
    width: 680px !important;
}
.map-pan-hint {
    text-align: center;
    font-size: 0.76rem;
    color: #38bdf8;
    margin-top: 6px;
    opacity: 0.85;
    letter-spacing: 0.5px;
}
.map-notes {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
}

/* 遭遇昏迷人员弹窗 */
.encounter-box {
    text-align: center;
}
.encounter-avatar-slot,
#encounter-npc-avatar {
    width: 140px;
    height: 140px;
    max-width: 140px;
    max-height: 140px;
    min-width: 140px;
    min-height: 140px;
    margin: 0 auto 16px auto;
    border-radius: 16px;
    overflow: hidden !important;
    position: relative;
    border: 2px solid var(--border-cyan);
    background: rgba(11, 17, 32, 0.95);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}
.encounter-avatar-slot img,
#encounter-npc-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center 15% !important; /* 严格截取图片中心偏上的头部肖像，防止拉伸或溢出 */
    display: block !important;
    border-radius: 14px;
}
.encounter-avatar-slot svg,
#encounter-npc-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
}
.encounter-name {
    font-size: 1.3rem;
    margin-bottom: 8px;
}
.encounter-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 22px;
}
.modal-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 傍晚交谈卡片列表 */
.inquiry-cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(48vh, 420px);
    max-height: min(48dvh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.inquiry-card {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid;
    border-radius: 8px;
    gap: 12px;
    transition: all 0.2s;
}

.inquiry-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid;
}
.inquiry-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inquiry-card-info {
    flex: 1;
}
.inquiry-card-name {
    font-weight: 600;
    font-size: 1rem;
}
.inquiry-card-times {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.inquiry-card-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

/* 裁决列表项 */
.judgement-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(48vh, 420px);
    max-height: min(48dvh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.judgement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid;
    border-radius: 8px;
}
.judgement-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-right: 8px;
}
.judgement-role-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.judgement-actions {
    display: flex;
    gap: 8px;
}
.judge-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-confine {
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
}
.btn-confine:hover {
    background: var(--accent-gold);
    color: #000;
}
.btn-exile {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}
.btn-exile:hover {
    background: var(--accent-red);
    color: #fff;
}

/* 黑夜技能选择 */
.night-choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(48vh, 420px);
    max-height: min(48dvh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.night-choice-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.night-choice-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: translateX(4px);
}
.btn-save-action {
    border-color: var(--accent-purple) !important;
    background: rgba(192, 132, 252, 0.2) !important;
    color: #ffffff !important;
}

/* 结算弹窗 */
.result-box {
    text-align: center;
}
.result-box h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}
.result-body-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
    white-space: pre-line;
    margin-bottom: 25px;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   移动端与各种手机机型原生排版自适应 (Mobile First Responsive Overhaul)
   ========================================================================== */
.log-mobile-bar {
    display: none;
}

@media (max-width: 768px) {
    /* 移动端顶栏全新双层高科技战术布局 (彻底根治功能键挤压、体力值遮挡问题) */
    .game-top-bar {
        height: auto !important;
        min-height: 72px !important;
        padding: 6px 8px 5px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 5px !important;
        background: rgba(10, 16, 32, 0.96) !important;
        backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.25) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
    }

    /* 第一层：核心状态栏 (当前位置、体力血条、当前循环) */
    .top-left-status {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
        margin: 0 !important;
    }

    .status-box {
        padding: 3px 7px !important;
        font-size: 0.74rem !important;
        gap: 4px !important;
        background: rgba(15, 23, 42, 0.8) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
    }

    .location-box {
        flex: 1 !important;
        min-width: 0 !important;
        max-width: 46% !important;
        display: flex !important;
        align-items: center !important;
    }

    .location-name {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 0.74rem !important;
        color: #38bdf8 !important;
        font-weight: 600 !important;
    }

    /* 体力指示框：醒目居中、100%完全展示、绝不被遮挡 */
    .stamina-box {
        flex: 1 !important;
        max-width: 42% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(15, 23, 42, 0.9) !important;
        border-color: rgba(56, 189, 248, 0.4) !important;
    }

    .stamina-label {
        display: none !important;
    }

    .stamina-track {
        width: 46px !important;
        height: 8px !important;
        background: #0f172a !important;
        border-radius: 4px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    .stamina-num {
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        color: #e2e8f0 !important;
        font-family: var(--font-hud) !important;
    }

    .day-box {
        padding: 3px 6px !important;
    }

    .day-badge {
        font-size: 0.72rem !important;
        color: var(--accent-gold) !important;
        font-weight: 700 !important;
    }

    .team-box {
        display: none !important; /* 手机端留出空间给体力与地点 */
    }

    /* 第二层：功能操作条 (日志、任务、地图、存档、退出 均匀分布全宽) */
    .top-right-tools {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 4px !important;
        margin: 0 !important;
    }

    .tool-btn {
        flex: 1 !important;
        padding: 8px 2px !important;
        min-height: 44px !important;
        font-size: 0.74rem !important;
        border-radius: 8px !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(30, 41, 59, 0.75) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        color: #f1f5f9 !important;
        white-space: nowrap !important;
        letter-spacing: -0.2px !important;
        transition: background 0.15s, border-color 0.15s, transform 0.12s !important;
    }

    .tool-btn:active {
        background: rgba(56, 189, 248, 0.35) !important;
        border-color: #38bdf8 !important;
        transform: scale(0.97) !important;
    }

    /* 移动端抽屉式侧边栏 (彻底消灭顶部黑块遮挡) */
    .log-mobile-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 14px;
        background: rgba(15, 23, 42, 0.95);
        border-bottom: 1px solid var(--border-cyan);
        color: #38bdf8;
        font-size: 0.85rem;
        font-weight: 600;
    }
    .log-drawer-close {
        background: transparent;
        border: 1px solid rgba(56, 189, 248, 0.4);
        color: #e2e8f0;
        padding: 8px 14px;
        min-height: 40px;
        min-width: 44px;
        border-radius: 6px;
        font-size: 0.8rem;
        cursor: pointer;
    }
    .log-drawer-close:active {
        background: rgba(56, 189, 248, 0.25);
    }
    .action-log-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(320px, 86vw) !important;
        height: 100% !important;
        z-index: 500 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.85) !important;
        background: rgba(10, 16, 32, 0.98) !important;
        border-right: 1px solid var(--border-cyan) !important;
    }
    .action-log-sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    /* 游戏中心主视口 (完全归还全屏空间) */
    .game-center-viewport {
        width: 100% !important;
        height: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        overflow: hidden !important;
    }
    .stage-center-area {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        position: relative !important;
        padding: 6px 8px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* 探索操作盘自适应 */
    .exploration-hud {
        padding: 10px 16px;
        margin-top: auto;
        margin-bottom: 6px;
        background: rgba(15, 23, 42, 0.92);
        border-radius: 12px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
        z-index: 15;
    }
    .hud-header {
        font-size: 0.72rem;
        margin-bottom: 8px;
    }
    .compass-cross {
        gap: 6px;
    }
    .nav-btn {
        min-width: 80px;
        max-width: 110px;
        padding: 6px 8px;
        font-size: 0.78rem;
    }
    .nav-btn .dest-preview {
        max-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
    .compass-center-hub {
        width: 32px;
        height: 32px;
        font-size: 0.88rem;
    }

    /* 底部视觉小说对话框自适应：移动端底铺绝对悬浮，绝不挤压主视口与地图 */
    .vn-dialogue-wrapper {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-height: 98px !important;
        max-height: 145px !important;
        height: auto !important;
        padding: 14px 14px 8px 14px !important;
        background: linear-gradient(180deg, rgba(8, 14, 28, 0.95) 0%, rgba(3, 7, 18, 0.99) 100%) !important;
        z-index: 60 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .vn-text-content {
        font-size: 0.88rem !important;
        line-height: 1.55 !important;
        min-height: 48px !important;
        max-height: 96px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        white-space: pre-line !important;
        word-break: break-word !important;
        padding-right: 18px !important;
    }
    .vn-name-badge {
        top: -12px !important;
        left: 14px !important;
        font-size: 0.8rem !important;
        padding: 2px 12px !important;
    }
    .vn-dialogue-wrapper.has-portrait .vn-name-badge {
        left: 78px !important;
        top: -12px !important;
    }
    .vn-dialogue-wrapper.has-portrait .vn-text-content {
        padding-left: 66px !important;
        padding-right: 18px !important;
    }
    .vn-corner-portrait-slot {
        left: 12px !important;
        right: auto !important;
        top: -16px !important;
        bottom: auto !important;
    }
    .corner-avatar-frame {
        width: 58px !important;
        height: 72px !important;
        border-radius: 8px !important;
    }

    /* 战术微型雷达手机端居中紧凑 */
    .mini-radar-widget.embedded-radar {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        max-width: 190px !important;
        margin-bottom: 6px !important;
    }
    .mini-radar-widget.embedded-radar canvas {
        width: 78px !important;
        height: 78px !important;
    }

    /* 主菜单手机端等比自适应 */
    .menu-container {
        width: 94% !important;
        padding: 1.7rem 0.85rem 1.2rem !important;
        max-width: 420px !important;
    }
    .menu-brand {
        font-size: 2.15rem !important;
        letter-spacing: 0.16em !important;
        text-indent: 0.16em !important;
        margin-bottom: 0.55rem !important;
    }
    .menu-lede {
        font-size: 0.88rem !important;
        margin-bottom: 0 !important;
    }
    .menu-hero {
        margin-bottom: 1.35rem !important;
    }
    .menu-actions {
        gap: 0.5rem !important;
        margin-bottom: 1.1rem !important;
    }
    .menu-btn {
        padding: 0.78rem 0.85rem !important;
        gap: 0.75rem !important;
    }
    .menu-btn-text {
        font-size: 0.95rem !important;
    }
    .menu-btn-hint {
        font-size: 0.68rem !important;
    }
    .menu-orbit {
        top: 16% !important;
        opacity: 0.7;
    }

    /* 扇区观测弹窗 · 手机竖屏 */
    .level-select-modal-box {
        width: 96% !important;
        max-height: 92vh !important;
        padding: 12px 10px !important;
    }
    .level-select-board {
        max-height: 62vh !important;
        gap: 1rem !important;
    }
    .level-sector-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    .level-card {
        padding: 0.7rem 0.6rem !important;
        min-height: 72px !important;
    }
    .level-card.level-special {
        min-height: 86px !important;
        padding-top: 1.15rem !important;
    }
    .level-card .card-num {
        font-size: 0.64rem !important;
    }
    .level-card .card-name {
        font-size: 0.8rem !important;
    }
    .level-card .card-status {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
    }

    /* 人物图鉴与任务弹窗 */
    .persona-modal-box {
        width: 96% !important;
        padding: 12px 10px !important;
    }
    .persona-secrets-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .persona-reward-deck {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* 黑屏文字推进自适应 */
    .black-text-content {
        font-size: 1.15rem !important;
        line-height: 1.8 !important;
        letter-spacing: 1px !important;
        min-height: 90px !important;
    }
    .death-portrait-frame {
        width: 140px !important;
        height: 180px !important;
    }
    .death-victim-title {
        font-size: 1.1rem !important;
    }
    .death-text-content {
        font-size: 0.92rem !important;
        line-height: 1.6 !important;
    }
}


/* ==========================================================================
   扇区观测 · 关卡选择弹窗（拟态残响）
   ========================================================================== */
.level-select-modal-box {
    max-width: 920px;
    width: min(96vw, 920px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(8, 11, 18, 0.98), rgba(5, 7, 12, 0.99));
    border: 1px solid rgba(110, 196, 216, 0.28);
    border-radius: 2px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 165, 116, 0.06) inset;
}

.level-select-header h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--menu-ink, #efeae0);
}

.modal-subtitle-hint {
    font-size: 0.82rem;
    color: var(--menu-muted, #b8c4cf);
    margin-top: 6px;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.level-select-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.level-select-board {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    margin: 0.4rem 0 0.75rem;
    max-height: 64vh;
    overflow-y: auto;
    padding: 0.35rem 0.25rem 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(110, 196, 216, 0.35) transparent;
}

.level-sector-group {
    position: relative;
}

.level-sector-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(110, 196, 216, 0.16);
}

.level-sector-title {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--menu-ink, #efeae0);
}

.level-sector-range {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--menu-steel, #7ecfe0);
    opacity: 0.9;
}

.level-sector-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.level-sector-grid-finale {
    grid-template-columns: minmax(0, 1fr);
    max-width: 280px;
}

.level-sector-arc-c .level-sector-head {
    border-bottom-color: rgba(212, 165, 116, 0.28);
}

.level-sector-arc-c .level-sector-range {
    color: var(--menu-ember, #dcb07f);
}

.level-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.85rem 0.75rem 0.75rem;
    background: rgba(10, 14, 22, 0.72);
    border: 1px solid rgba(110, 196, 216, 0.16);
    border-radius: 2px;
    cursor: pointer;
    transition:
        border-color 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.22s ease;
    text-align: left;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    min-height: 88px;
    color: inherit;
    font-family: inherit;
    overflow: hidden;
}

.level-card .card-num {
    font-size: 0.68rem;
    font-family: var(--font-hud);
    color: rgba(154, 168, 181, 0.85);
    letter-spacing: 0.14em;
}

.level-card .card-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--menu-ink, #efeae0);
    line-height: 1.3;
    letter-spacing: 0.04em;
}

.level-card .card-status {
    margin-top: 0.2rem;
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
    border-radius: 1px;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.level-card.level-unlocked {
    background: linear-gradient(135deg, rgba(110, 196, 216, 0.1), rgba(10, 14, 22, 0.78));
    border-color: rgba(110, 196, 216, 0.42);
}

.level-card.level-unlocked:hover,
.level-card.level-unlocked:focus-visible {
    transform: translateY(-2px);
    border-color: var(--menu-steel, #7ecfe0);
    background: linear-gradient(135deg, rgba(110, 196, 216, 0.18), rgba(10, 14, 22, 0.82));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    outline: none;
}

.level-card.level-unlocked .card-num {
    color: var(--menu-steel, #7ecfe0);
}

.level-card.level-unlocked .card-status {
    background: rgba(110, 196, 216, 0.12);
    color: var(--menu-steel, #7ecfe0);
    border: 1px solid rgba(110, 196, 216, 0.28);
}

.level-card.level-completed {
    border-color: rgba(134, 196, 150, 0.55);
}

.level-card.level-completed .card-status {
    background: rgba(74, 160, 110, 0.18);
    color: #b7e4c7;
    border: 1px solid rgba(134, 196, 150, 0.4);
}

.level-card.level-locked {
    opacity: 0.48;
    background: rgba(8, 11, 18, 0.55);
    border-color: rgba(71, 85, 105, 0.28);
    cursor: not-allowed;
}

.level-card.level-locked .card-name {
    color: #7b8794;
}

.level-card.level-locked .card-status {
    background: rgba(51, 65, 85, 0.28);
    color: #7b8794;
    border: 1px solid rgba(71, 85, 105, 0.28);
}

/* —— 特殊关：4 / 9 / 15（一眼可辨） —— */
.level-card.level-special {
    min-height: 102px;
    padding-top: 1.35rem;
}

.level-card .card-special-mark {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.22rem 0.55rem;
    font-family: var(--font-hud);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.2;
}

/* 第四关 · 异象裂隙：余烬对角切面 */
.level-card.level-special-4 {
    border-color: rgba(220, 176, 127, 0.72);
    background:
        linear-gradient(135deg, transparent 62%, rgba(220, 176, 127, 0.18) 62.2%, rgba(220, 176, 127, 0.08) 100%),
        linear-gradient(160deg, rgba(220, 176, 127, 0.16), rgba(10, 14, 22, 0.88));
    box-shadow: 0 0 0 1px rgba(220, 176, 127, 0.12) inset;
}
.level-card.level-special-4 .card-special-mark {
    background: rgba(220, 176, 127, 0.92);
    color: #1a120c;
}
.level-card.level-special-4.level-unlocked .card-num,
.level-card.level-special-4.level-unlocked .card-status {
    color: #e8c49a;
    border-color: rgba(220, 176, 127, 0.4);
}
.level-card.level-special-4.level-unlocked .card-status {
    background: rgba(220, 176, 127, 0.12);
}
.level-card.level-special-4.level-unlocked:hover,
.level-card.level-special-4.level-unlocked:focus-visible {
    border-color: #e8c49a;
    box-shadow: 0 14px 32px rgba(120, 70, 30, 0.28);
}

/* 第九关 · 静默：冷钢虚线框 + 低噪声 */
.level-card.level-special-9 {
    border-style: dashed;
    border-width: 1.5px;
    border-color: rgba(126, 207, 224, 0.55);
    background: linear-gradient(180deg, rgba(20, 36, 48, 0.85), rgba(8, 12, 18, 0.92));
    filter: saturate(0.82);
}
.level-card.level-special-9 .card-special-mark {
    background: rgba(12, 28, 36, 0.95);
    color: #9ed7e6;
    border-left: 1px solid rgba(126, 207, 224, 0.45);
    border-bottom: 1px solid rgba(126, 207, 224, 0.45);
}
.level-card.level-special-9.level-unlocked:hover,
.level-card.level-special-9.level-unlocked:focus-visible {
    filter: saturate(1);
    border-color: #9ed7e6;
    box-shadow: 0 0 0 1px rgba(158, 215, 230, 0.2), 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* 第十五关 · 折叠：切角错位 + 内层描边 */
.level-card.level-special-15 {
    border-color: rgba(196, 120, 140, 0.65);
    background:
        linear-gradient(135deg, rgba(196, 120, 140, 0.16), rgba(10, 14, 22, 0.9));
    box-shadow: inset 0 0 0 1px rgba(196, 120, 140, 0.18);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.level-card.level-special-15 .card-special-mark {
    background: rgba(196, 120, 140, 0.92);
    color: #1a0e12;
}
.level-card.level-special-15.level-unlocked .card-num,
.level-card.level-special-15.level-unlocked .card-status {
    color: #e3b0bd;
    border-color: rgba(196, 120, 140, 0.4);
}
.level-card.level-special-15.level-unlocked .card-status {
    background: rgba(196, 120, 140, 0.12);
}
.level-card.level-special-15.level-unlocked:hover,
.level-card.level-special-15.level-unlocked:focus-visible {
    border-color: #e3b0bd;
    box-shadow: 0 14px 32px rgba(90, 40, 55, 0.28);
    transform: translateY(-2px);
}

/* 第二十五关 · 终焉单独成组 */
.level-card.level-finale {
    min-height: 110px;
    padding: 1.15rem 1rem;
    border-color: rgba(220, 176, 127, 0.45);
    background:
        radial-gradient(ellipse 80% 70% at 50% 0%, rgba(220, 176, 127, 0.14), transparent 60%),
        rgba(10, 14, 22, 0.82);
}
.level-card.level-finale .card-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.12em;
}
.level-card.level-finale.level-unlocked:hover,
.level-card.level-finale.level-unlocked:focus-visible {
    border-color: var(--menu-ember, #dcb07f);
    box-shadow: 0 16px 36px rgba(90, 50, 20, 0.3);
}

.level-select-footer-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--menu-muted, #b8c4cf);
    padding-top: 0.75rem;
    border-top: 1px solid rgba(110, 196, 216, 0.14);
    letter-spacing: 0.04em;
}

@media (max-width: 900px) {
    .level-sector-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .level-sector-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }
    .level-sector-grid-finale {
        max-width: none;
    }
    .level-card {
        padding: 0.7rem 0.6rem 0.65rem;
        min-height: 78px;
    }
    .level-card.level-special {
        min-height: 90px;
        padding-top: 1.2rem;
    }
    .level-card .card-num {
        font-size: 0.62rem;
    }
    .level-card .card-name {
        font-size: 0.84rem;
    }
    .level-card .card-status {
        font-size: 0.62rem;
    }
    .level-sector-title {
        font-size: 0.92rem;
    }
}

/* ==========================================================================
   扇区观测任务清单样式 (Missions Checklist UI)
   ========================================================================== */
.missions-sidebar-panel {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    padding: 10px 12px;
    flex-shrink: 0;
}

.missions-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    cursor: default;
}

.missions-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.missions-title-icon {
    font-size: 1rem;
}

.missions-title-text {
    font-size: 0.86rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.5px;
}

.missions-summary-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    border-radius: 10px;
    font-family: var(--font-hud);
}

.missions-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 190px;
    overflow-y: auto;
    padding-right: 2px;
}

.mission-item-card {
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.mission-item-card:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(56, 189, 248, 0.45);
}

.mission-item-card.mission-completed {
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(20, 83, 45, 0.15);
}

.mission-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.mission-name {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 0.82rem;
}

.mission-status-tag {
    font-size: 0.68rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.mission-status-unlocked {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.mission-status-locked {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.mission-objective {
    color: #94a3b8;
    line-height: 1.35;
    margin-bottom: 4px;
}

.mission-reward {
    color: #c084fc;
    font-size: 0.73rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mission-realtime {
    margin-top: 3px;
    font-size: 0.72rem;
    font-weight: 600;
}

.realtime-ready {
    color: #4ade80;
}

.realtime-waiting {
    color: #94a3b8;
}

.realtime-failed {
    color: #f87171;
}

/* 弹窗中的任务卡片 */
.mission-modal-box {
    max-width: 560px;
    width: 95%;
    max-height: 82vh;
    max-height: 82dvh;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(10, 15, 30, 0.98);
    border: 1px solid var(--border-cyan);
    box-shadow: 0 0 35px rgba(56, 189, 248, 0.3);
}

.mission-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mission-modal-cards-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.mission-modal-item {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.mission-modal-item:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.mission-modal-item.mission-completed {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(20, 83, 45, 0.2);
}

.mission-footer-notice {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid rgba(56, 189, 248, 0.15);
    flex-shrink: 0;
}

.result-unlock-notice {
    margin: 12px 0 16px 0;
    padding: 10px 14px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 8px;
    color: #c084fc;
    font-size: 0.84rem;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.2);
}

/* ========================================================================= */
/* 星舰环境遥测与随行同伴栏目 (Telemetry HUD & Team Companions Deck) */
/* ========================================================================= */
.sector-telemetry-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 20px;
    margin-bottom: 6px;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.12);
    backdrop-filter: blur(6px);
    max-width: 440px;
    width: 95%;
}

.telemetry-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    font-family: var(--font-hud);
    color: #cbd5e1;
    white-space: nowrap;
}

.live-pulse {
    width: 6px;
    height: 6px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
    animation: dotPulse 1.8s infinite ease-in-out;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.25); }
}

.text-glow-green {
    color: #4ade80;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.45);
}

/* 随行同伴实时头像状态栏 */
.team-roster-deck {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    min-height: 38px;
    max-width: 440px;
    width: 95%;
}

.roster-card {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 20px;
    padding: 3px 10px 3px 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
}

.roster-card:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
}

.roster-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #38bdf8;
}

.roster-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
}

.roster-status {
    font-size: 0.68rem;
    color: #c084fc;
}

/* ========================================================================= */
/* 战术全息微型雷达 (嵌入在操作盘正中央上方) */
/* ========================================================================= */
.mini-radar-widget.embedded-radar {
    position: static !important; /* 彻底告别右上角悬浮！ */
    width: 100%;
    max-width: 220px;
    margin-bottom: 8px;
    background: rgba(10, 16, 32, 0.95);
    border: 1px solid var(--border-cyan);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
    overflow: hidden;
}

.mini-radar-widget.embedded-radar .radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
}

.mini-radar-widget.embedded-radar .radar-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #38bdf8;
}

.mini-radar-widget.embedded-radar .radar-pos-tag {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    color: #cbd5e1;
    margin-right: 6px;
}

.mini-radar-widget.embedded-radar .radar-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #7dd3fc;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    cursor: pointer;
}

.mini-radar-widget.embedded-radar .radar-body-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.12) 0%, rgba(3, 7, 18, 0.95) 100%);
}

.mini-radar-widget.embedded-radar canvas {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.radar-actions {
    display: flex;
    gap: 4px;
}

.radar-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.radar-btn:hover {
    background: rgba(56, 189, 248, 0.3);
    border-color: #38bdf8;
    color: #ffffff;
}

.radar-body-wrap {
    position: relative;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.radar-body-wrap.radar-collapsed {
    display: none !important;
}

#mini-radar-canvas {
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s;
}

#mini-radar-canvas:hover {
    transform: scale(1.02);
}

.radar-pos-tag {
    margin-top: 4px;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ========================================================================= */
/* 记忆图鉴与角色专属分支 (Persona Log) 样式 */
/* ========================================================================= */
.persona-menu-btn {
    position: relative;
    overflow: hidden;
}

.persona-modal-box {
    max-width: 860px;
    width: 95%;
    max-height: 88vh;
    background: rgba(8, 13, 26, 0.98);
    border: 1px solid rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 35px rgba(168, 85, 247, 0.3);
    display: flex;
    flex-direction: column;
}

.persona-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 10px 4px 14px 4px;
}

.persona-char-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.25);
    padding-bottom: 10px;
}

.persona-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #e2e8f0;
}

.persona-tab-btn:hover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
}

.persona-tab-btn.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(56, 189, 248, 0.2));
    border-color: #c084fc;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.35);
}

.persona-tab-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #a855f7;
}

.persona-tab-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.persona-tab-name {
    font-size: 0.95rem;
    font-weight: bold;
}

.persona-tab-progress {
    font-size: 0.72rem;
    color: #a855f7;
}

.persona-char-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.persona-hero-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 10px;
    padding: 12px 18px;
}

.persona-hero-portrait {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 2px solid;
    object-fit: cover;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
}

.persona-hero-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.persona-hero-name {
    font-size: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.persona-hero-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.persona-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.persona-progress-track {
    flex: 1;
    height: 8px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 4px;
    overflow: hidden;
}

.persona-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #a855f7);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.persona-secrets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.persona-secret-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
}

.persona-secret-card.unlocked {
    border-color: rgba(168, 85, 247, 0.55);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(30, 41, 59, 0.8));
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
}

.persona-secret-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.persona-secret-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.persona-secret-card.unlocked .persona-secret-title {
    color: #c084fc;
}

.persona-secret-status {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-unlocked {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.status-locked {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.persona-secret-desc {
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.persona-secret-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-style: italic;
}

/* 专属保命技能与专属剧情栏目 */
.persona-reward-deck {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.persona-passive-box {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.persona-passive-box.active-skill {
    border-color: #eab308;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(30, 41, 59, 0.85));
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.25);
}

.persona-passive-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    font-size: 0.88rem;
    color: #fbbf24;
}

.persona-passive-desc {
    font-size: 0.8rem;
    color: #e2e8f0;
    line-height: 1.4;
}

.persona-branch-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn-launch-branch {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-launch-branch.enabled {
    background: linear-gradient(135deg, #10b981, #0ea5e9);
    border: 1px solid #34d399;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.btn-launch-branch.enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 28px rgba(16, 185, 129, 0.6);
}

.btn-launch-branch.disabled {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #64748b;
    cursor: not-allowed;
}

/* 角色记忆解构悬浮轻提示 (Persona Unlock Toast) */
.persona-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
    border: 1px solid #c084fc;
    box-shadow: 0 0 24px rgba(192, 132, 252, 0.45), 0 8px 32px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 12px 18px;
    z-index: 9999;
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 340px;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    animation: personaToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.persona-toast.fade-out {
    opacity: 0;
    transform: translateY(-16px);
}

.persona-toast-title {
    font-size: 0.88rem;
    font-weight: bold;
    color: #c084fc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.persona-toast-body {
    font-size: 0.8rem;
    color: #e2e8f0;
    line-height: 1.4;
}

@keyframes personaToastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   移动端与 iOS 原生惯性阻尼滑动手势优化 (Mobile Momentum Touch Scrolling)
   ========================================================================== */
.modal-backdrop,
.modal-box,
.modal-body,
.modal-choices,
.level-select-modal-box,
.level-select-board,
.level-sector-grid,
.mission-modal-box,
.mission-modal-body,
.mission-modal-cards-list,
.missions-sidebar-list,
.persona-modal-box,
.persona-modal-body,
.persona-char-tabs,
.persona-char-detail,
.persona-secrets-grid,
.inquiry-box,
.inquiry-cards-container,
.judgement-box,
.judgement-items-container,
.night-box,
.night-choices-container,
.encounter-box,
.power-restore-box,
.power-restore-body,
.result-box,
.diary-modal-box,
.diary-body,
.diary-page-content,
.tutorial-modal-box,
.map-modal-box,
.map-body,
.map-view-container,
.coach-tooltip,
.coach-body,
.menu-container,
.log-list,
.action-log-sidebar,
.dialog-box,
.event-choices,
#screen-q1-black,
#screen-evening-black,
#screen-death-black,
.black-screen-center {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 小屏兜底：外层锁死，弹窗整盒单层滚动（避免 backdrop + box + body 三重抢滚） */
@media (max-height: 720px), (max-width: 768px) {
    .modal-backdrop {
        align-items: flex-start !important;
        overflow-y: hidden !important;
        overflow-x: hidden !important;
    }

    .modal-box,
    .level-select-modal-box,
    .mission-modal-box,
    .persona-modal-box,
    .map-modal-box,
    .diary-modal-box,
    .tutorial-modal-box,
    .encounter-box,
    .power-restore-box,
    .inquiry-box,
    .judgement-box,
    .night-box,
    .result-box,
    .key-sequence-box,
    .talent-modal-box {
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        margin-top: auto;
        margin-bottom: auto;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    /* 有独立列表区时，列表继续可滚；与整盒滚动并存但优先触达内层 */
    .inquiry-cards-container,
    .judgement-items-container,
    .night-choices-container,
    .mission-modal-cards-list,
    .level-select-board,
    .persona-char-detail,
    .diary-page-content,
    .power-restore-body,
    .talent-modal-body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        min-height: 0 !important;
    }

    .map-view-container {
        max-height: min(52dvh, 420px) !important;
        overflow: auto !important;
    }

    .modal-close-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .modal-close-btn:active {
        color: #fff;
        background: rgba(56, 189, 248, 0.15);
        border-radius: 8px;
    }

    .night-choice-btn {
        min-height: 44px;
    }

    .night-choice-btn:active {
        transform: scale(0.98);
        filter: brightness(1.15);
    }

    .menu-btn:active {
        transform: scale(0.985);
        filter: brightness(1.08);
    }

    .level-card {
        min-height: 72px;
    }

    .level-card:active {
        transform: scale(0.98);
        filter: brightness(1.1);
    }

    .card-status {
        font-size: 0.68rem !important;
        line-height: 1.3;
    }
}

/* ==========================================================================
   4. 移动端自适应（已移除强制横屏引导 / 旋转按钮 / CSS 90° 强制横屏）
   ========================================================================== */

/* ==========================================================================
   横屏排版精细化适配 (无论是原生横屏还是强制横屏，覆盖至 640px 手机与平板高度)
   ========================================================================== */
@media (orientation: landscape) and (max-height: 640px), (max-height: 540px) {
    /* 顶栏紧凑化 */
    .game-top-bar {
        height: 38px;
        padding: 0 12px;
    }
    .status-box {
        font-size: 0.76rem;
        padding: 2px 6px;
        gap: 4px;
    }
    .stamina-track {
        width: 65px;
        height: 7px;
    }
    .location-name {
        max-width: 120px;
    }
    .tool-btn {
        padding: 3px 8px;
        font-size: 0.74rem;
    }

    /* 主菜单横屏双列紧凑布局 */
    .menu-container {
        padding: 14px 24px;
        max-height: 96vh;
        max-width: 640px;
    }
    .glow-title {
        font-size: 2.2rem;
        letter-spacing: 4px;
        margin-bottom: 2px;
    }
    .menu-subtitle {
        font-size: 0.82rem;
        margin-bottom: 12px;
    }
    .menu-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 10px;
    }
    .menu-btn {
        padding: 8px 12px;
        font-size: 0.86rem;
        gap: 6px;
    }
    .menu-system-info {
        padding-top: 8px;
        font-size: 0.72rem;
    }

    /* 游戏核心视口排版 */
    .game-center-viewport {
        width: 100% !important;
        height: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden !important;
    }
    .action-log-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(320px, 86vw) !important;
        height: 100% !important;
        z-index: 500 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.85) !important;
        background: rgba(10, 16, 32, 0.98) !important;
        border-right: 1px solid var(--border-cyan) !important;
    }
    .action-log-sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    .log-panel-header {
        padding: 6px 12px;
        font-size: 0.78rem;
    }
    .log-entry {
        font-size: 0.74rem;
        line-height: 1.35;
    }

    /* 屏幕正中区域：横屏下顶部遥测与羁绊栏、中部水平操作盘 */
    .stage-center-area {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px 8px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        gap: 2px !important;
    }

    .sector-telemetry-hud {
        margin-bottom: 2px !important;
        padding: 2px 8px !important;
        gap: 6px !important;
    }
    .telemetry-chip {
        font-size: 0.66rem !important;
        padding: 1px 6px !important;
    }
    .team-roster-deck {
        margin-bottom: 2px !important;
        padding: 2px 6px !important;
        gap: 6px !important;
    }
    .roster-card {
        padding: 1px 5px !important;
        gap: 4px !important;
    }
    .roster-avatar {
        width: 20px !important;
        height: 20px !important;
    }
    .roster-name {
        font-size: 0.68rem !important;
    }
    .roster-status {
        font-size: 0.62rem !important;
    }

    /* 横屏操作盘核心：左右并列横向排布！左边雷达球，右边十字方向键！高度降至 90px，向后走绝不被截断 */
    .exploration-hud {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 20px !important;
        padding: 4px 14px !important;
        margin: auto 0 4px 0 !important;
        background: rgba(15, 23, 42, 0.94) !important;
        border-radius: 10px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7) !important;
        z-index: 15 !important;
    }

    .mini-radar-widget.embedded-radar {
        position: static !important;
        transform: none !important;
        width: auto !important;
        max-width: 120px !important;
        margin-bottom: 0 !important;
        border-radius: 8px !important;
    }
    .mini-radar-widget.embedded-radar .radar-header {
        padding: 2px 6px !important;
    }
    .mini-radar-widget.embedded-radar .radar-title {
        font-size: 0.66rem !important;
    }
    .mini-radar-widget.embedded-radar .radar-pos-tag {
        display: none !important;
    }
    .mini-radar-widget.embedded-radar .radar-btn {
        font-size: 0.64rem !important;
        padding: 1px 4px !important;
    }
    .mini-radar-widget.embedded-radar .radar-body-wrap {
        padding: 3px !important;
    }
    .mini-radar-widget.embedded-radar canvas {
        width: 64px !important;
        height: 64px !important;
    }

    /* 十字导航键紧凑防截断 */
    .compass-cross {
        gap: 3px !important;
    }
    .compass-mid-row {
        gap: 5px !important;
    }
    .compass-center-hub {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.76rem !important;
    }
    .nav-btn {
        min-width: 64px !important;
        max-width: 90px !important;
        padding: 3px 6px !important;
        font-size: 0.72rem !important;
        gap: 1px !important;
    }
    .nav-btn .dest-preview {
        font-size: 0.62rem !important;
        max-width: 72px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }

    /* 对话框紧凑横屏：绝对悬浮底铺，不挤压地图视口 */
    .vn-dialogue-wrapper {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-height: 64px !important;
        max-height: 90px !important;
        height: auto !important;
        padding: 6px 12px 3px 12px !important;
        z-index: 60 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .vn-text-content {
        max-height: 60px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        white-space: pre-line !important;
        word-break: break-word !important;
    }
    .vn-name-badge {
        top: -11px !important;
        left: 14px !important;
        font-size: 0.72rem !important;
        padding: 1px 10px !important;
    }
    .vn-dialogue-wrapper.has-portrait .vn-name-badge {
        left: 60px !important;
    }
    .vn-dialogue-wrapper.has-portrait .vn-text-content {
        padding-left: 50px !important;
        padding-right: 14px !important;
    }
    .vn-corner-portrait-slot {
        left: 8px !important;
        right: auto !important;
        top: -12px !important;
        bottom: auto !important;
    }
    .corner-avatar-frame {
        width: 44px !important;
        height: 54px !important;
    }
    .center-portrait-container {
        display: none !important; /* 横屏下立绘已由对话框左上角挂载，避免中央立绘挤占按键空间 */
    }

    /* 扇区观测弹窗横屏自适应 */
    .level-select-modal-box {
        max-height: 96vh;
        width: 96%;
        max-width: 920px;
        padding: 10px 14px;
    }
    .level-select-board {
        gap: 0.85rem;
        max-height: 62vh;
        margin: 6px 0;
    }
    .level-sector-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }
    .level-card {
        padding: 0.55rem 0.55rem;
        min-height: 64px;
    }
    .level-card.level-special {
        min-height: 78px;
        padding-top: 1.05rem;
    }
    .level-card .card-num {
        font-size: 0.62rem;
    }
    .level-card .card-name {
        font-size: 0.78rem;
    }
    .level-card .card-status {
        font-size: 0.58rem;
        padding: 1px 3px;
    }

    /* 人物图鉴横屏自适应 */
    .persona-modal-box {
        max-height: 96vh;
        width: 96%;
        padding: 10px 14px;
    }
    .persona-hero-header {
        padding: 6px 10px;
        gap: 8px;
    }
    .persona-hero-avatar {
        width: 44px;
        height: 44px;
    }
    .persona-hero-name {
        font-size: 1rem;
    }
    .persona-secrets-grid {
        gap: 6px;
    }
    .persona-secret-card {
        padding: 6px 8px;
        gap: 2px;
    }
    .persona-secret-title {
        font-size: 0.78rem;
    }
    .persona-secret-desc {
        font-size: 0.72rem;
        line-height: 1.3;
    }

    /* 任务清单横屏自适应 */
    .mission-modal-box {
        max-height: 96vh;
        width: 96%;
    }
    .mission-modal-cards-list {
        max-height: 58vh;
        gap: 6px;
    }
    .mission-item-card {
        padding: 5px 8px;
    }

    /* 地图弹窗手机端自适应 (全屏沉浸拖拽观察，支持单指拖拽与双指缩放) */
    .map-modal-box {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        padding: 6px 8px !important;
        margin: 0 !important;
        border: none !important;
    }
    .map-modal-box .map-view-container {
        min-height: 220px !important;
        max-height: none !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        padding: 0 !important;
    }
}




/* ==========================================================================
   卡罗唯一伪人自白离队（独立全屏剧情）
   ========================================================================== */
.kaze-confession-overlay {
    position: fixed;
    inset: 0;
    z-index: 480;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
}

.kaze-confession-overlay.hidden {
    display: none !important;
}

.kaze-confession-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.kaze-confession-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.kaze-confession-content {
    position: relative;
    z-index: 1;
    width: min(520px, 92vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 12px;
    box-sizing: border-box;
}

.kaze-confession-frame {
    width: min(300px, 70vw);
    height: min(390px, 48vh);
    border-radius: 16px;
    border: 2px solid #38bdf8;
    overflow: hidden;
    background: #050810;
    box-shadow: 0 0 36px rgba(56, 189, 248, 0.35), 0 16px 40px rgba(0, 0, 0, 0.7);
}

.kaze-confession-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 12%;
    display: block;
}

.kaze-confession-dialog {
    width: 100%;
    padding: 18px 18px 14px;
    border-radius: 12px;
    background: rgba(8, 14, 28, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.18);
    box-sizing: border-box;
    cursor: pointer;
}

.kaze-confession-name {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 14px;
    border-radius: 6px;
    border: 1.5px solid #38bdf8;
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.95rem;
    background: rgba(3, 8, 18, 0.9);
}

.kaze-confession-text {
    color: #f1f5f9;
    font-size: 1.05rem;
    line-height: 1.7;
    min-height: 3.2em;
    white-space: pre-wrap;
    word-break: break-word;
}

.kaze-confession-hint {
    margin-top: 10px;
    text-align: right;
    color: #64748b;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .kaze-confession-frame {
        width: min(240px, 72vw);
        height: min(310px, 42vh);
    }
    .kaze-confession-text {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   定锚科技树 (Talent Tech Tree · Kingdom-Rush style)
   ========================================================================== */
.talent-menu-btn {
    position: relative;
}

.talent-modal-box {
    max-width: 980px;
    width: 96%;
    max-height: 92vh;
    max-height: 92dvh;
    background: rgba(8, 12, 24, 0.98);
    border: 1px solid rgba(251, 191, 36, 0.45);
    box-shadow: 0 0 36px rgba(251, 191, 36, 0.18), 0 12px 40px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

.talent-points-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.14), rgba(14, 165, 233, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.35);
    flex-shrink: 0;
}

.talent-points-label {
    color: #94a3b8;
    font-size: 0.85rem;
}

.talent-points-value {
    color: #fde68a;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    font-family: var(--font-hud);
}

.talent-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.talent-tree-root {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.talent-branch {
    --talent-accent: #38bdf8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.08);
}

.talent-branch-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.talent-branch-icon {
    font-size: 1.4rem;
}

.talent-branch-name {
    font-weight: 700;
    color: #f8fafc;
    font-size: 1rem;
}

.talent-branch-blurb {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-top: 2px;
}

.talent-branch-rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 4px;
}

.talent-node {
    text-align: left;
    padding: 12px 12px 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(148, 163, 184, 0.28);
    background: rgba(2, 6, 23, 0.72);
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s, background 0.18s;
    font-family: inherit;
}

.talent-node:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: var(--talent-accent);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.28);
}

.talent-node:disabled {
    cursor: default;
    opacity: 0.92;
}

.talent-node.talent-unlocked {
    border-color: var(--talent-accent);
    background: linear-gradient(160deg, rgba(56, 189, 248, 0.22), rgba(2, 6, 23, 0.9));
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.22);
}

.talent-node.talent-available {
    border-color: #fbbf24;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.25);
}

.talent-node.talent-locked {
    opacity: 0.55;
    filter: grayscale(0.35);
}

.talent-node-cost {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.78rem;
    color: #fbbf24;
    font-weight: 700;
    margin-bottom: 6px;
}

.talent-node-cost span {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
}

.talent-node-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.talent-node-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #94a3b8;
}

.talent-node-status {
    margin-top: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: #64748b;
}

.talent-node.talent-unlocked .talent-node-status {
    color: #4ade80;
}

.talent-node.talent-available .talent-node-status {
    color: #fbbf24;
}

.talent-link {
    width: 3px;
    height: 16px;
    margin: 2px auto;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.28);
}

.talent-link.talent-link-on {
    background: var(--talent-accent);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

.talent-footer-hint {
    margin: 4px 0 0;
    font-size: 0.78rem;
    color: #64748b;
    text-align: center;
    flex-shrink: 0;
}

.judgement-confine-hint {
    font-size: 0.82rem;
    color: #fbbf24;
    text-align: center;
    padding: 6px 8px 10px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    margin-bottom: 8px;
}

@media (max-width: 860px) {
    .talent-tree-root {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   全局 Toast + 手机优先补丁（替代原生 alert，全面提升触控手感）
   ========================================================================== */
.app-toast {
    position: fixed;
    left: 50%;
    top: max(14px, calc(10px + env(safe-area-inset-top, 0px)));
    transform: translate(-50%, -8px) scale(0.98);
    z-index: 200000;
    max-width: min(92vw, 440px);
    width: max-content;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(10, 16, 32, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55), 0 0 18px rgba(56, 189, 248, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f1f5f9;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s;
}

.app-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
}

.app-toast.is-leaving {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -6px) scale(0.98);
}

.modal-close-btn {
    min-width: 40px;
    min-height: 40px;
}

.map-floating-btn,
.stage-floating-btn {
    min-width: 44px;
    min-height: 44px;
}

.menu-btn {
    min-height: 52px;
}

.loading-start-btn {
    min-height: 48px;
}

.persona-toast {
    top: max(18px, calc(12px + env(safe-area-inset-top, 0px))) !important;
    max-width: min(92vw, 420px);
}

@media (max-width: 768px) {
    .game-top-bar {
        padding-top: 6px !important;
    }

    .stage-mission-card {
        top: max(8px, env(safe-area-inset-top, 0px));
        left: max(8px, env(safe-area-inset-left, 0px));
        max-height: min(42vh, 260px);
        overflow: hidden;
    }

    .stage-mission-content {
        max-height: min(32vh, 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .stage-map-floating-controls {
        bottom: max(10px, env(safe-area-inset-bottom, 0px));
        right: max(10px, env(safe-area-inset-right, 0px));
    }

    .action-log-sidebar {
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    .black-screen-center,
    #screen-q1-black,
    #screen-evening-black,
    #screen-death-black {
        padding: max(16px, env(safe-area-inset-top, 0px)) 14px max(20px, env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box;
    }

    .dialog-box {
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .talent-node {
        min-height: 64px;
        padding: 12px 14px;
    }

    .talent-node:active:not(:disabled) {
        transform: scale(0.98);
        filter: brightness(1.08);
    }
}

@media (orientation: landscape) and (max-height: 480px) {
    .app-toast {
        top: max(8px, env(safe-area-inset-top, 0px));
        font-size: 0.8rem;
        padding: 8px 12px;
        max-width: min(70vw, 360px);
    }

    .tool-btn {
        min-height: 40px !important;
        padding: 6px 2px !important;
    }
}

/* ==========================================================================
   第十五关 · 折叠维度（审讯 / 提问 / 墨染星图）— 手机优先
   ========================================================================== */
.l15-screen {
    position: fixed;
    inset: 0;
    z-index: 12000;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #050608;
    color: #f3efe6;
    overflow: hidden;
    touch-action: none;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
             env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    box-sizing: border-box;
}

.l15-phase {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* —— Intro —— */
.l15-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #030406;
    cursor: pointer;
}

.l15-intro-veil {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 40% at 50% 42%, rgba(180, 140, 90, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse 80% 50% at 50% 100%, rgba(40, 70, 90, 0.12) 0%, transparent 55%);
    pointer-events: none;
}

.l15-intro-orbit {
    position: absolute;
    left: 50%;
    top: 46%;
    width: min(78vw, 420px);
    height: min(78vw, 420px);
    transform: translate(-50%, -50%);
    border: 1px solid rgba(214, 192, 156, 0.12);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.7;
}

.l15-intro-orbit::after {
    content: "";
    position: absolute;
    inset: 14%;
    border: 1px dashed rgba(126, 180, 200, 0.14);
    border-radius: 50%;
}

.l15-intro-center {
    position: relative;
    z-index: 1;
    width: min(92vw, 520px);
    padding: 1.5rem 1.25rem;
    text-align: center;
}

.l15-intro-eyebrow {
    font-family: var(--font-hud);
    font-size: 0.68rem;
    letter-spacing: 0.28em;
    color: rgba(214, 192, 156, 0.55);
    margin-bottom: 1.4rem;
}

.l15-intro-text {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 5.2vw, 1.85rem);
    font-weight: 600;
    line-height: 1.55;
    letter-spacing: 0.06em;
    color: #f7f1e6;
    text-shadow: 0 0 28px rgba(214, 192, 156, 0.18);
    min-height: 3.2em;
    will-change: opacity, transform;
}

.l15-intro-prompt {
    margin-top: 2rem;
    font-size: 0.78rem;
    letter-spacing: 0.32em;
    color: rgba(214, 192, 156, 0.4);
    animation: l15PromptBlink 1.4s step-end infinite;
}

@keyframes l15PromptBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.28; }
}

/* —— Quiz —— */
.l15-quiz {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 70% 50% at 50% 30%, rgba(56, 100, 120, 0.16) 0%, transparent 55%),
        linear-gradient(180deg, #0a0e14 0%, #05070c 100%);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 16px 12px;
    box-sizing: border-box;
}

.l15-quiz-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.l15-quiz-frame-line {
    position: absolute;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(214, 192, 156, 0.35), transparent);
}

.l15-quiz-frame-t { top: max(18px, env(safe-area-inset-top, 0px)); }
.l15-quiz-frame-b { bottom: max(18px, env(safe-area-inset-bottom, 0px)); }

.l15-quiz-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: rgba(214, 192, 156, 0.45);
    border-style: solid;
    border-width: 0;
}
.l15-c-tl { top: 22px; left: 18px; border-top-width: 1px; border-left-width: 1px; }
.l15-c-tr { top: 22px; right: 18px; border-top-width: 1px; border-right-width: 1px; }
.l15-c-bl { bottom: 22px; left: 18px; border-bottom-width: 1px; border-left-width: 1px; }
.l15-c-br { bottom: 22px; right: 18px; border-bottom-width: 1px; border-right-width: 1px; }

.l15-quiz-glow {
    position: absolute;
    inset: 20% 10%;
    background: radial-gradient(ellipse at center, rgba(220, 180, 110, 0.06), transparent 70%);
}

.l15-quiz-shell {
    position: relative;
    z-index: 1;
    width: min(94vw, 440px);
    margin: auto;
}

.l15-quiz-progress {
    text-align: center;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: rgba(176, 196, 210, 0.65);
    margin-bottom: 14px;
}

.l15-quiz-card {
    position: relative;
    background: rgba(8, 12, 18, 0.92);
    border: 1px solid rgba(214, 192, 156, 0.28);
    border-radius: 4px;
    padding: 22px 16px 18px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 18px 48px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    will-change: opacity, transform;
}

.l15-quiz-ink {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 52px;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent),
        radial-gradient(ellipse 80% 120% at 30% 0%, rgba(20, 20, 20, 0.9), transparent 70%);
    opacity: 0.85;
    pointer-events: none;
}

.l15-quiz-title {
    position: relative;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-align: center;
    color: #e8dcc4;
    margin-bottom: 14px;
}

.l15-quiz-prompt {
    position: relative;
    font-size: 1.02rem;
    line-height: 1.55;
    text-align: center;
    color: #f5f0e6;
    margin-bottom: 18px;
    font-weight: 500;
}

.l15-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.l15-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    width: 100%;
    padding: 12px 14px;
    background: #0a0a0c;
    border: 1px solid rgba(230, 230, 230, 0.22);
    border-radius: 2px;
    color: #f5f5f5;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.l15-option:active {
    transform: scale(0.985);
}

.l15-option-key {
    flex-shrink: 0;
    width: 1.4em;
    font-family: var(--font-hud);
    font-weight: 700;
    color: rgba(214, 192, 156, 0.85);
}

.l15-option-text {
    flex: 1;
    line-height: 1.4;
}

.l15-option.is-wrong {
    border-color: #ef4444;
    background: rgba(127, 29, 29, 0.45);
    color: #fecaca;
}

.l15-option.is-wrong .l15-option-key {
    color: #f87171;
}

.l15-option.is-correct {
    border-color: #4ade80;
    background: rgba(20, 83, 45, 0.5);
    color: #dcfce7;
    box-shadow: 0 0 18px rgba(74, 222, 128, 0.25);
}

.l15-option.is-correct .l15-option-key {
    color: #86efac;
}

.l15-option.is-dimmed {
    opacity: 0.35;
}

/* —— Map —— */
.l15-map {
    display: flex;
    flex-direction: column;
    background: #04060a;
}

.l15-map-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
}

.l15-map-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
}

.l15-map-viewport {
    position: absolute;
    inset: 0;
    transform-origin: center center;
    will-change: transform;
}

.l15-map-stack {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.l15-map-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.l15-map-clear {
    z-index: 1;
    /* 清晰图只作揭示层素材源，底板不可见，避免一上来就“整图看清” */
    opacity: 0;
    visibility: hidden;
}

.l15-map-blur {
    z-index: 2;
    filter: blur(7px) saturate(0.75) brightness(0.72);
    transform: scale(1.02);
}

.l15-map-reveal {
    position: absolute;
    inset: 0;
    z-index: 3;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    opacity: 0;
    --ink: 0%;
}

.l15-map-reveal.is-open {
    opacity: 1;
}

/* 三槽完成后渐入的侧视飞船立绘 */
.l15-ship-art {
    position: absolute;
    inset: 0;
    z-index: 9;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 0;
    transform: scale(1.04);
    filter: brightness(0.7) saturate(0.85);
    transition:
        opacity 1.2s ease,
        transform 1.35s cubic-bezier(0.22, 1, 0.36, 1),
        filter 1.2s ease;
}

.l15-ship-art.is-revealing {
    display: block;
}

.l15-ship-art.is-visible {
    opacity: 1;
    transform: none;
    filter: brightness(1) saturate(1.05);
}

.l15-slot-rail.is-dimmed {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.l15-zoom-hint {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 11;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(243, 239, 230, 0.75);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    pointer-events: none;
}

/* 每块揭示层强制裁在对应象限内，墨染半径再大也不会“整图开雾” */
.l15-reveal-tl {
    clip-path: inset(0 48% 48% 0);
    -webkit-clip-path: inset(0 48% 48% 0);
    -webkit-mask-image: radial-gradient(circle at 25% 25%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
            mask-image: radial-gradient(circle at 25% 25%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
}

.l15-reveal-tr {
    clip-path: inset(0 0 48% 48%);
    -webkit-clip-path: inset(0 0 48% 48%);
    -webkit-mask-image: radial-gradient(circle at 75% 25%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
            mask-image: radial-gradient(circle at 75% 25%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
}

.l15-reveal-bl {
    clip-path: inset(48% 48% 0 0);
    -webkit-clip-path: inset(48% 48% 0 0);
    -webkit-mask-image: radial-gradient(circle at 25% 75%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
            mask-image: radial-gradient(circle at 25% 75%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
}

.l15-reveal-br {
    clip-path: inset(48% 0 0 48%);
    -webkit-clip-path: inset(48% 0 0 48%);
    -webkit-mask-image: radial-gradient(circle at 75% 75%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
            mask-image: radial-gradient(circle at 75% 75%, #000 0%, #000 var(--ink), transparent calc(var(--ink) + 16%));
}

.l15-drop-zone {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 6;
    width: min(42vw, 168px);
    height: min(42vw, 168px);
    border-radius: 50%;
    border: 1.5px dashed rgba(214, 192, 156, 0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: rgba(243, 239, 230, 0);
    background: radial-gradient(circle, rgba(214, 192, 156, 0) 0%, transparent 70%);
    pointer-events: none;
    transition: none;
}

.l15-drop-zone.is-active {
    border-color: rgba(214, 192, 156, 0.55);
    color: rgba(243, 239, 230, 0.88);
    background: radial-gradient(circle, rgba(214, 192, 156, 0.12) 0%, transparent 72%);
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 40px rgba(214, 192, 156, 0.12);
}

.l15-drop-zone.is-hot {
    border-color: rgba(126, 207, 224, 0.85);
    color: #e8fbff;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, transparent 72%);
    box-shadow: 0 0 48px rgba(56, 189, 248, 0.22);
}

.l15-lore-dialog {
    position: absolute;
    left: 50%;
    bottom: max(18%, calc(72px + env(safe-area-inset-bottom, 0px)));
    transform: translateX(-50%) translateY(10px);
    z-index: 20;
    width: min(92%, 420px);
    margin: 0;
    padding: 14px 16px 12px;
    border: 1px solid rgba(214, 192, 156, 0.45);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(16, 22, 34, 0.96), rgba(8, 12, 20, 0.94));
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    color: #f5ead6;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    box-sizing: border-box;
    font: inherit;
}

.l15-lore-dialog.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.l15-lore-dialog[hidden] {
    display: none !important;
}

.l15-lore-dialog.is-show[hidden] {
    display: block !important;
}

.l15-lore-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #f5ead6;
}

.l15-lore-hint {
    margin-top: 10px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: rgba(126, 207, 224, 0.9);
    text-align: right;
}

.l15-map-guide {
    position: relative;
    z-index: 7;
    flex-shrink: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 14px max(12px, env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    background: rgba(5, 8, 12, 0.92);
    border: none;
    border-top: 1px solid rgba(214, 192, 156, 0.28);
    font-size: 0.84rem;
    letter-spacing: 0.06em;
    color: rgba(243, 239, 230, 0.92);
    text-align: center;
    pointer-events: none;
    box-sizing: border-box;
}

/* 右侧关卡槽（模仿参考图黑矩形槽） */
.l15-slot-rail {
    position: relative;
    z-index: 10;
    width: min(92px, 24vw);
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 8px max(12px, env(safe-area-inset-bottom, 0px));
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35)),
        rgba(4, 5, 8, 0.92);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

.l15-slot-rail-title {
    font-size: 0.62rem;
    letter-spacing: 0.28em;
    text-align: center;
    color: rgba(200, 200, 200, 0.55);
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.l15-slot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.l15-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 64px;
    width: 100%;
    padding: 10px 4px;
    background: #000;
    border: 1px solid rgba(230, 230, 230, 0.55);
    border-radius: 1px;
    color: #fff;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.l15-slot:active {
    cursor: grabbing;
}

.l15-slot-label {
    font-family: var(--font-hud);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.l15-slot-hint {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: rgba(200, 200, 200, 0.65);
}

.l15-slot.is-placed,
.l15-slot:disabled {
    opacity: 0.28;
    cursor: default;
    border-color: rgba(255, 255, 255, 0.2);
}

.l15-slot.is-dragging-source {
    opacity: 0.25;
}

.l15-slot-ghost {
    position: fixed;
    z-index: 30000;
    pointer-events: none;
    margin: 0;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
    transform: scale(1.04);
    opacity: 0.95;
}

@media (max-width: 380px) {
    .l15-slot-rail {
        width: 78px;
        padding-left: 6px;
        padding-right: 6px;
    }
    .l15-slot {
        min-height: 56px;
        padding: 8px 2px;
    }
    .l15-slot-label {
        font-size: 0.85rem;
    }
}

@media (orientation: landscape) and (max-height: 430px) {
    .l15-quiz-card {
        padding: 14px 12px 12px;
    }
    .l15-option {
        min-height: 42px;
        padding: 8px 10px;
    }
    .l15-map-guide {
        font-size: 0.74rem;
        padding: 8px 12px max(8px, env(safe-area-inset-bottom, 0px));
    }
    .l15-lore-dialog.is-show {
        font-size: 0.9rem;
        bottom: max(14%, 56px);
        padding: 10px 12px 8px;
    }
    .l15-lore-text {
        font-size: 0.88rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .l15-intro-prompt {
        animation: none;
    }
}


