/* 失色纪·修钟人 - 水彩暗黑童话风格 */

@import url('https://fonts.loli.net/css2?family=Ma+Shan+Zheng&family=ZCOOL+XiaoWei&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 褪色后的颜色变量：低饱和度、偏灰铅白调 */
    --ochre: #A89268;          /* 原金黄 → 灰褐 */
    --olive-green: #7A8270;    /* 原草绿 → 灰绿 */
    --terracotta: #8C6058;     /* 原赤陶 → 灰玫 */
    --deep-purple: #3A3350;    /* 原深紫 → 蓝灰紫 */
    --shadow-blue: #1C1C2A;    /* 原暗蓝 → 深铅 */
    --parchment: #E8E0D0;      /* 原暖黄 → 灰白宣纸 */
    --parchment-dark: #C8C0B0; /* 原暖褐 → 灰铅纸 */
    --gold-accent: #B8A878;    /* 原金 → 暗哑金 */
    --ink-black: #2A2830;      /* 原墨蓝 → 暗铅黑 */
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--shadow-blue);
    font-family: 'ZCOOL XiaoWei', serif;
    touch-action: none;
}

#game-container {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

/* ── 全屏点击进入提示层 ── */
#enter-overlay {
    position: absolute;
    inset: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #0e0820 0%, #050310 100%);
    cursor: pointer;
    transition: opacity 0.8s ease;
}

#enter-overlay.enter-overlay-out {
    opacity: 0;
    pointer-events: none;
}

.enter-hint {
    font-family: 'Cinzel Decorative', 'UnifrakturMaguntia', 'Ma Shan Zheng', serif;
    font-size: 66px;
    font-weight: 700;
    color: #D4C9A8;
    letter-spacing: 0.18em;
    text-shadow:
        2px 3px 0 rgba(0,0,0,0.6),
        0 0 40px rgba(196,163,90,0.35),
        0 0 80px rgba(120,80,20,0.2);
    transform: rotate(-1.2deg);
    animation: enterHintPulse 2.4s ease-in-out infinite;
    user-select: none;
}

@keyframes enterHintPulse {
    0%,  100% { opacity: 0.45; transform: scale(1);    }
    50%        { opacity: 0.90; transform: scale(1.04); }
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* 全局褪色滤镜：模拟颜色从世界流失的核心视觉 */
    filter: saturate(0.38) brightness(0.90) contrast(1.05);
}

.hidden {
    display: none !important;
}

/* ========== 开始界面 ========== */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--shadow-blue) 0%, var(--deep-purple) 50%, #3D2B5E 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(ellipse at 20% 30%, rgba(196, 163, 90, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(112, 130, 56, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* 暗色蒙肧脉动 —— 整体节奏感 */
#start-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(8,5,18,0.55) 100%);
    animation: startDimPulse 9s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes startDimPulse {
    0%   { opacity: 0.4; }
    45%  { opacity: 1.0; }
    100% { opacity: 0.4; }
}

/* 点状褪色文字背景画布 */
#start-text-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* 褪色钟楼背景画布 */
#clock-tower-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* 褪色色块特效层 */
.start-fade-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.fade-blob {
    position: absolute;
    border-radius: 50%;
    animation: blobDrain var(--dur, 8s) ease-in-out var(--delay, 0s) infinite;
}

.fb1 {
    width: 38vw; height: 38vw;
    top: -8%; left: -6%;
    background: radial-gradient(circle, rgba(194,69,45,0.55) 0%, transparent 68%);
    --dur: 9s; --delay: 0s;
}
.fb2 {
    width: 32vw; height: 32vw;
    bottom: -5%; right: -4%;
    background: radial-gradient(circle, rgba(44,90,170,0.5) 0%, transparent 68%);
    --dur: 11s; --delay: -3s;
}
.fb3 {
    width: 26vw; height: 26vw;
    top: 30%; right: 2%;
    background: radial-gradient(circle, rgba(196,163,90,0.45) 0%, transparent 68%);
    --dur: 8s; --delay: -5s;
}
.fb4 {
    width: 22vw; height: 22vw;
    bottom: 8%; left: 5%;
    background: radial-gradient(circle, rgba(90,140,60,0.4) 0%, transparent 68%);
    --dur: 13s; --delay: -7s;
}
.fb5 {
    width: 18vw; height: 18vw;
    top: 50%; left: 38%;
    background: radial-gradient(circle, rgba(150,50,160,0.35) 0%, transparent 68%);
    --dur: 7s; --delay: -2s;
}

@keyframes blobDrain {
    0%   { filter: saturate(2.2) brightness(1.1); opacity: 0.8; transform: scale(1); }
    35%  { filter: saturate(0.15) brightness(0.55); opacity: 0.35; transform: scale(1.12); }
    65%  { filter: saturate(0) brightness(0.3); opacity: 0.12; transform: scale(0.92); }
    100% { filter: saturate(2.2) brightness(1.1); opacity: 0.8; transform: scale(1); }
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 1.5s ease-out;
    position: relative;
    z-index: 2;
}

/* 横屏/宽屏优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .title-container {
        margin-bottom: 20px;
    }
    .game-title {
        font-size: 72px !important;
        letter-spacing: 12px !important;
        margin-bottom: 5px !important;
    }
    .game-subtitle {
        font-size: 36px !important;
        letter-spacing: 18px !important;
    }
    .tagline {
        font-size: 16px !important;
        margin-top: 15px !important;
    }
    .parchment-btn {
        font-size: 18px !important;
        padding: 12px 36px !important;
        margin: 6px 0 !important;
    }
    .guide-toggle {
        padding: 8px 24px !important;
        font-size: 14px !important;
    }
    .credits {
        bottom: 10px !important;
        font-size: 12px !important;
    }
    .lore-figure {
        width: 160px !important;
        height: 100px !important;
        margin: -10px auto 8px !important;
    }
}

/* 线稿人物 */
.lore-figure {
    width: 237px;
    height: 148px;
    margin: -15px auto 12px;
    cursor: pointer;
    color: rgba(200, 60, 50, 0.65);
    filter: drop-shadow(0 0 6px rgba(196, 163, 90, 0.25));
    transition: color 0.4s ease, filter 0.4s ease, transform 0.3s ease;
    animation: loreBreathe 4s ease-in-out infinite;
}
.lore-figure:hover {
    color: rgba(220, 60, 50, 1);
    filter: drop-shadow(0 0 14px rgba(200, 60, 50, 0.6));
    transform: scale(1.08);
}
.lore-figure svg {
    width: 100%;
    height: 100%;
}
@keyframes loreBreathe {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 世界观浮层 */
.lore-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(8, 5, 18, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}
.lore-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.lore-overlay.hidden {
    display: none;
}
.lore-content {
    max-width: 560px;
    padding: 40px 32px;
    text-align: center;
}
.lore-text {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 22px;
    line-height: 2;
    color: rgba(244, 228, 188, 0.85);
    letter-spacing: 2px;
}
.lore-text .lore-char {
    opacity: 0;
    transition: opacity 0.4s ease;
}
.lore-text .lore-char.visible {
    opacity: 1;
}
.lore-close {
    display: block;
    margin-top: 30px;
    font-size: 14px;
    color: rgba(196, 163, 90, 0.5);
    letter-spacing: 4px;
    animation: loreBreathe 3s ease-in-out infinite;
}

.game-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 120px;
    color: var(--parchment);
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.5),
        2px 2px 0 var(--ochre);
    letter-spacing: 20px;
    margin-bottom: 10px;
}

.game-subtitle {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 60px;
    color: var(--ochre);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 30px;
}

.tagline {
    font-size: 20px;
    color: rgba(244, 228, 188, 0.7);
    margin-top: 30px;
    letter-spacing: 3px;
}

.parchment-btn {
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 22px;
    padding: 14px 42px;
    margin: 6px 0;
    background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    border: 2px solid var(--ochre);
    border-radius: 5px;
    position: relative;
    z-index: 2;
    color: var(--ink-black);
    cursor: pointer;
    box-shadow: 
        0 3px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    animation: fadeInUp 1.5s ease-out 0.3s both;
}

