﻿html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: white;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 全局移除点击聚焦轮廓和蓝色高亮 */
button, a, [tabindex] {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

button:focus,
a:focus,
[tabindex]:focus {
    outline: none;
}

#game-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: #000;
}

#gameCanvas {
    position: fixed;
    left: 0;
    top: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #3a5a40; /* 鑽夊湴棰滆壊 */
    touch-action: none;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 璁╃偣鍑荤┛閫忓埌canvas */
}

#opening-video-screen,
#title-screen {
    pointer-events: auto;
}

#opening-video-screen,
#video-player-ui {
    z-index: 10110 !important;
}

#opening-video,
#fullscreen-video {
    background: #000;
}

#opening-video::-webkit-media-controls,
#fullscreen-video::-webkit-media-controls,
#opening-video::-webkit-media-controls-start-playback-button,
#fullscreen-video::-webkit-media-controls-start-playback-button,
#opening-video::-webkit-media-controls-overlay-play-button,
#fullscreen-video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== 标题页按钮 — 伪木板风格 ===== */
.title-menu-btn {
    background: url('../assets/ui/title_menu_buttons.png') center/100% 100% no-repeat;
    border: none;
    border-radius: 4px;
    color: #ffe8c0;
    padding: 18px 48px;
    font-size: 26px;
    cursor: pointer;
    font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
    letter-spacing: 0.12em;
    text-shadow: 0 0 6px rgba(0,0,0,0.8), 1px 1px 2px #000;
    transition: background-image 0.2s, transform 0.1s;
    min-width: 200px;
    text-align: center;
}

.title-menu-btn:hover {
    background-image: url('../assets/ui/title_menu_buttons selected.png');
    color: #fff;
    transform: scale(1.03);
}

.title-menu-btn:active {
    transform: scale(0.97);
}

/* 移动端恢复按钮原始大小和位置 */
body.mobile-mode #title-btn-group {
    bottom: 50px !important;
    left: 50px !important;
    gap: 10px !important;
}
body.mobile-mode .title-menu-btn {
    padding: 10px 24px;
    font-size: 18px;
    min-width: 130px;
}

/* 移动端角色选择页适配 */
body.mobile-mode .char-display {
    min-height: 0;
    padding: clamp(10px, 2vh, 20px) clamp(10px, 3vw, 20px);
}
body.mobile-mode .char-info-card {
    padding-top: 14px;
}
body.mobile-mode .char-detail-traits {
    font-size: 10px;
    line-height: 1.3;
}
body.mobile-mode .select-footer {
    margin-top: 6px;
}
body.mobile-mode .thumbnail-frame {
    margin-top: 4px;
}
body.mobile-mode .select-main {
    gap: 4px;
}

/* ===== 火光粒子动画 ===== */
.title-fire-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.fire-particle {
    position: absolute;
    bottom: -10px;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(255,160,40,0.9) 0%, rgba(255,80,20,0.4) 50%, transparent 70%);
    border-radius: 50%;
    animation: fireRise 4.5s ease-in infinite;
    opacity: 0;
}

.fire-particle:nth-child(odd) {
    width: 6px;
    height: 6px;
    animation-duration: 5s;
}

.fire-particle:nth-child(3n) {
    width: 10px;
    height: 10px;
    animation-duration: 3.8s;
    background: radial-gradient(circle, rgba(255,200,60,0.8) 0%, rgba(255,100,30,0.3) 50%, transparent 70%);
}

@keyframes fireRise {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: translateX(0) scale(0.5);
    }
    15% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.5;
        transform: translateX(15px) scale(1);
    }
    85% {
        opacity: 0.15;
        transform: translateX(-8px) scale(0.7);
    }
    100% {
        bottom: 65%;
        opacity: 0;
        transform: translateX(5px) scale(0.3);
    }
}

#opening-video-skip,
#video-skip-hint {
    z-index: 3;
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

/* ===== 角色选择页 —— 反抗者身份档案 ===== */
#start-screen {
    background-image: url('../assets/ui/title_bg_new.png');
    background-size: cover;
    background-position: center;
    background-color: rgba(0, 0, 0, 0.35);
    background-blend-mode: darken;
    justify-content: space-between;
    padding: clamp(16px, 2.5vh, 32px) clamp(18px, 3.5vw, 48px);
    box-sizing: border-box;
    overflow: hidden;
    gap: clamp(4px, 0.7vh, 10px);
    position: relative;
}

/* 背景暗化遮罩 */
.select-bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 40%, rgba(8, 5, 2, 0.55) 85%, rgba(4, 2, 0, 0.8) 100%),
        linear-gradient(180deg, rgba(4, 2, 0, 0.45) 0%, transparent 25%, transparent 75%, rgba(4, 2, 0, 0.5) 100%);
}

/* 火星粒子层 */
.select-fire-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.35;
}

/* ===== 顶部标题牌匾 ===== */
.select-header {
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.select-title-plate {
    display: inline-block;
    position: relative;
    padding: 8px 44px 10px 44px;
    background: url('../assets/ui/char_title_plate.png') center/100% 100% no-repeat;
    border: none;
}

.select-header h1 {
    margin: 0;
    font-size: clamp(24px, 2.8vw, 38px);
    letter-spacing: 0.1em;
    font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
    color: #c4a86a;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 8px rgba(180, 140, 80, 0.15);
}

.carousel-subtitle {
    text-align: center;
    color: #b8a080;
    font-size: clamp(13px, 1.2vw, 16px);
    font-weight: normal;
    margin: 6px 0 0 0;
    text-shadow: 1px 1px 2px #000;
    line-height: 1.4;
    letter-spacing: 0.04em;
}

/* ===== 主展示区 ===== */
.select-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 1.5vw, 28px);
    width: min(1340px, 97%);
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 2;
}

