/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

:root {
    --gold: #c9a84c;
    --gold-dim: #8a6d2b;
    --dark-bg: #1a1410;
    --dialog-bg: rgba(15, 10, 5, 0.92);
    --text-color: #e8dcc8;
    --text-dim: #9a8b76;
    --accent-red: #8b2020;
    --accent-red-bright: #c53030;
    --paper: #f4e8c1;
    --ink: #2a1a0a;
    --pressure-green: #4a8c5c;
    --pressure-yellow: #c9a84c;
    --pressure-red: #8b2020;
    --font-main: "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
    --font-ui: "Microsoft YaHei", "PingFang SC", sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: var(--font-main);
}

/* ===== 游戏容器（竖屏 9:16） ===== */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--dark-bg);
}

/* ===== 场景背景 ===== */
#scene-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: background-image 0.8s ease, filter 0.6s ease;
}

/* ===== 书房烛光效果 ===== */
#scene-bg[data-scene="study"]::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(
        ellipse 35% 30% at 30% 70%,
        rgba(244, 200, 100, 0.08) 0%,
        rgba(244, 180, 80, 0.03) 40%,
        transparent 70%
    );
    animation: candleFlicker 3s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes candleFlicker {
    0%   { opacity: 0.6; }
    25%  { opacity: 0.9; }
    50%  { opacity: 0.5; }
    75%  { opacity: 1; }
    100% { opacity: 0.7; }
}

/* ===== 现场勘查热点 ===== */
#investigation-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    pointer-events: none;
}

#investigation-overlay:not(.hidden) {
    pointer-events: none;
}

.hotspot {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
}

.hotspot-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(201, 168, 76, 0.6);
    background: rgba(201, 168, 76, 0.15);
    transform: translate(-50%, -50%);
}

.hotspot-dot:hover {
    background: rgba(201, 168, 76, 0.35);
    border-color: rgba(201, 168, 76, 0.9);
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
    transform: translate(-50%, -50%) scale(1.15);
}

.hotspot-dot:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.hotspot.found {
    border-color: rgba(100, 100, 100, 0.3);
    background: rgba(100, 100, 100, 0.08);
    pointer-events: none;
    opacity: 0.4;
}

.hotspot.found .hotspot-pulse {
    display: none;
}

.hotspot.found .hotspot-label {
    color: rgba(150, 150, 150, 0.5);
}

.hotspot-pulse {
    position: absolute;
    inset: -6px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    opacity: 0;
    animation: hotspotPulse 2s ease-in-out infinite;
}

@keyframes hotspotPulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.5); }
}

.hotspot-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--gold);
    font-size: 11px;
    font-family: var(--font-ui);
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    letter-spacing: 1px;
}

#investigation-done-btn {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.08));
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    padding: 12px 28px;
    color: var(--gold);
    font-family: var(--font-main);
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    animation: fadeInUp 0.5s ease-out;
}

#investigation-done-btn:hover {
    background: rgba(201, 168, 76, 0.2);
    border-color: var(--gold);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 氛围叠加层 ===== */
#atmosphere-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background 0.8s ease;
    z-index: 1;
}

.atmosphere-interrogation {
    background: linear-gradient(
        to bottom,
        rgba(60, 10, 10, 0.3) 0%,
        rgba(20, 5, 5, 0.1) 40%,
        rgba(20, 5, 5, 0.4) 100%
    ) !important;
}

.atmosphere-tense {
    background: linear-gradient(
        to bottom,
        rgba(80, 10, 10, 0.45) 0%,
        rgba(30, 5, 5, 0.2) 40%,
        rgba(40, 5, 5, 0.55) 100%
    ) !important;
}

.atmosphere-breakthrough {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* ===== 角色立绘 ===== */
#character-layer {
    position: absolute;
    bottom: 32%;
    left: 50%;
    transform: translateX(-50%);
    width: 72%;
    height: 58%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2;
    transition: transform 0.3s ease, filter 0.3s ease;
}

#character-sprite {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    transition: background-image 0.15s ease, transform 0.2s ease, filter 0.3s ease;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
}

/* 角色动画效果 */
.char-shake {
    animation: charShake 0.4s ease-in-out;
}

.char-tremble {
    animation: charTremble 0.8s ease-in-out infinite;
}

.char-flinch {
    animation: charFlinch 0.3s ease-out;
}