/* 继续旅程按钮 - 次要样式 */
#continue-btn {
    font-size: 18px;
    padding: 10px 32px;
    background: linear-gradient(180deg, rgba(244,228,188,0.85) 0%, rgba(220,200,160,0.85) 100%);
    border: 1px solid rgba(160,146,104,0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 玩法说明按钮 - 更小的样式 */
#guide-btn {
    font-size: 16px;
    padding: 8px 28px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid rgba(196,163,90,0.5);
    color: rgba(244,228,188,0.8);
    box-shadow: none;
}
#guide-btn:hover {
    background: rgba(196,163,90,0.15);
    border-color: rgba(196,163,90,0.8);
    color: #F4E4BC;
    box-shadow: 0 0 10px rgba(196,163,90,0.3);
}

.parchment-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 0 15px rgba(255, 215, 0, 0.3);
}

.parchment-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.credits {
    position: absolute;
    bottom: 30px;
    color: rgba(244, 228, 188, 0.4);
    font-size: 14px;
    letter-spacing: 5px;
    z-index: 2;
}

/* ========== UI层 ========== */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-layer > * {
    pointer-events: auto;
}

/* 数值栏 */
#stats-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(220, 212, 200, 0.88) 0%, rgba(200, 194, 182, 0.72) 100%);
    padding: 8px 15px;
    border-radius: 25px;
    border: 2px solid rgba(160, 146, 104, 0.7);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    min-width: 180px;
}

.stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: relative;
}

.color-icon {
    background: linear-gradient(135deg, #8C6058 0%, #A07068 100%);
    box-shadow: 0 0 8px rgba(100, 70, 65, 0.35);
}

.ink-icon {
    background: linear-gradient(135deg, #303040 0%, #484860 100%);
    box-shadow: 0 0 8px rgba(30, 30, 50, 0.4);
}

.warmth-icon {
    background: linear-gradient(135deg, #A89268 0%, #C0A878 100%);
    box-shadow: 0 0 8px rgba(140, 120, 80, 0.35);
}

.stat-bar {
    flex: 1;
    height: 12px;
    background: rgba(26, 26, 46, 0.2);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(196, 163, 90, 0.5);
}

.stat-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease, background 0.5s ease;
}

#color-fill {
    background: linear-gradient(90deg, #7A5850 0%, #9A7068 100%);
    width: 100%;
}

#ink-fill {
    background: linear-gradient(90deg, #383448 0%, #504868 100%);
    width: 100%;
}

#warmth-fill {
    background: linear-gradient(90deg, #988050 0%, #B09870 100%);
    width: 100%;
}

.stat-label {
    font-size: 14px;
    color: var(--ink-black);
    min-width: 35px;
}

/* ── 时钟图标（合并面板内使用）── */
#clock-icon {
    width: 28px;
    height: 28px;
    margin: 0;
    border: 2px solid var(--ochre);
    border-radius: 50%;
    position: relative;
    background: var(--parchment);
    flex-shrink: 0;
}

#clock-icon::before,
#clock-icon::after {
    content: '';
    position: absolute;
    background: var(--ink-black);
    left: 50%;
    transform-origin: bottom center;
}

#clock-icon::before {
    width: 2px;
    height: 8px;
    top: 4px;
    transform: translateX(-50%);
}

#clock-icon::after {
    width: 2px;
    height: 6px;
    top: 7px;
    transform: translateX(-50%) rotate(90deg);
}

/* 时段进度条 */
#period-bar-wrap {
    margin-top: 10px;
    width: 100%;
}
#period-bar-track {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    overflow: visible;
    background: linear-gradient(to right,
        rgba(255, 210, 100, 0.5) 0%,
        rgba(255, 210, 100, 0.5) 33.3%,
        rgba(220, 130, 60, 0.5) 33.3%,
        rgba(220, 130, 60, 0.5) 50%,
        rgba(40, 30, 80, 0.6) 50%,
        rgba(40, 30, 80, 0.6) 100%
    );
    border: 1px solid rgba(196, 163, 90, 0.4);
}
#period-bar-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.8s ease, background-color 1s ease;
    pointer-events: none;
}
#period-bar-cursor {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--parchment);
    border: 2px solid var(--ochre);
    transform: translate(-50%, -50%);
    transition: left 0.8s ease, background-color 1s ease;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    z-index: 1;
}
#period-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
}
.pbl {
    font-size: 10px;
    font-family: 'Ma Shan Zheng', cursive;
    opacity: 0.6;
    flex: 1;
    text-align: center;
    transition: opacity 0.5s ease, color 0.5s ease;
}
.pbl.active {
    opacity: 1;
    font-weight: bold;
}
.pbl.day   { color: #908060; }
.pbl.dusk  { color: #806050; }
.pbl.night { color: #505070; }

/* ── 折叠态 mini 时间条 ── */
#period-bar-mini {
    position: relative;
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(to right,
        rgba(255,210,100,0.55) 0%,
        rgba(255,210,100,0.55) 33.3%,
        rgba(220,130,60,0.55) 33.3%,
        rgba(220,130,60,0.55) 50%,
        rgba(40,30,80,0.65) 50%,
        rgba(40,30,80,0.65) 100%
    );
    border: 1px solid rgba(196,163,90,0.35);
    overflow: visible;
}
#period-bar-mini-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    border-radius: 3px 0 0 3px;
    pointer-events: none;
    transition: width 0.8s ease, background-color 1s ease;
}
#period-bar-mini-cursor {
    position: absolute;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--parchment);
    border: 1.5px solid var(--ochre);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: left 0.8s ease, background-color 1s ease;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
    z-index: 1;
}

/* ── 合并面板 mini 行 ── */
#tracker-mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-height: 80px;
    opacity: 1;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.3s ease;
}
.tracker-mini-row {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
}
.tracker-mini-label {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 11px;
    color: var(--deep-purple);
    opacity: 0.75;
    white-space: nowrap;
    width: 24px;
    flex-shrink: 0;
}
#tracker-mini-time {
    font-size: 10px;
    color: var(--ochre);
    white-space: nowrap;
    font-weight: bold;
    min-width: 26px;
    text-align: right;
}

/* ── 展开态时间区块 ── */
#time-expand-section {
    padding: 10px 12px 6px;
    text-align: center;
}
#time-expand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2px;
}
#day-display {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 20px;
    color: var(--ink-black);
}
#time-display {
    font-size: 14px;
    color: var(--deep-purple);
}
#time-expand-section #period-bar-wrap {
    margin-top: 6px;
    padding: 0 2px;
}

/* ── 分割线 ── */
#tracker-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(196,163,90,0.4), transparent);
    margin: 2px 10px;
}

/* 颜料槽 */
#pigment-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: linear-gradient(180deg, rgba(210, 202, 190, 0.88) 0%, rgba(185, 178, 165, 0.90) 100%);
    padding: 15px 25px;
    border-radius: 30px;
    border: 3px solid rgba(155, 138, 98, 0.65);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.28);
}

.pigment-slot {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--ochre);
    background: var(--parchment);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pigment-slot:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.pigment-slot .pigment-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: height 0.3s ease;
}

#pigment-red .pigment-fill {
    background: radial-gradient(circle at 30% 30%, #A07070 0%, #7A5050 100%);
}

#pigment-yellow .pigment-fill {
    background: radial-gradient(circle at 30% 30%, #C0A860 0%, #988048 100%);
}

#pigment-blue .pigment-fill {
    background: radial-gradient(circle at 30% 30%, #7090B8 0%, #506080 100%);
}