/* ===== 左右箭头 — 暗金属圆形按钮 ===== */
.carousel-arrow {
    flex: 0 0 auto;
    width: clamp(40px, 4vw, 64px);
    height: clamp(40px, 4vw, 64px);
    border-radius: 50%;
    border: none;
    background: url('../assets/ui/char_arrow_btn.png') center/100% 100% no-repeat;
    color: #a08860;
    font-size: clamp(14px, 1.6vw, 20px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.carousel-arrow:hover {
    color: #d4b888;
    filter: brightness(1.15) drop-shadow(0 0 8px rgba(180, 60, 40, 0.4));
    transform: scale(1.08);
}
.carousel-arrow:active {
    transform: scale(0.93);
}

/* ===== 角色展示面板 — 暗金属档案框 ===== */
.char-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(14px, 2.5vw, 42px);
    background: url('../assets/ui/char_select_panel_frame.png') center/100% 100% no-repeat;
    padding: clamp(18px, 2.5vh, 34px) clamp(22px, 3vw, 46px);
    flex: 1 1 auto;
    max-width: 1100px;
    min-height: clamp(360px, 50vh, 560px);
    position: relative;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.char-display.transitioning {
    opacity: 0;
    transform: scale(0.97);
}

/* ===== 左侧：角色立绘展示区 ===== */
.char-portrait-zone {
    flex: 0 0 clamp(180px, 24vw, 340px);
    height: clamp(260px, 38vh, 480px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.char-glow {
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    opacity: 0.35;
    transition: background 0.4s ease;
    pointer-events: none;
    filter: blur(48px);
    z-index: 0;
}

.char-portrait {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: 58% bottom;
    background-repeat: no-repeat;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
    transition: background-image 0.3s ease;
    position: relative;
    z-index: 1;
    transform: translateY(-6px);
}

/* 角色底座 — 破旧石板圆台 */
.char-stand-base {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    height: clamp(18px, 2.4vh, 28px);
    background: url('../assets/ui/char_stand_platform.png') center/100% 100% no-repeat;
    border: none;
    border-radius: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===== 右侧：泛黄档案纸信息卡 ===== */
.char-info-card {
    flex: 1;
    min-width: 0;
    background: url('../assets/ui/char_archive_paper.png') center/100% 100% no-repeat;
    border: none;
    border-radius: 3px;
    padding: clamp(16px, 2.5vh, 30px) clamp(16px, 2.5vw, 34px);
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
/* 档案纸上的纹理由 char_archive_paper.png 提供 */
.char-info-card .char-info {
    position: relative;
}

.char-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(2px, 0.3vh, 5px);
    position: relative;
    padding-left: 6px;
}

.char-name {
    font-size: clamp(24px, 2.8vw, 36px);
    font-family: "Noto Serif SC", "Songti SC", serif;
    color: #5a3820;
    margin: 0;
    line-height: 1.2;
    text-shadow: none;
    letter-spacing: 0.04em;
}

.char-title {
    font-size: clamp(13px, 1vw, 16px);
    color: #7a5a3a;
    display: inline-block;
    padding-bottom: 2px;
    align-self: flex-start;
    font-weight: bold;
    letter-spacing: 0.03em;
}

.char-quote {
    font-style: italic;
    color: #6b4e32;
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.5;
    margin: 2px 0;
    padding-left: 8px;
    border-left: 3px solid #8b3a2a;
}

/* ===== 属性星级（档案条目格式，同行排列） ===== */
.char-attributes {
    display: flex;
    flex-flow: row wrap;
    gap: 6px 14px;
    margin: 2px 0;
}

.char-attributes .attr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(13px, 1vw, 16px);
    color: #5a3a20;
    padding: 1px 0;
}

.char-attributes .attr-row .attr-label {
    min-width: 28px;
    color: #6b4e32;
    font-weight: bold;
}

.char-attributes .attr-row .attr-stars {
    color: #b89040;
    letter-spacing: 1px;
    text-shadow: 0 0 2px rgba(180, 140, 60, 0.3);
}
.char-attributes .attr-row .attr-stars .empty {
    color: rgba(100, 80, 50, 0.25);
    text-shadow: none;
}

/* ===== 擅长/特点 ===== */
.char-detail-traits {
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.5;
    color: #5a3a20;
}
.char-detail-traits p {
    margin: 1px 0;
}
.char-detail-traits strong {
    color: #4a2a10;
}

/* ===== 底部区域 ===== */
.select-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(4px, 0.6vh, 10px);
    width: 100%;
    position: relative;
    z-index: 2;
}

/* ===== 缩略图导航 — 档案照片框 ===== */
.thumbnail-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 1.4vw, 18px);
}

/* 档案照片框外壳 */
.thumbnail-frame {
    width: clamp(60px, 6.5vw, 84px);
    height: clamp(60px, 6.5vw, 84px);
    background: url('../assets/ui/char_thumbnail_frame.png') center/100% 100% no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    filter: brightness(0.55) saturate(0.4);
    cursor: pointer;
}
.thumbnail-frame:hover {
    filter: brightness(0.75) saturate(0.6);
    transform: scale(1.06);
}
.thumbnail-frame.active {
    background-image: url('../assets/ui/char_thumbnail_frame_active.png');
    filter: brightness(1) saturate(1);
    transform: scale(1.1);
    z-index: 2;
}

/* 内部角色照片 */
.thumbnail-btn {
    width: 70%;
    height: 70%;
    border-radius: 2px;
    border: none;
    background-color: transparent;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    pointer-events: none;  /* 点击由外层 wrapper 处理 */
}
.thumbnail-frame .thumbnail-btn {
    pointer-events: auto;  /* 恢复按钮可点击 */
}

/* ===== 底部操作按钮区 ===== */
.select-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 1.5vw, 20px);
    flex-wrap: wrap;
}

/* "查看身份档案"按钮 — 旧木板风格 */
.detail-btn {
    padding: clamp(9px, 1vh, 14px) clamp(20px, 2.6vw, 36px);
    font-size: clamp(14px, 1.1vw, 17px);
    background: url('../assets/ui/char_detail_btn.png') center/100% 100% no-repeat;
    border: none;
    color: #c4a878;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Noto Serif SC", serif;
    letter-spacing: 0.04em;
    white-space: nowrap;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.detail-btn:hover {
    filter: brightness(1.12);
    color: #d4b888;
    box-shadow: 0 0 10px rgba(180, 140, 100, 0.2), 0 2px 4px rgba(0,0,0,0.3);
}

/* "以X的身份开始"按钮 — 暗红金属牌 */
#start-btn {
    margin: 0;
    padding: clamp(12px, 1.4vh, 20px) clamp(32px, 6vw, 68px);
    font-size: clamp(18px, 2vw, 26px);
    font-family: "Noto Serif SC", serif;
    letter-spacing: 0.06em;
    background: url('../assets/ui/char_start_btn.png') center/100% 100% no-repeat;
    border: none;
    color: #d4a017;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}
#start-btn:hover:not(:disabled) {
    filter: brightness(1.15) drop-shadow(0 0 12px rgba(200, 40, 40, 0.5));
    color: #e8c050;
}
#start-btn:active:not(:disabled) {
    transform: scale(0.96);
    filter: brightness(0.9);
}
#start-btn:disabled {
    background: linear-gradient(180deg, #3a3528, #1e1a10);
    border-color: #4a4530;
    color: #6a6050;
    cursor: not-allowed;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    text-shadow: none;
}

/* ===== 详情弹窗 — 档案册风格 ===== */
.char-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 5, 2, 0.85);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.char-detail-overlay.open {
    display: flex;
}
.char-detail-modal {
    background: linear-gradient(170deg, rgba(42, 34, 24, 0.98), rgba(18, 14, 8, 0.98));
    border: 2px solid rgba(139, 100, 50, 0.5);
    border-radius: 6px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: clamp(20px, 3vh, 36px);
    position: relative;
    box-shadow: 0 0 30px rgba(60, 30, 10, 0.5);
}
.char-detail-modal h2 {
    color: #c4a86a;
    margin-top: 0;
    font-family: "Noto Serif SC", "Songti SC", serif;
}
.char-detail-modal .close-detail-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    background: rgba(60, 40, 20, 0.6);
    border: 1px solid rgba(139, 100, 50, 0.4);
    border-radius: 50%;
    color: #a09070;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 7px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.char-detail-modal .close-detail-btn:hover {
    color: #d4b888;
    border-color: rgba(180, 140, 80, 0.6);
    box-shadow: 0 0 8px rgba(180, 120, 60, 0.2);
}