@keyframes charShake {
    0%, 100% { transform: translateX(-50%); }
    20% { transform: translateX(calc(-50% + 8px)); }
    40% { transform: translateX(calc(-50% - 8px)); }
    60% { transform: translateX(calc(-50% + 5px)); }
    80% { transform: translateX(calc(-50% - 3px)); }
}

@keyframes charTremble {
    0%, 100% { transform: translateX(-50%); }
    25% { transform: translateX(calc(-50% + 2px)); }
    75% { transform: translateX(calc(-50% - 2px)); }
}

@keyframes charFlinch {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(0.97); }
    100% { transform: translateX(-50%) scale(1); }
}

/* ===== 角色名牌 ===== */
#name-plate {
    position: absolute;
    top: -16px;
    left: 0;
    z-index: 11;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    padding: 4px 18px;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
}

#character-name {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-bg);
    letter-spacing: 4px;
}

/* ===== 对话框 ===== */
#dialog-box {
    position: absolute;
    bottom: 18%;
    left: 4%;
    right: 4%;
    z-index: 10;
    background: var(--dialog-bg);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    padding: 20px 18px 16px;
    min-height: 120px;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

#dialog-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
    letter-spacing: 1px;
    min-height: 60px;
    max-height: 45vh;
    overflow-y: auto;
}

#dialog-text .highlight {
    color: var(--gold);
    font-weight: 700;
}

#click-indicator {
    position: absolute;
    bottom: 8px;
    right: 14px;
    color: var(--gold);
    font-size: 12px;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ===== 内心独白 ===== */
#inner-thought {
    position: absolute;
    /* 避开 TapTap 小程序顶栏胶囊（~88px）+ iOS 灵动岛 */
    top: max(8%, calc(env(safe-area-inset-top, 0px) + 96px));
    left: 6%;
    right: 6%;
    /* z-index 调高盖住右上角胶囊（#menu-btn z=60 / #back-launcher z=50 / #pressure-meter z=12）
       气泡是临时浮层，玩家点开消失后右上角胶囊重新可见 */
    z-index: 70;
    background: rgba(244, 232, 193, 0.95);
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: thoughtSlideIn 0.4s ease-out;
}

@keyframes thoughtSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#thought-icon {
    font-size: 13px;
    flex-shrink: 0;
    background: var(--gold);
    color: var(--dark-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 2px;
    font-style: normal;
}

#thought-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink);
    font-style: normal;
}

/* ===== 选项面板 ===== */
#choices-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);   /* 屏幕完全居中，避免拇指误触 */
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: stretch;       /* 让所有按钮横向铺满容器 → 等宽，左右对齐 */
    gap: 14px;
    width: 86%;
    max-width: 420px;
}

.choice-btn {
    /* 半透明背景 + 胶囊圆角，弱化"方格"感 */
    background: rgba(20, 14, 8, 0.5);
    border: 1px solid rgba(201, 168, 76, 0.28);
    border-radius: 26px;
    padding: 13px 22px;
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 15px;
    letter-spacing: 0.8px;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    width: 100%;             /* 等宽：所有按钮宽度 = 容器宽度，左右自然对齐 */
    white-space: normal;
    word-break: keep-all;
}

.choice-btn:hover {
    background: rgba(201, 168, 76, 0.18);
    border-color: rgba(201, 168, 76, 0.7);
    transform: scale(1.02);
}

.choice-btn:active {
    transform: scale(0.98);
}

@media (max-width: 480px) {
    #choices-panel {
        width: 88%;
    }
    .choice-btn {
        font-size: 14px;
        padding: 12px 18px;
        letter-spacing: 0.5px;
    }
}

/* ===== 审讯输入面板 ===== */
#interrogation-panel {
    position: absolute;
    bottom: calc(10% + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 15;
    background: linear-gradient(to top, rgba(10, 6, 3, 0.98) 70%, rgba(10, 6, 3, 0.8));
    padding: 10px 12px 14px;
    border-top: 1px solid var(--gold-dim);
}

#evidence-hint {
    margin-bottom: 8px;
    padding: 6px 12px;
    background: rgba(201, 168, 76, 0.1);
    border-left: 3px solid var(--gold);
    border-radius: 2px;
    font-size: 12px;
    color: var(--gold);
    animation: hintFade 0.3s ease-out;
}

@keyframes hintFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

#input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#player-input {
    flex: 1;
    background: rgba(244, 232, 193, 0.08);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#player-input:focus {
    border-color: var(--gold);
}

#player-input::placeholder {
    color: var(--text-dim);
}

#send-btn {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border: none;
    border-radius: 4px;
    padding: 10px 26px;
    min-width: 72px;
    color: var(--dark-bg);
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