/* 装备栏 */
#equip-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(180deg, rgba(210,202,190,0.92) 0%, rgba(185,178,165,0.93) 100%);
    border: 2px solid rgba(155,138,98,0.6);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 130px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.equip-label {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 13px;
    color: var(--deep-purple);
    opacity: 0.7;
    margin-bottom: 6px;
    letter-spacing: 3px;
}
.equip-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(26,26,46,0.06);
    border: 1.5px dashed rgba(196,163,90,0.5);
    border-radius: 7px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    min-height: 36px;
}
.equip-slot:hover {
    background: rgba(255,215,0,0.12);
    border-color: var(--ochre);
}
.equip-slot.has-item {
    border-style: solid;
    border-color: var(--ochre);
}
.equip-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    flex-shrink: 0;
    background: transparent;
    transition: background 0.3s ease;
}
.equip-name {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 14px;
    color: var(--ink-black);
    flex: 1;
    text-align: left;
}
.equip-effect {
    margin-top: 6px;
    font-size: 11px;
    color: var(--terracotta);
    line-height: 1.5;
    min-height: 16px;
    text-align: left;
    font-weight: bold;
}

/* UI按钮 */
.ui-btn {
    position: absolute;
    bottom: 20px;
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 16px;
    padding: 12px 25px;
    background: linear-gradient(180deg, rgba(210,202,190,0.92) 0%, rgba(182,174,162,0.92) 100%);
    border: 2px solid rgba(155,138,98,0.6);
    border-radius: 20px;
    color: #2A2830;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ui-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#inventory-btn {
    right: 130px;
}

#craft-btn {
    right: 20px;
}

/* ========== 弹出面板 ========== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 62, 0.8);
    z-index: 100;
}

.parchment-panel {
    background: linear-gradient(180deg, #E2DAC8 0%, #C5BCA8 100%);
    border: 4px solid rgba(150,132,92,0.7);
    border-radius: 15px;
    padding: 30px;
    position: relative;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.parchment-panel h2 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 36px;
    color: var(--ink-black);
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--ochre);
    padding-bottom: 10px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    background: none;
    border: none;
    color: var(--ink-black);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--terracotta);
}

/* 背包格子 */
#inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 20px;
}

.inventory-slot {
    width: 60px;
    height: 60px;
    background: rgba(26, 26, 46, 0.1);
    border: 2px solid var(--ochre);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.inventory-slot:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.05);
}

.inventory-slot .item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.inventory-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 5px;
    font-size: 12px;
    color: var(--ink-black);
    font-weight: bold;
}

/* 合成界面 */
.craft-panel {
    min-width: 680px;
    max-width: 780px;
}

#craft-body {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

/* 左侧材料背包 */
#craft-inventory {
    flex: 0 0 220px;
    border-right: 2px solid rgba(196,163,90,0.3);
    padding-right: 16px;
}
#craft-inventory h3 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 18px;
    color: var(--ochre);
    margin-bottom: 10px;
}
#craft-inv-grid {
    display: grid;
    grid-template-columns: repeat(4, 48px);
    gap: 6px;
}
.craft-inv-item {
    width: 48px;
    height: 48px;
    background: rgba(26,26,46,0.08);
    border: 2px solid rgba(196,163,90,0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: grab;
    position: relative;
    transition: all 0.15s ease;
    user-select: none;
}
.craft-inv-item:hover {
    border-color: var(--gold-accent);
    background: rgba(255,215,0,0.12);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.craft-inv-item:active { cursor: grabbing; }
.craft-inv-item .ci-icon {
    width: 24px; height: 24px;
    border-radius: 50%;
}
.craft-inv-item .ci-count {
    font-size: 10px;
    color: var(--ink-black);
    font-weight: bold;
    position: absolute;
    bottom: 1px; right: 4px;
}
.craft-inv-item .ci-name {
    display: none;
}
.craft-inv-item[data-count="0"] {
    opacity: 0.3;
    pointer-events: none;
}

/* 右侧调色区 */
#palette-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

#craft-slots {
    display: flex;
    gap: 12px;
}

.craft-slot {
    width: 68px;
    height: 68px;
    background: rgba(26, 26, 46, 0.08);
    border: 3px dashed var(--ochre);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.craft-slot.drag-over {
    background: rgba(255, 215, 0, 0.25);
    border-style: solid;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
    transform: scale(1.08);
}
.craft-slot:hover {
    background: rgba(255, 215, 0, 0.12);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}
.craft-slot.filled {
    border-style: solid;
    border-color: var(--gold-accent);
    background: rgba(255, 215, 0, 0.10);
}
.craft-slot .cs-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
}
.craft-slot .cs-count {
    font-size: 11px;
    font-weight: bold;
    color: var(--ink-black);
    margin-top: 2px;
}

/* 预览区 */
#craft-preview {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 18px;
    color: var(--ochre);
}
#craft-preview .cp-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gold-accent);
}
#craft-preview.no-match {
    color: rgba(128,128,128,0.6);
    font-size: 14px;
}

#craft-center {
    margin: 4px 0;
}

#craft-execute {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 22px;
    padding: 12px 36px;
    background: linear-gradient(180deg, var(--ochre) 0%, #A88A4A 100%);
    border: 3px solid var(--gold-accent);
    border-radius: 25px;
    color: var(--parchment);
    cursor: pointer;
    transition: all 0.2s ease;
}
#craft-execute:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.6);
}
#craft-execute:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

#craft-result {
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#recipes-list {
    border-top: 2px solid var(--ochre);
    padding-top: 12px;
    margin-top: 8px;
}

.recipe-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: rgba(26, 26, 46, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
}

.recipe-item:hover {
    background: rgba(255, 215, 0, 0.15);
}

.recipe-item.unavailable {
    opacity: 0.5;
    filter: grayscale(0.5);
}

/* ========== 对话框 ========== */
#dialog-box {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    border: 3px solid var(--ochre);
    border-radius: 10px;
    padding: 20px 30px;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

#dialog-text {
    font-size: 18px;
    color: var(--ink-black);
    line-height: 1.6;
}

/* ========== 游戏结束界面 ========== */
#end-screen {
    background: #0A080E;  /* fallback，实际由 JS canvas 绘制背景 */
    position: absolute;   /* 继承 .screen 的全屏定位 */
    overflow-x: hidden;
    overflow-y: auto;     /* 内容可滚动，防止按钮被推出屏幕 */
}
.end-content {
    width: 100%;
    box-sizing: border-box;
    padding: 20px 16px;
}

@media (hover: none) and (orientation: landscape) {
    #end-title   { font-size: clamp(28px, 6.5vw, 52px); margin-bottom: 8px; }
    #end-message { font-size: 13px; margin: 0 auto 14px; max-width: 85vw; line-height: 1.75; padding: 0 8px; }
    #end-figure-canvas { margin-bottom: 6px !important; }
    .end-content { padding: 6px 16px; }
    #restart-btn { font-size: 15px; padding: 8px 26px; }
}

#end-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.end-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: endContentFadeIn 1.2s ease forwards;
}

@keyframes endContentFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

#end-figure-canvas {
    display: block;
    margin: 0 auto 20px;
}

#end-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 72px;
    color: var(--parchment);
    margin-bottom: 20px;
    text-shadow: 0 0 24px rgba(107,30,138,0.5);
}

#end-message {
    font-size: 18px;
    color: rgba(244, 228, 188, 0.82);
    margin: 0 auto 40px;
    max-width: 600px;
    line-height: 1.8;
    word-break: break-all;
    word-break: auto-phrase;   /* Chrome 119+：按语义短语断行 */
    overflow-wrap: break-word;
    padding: 0 12px;
}

/* ========== 提示信息 ========== */
#tooltip {
    position: absolute;
    background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    border: 2px solid var(--ochre);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    color: var(--ink-black);
    max-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 面板入场动画 */
@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.parchment-panel {
    animation: panelSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 物品获取闪光 */
@keyframes itemNewGlow {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,215,0,0); }
    50%      { box-shadow: inset 0 0 12px 2px rgba(255,215,0,0.6), 0 0 8px rgba(255,215,0,0.4); }
}
.inventory-slot.item-new {
    animation: itemNewGlow 0.6s ease-out 2;
}

/* 对话框弹出动画 */
@keyframes dialogPop {
    from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.92); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
#dialog-box:not(.hidden) {
    animation: dialogPop 0.25s ease-out forwards;
}