/* ===== 手机端适配 ===== */
@media (max-width: 640px) {
    .char-display {
        flex-direction: column;
        text-align: center;
        padding: clamp(6px, 1.5vh, 10px);
        gap: clamp(4px, 1vh, 8px);
        max-width: 96vw;
        min-height: 0;
    }
    .char-portrait-zone {
        flex: 0 0 clamp(100px, 24vw, 160px);
        height: clamp(120px, 20vh, 180px);
    }
    .char-quote {
        border-left: none;
        padding-left: 0;
    }
    .char-title {
        align-self: center;
    }
    .char-stand-base {
        width: 50%;
        height: 10px;
    }
    .carousel-arrow {
        width: 26px;
        height: 26px;
        font-size: 0;
    }
    .select-main {
        gap: 2px;
        width: 100%;
    }
    .thumbnail-frame {
        width: clamp(38px, 7vw, 46px);
        height: clamp(38px, 7vw, 46px);
    }
    .select-actions {
        flex-direction: column;
        gap: 6px;
    }
    .detail-btn {
        align-self: center;
        padding: 6px 14px;
        font-size: 11px;
    }
    .select-title-plate {
        padding: 3px 18px 5px 18px;
    }
    #start-btn {
        padding: 8px 20px;
        font-size: 14px;
    }
    .char-info-card {
        padding: 8px 10px;
        overflow: hidden;
    }
    .char-name {
        font-size: 16px;
    }
    .char-quote {
        font-size: 10px;
    }
    .char-attributes {
        gap: 2px 8px;
    }
    .char-attributes .attr-row {
        font-size: 10px;
        gap: 3px;
    }
    .char-attributes .attr-row .attr-label {
        min-width: 22px;
    }
    .char-detail-traits {
        font-size: 10px;
    }
    .char-info {
        gap: 1px;
        padding-left: 2px;
    }
    .char-info-card .char-info::after {
        width: 22px;
        height: 22px;
    }
    .select-header { margin-top: -10px; }
    .select-main { margin-top: 26px; }
    .select-footer { margin-top: auto; padding-bottom: 14px; }
    #start-screen { justify-content: flex-start; padding-top: 0; padding-bottom: 0; }
}

#game-over-screen {
    background-color: rgba(0, 0, 0, 0.8);
}

h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ff4d4d;
    text-shadow: 2px 2px 4px #000;
}

p {
    font-size: 20px;
    margin-bottom: 10px;
}

button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #ff1a1a;
}

#language-select,
#language-select option {
    color: #fff !important;
    background-color: #111 !important;
}

#language-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.language-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 40px;
    padding: 3px;
    background: #111;
    border: 1px solid #777;
    border-radius: 5px;
    box-sizing: border-box;
    overflow: hidden;
}

.language-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: #ffd700;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
    transition: transform 0.18s ease;
    pointer-events: none;
}

.language-toggle.is-traditional .language-toggle-thumb {
    transform: translateX(100%);
}

.language-toggle-option {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: #ddd;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    transition: color 0.18s ease;
}

.language-toggle-option:hover {
    background: transparent;
}

.language-toggle-option.active {
    color: #111;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#stats-container {
    display: flex;
    flex-direction: column;
}

#level-display {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

#hp-bar, #exp-bar {
    width: 200px;
    height: 18px;
    background-color: #333;
    border: 2px solid #fff;
    border-radius: 8px;
    overflow: hidden;
}

#hp-fill {
    width: 100%;
    height: 100%;
    background-color: #ff4d4d;
    transition: width 0.2s;
}

#exp-fill {
    width: 0%;
    height: 100%;
    background-color: #33ccff;
    transition: width 0.2s;
}

#timer {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

#message {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: #ffd700;
    text-shadow: 1px 1px 2px #000;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 10001;
    pointer-events: none;
}

#dialogue-box {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1120px, 92vw);
    min-height: 196px;
    padding: 18px;
    box-sizing: border-box;
    pointer-events: auto;
    z-index: 100;
    display: flex;
    align-items: stretch;
    gap: 18px;
    border: 1px solid rgba(255, 238, 188, 0.55);
    border-radius: 18px;
    background:
        radial-gradient(100% 140% at 0% 100%, rgba(255, 176, 87, 0.24), rgba(0, 0, 0, 0) 60%),
        radial-gradient(120% 140% at 100% 0%, rgba(106, 186, 255, 0.18), rgba(0, 0, 0, 0) 66%),
        linear-gradient(165deg, rgba(14, 16, 28, 0.94), rgba(8, 9, 18, 0.9));
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(8px);
}

#dialogue-box.dialogue-right {
    flex-direction: row-reverse;
}

#dialogue-box.dialogue-left {
    flex-direction: row;
}

#dialogue-portrait-stage {
    width: 188px;
    min-width: 188px;
    height: 188px;
    border-radius: 14px;
    border: 1px solid rgba(255, 228, 167, 0.75);
    background: linear-gradient(180deg, rgba(34, 38, 62, 0.85), rgba(16, 18, 31, 0.92));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 10px 24px rgba(0, 0, 0, 0.32);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dialogue-portrait {
    position: static;
    width: 100%;
    height: 100%;
    display: block;
}

#dialogue-content {
    flex: 1;
    min-width: 0;
    min-height: 188px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

#speaker-name {
    font-size: 30px;
    font-weight: bold;
    color: #ffd700;
    letter-spacing: 0.04em;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
    margin: 0;
}

#dialogue-text {
    font-size: 24px;
    line-height: 1.62;
    color: #f4f7ff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    word-break: break-word;
}

#dialogue-hint {
    position: static;
    align-self: flex-end;
    font-size: 14px;
    color: rgba(255, 240, 188, 0.95);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 230, 168, 0.45);
    background: rgba(255, 220, 137, 0.1);
    animation: blink 1s infinite;
}

@media (max-width: 900px) {
    #dialogue-box {
        width: 96vw;
        min-height: 140px;
        bottom: 10px;
        border-radius: 14px;
        padding: 10px;
        gap: 10px;
    }

    #dialogue-portrait-stage {
        width: 108px;
        min-width: 108px;
        height: 108px;
        border-radius: 10px;
    }

    #dialogue-content {
        min-height: 108px;
        gap: 8px;
    }

    #speaker-name {
        font-size: 20px;
    }

    #dialogue-text {
        font-size: 16px;
        line-height: 1.45;
    }

    #dialogue-hint {
        font-size: 12px;
        padding: 2px 8px;
    }
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

#ending-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 10120;
}

#ending-screen h2 {
    font-size: 36px;
    color: #fff;
    margin: 20px 0;
    text-shadow: 2px 2px 4px #000;
    text-align: center;
}

#ending-ink-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 10120;
    overflow: hidden;
}

#ending-ink-screen.prelude #ending-ink-main,
#ending-ink-screen.prelude #ending-ink-subtitle,
#ending-ink-screen.prelude #ending-ink-restart-btn,
#ending-ink-screen.prelude .ending-ink-blot {
    opacity: 0 !important;
    animation: none !important;
}