#send-btn:hover { opacity: 0.9; }
#send-btn:active { transform: scale(0.95); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#interrogation-tools {
    display: flex;
    gap: 8px;
}

.tool-btn {
    flex: 1;
    background: rgba(244, 232, 193, 0.06);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-dim);
    font-family: var(--font-ui);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold);
    border-color: var(--gold-dim);
}

/* "听元芳"按钮：有 hint 待看时金色脉冲提醒 */
.tool-btn.has-hint {
    background: rgba(201, 168, 76, 0.18);
    color: var(--gold);
    border-color: var(--gold);
    animation: hintPulse 1.8s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); }
    50%      { box-shadow: 0 0 10px 2px rgba(201, 168, 76, 0.35); }
}

/* ===== 线索面板 ===== */
#evidence-panel {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

#evidence-panel-inner {
    width: 88%;
    max-height: 75vh;
    background: var(--dialog-bg);
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    padding: 24px 18px;
    overflow-y: auto;
    position: relative;
}

#evidence-panel-inner h3 {
    color: var(--gold);
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gold-dim);
}

.ev-cat-header {
    color: var(--gold);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 6px 0 4px;
    margin-top: 10px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.25);
    margin-bottom: 8px;
    opacity: 0.8;
}

.ev-cat-header:first-child {
    margin-top: 0;
}

.evidence-item {
    background: rgba(244, 232, 193, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ev-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
    background: rgba(244, 232, 193, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.15);
    padding: 4px;
}

.ev-text-wrap {
    flex: 1;
    min-width: 0;
}

.evidence-item:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--gold-dim);
}

.evidence-item .ev-title {
    color: var(--gold);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.evidence-item .ev-desc {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.6;
}

.evidence-item.ev-new {
    border-color: var(--gold);
    animation: evPulse 1s ease-in-out 2;
}

@keyframes evPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); }
    50% { box-shadow: 0 0 12px 2px rgba(201, 168, 76, 0.3); }
}

#close-evidence {
    position: sticky;
    top: 0;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px;
    font-size: 14px;
    background: var(--dialog-bg);
    border-color: var(--gold-dim);
    color: var(--gold);
    z-index: 1;
}

/* ===== 压力指示器 ===== */
#pressure-meter {
    position: absolute;
    /* 让心理防线避开 TapTap 顶栏 + #menu-btn (env+100) + #back-launcher (env+148) 两层胶囊 */
    top: calc(env(safe-area-inset-top, 0px) + 196px);
    right: 12px;
    z-index: 12;
    text-align: right;
    background: rgba(15, 10, 5, 0.7);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

#pressure-label {
    font-size: 12px;
    color: var(--gold-dim);
    margin-bottom: 5px;
    letter-spacing: 2px;
    font-family: var(--font-ui);
}

#pressure-bar-bg {
    width: 130px;
    height: 8px;
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
    overflow: hidden;
}

#pressure-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--pressure-green);
    border-radius: 4px;
    transition: width 0.6s ease, background-color 0.6s ease;
}

/* 审讯开始时高亮提醒 */
#pressure-meter.highlight {
    animation: defenseHighlight 2s ease-out;
    border-color: var(--gold);
}
@keyframes defenseHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.6); transform: scale(1); }
    15%  { box-shadow: 0 0 16px 4px rgba(201, 168, 76, 0.5); transform: scale(1.08); }
    40%  { box-shadow: 0 0 8px 2px rgba(201, 168, 76, 0.3); transform: scale(1.04); }
    100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0); transform: scale(1); }
}

/* ===== 击穿演出 ===== */
#breakthrough-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: breakthroughFlash 0.5s ease-out;
}

@keyframes breakthroughFlash {
    0% { background: rgba(201, 168, 76, 0.6); }
    100% { background: rgba(0, 0, 0, 0.9); }
}

#breakthrough-text {
    color: var(--gold);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    animation: btTextReveal 0.8s ease-out 0.3s both;
}

@keyframes btTextReveal {
    from { transform: scale(1.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== 转场遮罩 ===== */
#transition-mask {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: #000;
    transition: opacity 0.6s ease;
}

.mask-fade-in { opacity: 1 !important; }
.mask-fade-out { opacity: 0 !important; }

/* ===== 开始画面 ===== */
#title-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: url('../img/cover.webp') center center / cover no-repeat;
    background-color: #f4e8c1;
    overflow: hidden;
}

/* --- 案卷卷轴 --- */
#scroll-wrap {
    position: absolute;
    inset: 0;
    z-index: 52;
    pointer-events: none;
}