/* 数值浮动文字 */
@keyframes statFloatUp {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-24px); }
}
.stat-float {
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 15px;
    font-weight: bold;
    animation: statFloatUp 1.2s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.stat-float.positive { color: #7A9F5A; }
.stat-float.negative { color: #C2452D; }

/* 颜料消耗波动 */
@keyframes pigmentDrain {
    0%   { transform: scaleY(1); }
    30%  { transform: scaleY(0.95); }
    60%  { transform: scaleY(1.02); }
    100% { transform: scaleY(1); }
}
.pigment-fill.draining {
    animation: pigmentDrain 0.4s ease-out;
}

/* 受伤屏幕闪红 */
#damage-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(194,69,45,0.45) 100%);
    opacity: 0;
    transition: opacity 0.1s ease;
}
#damage-vignette.flash {
    opacity: 1;
}

/* 合成成功闪光 */
@keyframes craftSuccessFlash {
    0%   { box-shadow: 0 0 0 0 rgba(255,215,0,0.8); }
    50%  { box-shadow: 0 0 30px 10px rgba(255,215,0,0.5); }
    100% { box-shadow: 0 0 0 0 rgba(255,215,0,0); }
}
#craft-result.success {
    animation: craftSuccessFlash 0.6s ease-out;
}

/* 古钟碎片收集特效 */
@keyframes clockPieceCollect {
    0%   { transform: scale(1) rotate(0deg); opacity: 1; }
    50%  { transform: scale(1.3) rotate(180deg); opacity: 0.8; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes waterRipple {
    0% {
        box-shadow: 0 0 0 0 rgba(106, 159, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(106, 159, 255, 0);
    }
}

/* 低数值警告动画 */
.stat-item.warning .stat-fill {
    animation: pulse 1s ease-in-out infinite;
}

.stat-item.critical {
    animation: shake 0.5s ease-in-out infinite;
}

/* 水渍扭曲效果覆盖层 */
#distortion-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(106, 159, 255, 0.2) 100%);
    transition: opacity 0.5s ease;
}

/* 收集资源时的涟漪效果 */
.collect-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: rippleExpand 0.8s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* ========== 玩法说明面板 ========== */
.guide-toggle {
    margin-top: 10px;
    font-size: 0.9em;
    padding: 8px 28px;
    opacity: 0.85;
}
.guide-toggle:hover { opacity: 1; }

.guide-panel {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 46, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.guide-panel.hidden { display: none; }

.guide-scroll {
    width: min(680px, 90vw);
    max-height: 85vh;
    overflow-y: auto;
    background:
        linear-gradient(135deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    border: 3px solid var(--ochre);
    border-radius: 12px;
    padding: 32px 36px 28px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), inset 0 0 60px rgba(139,115,85,0.15);
    color: var(--ink-black);
    line-height: 1.75;
    scrollbar-width: thin;
    scrollbar-color: var(--ochre) transparent;
}
.guide-scroll::-webkit-scrollbar { width: 6px; }
.guide-scroll::-webkit-scrollbar-thumb {
    background: var(--ochre);
    border-radius: 3px;
}

.guide-heading {
    text-align: center;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.6em;
    color: var(--deep-purple);
    margin-bottom: 18px;
    letter-spacing: 4px;
}

.guide-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px dashed rgba(139,115,85,0.35);
}
.guide-section:last-of-type { border-bottom: none; }

.guide-section h3 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.15em;
    color: var(--terracotta);
    margin-bottom: 8px;
}

.guide-section p,
.guide-section li {
    font-size: 0.92em;
    color: #3A2A1A;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 0.9em;
}
.guide-table td,
.guide-table th {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(139,115,85,0.2);
    text-align: left;
}
.guide-table tr td:first-child {
    font-weight: bold;
    color: var(--deep-purple);
    white-space: nowrap;
    width: 40%;
}
.recipe-table th {
    background: rgba(45,27,78,0.1);
    font-weight: bold;
    color: var(--deep-purple);
    font-size: 0.95em;
}
.recipe-table td:first-child { color: var(--terracotta); }

.stat-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    box-shadow: 0 0 4px currentColor;
}

.guide-stat,
.guide-creature {
    font-size: 0.92em;
    margin: 5px 0;
    padding-left: 4px;
}

.guide-steps {
    padding-left: 22px;
    margin: 8px 0;
}
.guide-steps li {
    margin-bottom: 6px;
}

.guide-tips {
    padding-left: 20px;
    margin: 8px 0;
}
.guide-tips li {
    margin-bottom: 5px;
    list-style: disc;
}

.guide-warn {
    margin-top: 10px;
    color: var(--terracotta);
    font-weight: bold;
    text-align: center;
    font-size: 0.95em;
}

#guide-close-btn {
    display: block;
    margin: 18px auto 0;
    font-size: 0.95em;
    border: 2px solid var(--ochre);
    background: rgba(196,163,90,0.15);
    padding: 10px 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}
#guide-close-btn:hover {
    background: rgba(196,163,90,0.3);
}

/* ========== 合并面板：时间 + 任务 ========== */
#quest-tracker {
    position: fixed;
    right: 16px;
    top: 20px;
    width: 200px;
    background: linear-gradient(160deg, rgba(244,228,188,0.92) 0%, rgba(212,196,160,0.88) 100%);
    border: 2px solid rgba(196,163,90,0.55);
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13), inset 0 0 20px rgba(139,115,85,0.1);
    z-index: 50;
    font-size: 13px;
    color: var(--ink-black);
    overflow: hidden;
    cursor: default;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, width 0.3s ease;
}
#quest-tracker:hover {
    border-color: var(--ochre);
    box-shadow: 0 4px 18px rgba(0,0,0,0.28), inset 0 0 20px rgba(139,115,85,0.1);
    width: 240px;
}

/* 任务 mini 进度条 */
#quest-mini-bar {
    flex: 1;
    height: 5px;
    background: rgba(26,26,46,0.12);
    border-radius: 3px;
    border: 1px solid rgba(139,115,85,0.3);
    overflow: hidden;
}
#quest-mini-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--ochre), var(--gold-accent));
    border-radius: 3px;
    transition: width 0.6s ease;
}
#quest-mini-pct {
    font-size: 10px;
    color: var(--ochre);
    white-space: nowrap;
    font-weight: bold;
    min-width: 26px;
    text-align: right;
}

/* 展开内容 */
#quest-expand {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.42s ease, opacity 0.3s ease;
}
#quest-tracker:hover #tracker-mini {
    opacity: 0;
    max-height: 0;
    pointer-events: none;
}
#quest-tracker:hover #quest-expand {
    max-height: 700px;
    opacity: 1;
}

#quest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(45,27,78,0.12);
    user-select: none;
}
#quest-chapter {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.1em;
    color: var(--deep-purple);
    letter-spacing: 2px;
}

/* 总进度条 */
#quest-progress-bar {
    position: relative;
    height: 16px;
    background: rgba(26,26,46,0.12);
    margin: 0 10px 6px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(139,115,85,0.3);
    max-height: 30px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease;
}
#quest-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--ochre), var(--gold-accent));
    border-radius: 8px;
    transition: width 0.6s ease;
}
#quest-progress-text {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: var(--deep-purple);
    text-shadow: 0 0 3px rgba(244,228,188,0.8);
}

/* 任务主体 */
#quest-body {
    padding: 4px 12px 10px;
    overflow: hidden;
    max-height: 400px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease;
}
#quest-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.05em;
    color: var(--terracotta);
    margin-bottom: 4px;
}
#quest-objective {
    font-size: 0.92em;
    color: #3A2A1A;
    line-height: 1.5;
    margin-bottom: 4px;
    font-weight: bold;
}
#quest-hint {
    font-size: 0.82em;
    color: #7A6A5A;
    line-height: 1.4;
    margin-bottom: 8px;
    font-style: italic;
}