#ending-ink-splash-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ending-ink-blot {
    position: absolute;
    left: var(--ink-x, 50%);
    top: var(--ink-y, 50%);
    width: var(--ink-w, 260px);
    height: var(--ink-h, 180px);
    background:
        radial-gradient(circle at 45% 40%, rgba(250, 250, 250, 0.46), rgba(206, 206, 206, 0.28) 36%, rgba(110, 110, 110, 0.16) 66%, rgba(0, 0, 0, 0) 100%);
    box-shadow:
        0 0 34px rgba(220, 220, 220, 0.18),
        0 0 80px rgba(180, 180, 180, 0.12);
    filter: blur(0.35px) contrast(132%);
    transform: translate(-50%, -50%) scale(0.12) rotate(var(--ink-r, 0deg));
    opacity: 0;
    border-radius: 41% 59% 53% 47% / 56% 43% 57% 44%;
    animation: inkBlotSpread 1.05s ease-out forwards;
    animation-delay: var(--ink-d, 0s);
}

#ending-ink-main {
    position: relative;
    color: #f2f2f2;
    font-size: clamp(60px, 9vw, 132px);
    font-family: "STKaiti", "KaiTi", "STSong", "SimSun", serif;
    letter-spacing: 0.14em;
    line-height: 1.15;
    text-align: center;
    opacity: 0;
    transform: translateY(22px) scale(0.96);
    text-shadow:
        0 0 3px rgba(255, 255, 255, 0.28),
        2px 3px 0 rgba(24, 24, 24, 0.95),
        -2px -1px 0 rgba(70, 70, 70, 0.45),
        0 0 28px rgba(210, 210, 210, 0.16);
}

#ending-ink-subtitle {
    position: relative;
    margin-top: 18px;
    max-width: min(86vw, 920px);
    padding: 14px 22px;
    text-align: center;
    color: #e9e9e9;
    opacity: 0;
    transform: translateY(16px);
    font-family: "STKaiti", "KaiTi", "STSong", "SimSun", serif;
    border: 1px solid rgba(210, 210, 210, 0.22);
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.42), rgba(4, 4, 4, 0.12));
    border-radius: 3px;
}

#ending-ink-subtitle .ending-ink-line {
    font-size: clamp(22px, 2.6vw, 38px);
    line-height: 1.55;
    letter-spacing: 0.06em;
    text-shadow:
        1px 2px 0 rgba(20, 20, 20, 0.9),
        -1px -1px 0 rgba(66, 66, 66, 0.42),
        0 0 18px rgba(230, 230, 230, 0.1);
}

#ending-ink-subtitle .ending-ink-line.emphasis {
    font-size: clamp(34px, 4.1vw, 62px);
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.25;
    text-shadow:
        2px 3px 0 rgba(15, 15, 15, 0.95),
        -1px -1px 0 rgba(88, 88, 88, 0.38),
        0 0 26px rgba(240, 240, 240, 0.18);
}

#ending-ink-restart-btn {
    position: relative;
    margin-top: 34px;
    padding: 11px 30px;
    border: 1px solid rgba(235, 235, 235, 0.62);
    background: rgba(8, 8, 8, 0.58);
    color: #f5f5f5;
    border-radius: 4px;
    font-size: 18px;
    letter-spacing: 0.12em;
    font-family: "STSong", "SimSun", serif;
    cursor: pointer;
    opacity: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

#ending-ink-restart-btn:hover {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(20, 20, 20, 0.78);
}

#ending-ink-screen.playing #ending-ink-main {
    animation: inkTextReveal 0.85s cubic-bezier(0.2, 0.75, 0.2, 1) 0.52s forwards;
}

#ending-ink-screen.playing #ending-ink-subtitle {
    animation: inkTextReveal 0.8s cubic-bezier(0.2, 0.75, 0.2, 1) 0.9s forwards;
}

#ending-ink-screen.playing #ending-ink-restart-btn {
    animation: inkTextReveal 0.6s ease-out 1.2s forwards;
}

@keyframes inkBlotSpread {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.1) rotate(var(--ink-r, 0deg));
    }
    30% {
        opacity: 0.94;
    }
    100% {
        opacity: 0.76;
        transform: translate(-50%, -50%) scale(1) rotate(var(--ink-r, 0deg));
    }
}

@keyframes inkTextReveal {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

#scene-title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 150;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

#scene-title-text {
    font-size: 64px;
    color: #fff;
    text-shadow: 2px 2px 8px #000;
    margin-bottom: 10px;
    letter-spacing: 5px;
}

#scene-subtitle-text {
    font-size: 32px;
    color: #ffd700;
    text-shadow: 1px 1px 4px #000;
    letter-spacing: 2px;
}

#memory-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 180;
    pointer-events: auto;
}

#memory-content {
    background: linear-gradient(135deg, #2c3e50, #000000);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 30px;
    width: 60%;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#memory-title {
    color: #ffd700;
    font-size: 28px;
    margin-top: 0;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px #000;
}

#memory-text {
    color: #e0e0e0;
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 30px;
    font-style: italic;
}

#memory-hint {
    color: #888;
    font-size: 14px;
    margin-bottom: 0;
    animation: blink 1.5s infinite;
}

#choice-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 160;
}

#choice-screen h2 {
    font-size: 48px;
    color: #fff;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px #000;
}

.choice-buttons {
    display: flex;
    gap: 30px;
}

.choice-buttons button {
    margin-top: 0;
    padding: 20px 30px;
    font-size: 24px;
    border: 2px solid #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

#choice-forgive {
    background-color: #4a90e2;
    color: white;
}

#choice-forgive:hover {
    background-color: #357abd;
    transform: scale(1.05);
}

#choice-execute {
    background-color: #e74c3c;
    color: white;
}

#choice-execute:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

/* Boss 澶ц鏉?*/
#boss-health-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: min(440px, 58vw);
    text-align: center;
    pointer-events: none;
    z-index: 50;
    animation: bossBarFadeIn 0.5s ease-out;
}

@keyframes bossBarFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#boss-name {
    font-size: 16px;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.8), 1px 1px 2px #000;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

#boss-bar-bg {
    position: relative;
    width: 100%;
    height: 14px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #888;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.4);
}

/* 寤惰繜鏉★紙榛勮壊锛屽湪绾㈣壊鏉″悗闈紝琛ㄧず鏈€杩戝彈鍒扮殑浼ゅ锛?*/
#boss-bar-delayed {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: #ffaa00;
    border-radius: 7px;
    transition: width 0.8s ease-out;
}

/* 瀹為檯琛€閲忔潯锛堢孩鑹诧紝鍦ㄥ欢杩熸潯涓婇潰锛?*/
#boss-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(to bottom, #ff6666, #cc0000);
    border-radius: 7px;
    transition: width 0.15s ease-out;
    z-index: 1;
}

#boss-hp-text {
    font-size: 12px;
    color: #ccc;
    text-shadow: 1px 1px 2px #000;
    margin-top: 4px;
}