/* 案卷两页：都占满屏，撕缝互补（不规则）——开场看起来是一整张封着的纸 */
#scroll-left, #scroll-right {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #e0d4b8, #f4e8c1 20%, #f4e8c1 80%, #e0d4b8);
    z-index: 52;
}

#scroll-left {
    clip-path: polygon(0% 0%, 50.3% 0%, 49.2% 5%, 50.7% 9%, 48.4% 16%, 48.9% 19%, 47.2% 27%, 51.9% 30%, 50.8% 38%, 47.6% 45%, 48.3% 50%, 51.2% 58%, 48.7% 66%, 50.3% 71%, 47.4% 80%, 49.2% 87%, 46.8% 94%, 48.8% 100%, 0% 100%);
    filter: drop-shadow(3px 0 8px rgba(60, 40, 20, 0.35));
    animation: scrollTearLeft 2.2s cubic-bezier(0.42, 0.02, 0.3, 1) 1.4s forwards;
}

#scroll-right {
    clip-path: polygon(50.3% 0%, 100% 0%, 100% 100%, 48.8% 100%, 46.8% 94%, 49.2% 87%, 47.4% 80%, 50.3% 71%, 48.7% 66%, 51.2% 58%, 48.3% 50%, 47.6% 45%, 50.8% 38%, 51.9% 30%, 47.2% 27%, 48.9% 19%, 48.4% 16%, 50.7% 9%, 49.2% 5%);
    filter: drop-shadow(-3px 0 8px rgba(60, 40, 20, 0.35));
    animation: scrollTearRight 2.2s cubic-bezier(0.42, 0.02, 0.3, 1) 1.4s forwards;
}

/* 卷轴纹理线 */
#scroll-left::before, #scroll-right::before {
    content: '';
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 40px,
        rgba(160, 130, 80, 0.08) 40px,
        rgba(160, 130, 80, 0.08) 41px
    );
}

/* 页面撕开：先绷住微动 → 撕一段卡一下 → 大幅撕开（带一点旋转，像手拉着两角） */
@keyframes scrollTearLeft {
    0%   { transform: translateX(0) rotate(0deg); }
    12%  { transform: translateX(-1.6%) rotate(-0.25deg); }
    20%  { transform: translateX(-1.2%) rotate(-0.2deg); }   /* 卡住 */
    46%  { transform: translateX(-24%) rotate(-0.9deg); }
    56%  { transform: translateX(-22.5%) rotate(-0.8deg); }  /* 再卡 */
    100% { transform: translateX(-110%) rotate(-1.6deg); }
}

@keyframes scrollTearRight {
    0%   { transform: translateX(0) rotate(0deg); }
    10%  { transform: translateX(1.4%) rotate(0.2deg); }
    18%  { transform: translateX(1.1%) rotate(0.18deg); }    /* 卡住 */
    50%  { transform: translateX(26%) rotate(0.9deg); }
    60%  { transform: translateX(24.5%) rotate(0.85deg); }   /* 再卡 */
    100% { transform: translateX(110%) rotate(1.5deg); }
}

/* --- 火漆封蜡 · 随纸同撕（蜡封在纸缝上，撕纸带撕蜡） --- */
/* 随纸层：满屏、与纸页跑同一套 scrollTear 关键帧（同时长/同缓动/同延时）→ 蜡半 1:1 粘在各自半页上 */
#seal-carry-left, #seal-carry-right {
    position: absolute;
    inset: 0;
    z-index: 53;
    pointer-events: none;
}
#seal-carry-left  { animation: scrollTearLeft  2.2s cubic-bezier(0.42, 0.02, 0.3, 1) 1.4s forwards; }
#seal-carry-right { animation: scrollTearRight 2.2s cubic-bezier(0.42, 0.02, 0.3, 1) 1.4s forwards; }

/* 蜡半：固定尺寸盒居中（margin 定心，keyframes 只管 scale/rotate），全画布烘焙图对位 */
#seal-left, #seal-right {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 172px;
    height: 153px;   /* 与 wax-seal.webp 500:444 同比 */
    margin: -76.5px 0 0 -86px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
    opacity: 0;
}