/* 步骤列表 */
#quest-steps {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.quest-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #5A4A3A;
    transition: all 0.3s;
}
.quest-step.active {
    background: rgba(196,163,90,0.18);
    color: var(--deep-purple);
    font-weight: bold;
}
.quest-step.completed {
    color: #8A8A8A;
    text-decoration: line-through;
    opacity: 0.6;
}
.quest-step.completed .step-check {
    color: var(--olive-green);
}
.step-check {
    font-size: 1em;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.step-count {
    font-size: 0.85em;
    color: var(--ochre);
    margin-left: auto;
}

/* 方向指引箭头 */
#quest-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 8px;
    border-top: 1px dashed rgba(139,115,85,0.3);
    font-size: 0.85em;
    color: var(--ochre);
}
#quest-arrow.hidden { display: none; }

#quest-arrow-icon {
    font-size: 1.3em;
    animation: arrowPulse 1.5s ease-in-out infinite;
    display: inline-block;
}
#quest-arrow-label {
    color: #5A4A3A;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 新任务完成闪光 */
.quest-step-flash {
    animation: stepFlash 0.8s ease-out;
}
@keyframes stepFlash {
    0% { background: rgba(255,215,0,0.5); }
    100% { background: transparent; }
}

/* ══════════════════════════════════════
   引言叙事遮罩
══════════════════════════════════════ */
.narration-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #060310;
    overflow: hidden;
}
.narration-overlay.hidden { display: none; }

/* 开始引言 —— 极深紫黑 */
.narration-opening {
    background: radial-gradient(ellipse at 50% 40%, #10082A 0%, #050210 70%);
}
/* 死亡引言 —— 带血色的暗调 */
.narration-death {
    background: radial-gradient(ellipse at 50% 60%, #150608 0%, #05020A 70%);
}

/* 角落装饰线 */
.narration-deco {
    position: absolute;
    width: 120px;
    height: 120px;
    opacity: 0.25;
    pointer-events: none;
}
.narration-deco-tl {
    top: 32px; left: 32px;
    border-top: 1px solid #B8860B;
    border-left: 1px solid #B8860B;
}
.narration-deco-br {
    bottom: 32px; right: 32px;
    border-bottom: 1px solid #B8860B;
    border-right: 1px solid #B8860B;
}

/* 文字区域 —— 普通（死亡叙事） */
.narration-text {
    width: 88vw;
    max-height: 86vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    padding: 0 4vw;
    display: flex;
    flex-direction: column;
    gap: 1.8em;
}
.narration-text::-webkit-scrollbar { display: none; }

.narration-para {
    font-family: 'Ma Shan Zheng', 'STKaiti', cursive;
    font-size: clamp(1.8rem, 3.6vw, 2.4rem);
    line-height: 2.2;
    color: #D8CFC4;
    text-align: justify;
    text-shadow: 0 0 36px rgba(180,140,100,0.25);
    margin: 0;
    letter-spacing: 0.1em;
    transition: opacity 0.6s ease;
}

/* 死亡引言段落色调偏冷灰 */
.narration-death .narration-para {
    color: #B8B0B0;
    text-shadow: 0 0 20px rgba(120,60,60,0.2);
}

/* ══ 开场序言：拼贴剪报滚动模式 ══ */
/* 外层裁剪容器 */
#collage-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 滚动内容容器——从屏幕底部向上滚 */
#collage-scroll {
    position: absolute;
    left: 8%;
    width: 84%;
    /* top 由 JS 控制 */
}

/* 段落块 */
.collage-para {
    display: block;
    margin-bottom: 2.6em;
    line-height: 1.9;
    word-break: break-all;
}

/* 手机横屏：优化段落间距，确保可读性 */
@media (hover: none) and (orientation: landscape) {
    .collage-para { margin-bottom: 1.2em; }
    #collage-scroll { padding-bottom: 12vh; }
}
/* 手机竖屏 */
@media (hover: none) and (orientation: portrait) {
    .collage-para { margin-bottom: 1.4em; }
    #collage-scroll { padding-bottom: 15vh; }
}

/* 每个字符的剪报片段——inline-block 流式排布 */
.collage-char {
    display: inline-block;
    position: relative;
    opacity: 0;
    transform-origin: center bottom;
    user-select: none;
    pointer-events: none;
}

/* 落入关键帧（适配 inline-block：用 --char-transform 叠加 translateY） */
@keyframes collageDrop {
    0%   { opacity: 0; transform: var(--char-transform) translateY(-28px) scale(1.15); filter: blur(2px); }
    50%  { opacity: 0.85; transform: var(--char-transform) translateY(4px) scale(0.98); filter: blur(0); }
    75%  { opacity: 1; transform: var(--char-transform) translateY(-2px) scale(1.01); }
    100% { opacity: 1; transform: var(--char-transform); }
}
/* 沙粒被风吹散消失（延长动画，更有“墨水晕开”感） */
@keyframes collageSandBlow {
    0%   { opacity: 1;
           transform: var(--char-transform) translateX(0px) translateY(0px) rotate(0deg) scale(1);
           filter: grayscale(1) brightness(0.5); }
    15%  { opacity: 0.88;
           transform: var(--char-transform) translateX(2px) translateY(-5px) rotate(calc(var(--blow-rot) * 0.08)) scale(0.95);
           filter: grayscale(1) brightness(0.45) blur(1px); }
    60%  { opacity: 0.3;
           transform: var(--char-transform) translateX(calc(var(--blow-x) * 0.5)) translateY(calc(var(--blow-y) * 0.4)) rotate(calc(var(--blow-rot) * 0.5)) scale(0.4);
           filter: grayscale(1) brightness(0.2) blur(3px); }
    100% { opacity: 0;
           transform: var(--char-transform) translateX(var(--blow-x)) translateY(var(--blow-y)) rotate(var(--blow-rot)) scale(0.02);
           filter: grayscale(1) brightness(0) blur(8px); }
}
.collage-char.dropping {
    animation: collageDrop 0.48s cubic-bezier(0.22,1,0.36,1) forwards;
}
.collage-char.sandblowing {
    animation: collageSandBlow 0.65s cubic-bezier(0.25, 0, 0.6, 1) forwards;
}

/* "按任意键继续" 提示 - 增强动画效果 */
.narration-prompt {
    margin-top: 3em;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2.85rem;
    color: #B8860B;
    letter-spacing: 0.3em;
    opacity: 0;
    pointer-events: all;
    cursor: pointer;
    text-shadow: 0 0 20px rgba(184,134,11,0.3);
    animation: narrationPulse 2.4s ease-in-out infinite;
}
.narration-prompt.hidden { display: none; }

@keyframes narrationPulse {
    0%, 100% { opacity: 0.45; transform: scale(1); text-shadow: 0 0 15px rgba(184,134,11,0.2); }
    50%      { opacity: 1; transform: scale(1.02); text-shadow: 0 0 25px rgba(184,134,11,0.5); }
}

/* 跳过按钮 */
.narration-skip {
    position: absolute;
    bottom: 28px;
    right: 36px;
    background: transparent;
    border: 1px solid rgba(184,134,11,0.35);
    color: rgba(184,134,11,0.55);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 0.82rem;
    padding: 4px 14px;
    cursor: pointer;
    letter-spacing: 0.15em;
    transition: color 0.2s, border-color 0.2s;
}
.narration-skip:hover {
    color: #B8860B;
    border-color: #B8860B;
}
/* 手机端跳过按钮移至顶部安全区域 */
@media (hover: none) {
    .narration-skip {
        bottom: auto;
        top: max(env(safe-area-inset-top, 16px), 16px);
        right: max(env(safe-area-inset-right, 16px), 16px);
        font-size: 0.9rem;
        padding: 6px 16px;
    }
}

/* IntroAnimation跳过按钮 */
#intro-skip-btn {
    position: fixed;
    bottom: 28px;
    right: 36px;
    background: transparent;
    border: 1px solid rgba(244,228,188,0.35);
    color: rgba(244,228,188,0.55);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 0.9rem;
    padding: 6px 18px;
    cursor: pointer;
    letter-spacing: 0.15em;
    z-index: 1001;
    transition: color 0.2s, border-color 0.2s, opacity 0.3s;
}
#intro-skip-btn:hover {
    color: rgba(244,228,188,0.9);
    border-color: rgba(244,228,188,0.7);
}
@media (hover: none) {
    #intro-skip-btn {
        bottom: auto;
        top: max(env(safe-area-inset-top, 16px), 16px);
        right: max(env(safe-area-inset-right, 16px), 16px);
    }
}