body.mobile-mode {
    touch-action: none;
    overscroll-behavior: none;
}

/* ===== 设置面板 — 战地工具箱风格 ===== */

/* 背景暗化遮罩 */
#settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 10070;
    background: rgba(0, 0, 0, 0.62);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
#settings-overlay.active {
    opacity: 1;
}

/* 主面板容器 */
#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    max-width: 95vw;
    max-height: 90vh;
    z-index: 10080 !important;
    pointer-events: auto;
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(30, 28, 26, 0.98) 0%, rgba(22, 20, 18, 0.98) 100%);
    border: 2px solid #8a7a5a;
    border-radius: 6px;
    box-shadow:
        0 0 24px rgba(0, 0, 0, 0.7),
        inset 0 0 40px rgba(10, 8, 5, 0.5),
        0 0 0 1px rgba(180, 160, 120, 0.1) inset;
    color: #d4cbb0;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    opacity: 0;
    animation: none;
}
#settings-panel.open {
    display: flex;
    animation: settings-panel-enter 0.2s ease-out forwards;
}
#settings-panel.closing {
    display: flex;
    animation: settings-panel-exit 0.18s ease-in forwards;
}

@keyframes settings-panel-enter {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes settings-panel-exit {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to   { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
}

/* 标题栏 */
#settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px 9px 18px;
    background: linear-gradient(90deg, rgba(50, 40, 28, 0.55), rgba(35, 30, 22, 0.55));
    flex-shrink: 0;
}

#settings-title-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
#settings-title {
    font-size: 17px;
    font-weight: bold;
    color: #c4a86a;
    letter-spacing: 0.06em;
    font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
    text-shadow: 0 0 8px rgba(180, 150, 80, 0.15);
}
#settings-subtitle {
    font-size: 10px;
    color: #7a6a4a;
    letter-spacing: 0.06em;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 关闭按钮 */
#settings-close-btn {
    width: 30px;
    height: 30px;
    background: rgba(50, 40, 30, 0.65);
    border: 1px solid rgba(138, 122, 90, 0.4);
    border-radius: 50%;
    color: #a09070;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
#settings-close-btn:hover {
    background: rgba(80, 55, 35, 0.75);
    border-color: rgba(180, 140, 80, 0.55);
    color: #d4bb88;
    box-shadow: 0 0 8px rgba(180, 140, 80, 0.18);
}
#settings-close-btn:active {
    transform: scale(0.9);
}

/* 内容区（可滚动） */
#settings-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 14px;
    min-height: 0;
    background: rgba(18, 16, 14, 0.3);
}
#settings-content::-webkit-scrollbar {
    width: 5px;
}
#settings-content::-webkit-scrollbar-track {
    background: rgba(60, 50, 35, 0.12);
    border-radius: 3px;
}
#settings-content::-webkit-scrollbar-thumb {
    background: rgba(138, 122, 90, 0.3);
    border-radius: 3px;
}
#settings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 122, 90, 0.5);
}

/* 模块分组 */
.settings-section {
    margin-bottom: 4px;
    border: 1px solid rgba(138, 122, 90, 0.1);
    border-radius: 3px;
    background: rgba(25, 22, 18, 0.45);
}
.settings-section-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    background: linear-gradient(90deg, rgba(60, 48, 32, 0.35), rgba(35, 30, 22, 0.15));
    border-bottom: 1px solid rgba(138, 122, 90, 0.12);
}
.settings-section-icon {
    font-size: 13px;
    width: 18px;
    text-align: center;
    opacity: 0.65;
}
.settings-section-title {
    font-size: 12px;
    font-weight: bold;
    color: #b8a882;
    letter-spacing: 0.05em;
}
.settings-section-body {
    padding: 7px 10px 9px;
}

/* 控件组 */
.settings-control-group {
    margin-bottom: 9px;
}
.settings-control-group:last-child {
    margin-bottom: 0;
}
.settings-label {
    display: block;
    font-size: 12px;
    color: #a09078;
    margin-bottom: 5px;
}

/* 自定义滑动条 */
.settings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #2a2418, #4a3e28);
    border-radius: 3px;
    outline: none;
    border: 1px solid rgba(138, 122, 90, 0.18);
    cursor: pointer;
    margin: 5px 0;
}
.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 18px;
    background: radial-gradient(circle at 40% 35%, #8a7a5a, #5a4a30);
    border: 1px solid rgba(180, 160, 120, 0.35);
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4), inset 0 1px 2px rgba(200, 180, 140, 0.12);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.settings-slider::-webkit-slider-thumb:hover {
    border-color: rgba(200, 180, 140, 0.55);
    box-shadow: 0 1px 6px rgba(0,0,0,0.5), inset 0 1px 2px rgba(200, 180, 140, 0.22);
}
.settings-slider::-moz-range-thumb {
    width: 16px;
    height: 18px;
    background: radial-gradient(circle at 40% 35%, #8a7a5a, #5a4a30);
    border: 1px solid rgba(180, 160, 120, 0.35);
    border-radius: 3px;
    cursor: pointer;
}

/* 语言切换（新风格，叠加在旧类名上） */
.settings-lang-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 34px;
    padding: 3px;
    background: #1a1814;
    border: 1px solid rgba(138, 122, 90, 0.3);
    border-radius: 4px;
    box-sizing: border-box;
    overflow: hidden;
}
.settings-lang-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: linear-gradient(180deg, #8a7a5a, #6a5a3a);
    border-radius: 3px;
    box-shadow: 0 0 6px rgba(138, 122, 90, 0.18), inset 0 1px 2px rgba(200, 180, 140, 0.18);
    transition: transform 0.18s ease;
    pointer-events: none;
}
.settings-lang-toggle.is-traditional .settings-lang-thumb {
    transform: translateX(100%);
}
.settings-lang-option {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 3px;
    color: #8a7a5a;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    transition: color 0.18s ease;
}
.settings-lang-option:hover {
    background: transparent;
}
.settings-lang-option.active {
    color: #d4cbb0;
}