#seal-left {
    background-image: url('../img/wax-left.webp');
    transform-origin: 48% 100%;
    animation:
        sealAppear 0.5s cubic-bezier(0.25, 0.9, 0.35, 1.2) 0.1s forwards,  /* 砸下盖印（两半同参→看着是整枚） */
        sealStrain 0.35s ease-in-out 1.0s,                                  /* 撕前绷劲 */
        sealSnapLeft 0.3s cubic-bezier(0.5, 0, 0.4, 1) 1.55s forwards;      /* 纸一给劲，蜡"啪"崩一下 */
}

#seal-right {
    background-image: url('../img/wax-right.webp');
    transform-origin: 48% 100%;
    animation:
        sealAppear 0.5s cubic-bezier(0.25, 0.9, 0.35, 1.2) 0.1s forwards,
        sealStrain 0.35s ease-in-out 1.0s,
        sealSnapRight 0.3s cubic-bezier(0.5, 0, 0.4, 1) 1.58s forwards;     /* 右半晚 0.03s——脆断不齐 */
}

/* 砸下：大→小 + 末端一记回弹（像真盖上去） */
@keyframes sealAppear {
    0%   { opacity: 0; transform: scale(2.6) rotate(-6deg); }
    70%  { opacity: 1; transform: scale(1.42) rotate(1deg); }
    85%  { opacity: 1; transform: scale(1.56) rotate(0deg); }
    100% { opacity: 1; transform: scale(1.5); }
}

/* 撕前绷劲：被两只手拽住微微横向绷紧 */
@keyframes sealStrain {
    0%   { transform: scale(1.5); }
    50%  { transform: scale(1.56, 1.47); }
    100% { transform: scale(1.5); }
}

/* 崩断小动作：撕开瞬间蜡半相对纸面轻轻一崩（大位移全由随纸层承担） */
@keyframes sealSnapLeft {
    0%   { transform: scale(1.5) rotate(0deg); }
    55%  { transform: scale(1.5) rotate(-3.6deg) translate(-2px, 0); }
    100% { transform: scale(1.5) rotate(-3deg)   translate(-2px, 1px); }
}
@keyframes sealSnapRight {
    0%   { transform: scale(1.5) rotate(0deg); }
    55%  { transform: scale(1.5) rotate(4deg)   translate(2px, -1px); }
    100% { transform: scale(1.5) rotate(3.2deg) translate(2px, 1px); }
}

/* --- 标题文字 --- */
#title-content {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 51;
    text-align: center;
    opacity: 0;
    animation: titleContentReveal 1.2s ease-out 2.5s forwards;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

@keyframes titleContentReveal {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

#game-title {
    font-size: 52px;
    color: #2a1a0a;
    letter-spacing: 14px;
    text-shadow: 0 0 12px rgba(244, 232, 193, 0.9), 0 0 24px rgba(244, 232, 193, 0.6);
    writing-mode: vertical-rl;
    display: inline-block;
    margin-bottom: 0;
}

#title-divider {
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, transparent, #8a6d2b, transparent);
    margin: 0;
    align-self: stretch;
    animation: dividerGrow 0.8s ease-out 3.2s forwards;
}

@keyframes dividerGrow {
    to { height: 50px; }
}

#case-title {
    font-size: 14px;
    color: #5a4a36;
    letter-spacing: 4px;
    font-weight: 400;
    writing-mode: vertical-rl;
    display: inline-block;
    opacity: 0;
    text-shadow: 0 0 8px rgba(244, 232, 193, 0.8);
    animation: fadeIn 0.8s ease-out 3.6s forwards;
}

/* --- 底部输入和按钮 --- */
#title-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 51;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0 0;
    bottom: 14%;
    opacity: 0;
    background: none;
    animation: fadeIn 1s ease-out 3.8s forwards;
}

#api-key-area {
    margin-bottom: 16px;
    width: 75%;
    max-width: 300px;
}

#api-key-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid #a08050;
    border-radius: 4px;
    padding: 10px 14px;
    color: #2a1a0a;
    font-family: var(--font-ui);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

#api-key-input:focus {
    border-color: #6a4a2a;
}

#api-key-input::placeholder {
    color: #8a7a66;
}

#api-status {
    margin-top: 6px;
    font-size: 12px;
    font-family: var(--font-ui);
    min-height: 18px;
    color: #5a4a36;
}

.api-ok { color: #4a8c5c; }
.api-err { color: var(--accent-red-bright); }

#continue-btn {
    background: rgba(42, 26, 10, 0.08);
    border: 1px solid #6a4a2a;
    border-radius: 4px;
    padding: 14px 48px;
    color: #3a2a1a;
    font-family: var(--font-main);
    font-size: 18px;
    letter-spacing: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}