/* ══════════════════════════════════════
   进入世界互动动画层
══════════════════════════════════════ */
#intro-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: #000;
    cursor: pointer;
}
#intro-canvas.hidden { display: none; }


/* ══════════════════════════════════════
   外挂系统
══════════════════════════════════════ */

/* 隐蔽触发点 */
#cheat-trigger {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    z-index: 9999;
    cursor: default;
    opacity: 0;
    pointer-events: all;
}

/* 密码弹窗遮罩 */
#cheat-pwd-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 3, 14, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
#cheat-pwd-overlay.hidden { display: none; }

#cheat-pwd-box {
    background: linear-gradient(145deg, #1a1030, #0e0820);
    border: 1px solid rgba(196,163,90,0.35);
    border-radius: 10px;
    padding: 28px 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    min-width: 220px;
}

#cheat-pwd-title {
    font-size: 22px;
    opacity: 0.5;
    letter-spacing: 4px;
    color: rgba(196,163,90,0.6);
}

#cheat-pwd-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(196,163,90,0.3);
    border-radius: 6px;
    color: rgba(244,228,188,0.9);
    font-size: 18px;
    letter-spacing: 6px;
    text-align: center;
    padding: 8px 14px;
    outline: none;
    width: 140px;
    transition: border-color 0.2s;
}
#cheat-pwd-input:focus {
    border-color: rgba(196,163,90,0.7);
}

#cheat-pwd-err {
    font-size: 12px;
    color: #C2452D;
    min-height: 16px;
    letter-spacing: 1px;
}

#cheat-pwd-btns {
    display: flex;
    gap: 10px;
}
#cheat-pwd-btns button {
    padding: 6px 18px;
    border-radius: 5px;
    border: 1px solid rgba(196,163,90,0.35);
    background: transparent;
    color: rgba(244,228,188,0.75);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 1px;
}
#cheat-pwd-btns button:hover {
    background: rgba(196,163,90,0.15);
    color: rgba(244,228,188,1);
}

/* 外挂控制面板 */
#cheat-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9998;
    background: linear-gradient(145deg, rgba(18,10,35,0.96), rgba(10,6,22,0.97));
    border: 1px solid rgba(196,163,90,0.28);
    border-radius: 10px;
    padding: 0;
    min-width: 210px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
    user-select: none;
    backdrop-filter: blur(6px);
}
#cheat-panel.hidden { display: none; }

#cheat-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px 8px;
    border-bottom: 1px solid rgba(196,163,90,0.18);
    font-size: 12px;
    color: rgba(196,163,90,0.65);
    letter-spacing: 2px;
}
#cheat-panel-close {
    background: none;
    border: none;
    color: rgba(196,163,90,0.45);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}
#cheat-panel-close:hover { color: rgba(196,163,90,1); }

.cheat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    gap: 10px;
}
.cheat-row:last-child { border-bottom: none; }

.cheat-label {
    font-size: 12px;
    color: rgba(220,210,190,0.75);
    letter-spacing: 1px;
    white-space: nowrap;
}

/* 开关 */
.cheat-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}
.cheat-toggle input { opacity: 0; width: 0; height: 0; }
.cheat-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid rgba(196,163,90,0.25);
}
.cheat-slider::before {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    left: 3px; top: 2px;
    background: rgba(196,163,90,0.5);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.cheat-toggle input:checked + .cheat-slider {
    background: rgba(196,163,90,0.22);
    border-color: rgba(196,163,90,0.6);
}
.cheat-toggle input:checked + .cheat-slider::before {
    transform: translateX(18px);
    background: #C4A35A;
}

/* 倍速按钮组 */
#cheat-speed-btns {
    display: flex;
    gap: 4px;
}
.cheat-speed-btn {
    padding: 3px 7px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid rgba(196,163,90,0.25);
    background: transparent;
    color: rgba(220,210,190,0.55);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.5px;
}
.cheat-speed-btn:hover {
    background: rgba(196,163,90,0.12);
    color: rgba(220,210,190,0.9);
}
.cheat-speed-btn.active {
    background: rgba(196,163,90,0.2);
    border-color: rgba(196,163,90,0.6);
    color: #C4A35A;
}

/* 功能按钮 */
.cheat-action-btn {
    padding: 3px 12px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid rgba(196,163,90,0.25);
    background: transparent;
    color: rgba(220,210,190,0.6);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 1px;
}
.cheat-action-btn:hover {
    background: rgba(196,163,90,0.15);
    color: rgba(244,228,188,1);
}

/* ── 竖屏提示 ──────────────────────────────── */
#portrait-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #080512;
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(225, 195, 100, 0.9);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 20px;
    text-align: center;
    line-height: 2.4;
    gap: 0;
}
@media (hover: none) and (orientation: portrait) {
    #portrait-overlay { display: flex; }
}
.portrait-phone {
    width: 44px;
    height: 72px;
    border: 3px solid rgba(225, 195, 100, 0.75);
    border-radius: 10px;
    margin-bottom: 18px;
    position: relative;
    animation: phoneTilt 2s ease-in-out infinite;
}
.portrait-phone::after {
    content: '';
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 3px;
    background: rgba(225, 195, 100, 0.75);
    border-radius: 2px;
}
@keyframes phoneTilt {
    0%, 35%  { transform: rotate(0deg); }
    65%, 100% { transform: rotate(90deg); }
}

/* ── 手机横屏通用适配（max-height 保证只影响手机） ── */
@media (hover: none) and (orientation: landscape) {
    .enter-hint { font-size: 30px; }

    .game-title    { font-size: clamp(38px, 9vw, 80px); letter-spacing: 8px; margin-bottom: 4px; }
    .game-subtitle { font-size: clamp(20px, 4.5vw, 40px); letter-spacing: 10px; }
    .title-container { margin-bottom: 14px; }
    .tagline       { font-size: 13px; margin-top: 8px; letter-spacing: 2px; }
    .parchment-btn { font-size: 16px; padding: 10px 28px; }
    .credits       { bottom: 6px; font-size: 10px; }
    .lore-figure   { width: 130px; height: 82px; margin: -6px auto 6px; }

    /* ── 状态栏极度紧凑 ── */
    #stats-panel   { gap: 3px; top: 4px; left: 6px; }
    .stat-item     { padding: 3px 8px; gap: 5px; min-width: auto; border-radius: 14px; border-width: 1.5px; }
    .stat-icon     { width: 16px; height: 16px; }
    .stat-bar      { width: 54px; height: 5px; border-radius: 3px; }
    .stat-label    { font-size: 9px; min-width: 22px; }

    /* ── 任务面板缩小 ── */
    #quest-tracker { width: 130px; top: 4px; right: 6px; padding: 4px 7px; font-size: 10px; border-radius: 7px; }
    #quest-tracker:hover { width: 180px; }
    .tracker-mini-label { font-size: 8px; width: 18px; }
    #tracker-mini-time  { font-size: 8px; min-width: 18px; }
    #quest-mini-pct     { font-size: 8px; min-width: 18px; }
    #tracker-mini       { gap: 3px; }

    /* ── 颜料槽移到右侧中部，避免遮挡玩家和操作按钮 ── */
    #pigment-panel { left: auto; right: 58px; bottom: auto; top: 42%; transform: translateY(-50%); flex-direction: column; padding: 8px 6px; gap: 6px; border-width: 2px; border-radius: 18px; z-index: 50; }
    .pigment-slot  { width: 26px; height: 26px; border-width: 2px; }

    /* ── 任务面板触摸展开支持 ── */
    #quest-tracker.expanded #tracker-mini { opacity: 0; max-height: 0; pointer-events: none; }
    #quest-tracker.expanded #quest-expand { max-height: 700px; opacity: 1; }

    /* ── 装备栏移到左侧状态栏下方 ── */
    #equip-panel   { bottom: auto; top: 70px; left: 6px; padding: 4px 8px; min-width: auto; border-radius: 7px; }
    .equip-label   { font-size: 9px; margin-bottom: 2px; letter-spacing: 1px; }
    .equip-slot    { padding: 3px 6px; min-height: 22px; gap: 4px; }
    .equip-icon    { width: 16px; height: 16px; }
    .equip-name    { font-size: 10px; }
    .equip-effect  { font-size: 8px; margin-top: 2px; min-height: 10px; }

    /* ── 隐藏桌面端UI按钮（手机有操作杆上的包/调按钮，避免重复） ── */
    .ui-btn        { display: none !important; }

    /* ── 对话框上移避开操作区 ── */
    #dialog-box    { bottom: auto; top: 6px; left: 50%; padding: 6px 14px; max-width: 52vw; border-width: 2px; border-radius: 8px; }
    #dialog-text   { font-size: 12px; line-height: 1.5; }

    /* ── 弹出面板适配 ── */
    .parchment-panel { min-width: auto; max-width: 90vw; padding: 14px 16px; max-height: min(85vh, calc(100vh - 20px)); overflow-y: auto; scrollbar-width: thin; }
    #recipes-list { max-height: 28vh; overflow-y: auto; scrollbar-width: thin; }
    .parchment-panel h2 { font-size: 22px; margin-bottom: 10px; padding-bottom: 6px; }
    #inventory-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px; }
    .inventory-slot { width: 42px; height: 42px; }
    .inventory-slot .item-icon { width: 28px; height: 28px; }

    .craft-panel   { min-width: auto; max-width: 92vw; }
    #craft-body    { flex-direction: column; gap: 8px; }
    #craft-inventory { flex: none; border-right: none; border-bottom: 1px solid rgba(196,163,90,0.3); padding-right: 0; padding-bottom: 8px; }
    #craft-inv-grid { grid-template-columns: repeat(6, 38px); gap: 4px; }
    .craft-inv-item { width: 38px; height: 38px; }
}