/* 自定义复选框 */
.settings-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 4px;
    margin-bottom: 1px;
    border-radius: 3px;
    transition: background 0.12s;
}
.settings-checkbox-row:hover {
    background: rgba(138, 122, 90, 0.05);
}
.settings-checkbox-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.settings-checkbox-box {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 1px solid rgba(138, 122, 90, 0.38);
    border-radius: 3px;
    background: linear-gradient(135deg, #1e1c18, #2a2620);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    position: relative;
}
.settings-checkbox-row:hover .settings-checkbox-box {
    border-color: rgba(180, 160, 120, 0.5);
    background: linear-gradient(135deg, #24201a, #2e2a22);
}
.settings-checkbox-row input[type="checkbox"]:checked + .settings-checkbox-box {
    border-color: rgba(180, 160, 100, 0.55);
    background: linear-gradient(135deg, #3a3224, #4a3e2a);
    box-shadow: 0 0 6px rgba(180, 160, 100, 0.12);
}
.settings-checkbox-row input[type="checkbox"]:checked + .settings-checkbox-box::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid #b8a060;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.settings-checkbox-row input[type="checkbox"]:disabled + .settings-checkbox-box {
    opacity: 0.35;
    border-color: rgba(80, 70, 50, 0.25);
}
.settings-checkbox-label {
    font-size: 13px;
    color: #c0b498;
    line-height: 1.3;
}

/* 底部按钮栏 */
#settings-footer {
    display: none;
    gap: 8px;
    padding: 10px 14px;
    border-top: 2px solid rgba(138, 122, 90, 0.22);
    background: linear-gradient(0deg, rgba(30, 26, 20, 0.75), rgba(22, 20, 16, 0.3));
    flex-shrink: 0;
    border-radius: 0 0 5px 5px;
}

/* 通用按钮 */
.settings-btn {
    flex: 1;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.04em;
    transition: all 0.12s;
    text-align: center;
    border-width: 1px;
    border-style: solid;
}
.settings-btn:active {
    transform: scale(0.96);
}

/* 保存按钮 — 军用蓝灰 */
.settings-btn-save {
    background: linear-gradient(180deg, #4a5a6a, #3a4a58);
    border-color: rgba(100, 140, 180, 0.3);
    color: #c0d0e0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.settings-btn-save:hover {
    background: linear-gradient(180deg, #5a6a7a, #4a5a68);
    border-color: rgba(100, 140, 180, 0.48);
    color: #e0e8f0;
}

/* 退出按钮 — 暗红警告 */
.settings-btn-exit {
    background: linear-gradient(180deg, #5a2a2a, #4a1e1e);
    border-color: rgba(160, 80, 60, 0.3);
    color: #d0a0a0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.settings-btn-exit:hover {
    background: linear-gradient(180deg, #6a3a3a, #5a2a2a);
    border-color: rgba(180, 100, 80, 0.48);
    color: #f0c0c0;
}

/* 次级按钮 — 自定义UI */
.settings-btn-secondary {
    width: 100%;
    padding: 7px 14px;
    background: linear-gradient(180deg, #3a3630, #2a2620);
    border: 1px solid rgba(138, 122, 90, 0.28);
    border-radius: 4px;
    color: #a09078;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.12s;
}
.settings-btn-secondary:hover {
    background: linear-gradient(180deg, #4a4438, #3a3428);
    border-color: rgba(180, 160, 120, 0.38);
    color: #c0b498;
}
.settings-btn-secondary:active {
    transform: scale(0.97);
}

/* 自定义UI区域 */
.settings-cui-section {
    display: none;
}

/* ===== 百科大全面板 — 旧档案册风格 ===== */
#encyclopedia-panel {
    z-index: 10080 !important;
}

#encyclopedia-panel .encyclopedia-tab {
    font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
}

#encyclopedia-panel .encyclopedia-tab:hover {
    color: #d4c5a0 !important;
}

.encyclopedia-tab-content {
    animation: fadeIn 0.3s ease-out;
}

/* 滚动条 — 暖棕色调 */
#encyclopedia-content::-webkit-scrollbar {
    width: 6px;
}

#encyclopedia-content::-webkit-scrollbar-track {
    background: rgba(80, 50, 25, 0.15);
    border-radius: 3px;
}

#encyclopedia-content::-webkit-scrollbar-thumb {
    background: rgba(180, 130, 70, 0.4);
    border-radius: 3px;
}

#encyclopedia-content::-webkit-scrollbar-thumb:hover {
    background: rgba(180, 130, 70, 0.6);
}

/* 角色轮播 */
#enc-char-detail .enc-char-portrait {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(139, 90, 35, 0.5);
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.25);
}

#enc-char-detail .enc-char-name {
    font-size: 20px;
    font-weight: bold;
    color: #5A3018;
    font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
    margin-bottom: 2px;
}

#enc-char-detail .enc-char-title {
    font-size: 13px;
    color: #7A5A38;
    margin-bottom: 6px;
}

#enc-char-detail .enc-char-quote {
    font-size: 13px;
    color: #6F5435;
    font-style: italic;
    margin-bottom: 10px;
    line-height: 1.4;
}

#enc-char-detail .enc-char-meta {
    font-size: 13px;
    color: #4A2E18;
    text-align: left;
    line-height: 1.6;
    max-width: 360px;
    margin: 0 auto;
}

#enc-char-detail .enc-char-clue {
    font-size: 12px;
    color: #7A5A38;
    margin-top: 8px;
    font-style: italic;
}

/* 道具图鉴网格 */
#encyclopedia-items-grid .enc-item-card {
    background: rgba(55, 35, 18, 0.55);
    border: 1px solid rgba(139, 90, 35, 0.35);
    border-radius: 6px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

#encyclopedia-items-grid .enc-item-card:hover {
    transform: scale(1.04);
    border-color: rgba(200, 150, 70, 0.6);
    box-shadow: 0 0 10px rgba(180, 120, 50, 0.2);
}

#encyclopedia-items-grid .enc-item-card.owned {
    background: rgba(65, 40, 18, 0.65);
    border-color: rgba(180, 130, 60, 0.5);
}

#encyclopedia-items-grid .enc-item-card.locked {
    background: rgba(40, 25, 14, 0.5);
    border-color: rgba(100, 70, 35, 0.25);
    opacity: 0.65;
    filter: grayscale(0.5);
}

#encyclopedia-items-grid .enc-item-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 6px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

#encyclopedia-items-grid .enc-item-name {
    font-size: 12px;
    color: #c4a070;
    line-height: 1.3;
}

#encyclopedia-items-grid .enc-item-card.locked .enc-item-name {
    color: #8C7A62;
}

/* 海报收藏 */
#encyclopedia-posters-container .enc-poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

#encyclopedia-posters-container .enc-poster-card {
    background: rgba(60, 35, 15, 0.35);
    border: 1px solid rgba(139, 90, 35, 0.3);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s;
}

#encyclopedia-posters-container .enc-poster-card:hover {
    transform: scale(1.04);
}

#encyclopedia-posters-container .enc-poster-thumb {
    width: 100%;
    height: 110px;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    margin-bottom: 6px;
}

#encyclopedia-posters-container .enc-poster-name {
    font-size: 11px;
    color: #b0a080;
}

/* 道具详情弹窗 */
#enc-item-detail-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#enc-item-detail-overlay .detail-card {
    background: rgba(28, 18, 10, 0.97);
    border: 3px solid #8b5a2b;
    border-radius: 6px;
    padding: 28px 24px;
    max-width: 420px;
    width: 88vw;
    text-align: center;
    color: #d4c5a0;
    box-shadow: 0 0 40px rgba(60, 30, 10, 0.6);
    position: relative;
}

#enc-item-detail-overlay .detail-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #8b7355;
    font-size: 22px;
    cursor: pointer;
}

#enc-item-detail-overlay .detail-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

#enc-item-detail-overlay .detail-name {
    font-size: 20px;
    color: #e8c878;
    font-weight: bold;
    font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
}

#enc-item-detail-overlay .detail-desc {
    font-size: 14px;
    color: #c0a880;
    font-style: italic;
    margin: 8px 0;
    line-height: 1.5;
}