#continue-btn:hover {
    background: rgba(42, 26, 10, 0.15);
    box-shadow: 0 0 20px rgba(42, 26, 10, 0.15);
}

#start-btn {
    background: rgba(42, 26, 10, 0.06);
    border: 1px solid #6a4a2a;
    border-radius: 4px;
    padding: 14px 48px;
    color: #3a2a1a;
    font-family: var(--font-main);
    font-size: 18px;
    letter-spacing: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-btn:hover {
    background: rgba(42, 26, 10, 0.15);
    box-shadow: 0 0 20px rgba(42, 26, 10, 0.12);
}

#subtitle {
    margin-top: 14px;
    color: #7a6a56;
    font-size: 12px;
    letter-spacing: 2px;
    font-family: var(--font-ui);
    opacity: 0.7;
}

/* ===== 结局尾按钮组（重新开始 + 返回主菜单）===== */
#endgame-btns {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 80%;
    max-width: 360px;
    opacity: 0;
}
#endgame-btns.show {
    animation: fadeIn 0.8s ease-out 1s forwards;
}
.endgame-btn {
    display: block;
    width: 100%;
    border-radius: 6px;
    padding: 13px 24px;
    font-family: var(--font-main);
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.endgame-btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border: none;
    color: var(--dark-bg);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 5px;
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}
.endgame-btn-primary:hover {
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.5);
    transform: scale(1.03);
}
.endgame-btn-primary:active { transform: scale(0.97); }
.endgame-btn-secondary {
    background: rgba(15, 10, 5, 0.55);
    border: 1px solid rgba(201, 168, 76, 0.45);
    color: var(--gold);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 4px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.endgame-btn-secondary:hover {
    background: rgba(201, 168, 76, 0.16);
    border-color: var(--gold);
    transform: scale(1.03);
}
.endgame-btn-secondary:active { transform: scale(0.97); }

/* ===== 指认凶手面板 ===== */
#guess-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);   /* 屏幕完全居中 */
    width: 92%;
    max-width: 520px;
    z-index: 15;
    background: var(--dialog-bg);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    padding: 20px 18px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.4s ease-out;
}

#guess-prompt {
    font-size: 15px;
    color: var(--gold);
    letter-spacing: 2px;
    margin-bottom: 14px;
    text-align: center;
}

#guess-input-wrapper {
    display: flex;
    gap: 8px;
}

#guess-input {
    flex: 1;
    background: rgba(244, 232, 193, 0.08);
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#guess-input:focus {
    border-color: var(--gold);
}

#guess-input::placeholder {
    color: var(--text-dim);
}

#guess-submit {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    color: var(--dark-bg);
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    transition: transform 0.1s, opacity 0.2s;
}

#guess-submit:hover { opacity: 0.9; }
#guess-submit:active { transform: scale(0.95); }

/* ===== 定场诗 ===== */
#poem-screen {
    position: absolute;
    inset: 0;
    z-index: 55;
    background: linear-gradient(
        to bottom,
        #050302 0%,
        #1a1410 20%,
        #1a1410 80%,
        #050302 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    cursor: pointer;
}

#poem-allusion {
    text-align: center;
    opacity: 0;
    animation: poemFadeIn 1.5s ease-out 0.5s forwards;
}

#allusion-source {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 3px;
    margin-bottom: 12px;
}

#allusion-text {
    font-size: 14px;
    color: var(--gold-dim);
    letter-spacing: 2px;
    line-height: 2;
    max-width: 80%;
    margin: 0 auto;
    font-style: italic;
}

#poem-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 0;
}

.poem-line {
    font-size: 20px;
    color: var(--gold);
    letter-spacing: 4px;
    line-height: 2;
    opacity: 0;
    transform: translateY(12px);
    text-shadow: 0 1px 10px rgba(201, 168, 76, 0.2);
}

.poem-line:nth-child(2n+3) {
    margin-top: 16px;
}

.poem-line.poem-line-show {
    animation: poemLineReveal 0.8s ease-out forwards;
}

@keyframes poemLineReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes poemFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#poem-skip {
    position: absolute;
    bottom: 40px;
    color: var(--text-dim);
    font-size: 13px;
    letter-spacing: 4px;
    font-family: var(--font-ui);
    opacity: 0;
    animation: poemFadeIn 1s ease-out 8s forwards;
}

/* ===== 屏幕震动 ===== */
.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-6px, 3px); }
    20% { transform: translate(6px, -3px); }
    30% { transform: translate(-4px, 2px); }
    40% { transform: translate(4px, -2px); }
    50% { transform: translate(-2px, 1px); }
}