/* ── 手机虚拟操作杆 ────────────────────────── */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 12px 10px;
    pointer-events: none;
    z-index: 600;
    user-select: none;
    -webkit-user-select: none;
}
#mobile-controls.hidden { display: none !important; }

/* ── 超小屏幕适配（高度<380px） ── */
@media (hover: none) and (orientation: landscape) and (max-height: 380px) {
    #pigment-panel { top: 35%; }
    .pigment-slot  { width: 22px; height: 22px; }
}

@media (hover: hover) and (pointer: fine) {
    #mobile-controls { display: none !important; }
}

#joystick-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: all;
}

#joystick-base {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(18, 12, 6, 0.52);
    border: 2px solid rgba(180, 140, 55, 0.45);
    box-shadow: 0 0 16px rgba(0,0,0,0.4) inset;
    position: relative;
    touch-action: none;
    flex-shrink: 0;
}

#joystick-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, rgba(230,185,75,0.9), rgba(130,95,28,0.75));
    border: 2px solid rgba(210,165,55,0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    will-change: transform;
}

#mobile-action-btns {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: all;
}

.mobile-btn-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-action-btn {
    border-radius: 50%;
    background: rgba(18, 12, 6, 0.52);
    border: 2px solid rgba(180, 140, 55, 0.45);
    color: rgba(225, 195, 100, 0.95);
    font-family: 'Ma Shan Zheng', cursive, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
    transition: background 0.08s, transform 0.08s, box-shadow 0.08s;
    width: 50px;
    height: 50px;
    font-size: 13px;
}
.mobile-action-btn.mobile-btn-sm {
    width: 38px;
    height: 38px;
    font-size: 11px;
}
.mobile-action-btn.mb-active,
.mobile-action-btn:active {
    background: rgba(170, 130, 35, 0.55);
    transform: scale(0.9);
    box-shadow: 0 0 12px rgba(200,160,50,0.45);
}

/* 墨水晕染装饰（纯 CSS 背景图案） */
#narration-ink {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 300px 200px at 15% 80%, rgba(80,20,100,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 200px 300px at 85% 20%, rgba(100,40,10,0.08) 0%, transparent 70%);
}

/* ══════════════════════════════════════
   暂停菜单
══════════════════════════════════════ */
#pause-menu {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 8, 20, 0.85);
    backdrop-filter: blur(4px);
}
.pause-panel {
    background: linear-gradient(145deg, rgba(35,30,45,0.95), rgba(20,18,28,0.98));
    border: 1px solid rgba(184,134,11,0.3);
    border-radius: 8px;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: 0 0 40px rgba(0,0,0,0.6), inset 0 0 30px rgba(184,134,11,0.05);
}
.pause-panel h2 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2rem;
    color: #B8A878;
    margin-bottom: 1.5rem;
    letter-spacing: 0.2em;
}
.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.pause-btn {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.1rem;
    padding: 0.7rem 2rem;
    background: rgba(40,35,50,0.8);
    border: 1px solid rgba(184,134,11,0.35);
    color: #C8B888;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.1em;
}
.pause-btn:hover {
    background: rgba(60,50,70,0.9);
    border-color: rgba(184,134,11,0.6);
    color: #E8D8A8;
    transform: translateY(-1px);
}
.pause-btn-danger {
    color: #A87070;
    border-color: rgba(168,112,112,0.35);
}
.pause-btn-danger:hover {
    color: #C89090;
    border-color: rgba(168,112,112,0.6);
}

/* ══════════════════════════════════════
   设置面板
══════════════════════════════════════ */
#settings-panel {
    position: fixed;
    inset: 0;
    z-index: 510;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 8, 20, 0.9);
}
.settings-box {
    background: linear-gradient(145deg, rgba(35,30,45,0.95), rgba(20,18,28,0.98));
    border: 1px solid rgba(184,134,11,0.3);
    border-radius: 8px;
    padding: 2rem 2.5rem;
    min-width: 320px;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
.settings-box h2 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.8rem;
    color: #B8A878;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 0.2em;
}
.settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.settings-label {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1rem;
    color: #A89878;
    min-width: 60px;
}
.settings-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(60,50,70,0.6);
    border-radius: 3px;
    outline: none;
}
.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C8A860, #8A6830);
    border: 2px solid rgba(184,134,11,0.6);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.settings-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C8A860, #8A6830);
    border: 2px solid rgba(184,134,11,0.6);
    cursor: pointer;
}
.settings-value {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 0.9rem;
    color: #888;
    min-width: 40px;
    text-align: right;
}
.settings-box .pause-btn {
    width: 100%;
    margin-top: 1rem;
}

/* ══════════════════════════════════════
   攻击范围指示器
══════════════════════════════════════ */
.attack-range-indicator {
    position: absolute;
    pointer-events: none;
    border: 2px dashed rgba(200, 80, 80, 0.4);
    border-radius: 50%;
    animation: attackRangePulse 0.8s ease-out forwards;
}
@keyframes attackRangePulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0; }
}

/* ══════════════════════════════════════
   序日教程系统
══════════════════════════════════════ */
.tutorial-chapter-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(10, 8, 15, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: tutorialFadeIn 1s ease-out;
}
.tutorial-chapter-overlay.fade-out {
    animation: tutorialFadeOut 1s ease-out forwards;
}
.tutorial-chapter-text {
    text-align: center;
    color: #B8A878;
    font-family: 'Ma Shan Zheng', cursive;
}
.tutorial-chapter-text .chapter-label {
    display: block;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}
.tutorial-chapter-text .chapter-title {
    display: block;
    font-size: 2.5rem;
    letter-spacing: 0.2em;
    animation: tutorialTextGlow 2s ease-in-out infinite;
}
@keyframes tutorialFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes tutorialFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes tutorialTextGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(184, 168, 120, 0.3); }
    50% { text-shadow: 0 0 20px rgba(184, 168, 120, 0.6); }
}