#enc-item-detail-overlay .detail-effect {
    font-size: 13px;
    color: #a09070;
    line-height: 1.5;
}

@media (max-width: 740px) {
    #encyclopedia-panel {
        width: 95vw !important;
        max-height: 90vh !important;
    }

    #encyclopedia-content {
        max-height: calc(88vh - 140px) !important;
    }

    #encyclopedia-items-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }

    #enc-char-detail .enc-char-portrait {
        width: 72px;
        height: 72px;
    }

    #enc-char-detail .enc-char-name {
        font-size: 17px;
    }
}

#mobile-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 14px 14px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 10040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.mobile-mode #mobile-controls.mobile-controls-active {
    opacity: 1;
    visibility: visible;
}

.mobile-left-panel,
.mobile-right-panel {
    pointer-events: none;
}

#mobile-joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), rgba(20, 20, 20, 0.35));
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    position: relative;
    pointer-events: auto;
    touch-action: none;
}

#mobile-joystick-knob {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: linear-gradient(180deg, rgba(245, 245, 245, 0.38), rgba(122, 122, 122, 0.45));
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.mobile-right-panel {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    width: 250px;
    min-height: 240px;
    position: relative;
}

#mobile-combat-cluster {
    position: relative;
    width: 214px;
    height: 214px;
    pointer-events: auto;
    touch-action: none;
}

.mobile-action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    position: absolute;
    right: 0;
    bottom: 168px;
    z-index: 6;
}

.mobile-action-btn {
    width: 150px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(35, 35, 35, 0.74), rgba(10, 10, 10, 0.62));
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.mobile-action-btn.active {
    transform: scale(0.95);
    background: linear-gradient(180deg, rgba(68, 68, 68, 0.78), rgba(22, 22, 22, 0.68));
}

.mobile-attack-btn {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.72);
    background-color: rgba(0, 0, 0, 0.28);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    position: absolute;
    right: 10px;
    bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    z-index: 8;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

.mobile-attack-btn.active {
    background-color: rgba(224, 64, 64, 0.48);
    border-color: rgba(255, 224, 224, 0.92);
    box-shadow: 0 0 14px rgba(255, 102, 102, 0.56);
}

body.mobile-mode #skills-container.mobile-skill-orbit {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 214px;
    height: 214px;
    margin: 0 !important;
    display: block;
    pointer-events: none;
    z-index: 3;
}

body.mobile-mode #skills-container.mobile-skill-orbit > #skill1-icon,
body.mobile-mode #skills-container.mobile-skill-orbit > #skill2-icon,
body.mobile-mode #skills-container.mobile-skill-orbit > #skill3-icon,
body.mobile-mode #skills-container.mobile-skill-orbit > #skill-special-icon {
    position: absolute !important;
    width: 44px !important;
    height: 44px !important;
    pointer-events: auto;
    transform: translate(-50%, -50%) !important;
}

body.mobile-mode #skills-container.mobile-skill-orbit > #skill1-icon {
    left: 98px !important;
    top: 192px !important;
}

body.mobile-mode #skills-container.mobile-skill-orbit > #skill2-icon {
    left: 84px !important;
    top: 150px !important;
}

body.mobile-mode #skills-container.mobile-skill-orbit > #skill3-icon {
    left: 108px !important;
    top: 108px !important;
}

body.mobile-mode #skills-container.mobile-skill-orbit > #skill-special-icon {
    left: 166px !important;
    top: 88px !important;
}


/* 移动端对话：点击继续 */
body.mobile-mode #dialogue-hint { display: none; }
body.mobile-mode #dialogue-hint-mobile { display: block !important; color: #aaa; font-size: 13px; margin-top: 8px; animation: pulse-hint 2s infinite; }
@keyframes pulse-hint { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
body.mobile-mode #dialogue-box { cursor: pointer; }

/* 移动端：隐藏确认/跳过按钮 */
body.mobile-mode #mobile-space-btn { display: none; }

/* 移动端背包适配 */
body.mobile-mode #backpack-panel { width: 95vw !important; max-width: 600px; }
body.mobile-mode #backpack-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 6px !important; }

/* 背包固定标题栏和关闭按钮 */
#backpack-panel { overflow: hidden; }

body.mobile-mode #backpack-panel {
    width: min(94vw, 420px) !important;
    min-height: 0 !important;
    max-height: 86vh;
    padding: 14px !important;
    overflow-y: auto;
    z-index: 10060 !important;
}

body.mobile-mode #backpack-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
    min-height: 0 !important;
}

body.mobile-mode #item-tooltip {
    margin-top: 8px !important;
    max-height: 38vh;
    overflow-y: auto;
}

body.mobile-mode #item-use-btn {
    min-height: 40px;
    font-size: 16px;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.mobile-side-btn {
    display: none;
}

.mobile-mode .mobile-tap-active {
    transform: scale(0.93) !important;
    transition: transform 0.08s ease;
}

@media (max-width: 920px) {
    #hp-bar,
    #exp-bar {
        width: 150px;
        height: 16px;
    }

    #level-display {
        font-size: 16px;
    }

    #stats-container {
        transform: scale(0.92);
        transform-origin: top left;
    }
}

@media (max-width: 700px) {
    #mobile-controls {
        padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    #mobile-joystick-base {
        width: 108px;
        height: 108px;
    }

    #mobile-joystick-knob {
        width: 48px;
        height: 48px;
    }

    .mobile-right-panel {
        width: 226px;
        min-height: 216px;
    }

    #mobile-combat-cluster {
        width: 196px;
        height: 196px;
    }

    .mobile-action-stack {
        gap: 6px;
        bottom: 154px;
    }

    .mobile-action-btn {
        width: 136px;
        height: 44px;
        font-size: 14px;
    }

    .mobile-attack-btn {
        width: 80px;
        height: 80px;
        font-size: 20px;
        right: 8px;
        bottom: 8px;
    }

    body.mobile-mode #skills-container.mobile-skill-orbit {
        width: 196px;
        height: 196px;
    }

    body.mobile-mode #skills-container.mobile-skill-orbit > #skill1-icon {
        left: 90px !important;
        top: 176px !important;
    }

    body.mobile-mode #skills-container.mobile-skill-orbit > #skill2-icon {
        left: 78px !important;
        top: 138px !important;
    }

    body.mobile-mode #skills-container.mobile-skill-orbit > #skill3-icon {
        left: 98px !important;
        top: 100px !important;
    }

    body.mobile-mode #skills-container.mobile-skill-orbit > #skill-special-icon {
        left: 152px !important;
        top: 82px !important;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    body.mobile-mode #settings-panel {
        width: min(94vw, 500px);
        max-height: 94vh;
    }
    body.mobile-mode #settings-content {
        padding: 4px 8px;
    }
    body.mobile-mode .settings-section-body {
        padding: 5px 8px 7px;
    }
    body.mobile-mode #settings-header {
        padding: 7px 10px 5px 12px;
    }
    body.mobile-mode #settings-footer {
        padding: 6px 10px;
    }

    body.mobile-mode #backpack-panel {
        width: min(96vw, 620px) !important;
        max-height: 92vh !important;
        padding: 10px !important;
    }

    body.mobile-mode #backpack-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    body.mobile-mode #item-tooltip {
        max-height: 42vh;
    }
}