/* ===== 通用 ===== */
.hidden { display: none !important; }

.fade-in { animation: fadeIn 0.4s ease-out; }
.fade-out { animation: fadeOut 0.4s ease-out forwards; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== 对话框内审讯模式下的狄仁杰发言 ===== */
.di-line {
    color: var(--gold);
    font-weight: 700;
}

/* ===== 加载指示器 ===== */
.typing-indicator {
    display: inline-block;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--text-dim);
    border-radius: 50%;
    margin: 0 2px;
    animation: typingDot 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
}

/* ===== 新线索获得提示 ===== */
#new-evidence-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 22;
    background: rgba(10, 6, 3, 0.95);
    border: 2px solid var(--gold);
    border-radius: 6px;
    padding: 20px 30px;
    text-align: center;
    animation: toastIn 0.5s ease-out;
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.3);
}

#new-evidence-toast .toast-title {
    color: var(--gold);
    font-size: 14px;
    letter-spacing: 4px;
    margin-bottom: 10px;
}

#new-evidence-toast .toast-content {
    color: var(--text-color);
    font-size: 16px;
    letter-spacing: 2px;
}

@keyframes toastIn {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}

/* ===== 深查面板 ===== */
#investigate-panel {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

#investigate-panel-inner {
    width: 88%;
    max-height: 75vh;
    background: var(--dialog-bg);
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    padding: 24px 18px;
    overflow-y: auto;
}

#investigate-panel-inner h3 {
    color: var(--gold);
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gold-dim);
}

#investigate-hint {
    color: #c9a84c;
    font-size: 13px;
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: rgba(201, 168, 76, 0.08);
    border-radius: 4px;
    border: 1px dashed rgba(201, 168, 76, 0.3);
}

.contradiction-item {
    background: rgba(244, 232, 193, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.contradiction-item:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--gold-dim);
}

.contradiction-item.investigated {
    opacity: 0.6;
    cursor: default;
}

.contradiction-item.investigated:hover {
    background: rgba(244, 232, 193, 0.05);
    border-color: rgba(201, 168, 76, 0.2);
}

.contradiction-title {
    color: var(--gold);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.contradiction-summary {
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.4;
}

.contradiction-status {
    color: var(--text-dim);
    font-size: 11px;
    margin-top: 6px;
    text-align: right;
}

.contradiction-status.clickable {
    color: var(--gold);
    cursor: pointer;
}

/* ===== 防线进度条状态 ===== */
.defense-stalled {
    animation: defenseBlink 1.2s ease-in-out infinite;
}

@keyframes defenseBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.defense-truth {
    box-shadow: 0 0 8px rgba(139, 32, 32, 0.6), 0 0 16px rgba(139, 32, 32, 0.3);
    animation: defenseGlow 2s ease-in-out infinite;
}

@keyframes defenseGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(139, 32, 32, 0.6); }
    50% { box-shadow: 0 0 16px rgba(201, 64, 64, 0.8), 0 0 24px rgba(201, 64, 64, 0.4); }
}

/* ===== 返回上一节点按钮 ===== */
/* ===== 静音按钮 ===== */
#mute-btn {
    position: absolute;
    top: 44px;
    left: 8px;
    z-index: 50;
    background: rgba(15, 10, 5, 0.5);
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 16px;
    line-height: 36px;
    text-align: center;
    padding: 0;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
}
#mute-btn:hover {
    background: rgba(15, 10, 5, 0.8);
    border-color: var(--gold);
}

#btn-back {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 15;
    background: rgba(15, 10, 5, 0.6);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 4px;
    padding: 6px 12px;
    color: var(--text-dim);
    font-size: 12px;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.2s;
}
#btn-back:hover {
    color: var(--gold);
    border-color: var(--gold);
    background: rgba(15, 10, 5, 0.8);
}

/* ===== 一级菜单（汇总返回主菜单 / 返回本节 / 静音）===== */
/* 旧按钮全部隐藏，由 #menu-panel 接管 UI（保留 DOM 供 JS 引用）*/
#mute-btn,
#back-launcher,
#btn-back { display: none !important; }

#menu-btn {
    position: absolute;
    /* 避开 TapTap 小程序顶栏胶囊（实测 ~100px，含 safe-area）+ iOS Safari 灵动岛/刘海 */
    top: calc(env(safe-area-inset-top, 0px) + 100px);
    right: 12px;
    z-index: 60;
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid rgba(201, 168, 76, 0.45);
    background: rgba(15, 10, 5, 0.7);
    color: #c9a84c;
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1;
    letter-spacing: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