.tutorial-narration {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.4rem;
    color: #C8B888;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 550;
    text-align: center;
    max-width: 80%;
}
.tutorial-narration.show {
    opacity: 1;
}
.tutorial-narration.hidden {
    opacity: 0;
}

.tutorial-objective {
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 18, 25, 0.45);
    border: 1px solid rgba(184, 134, 11, 0.4);
    border-radius: 8px;
    padding: 1rem 2rem;
    z-index: 540;
    text-align: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tutorial-objective.hidden {
    display: none;
}
.objective-text {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.3rem;
    color: #F0E4C0;
    margin-bottom: 0.3rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.objective-hint {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.0rem;
    color: #C8B070;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    letter-spacing: 0.05em;
}

.tutorial-key-hint {
    position: fixed;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(184, 134, 11, 0.2);
    border: 2px solid rgba(184, 134, 11, 0.6);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-family: monospace;
    font-size: 1.2rem;
    color: #E8D8A8;
    animation: keyHintPulse 1.5s ease-in-out infinite;
    z-index: 545;
}
@keyframes keyHintPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(184, 134, 11, 0.3); }
    50% { box-shadow: 0 0 20px rgba(184, 134, 11, 0.6); }
}

.tutorial-highlight {
    animation: tutorialHighlight 1.5s ease-in-out infinite !important;
    box-shadow: 0 0 15px rgba(200, 168, 96, 0.6) !important;
}
@keyframes tutorialHighlight {
    0%, 100% { box-shadow: 0 0 10px rgba(200, 168, 96, 0.4); }
    50% { box-shadow: 0 0 25px rgba(200, 168, 96, 0.8); }
}

/* 过渡动画 */
.tutorial-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    background: rgba(15, 12, 20, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 1s ease;
}
.tutorial-transition-overlay.cracking {
    background: rgba(15, 12, 20, 0.3);
}
.tutorial-transition-overlay.cracking .transition-cracks {
    opacity: 1;
}
.transition-cracks {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: 
        linear-gradient(45deg, transparent 48%, rgba(60, 50, 70, 0.5) 49%, rgba(60, 50, 70, 0.5) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(60, 50, 70, 0.5) 49%, rgba(60, 50, 70, 0.5) 51%, transparent 52%);
    background-size: 60px 60px;
    animation: cracksSpread 2s ease-out forwards;
}
@keyframes cracksSpread {
    from { background-size: 200px 200px; opacity: 0; }
    to { background-size: 30px 30px; opacity: 1; }
}
.tutorial-transition-overlay.fading {
    background: rgba(15, 12, 20, 0.85);
}
.tutorial-transition-overlay.fading .transition-cracks {
    filter: grayscale(1);
}
.tutorial-transition-overlay.falling {
    background: rgba(5, 3, 8, 0.98);
}
.transition-text {
    text-align: center;
    z-index: 1;
}
.fall-text {
    display: block;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.5rem;
    color: #A89878;
    opacity: 0;
    animation: fallTextIn 1.5s ease-out 2.5s forwards;
}
.fall-text.delay {
    animation-delay: 3.5s;
}
@keyframes fallTextIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.tutorial-transition-overlay.day-reveal {
    background: rgba(5, 3, 8, 1);
}
.chapter-reveal {
    text-align: center;
}
.day-label {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 3rem;
    color: #C8A860;
    letter-spacing: 0.3em;
    animation: dayReveal 1.5s ease-out forwards;
}
@keyframes dayReveal {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════════════
   成就系统
══════════════════════════════════════ */
.achievement-popup {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, rgba(40, 35, 50, 0.95), rgba(25, 22, 32, 0.98));
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 560;
    opacity: 0;
    transition: all 0.5s ease;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}
.achievement-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.achievement-popup.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
}
.achievement-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}
.achievement-content {
    text-align: left;
}
.achievement-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.2rem;
    color: #FFD700;
    margin-bottom: 0.2rem;
}
.achievement-desc {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 0.9rem;
    color: #A89878;
}

/* 连击文字 */
.streak-text {
    position: fixed;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.8rem;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    z-index: 555;
    opacity: 0;
    transform: translateY(0) scale(0.8);
    transition: all 0.3s ease;
}
.streak-text.show {
    opacity: 1;
    transform: translateY(-20px) scale(1);
}
.streak-text.fade {
    opacity: 0;
    transform: translateY(-40px) scale(1.1);
}

/* 幸运闪烁 */
.lucky-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 550;
    opacity: 0;
    box-shadow: inset 0 0 100px rgba(255, 215, 0, 0.3);
    transition: opacity 0.3s ease;
}
.lucky-flash.show {
    opacity: 1;
    animation: luckyFlash 0.6s ease-out forwards;
}
@keyframes luckyFlash {
    0% { box-shadow: inset 0 0 100px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: inset 0 0 50px rgba(255, 215, 0, 0); opacity: 0; }
}

/* ══════════════════════════════════════
   进度可视化 - 钟面进度环
══════════════════════════════════════ */
#clock-progress {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 60px;
    height: 60px;
    z-index: 100;
    pointer-events: none;
}
.clock-ring {
    fill: none;
    stroke: rgba(100, 90, 80, 0.3);
    stroke-width: 3;
}
.clock-progress-ring {
    fill: none;
    stroke: #C8A860;
    stroke-width: 3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.5s ease;
}
.clock-piece {
    fill: rgba(80, 70, 60, 0.5);
    transition: fill 0.5s ease;
}
.clock-piece.found {
    fill: #C8A860;
    filter: drop-shadow(0 0 3px rgba(200, 168, 96, 0.6));
}
.clock-center {
    fill: rgba(60, 50, 45, 0.8);
}

/* 三日进度条 */
#day-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 99;
    display: flex;
    background: rgba(30, 25, 35, 0.8);
}
.day-segment {
    flex: 1;
    height: 100%;
    background: rgba(80, 70, 90, 0.3);
    border-right: 1px solid rgba(60, 50, 70, 0.5);
    position: relative;
    overflow: hidden;
}
.day-segment:last-child {
    border-right: none;
}
.day-segment .day-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8A7050, #C8A860);
    transition: width 0.3s ease;
}
.day-segment.current .day-fill {
    background: linear-gradient(90deg, #C8A860, #E8D8A8);
}
.day-segment.completed .day-fill {
    width: 100%;
    background: rgba(100, 90, 70, 0.6);
}

/* ══════════════════════════════════════
   移动端/横屏适配 - 教程系统
══════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    .tutorial-chapter-overlay {
        padding: 10px;
    }
    .tutorial-chapter-text .chapter-label {
        font-size: 1rem;
    }
    .tutorial-chapter-text .chapter-title {
        font-size: 1.8rem;
    }
    .tutorial-narration {
        bottom: 8%;
        font-size: 1.1rem;
    }
    .tutorial-objective {
        top: 8%;
        padding: 0.6rem 1.2rem;
    }
    .objective-text {
        font-size: 1rem;
    }
    .objective-hint {
        font-size: 0.75rem;
    }
    .tutorial-key-hint {
        bottom: 18%;
        font-size: 1rem;
        padding: 0.3rem 0.8rem;
    }
    .achievement-popup {
        top: 10%;
        padding: 0.6rem 1rem;
    }
    .achievement-icon {
        font-size: 1.5rem;
    }
    .achievement-title {
        font-size: 1rem;
    }
    .achievement-desc {
        font-size: 0.75rem;
    }
    .streak-text {
        font-size: 1.4rem;
    }
    .fall-text {
        font-size: 1.2rem;
    }
    .day-label {
        font-size: 2rem;
    }
    #clock-progress {
        width: 45px;
        height: 45px;
        top: 8px;
        right: 8px;
    }
}

/* 移动端触摸设备 */
@media (pointer: coarse) {
    .tutorial-key-hint {
        display: none; /* 移动端不显示键盘提示 */
    }
    .tutorial-highlight {
        box-shadow: 0 0 20px rgba(200, 168, 96, 0.8) !important;
    }
}