/* 移动端：对话点击继续 */
body.mobile-mode #dialogue-hint { display: none; }
body.mobile-mode #dialogue-hint-mobile { display: block !important; animation: pulse-hint 2s infinite; }
@keyframes pulse-hint { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
body.mobile-mode #dialogue-box { cursor: pointer; }
body.mobile-mode #mobile-space-btn { display: none; }
/* 移动端背包适配 */
body.mobile-mode #backpack-panel { width: 95vw !important; max-width: 600px; }
#backpack-panel { overflow: hidden; }

/* 攻击按钮：半透明 + 点击缩放反馈 */
#mobile-attack-btn {
    opacity: 0.7;
    transition: transform 0.08s ease-out, opacity 0.15s ease;
    background-color: transparent !important;
}
#mobile-attack-btn:active {
    transform: scale(0.85);
    opacity: 0.95;
}
#mobile-attack-btn.active {
    transform: scale(0.85);
    opacity: 0.95;
}

/* 设置按钮：帧序列图动画 (1024x1024, 4×4=16帧, 每帧256×256) */
#settings-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 48px;
    height: 48px;
    z-index: 100;
    pointer-events: auto;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    line-height: 0;
    font-size: 0;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('../assets/ui/setting ui.png');
    background-size: 192px 192px;
    background-repeat: no-repeat;
    background-position: 0 0;
    border: none !important;
    border-radius: 8px;
    cursor: pointer;
    text-indent: -9999px;
    overflow: hidden;
    background-color: transparent !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ========== 自定义UI编辑器 ========== */
body.cui-editing {
    /* 编辑模式下防止意外滚动 */
    overscroll-behavior: none;
}

body.cui-editing #mobile-controls {
    /* 编辑模式下强制可见 */
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.cui-editing #settings-panel {
    /* 编辑时隐藏设置面板，避免遮挡 */
    display: none !important;
}

.cui-edit-overlay {
    position: fixed;
    border: 2px dashed #ffd700;
    background: rgba(255, 215, 0, 0.08);
    z-index: 10060;
    pointer-events: auto;
    cursor: move;
    box-sizing: border-box;
    border-radius: 4px;
    transition: opacity 0.1s ease;
}

.cui-edit-overlay:active {
    cursor: grabbing;
}

.cui-edit-label {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #ffd700;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.cui-size-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: #ccc;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 6px;
    border-radius: 3px;
}

.cui-resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 20px;
    height: 20px;
    background: #ffd700;
    border-radius: 50%;
    cursor: nwse-resize;
    border: 3px solid #1a1a2e;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    transition: transform 0.1s ease;
    touch-action: none;
}

.cui-resize-handle:hover {
    transform: scale(1.2);
}

.cui-resize-handle:active {
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.9);
}

/* 底部工具栏 → 顶部工具栏 */
#cui-edit-toolbar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.92);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 10px 18px;
    z-index: 10080;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 215, 0, 0.15);
    pointer-events: auto;
}

.cui-toolbar-hint {
    color: #aaa;
    font-size: 12px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cui-dot-sample {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: #ffd700;
    border-radius: 50%;
    border: 2px solid #1a1a2e;
    vertical-align: middle;
    margin: 0 2px;
}

.cui-toolbar-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.cui-toolbar-btn:active {
    transform: scale(0.96);
}

.cui-btn-reset {
    background: #555;
    color: #fff;
}
.cui-btn-reset:hover {
    background: #777;
}

.cui-btn-cancel {
    background: #a40000;
    color: #fff;
}
.cui-btn-cancel:hover {
    background: #cc0000;
}

.cui-btn-save {
    background: #1a7a1a;
    color: #fff;
    padding: 8px 22px;
}
.cui-btn-save:hover {
    background: #22aa22;
}

/* 编辑时隐藏可能与覆盖层冲突的元素 */
body.cui-editing .cui-edit-overlay {
    /* 确保覆盖层在最前 */
}

/* 响应式 - 小屏幕工具栏 */
@media (max-width: 600px) {
    #cui-edit-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 8px 12px;
        top: 8px;
    }
    .cui-toolbar-hint {
        width: 100%;
        text-align: center;
        margin-right: 0;
        font-size: 11px;
    }
}

/* ---- 存档选择面板 ---- */
.save-slot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 8px;
    padding: 12px 14px;
    gap: 10px;
    cursor: default;
    transition: border-color 0.2s, background 0.2s;
}
.save-slot-item:hover {
    border-color: rgba(255,215,0,0.6);
    background: rgba(255,255,255,0.1);
}
.save-slot-item.empty-slot {
    border-color: rgba(255,255,255,0.12);
    opacity: 0.55;
}
.save-slot-item.auto-slot {
    border-color: rgba(133,193,233,0.3);
    border-style: dashed;
}
.save-slot-item.auto-slot:hover {
    border-color: rgba(133,193,233,0.6);
}

.save-slot-info {
    flex: 1;
    min-width: 0;
}
.save-slot-title {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 3px;
}
.save-slot-item.auto-slot .save-slot-title {
    color: #85c1e9;
}
.save-slot-detail {
    font-size: 11px;
    color: #bbb;
    line-height: 1.5;
}
.save-slot-time {
    font-size: 10px;
    color: #888;
}

.save-slot-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}
.save-slot-btn {
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    border: none;
    min-width: 52px;
    transition: background 0.15s, opacity 0.15s;
}
.save-slot-btn.load-btn {
    background: #2a7a3a;
    color: #fff;
}
.save-slot-btn.load-btn:hover {
    background: #35914a;
}
.save-slot-btn.delete-btn {
    background: #8b2a2a;
    color: #fff;
}
.save-slot-btn.delete-btn:hover {
    background: #a33;
}
.save-slot-btn.save-btn {
    background: #1a5276;
    color: #fff;
    border: 1px solid #85c1e9;
}
.save-slot-btn.save-btn:hover {
    background: #256a94;
}

/* 保存确认删除覆盖层 */
.save-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 2;
}
.save-confirm-text {
    font-size: 14px;
    color: #ffd700;
    text-align: center;
}
.save-confirm-btns {
    display: flex;
    gap: 12px;
}
.save-confirm-btns button {
    padding: 5px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    border: none;
}
.save-confirm-yes {
    background: #c0392b;
    color: #fff;
}
.save-confirm-no {
    background: #555;
    color: #fff;
}

/* ===== 漫画阅读器 ===== */
@keyframes comicSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

#comic-reader-ui input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.5);
}

#comic-reader-ui input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.5);
}

#comic-reader-close-btn:hover {
    background: rgba(200,40,40,0.95) !important;
    transform: scale(1.08);
}

#comic-prev-page-btn:hover,
#comic-next-page-btn:hover {
    background: rgba(255,255,255,0.22) !important;
    border-color: rgba(255,215,0,0.5) !important;
}

#comic-prev-page-btn:disabled,
#comic-next-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