#menu-btn:hover {
    background: rgba(40, 30, 20, 0.85);
    border-color: var(--gold);
    transform: scale(1.04);
}
#menu-btn:active { transform: scale(0.96); }

#menu-panel {
    position: absolute;
    /* 按钮下方留间隙（按钮 top + 36 高 + 8 间距）*/
    top: calc(env(safe-area-inset-top, 0px) + 100px);
    right: 12px;
    z-index: 60;
    background: rgba(15, 10, 5, 0.95);
    border: 1px solid rgba(201, 168, 76, 0.45);
    border-radius: 8px;
    padding: 6px;
    min-width: 168px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
    animation: menuFadeIn 0.18s ease-out;
}
#menu-panel.hidden { display: none !important; }
@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: #d8c08c;
    font-family: var(--font-main);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    letter-spacing: 1.5px;
    transition: background 0.15s ease, color 0.15s ease;
}
.menu-item:hover {
    background: rgba(201, 168, 76, 0.16);
    color: var(--gold);
}
.menu-item.hidden { display: none !important; }
.menu-item + .menu-item { margin-top: 2px; }

/* ===== 章节选择（通关后解锁）===== */
#chapter-btn {
    background: rgba(244, 232, 193, 0.55);
    border: 1px solid #6a4a2a;
    border-radius: 4px;
    padding: 10px 36px;
    color: #2a1a0a;
    font-family: var(--font-main);
    font-size: 14px;
    letter-spacing: 6px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: all 0.3s ease;
}
#chapter-btn:hover {
    background: rgba(244, 232, 193, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
/* 未通关：灰显但仍可点（点了会弹提示） */
#chapter-btn.chapter-btn-locked {
    opacity: 0.72;
    color: rgba(42, 26, 10, 0.6);
    border-color: rgba(106, 74, 42, 0.55);
    cursor: not-allowed;
    box-shadow: none;
}
#chapter-btn.chapter-btn-locked:hover {
    background: rgba(244, 232, 193, 0.55);
    box-shadow: none;
}
#chapter-panel {
    position: absolute;
    inset: 0;
    background: rgba(20, 15, 10, 0.96);
    z-index: 60;
    padding: 50px 18px 30px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.chapter-panel-title {
    color: var(--gold);
    text-align: center;
    font-size: 18px;
    letter-spacing: 8px;
    margin-bottom: 20px;
    font-family: var(--font-main);
}
#chapter-list {
    width: 100%;
    max-width: 320px;
    flex: 1;
    overflow-y: auto;
}
.chapter-item {
    padding: 12px 18px;
    margin: 8px auto;
    border: 1px solid var(--gold-dim);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
    font-size: 14px;
    letter-spacing: 2px;
    border-radius: 2px;
}
.chapter-item.unlocked {
    color: var(--gold);
    background: rgba(60, 40, 20, 0.5);
}
.chapter-item.unlocked:hover {
    background: rgba(120, 80, 40, 0.6);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.chapter-item.locked {
    color: #5a4a38;
    background: transparent;
    cursor: not-allowed;
    border-color: rgba(138, 109, 43, 0.3);
}
#chapter-close {
    display: block;
    margin: 18px auto 0 auto;
    padding: 8px 24px;
    background: transparent;
    border: 1px solid var(--gold-dim);
    color: var(--text-dim);
    font-family: var(--font-main);
    font-size: 12px;
    letter-spacing: 4px;
    cursor: pointer;
    border-radius: 2px;
}
#chapter-close:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* 合集：返回上一节点 文字胶囊按钮，垂直堆叠在"返回主菜单"下方 */
#btn-back {
    top: 84px !important;
    left: auto !important;
    right: 8px !important;
    z-index: 50 !important;
    background: rgba(15, 10, 5, 0.5) !important;
    border: 1px solid rgba(201, 168, 76, 0.25) !important;
    border-radius: 18px !important;
    width: auto !important;
    height: auto !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
    line-height: 1 !important;
    text-align: center !important;
    color: #9a8b76 !important;
    font-family: 'Noto Serif SC','SimSun',serif !important;
    letter-spacing: 1px !important;
}
#btn-back:hover {
    color: var(--gold) !important;
    border-color: var(--gold) !important;
    background: rgba(15, 10, 5, 0.8) !important;
}
