/* ════════════════════════════════════════════════════════════ */
/* 🧸 像素离散·换装小剧场 — 可爱手游风 UI                        */
/* 设计规范：粉色马卡龙 + 圆形大按钮 + 玻璃拟态 + 大圆角         */
/* ════════════════════════════════════════════════════════════ */

:root {
    /* 粉色主题色板 */
    --pink-main: #ff8bb3;      /* 主粉 */
    --pink-deep: #ff5e93;      /* 深粉（强调、激活） */
    --pink-soft: #ffd5e4;      /* 浅粉（背景） */
    --pink-bg: #ffe9f0;        /* 最浅粉 */
    --mint: #7dd8c7;           /* 薄荷（好感度） */
    --gold: #ffc857;           /* 金色（星级/硬币） */
    --purple-soft: #b8a5ff;    /* 淡紫（稀有度） */

    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 24px rgba(255, 139, 179, 0.22);

    --text-dark: #4a2a3a;
    --text-mid: #8a6a78;
    --text-light: #b99aac;

    /* 🎨 主题语义化表面色（默认浅色） */
    --bg-app: linear-gradient(135deg, #ffd5e4 0%, #ffe9f0 50%, #e8e4ff 100%);
    --surface-1: #ffffff;          /* 主卡片底（卡片、抽屉、modal 等） */
    --surface-2: #fff5f8;          /* 次级表面（hover、嵌套） */
    --surface-soft: var(--pink-bg);/* 柔和粉底 */
    --border-soft: var(--pink-soft);
    --shadow-soft: 0 4px 12px rgba(255, 139, 179, 0.15);
    --shadow-pop: 0 10px 22px rgba(255, 94, 147, 0.3);

    --radius-round: 999px;
    --radius-big: 28px;
    --radius-mid: 18px;
    --radius-sm: 12px;

    color-scheme: light;
}

/* ════════════════════════════════════════ */
/* 🌙 暗色主题（夜樱）— 冷灰黑底 + 粉色点缀 */
/* ════════════════════════════════════════ */
html[data-theme="dark"] {
    /* 粉色仅保留为高光 / 强调，降低饱和度 */
    --pink-main: #e87da5;
    --pink-deep: #f06292;
    --pink-soft: #352530;
    --pink-bg: #1e1820;

    /* 文字色：纯净灰白，不带粉调 */
    --text-dark: #edeef0;
    --text-mid: #9ea3ab;
    --text-light: #626670;

    /* App 背景：中性深灰（极微暖调，避免纯冷灰太硬） */
    --bg-app: linear-gradient(135deg, #141418 0%, #1a1a20 50%, #16161c 100%);

    /* 表面色：中性深灰 */
    --surface-1: #1e1e24;
    --surface-2: #28282f;
    --surface-soft: #161619;
    --border-soft: rgba(255, 255, 255, 0.08);

    /* 玻璃态：冷灰玻璃 + 极淡粉边 */
    --glass-bg: rgba(24, 24, 30, 0.78);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);

    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 10px 22px rgba(240, 98, 146, 0.3);

    color-scheme: dark;
}

/* 暗色：默认硬编码白底元素的整体兜底（覆盖未变量化的卡片/抽屉/modal） */
html[data-theme="dark"] .modal-cute,
html[data-theme="dark"] .drawer-content,
html[data-theme="dark"] .selectable-card,
html[data-theme="dark"] .card-info-panel,
html[data-theme="dark"] .menu-overlay,
html[data-theme="dark"] .menu-content,
html[data-theme="dark"] .gacha-result-card,
html[data-theme="dark"] .album-card,
html[data-theme="dark"] .gift-modal,
html[data-theme="dark"] .purchase-modal,
html[data-theme="dark"] .prefs-modal {
    background: var(--surface-1) !important;
    color: var(--text-dark);
}
/* 暗色：ghost 按钮 */
html[data-theme="dark"] .btn-cute-ghost {
    background: var(--surface-2) !important;
    color: var(--pink-main) !important;
    border-color: var(--border-soft) !important;
}
html[data-theme="dark"] .btn-cute-ghost:hover {
    background: var(--surface-1) !important;
}
/* 暗色：lock-badge 小角标 */
html[data-theme="dark"] .lock-badge {
    background: var(--surface-1);
    color: var(--pink-main);
    border-color: var(--border-soft);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
/* 暗色：图片型卡片下半部信息条 */
html[data-theme="dark"] .selectable-card .card-meta {
    background: var(--surface-2);
    color: var(--text-dark);
}
/* 暗色：滚动条轨道 */
html[data-theme="dark"] .drawer-body::-webkit-scrollbar-track,
html[data-theme="dark"] .modal-cute::-webkit-scrollbar-track {
    background: var(--surface-2);
}
/* 暗色：输入框/滑杆轨道 */
html[data-theme="dark"] input[type="range"]::-webkit-slider-runnable-track {
    background: var(--surface-2);
}
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background: var(--surface-2);
    color: var(--text-dark);
    border-color: var(--border-soft);
}
/* 暗色：文字大色块的次要色文字（pref-toggle 等使用了硬编码色） */
html[data-theme="dark"] .prefs-toggle {
    color: var(--text-mid);
}
/* 暗色：粉色按钮在深色下加柔和发光，去掉白色描边 */
html[data-theme="dark"] .btn-cute:not(.btn-cute-ghost) {
    box-shadow: 0 4px 16px rgba(232, 125, 165, 0.25),
                0 0 0 1px rgba(232, 125, 165, 0.15);
}
html[data-theme="dark"] .tab-btn-center {
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(232, 125, 165, 0.22);
}
/* 暗色：桌面端 tabbar 毛玻璃减弱，降低饱和度 */
html[data-theme="dark"] .bottom-tabbar {
    background: rgba(18, 18, 22, 0.82);
    border-color: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px) saturate(1);
    -webkit-backdrop-filter: blur(12px) saturate(1);
}

/* ════════════════════════════════════════════════════════════
   暗色：抽屉外壳 + 抽屉内子组件（剧情/相册/礼物/对话选项等）
   原本这些元素硬编码白底，深色下要全部转成深紫表面
   ════════════════════════════════════════════════════════════ */
/* 抽屉本体（之前用 .drawer-content 选择器写错，DOM 里只有 .drawer） */
html[data-theme="dark"] .drawer {
    background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-soft) 100%) !important;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .drawer-handle {
    background: rgba(255, 255, 255, 0.18);
}
html[data-theme="dark"] .drawer-title {
    color: var(--text-dark);
}
html[data-theme="dark"] .drawer-close {
    background: var(--surface-2);
    color: var(--pink-main);
}
html[data-theme="dark"] .drawer-close:hover {
    background: var(--pink-main);
    color: #fff;
}
html[data-theme="dark"] .drawer-mask {
    background: rgba(0, 0, 0, 0.55);
}

/* 卡片下方文字条（服装/场景卡） */
html[data-theme="dark"] .card-label {
    background: var(--surface-2);
    color: var(--text-dark);
}

/* 章节列表项 */
html[data-theme="dark"] .chapter-item {
    background: var(--surface-1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    color: var(--text-dark);
}
html[data-theme="dark"] .chapter-item:hover {
    border-color: var(--pink-main);
    box-shadow: 0 8px 18px rgba(240, 98, 146, 0.2);
}
html[data-theme="dark"] .chapter-item.completed {
    background: linear-gradient(135deg, var(--surface-1) 0%, var(--surface-2) 100%);
}
html[data-theme="dark"] .chapter-name {
    color: var(--text-dark);
}
html[data-theme="dark"] .chapter-meta {
    color: var(--text-mid);
}

/* 相册项 */
html[data-theme="dark"] .album-item {
    background: var(--surface-1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* 礼物商店：分类标签 + 礼物卡片 */
html[data-theme="dark"] .gift-cat-btn {
    background: var(--surface-2);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-mid);
}
html[data-theme="dark"] .gift-cat-btn:hover {
    background: var(--surface-1);
    color: var(--pink-main);
}
html[data-theme="dark"] .gift-card {
    background: var(--surface-1);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--text-dark);
}
html[data-theme="dark"] .gift-card.gift-rarity-ssr {
    background: linear-gradient(135deg, rgba(80, 60, 30, 0.95), rgba(60, 40, 20, 0.9));
}
html[data-theme="dark"] .gift-shop-header {
    background: linear-gradient(135deg, rgba(232, 125, 165, 0.06), rgba(168, 85, 247, 0.05));
    border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .gift-shop-balance {
    color: var(--text-dark);
}

/* 剧情对话选项 */
html[data-theme="dark"] .dialogue-choice {
    background: var(--surface-1);
    border-color: var(--border-soft);
    color: var(--text-dark);
}
html[data-theme="dark"] .dialogue-choice:hover {
    background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
    border-color: var(--pink-main);
}
html[data-theme="dark"] .dialogue-choice.choice-locked,
html[data-theme="dark"] .dialogue-choice.choice-locked:hover {
    background: rgba(60, 50, 75, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(220, 210, 230, 0.5);
}
html[data-theme="dark"] .choice-lock-hint {
    color: rgba(220, 210, 230, 0.45);
}

/* 旁白对话框 */
html[data-theme="dark"] .dialogue-box.narration {
    background: rgba(24, 24, 30, 0.88);
}
/* 暗色：普通对话框去白边，改为极淡灰边 */
html[data-theme="dark"] .dialogue-box {
    border-color: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(12px) saturate(1);
    -webkit-backdrop-filter: blur(12px) saturate(1);
}

/* 邮件模态框 */
html[data-theme="dark"] .mail-modal {
    background: var(--surface-1) !important;
    border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .mail-modal-body {
    background: var(--surface-1);
}
html[data-theme="dark"] .mail-modal-tip {
    background: linear-gradient(135deg, rgba(120, 80, 30, 0.35), rgba(100, 65, 20, 0.3));
    color: #fbbf24;
    border-color: rgba(255, 255, 255, 0.06);
}

/* 暗色：顶部栏胶囊 / 圆形导航 / 信息卡 / 抽屉头等所有"半透明白玻璃态"元素 */
html[data-theme="dark"] .pill-btn,
html[data-theme="dark"] .chapter-pill,
html[data-theme="dark"] .resource-pill,
html[data-theme="dark"] .stat-chip,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .round-nav-btn,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .side-info-right .round-nav-btn,
html[data-theme="dark"] .drawer-header,
html[data-theme="dark"] .selectable-card-grid-bg {
    background: rgba(28, 28, 34, 0.72) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-dark);
    backdrop-filter: blur(12px) saturate(1);
    -webkit-backdrop-filter: blur(12px) saturate(1);
}
/* 暗色：进度条底色（好感、等级） */
html[data-theme="dark"] .stat-bar {
    background: rgba(255, 255, 255, 0.08) !important;
}
/* 暗色：顶部资源胶囊里的数字、章节文字保持高对比 */
html[data-theme="dark"] .chapter-pill,
html[data-theme="dark"] .resource-pill,
html[data-theme="dark"] .resource-pill .res-num,
html[data-theme="dark"] .stat-chip,
html[data-theme="dark"] .stat-val {
    color: var(--text-dark) !important;
}
/* 暗色：用户胶囊内头像底色 */
html[data-theme="dark"] .user-pill-avatar {
    color: var(--text-dark);
}
html[data-theme="dark"] .round-nav-btn:hover {
    background: rgba(40, 40, 48, 0.88) !important;
}
html[data-theme="dark"] .round-nav-btn.locked,
html[data-theme="dark"] .round-nav-btn.locked:hover {
    background: rgba(28, 28, 34, 0.45) !important;
}
/* 暗色：顶部栏 / 信息卡内文字色矫正（避免还是显示原本的深色文字） */
html[data-theme="dark"] #userArea,
html[data-theme="dark"] .top-bar,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .info-card * {
    color: var(--text-dark);
}

/* 暗色：全身模式背景（用户开"白色背景"开关时，深色模式下应该是深色而不是白色） */
html[data-theme="dark"] .scene-bg.fullbody-bg {
    background-color: #141418 !important;
}

/* 全身模式下：去掉立绘的粉色发光 drop-shadow（避免在纯色背景下被裁切显得不自然） */
.character-layer.fullbody .character-wrap {
    filter: none !important;
}

/* 整体：移除滚动，固定全屏舞台 */
html.dressup-html {
    overflow: hidden;
    height: 100%;
    width: 100%;
}
.dressup-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;  /* 防止水平溢出 */
    height: 100%;
    height: 100vh;
    height: 100svh; /* 稳定小视口，避免地址栏展开时内容被撑出 */
    min-height: 0;  /* 防止 flex 子元素撑开 */
    background: var(--bg-app);
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text-dark);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;  /* 防止 iOS 横屏字体放大 */
    text-size-adjust: 100%;
    transition: background 0.4s ease, color 0.3s ease;
}

@supports (height: 100dvh) {
    .dressup-body {
        height: 100dvh;
    }
}

/* ════════════════════════════════════════ */
/* ⏳ 加载遮罩                                */
/* ════════════════════════════════════════ */
/* ── loading 遮罩（碧蓝航线风格） ── */
.loading-mask {
    position: fixed;
    inset: 0;
    z-index: 10000;
    overflow: hidden;
    transition: opacity 0.6s ease;
}
.loading-mask.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 全屏 CG 背景图 */
.loading-bg {
    position: absolute;
    inset: 0;
    background-color: #0d0a14;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    transition: background-image 0.3s ease;
}
/* 手机竖屏：图片完整显示（上下留黑边，类似电影宽银幕），避免人物被裁切 */
@media (max-aspect-ratio: 4/5) {
    .loading-bg {
        background-size: contain;
        background-position: center 35%;
    }
}
/* 手机横屏 & 接近方形屏：保持 cover 但焦点偏上，确保人物头部不被底部 UI 遮挡 */
@media (min-aspect-ratio: 4/5) and (max-width: 900px) {
    .loading-bg {
        background-position: center 30%;
    }
}

/* 底部渐变遮罩（让文字/进度条可读） */
.loading-overlay-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 6, 20, 0.88) 0%,
        rgba(10, 6, 20, 0.45) 30%,
        transparent 60%
    );
    pointer-events: none;
}
@media (max-aspect-ratio: 4/5) {
    .loading-overlay-gradient {
        background: linear-gradient(
            to top,
            rgba(10, 6, 20, 0.7) 0%,
            rgba(10, 6, 20, 0.2) 20%,
            transparent 40%
        );
    }
}

/* 底部信息区 */
.loading-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 clamp(20px, 5vw, 60px) clamp(24px, 4vh, 44px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.loading-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(0.82rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1.5px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

/* 进度条 */
.loading-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.loading-bar-track {
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
}
.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #c8a0e0 0%, #e8b4ff 50%, #ffffff 100%);
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
    position: relative;
    box-shadow: 0 0 8px rgba(220, 180, 255, 0.7);
}
.loading-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
    animation: loadingShimmer 1.6s ease-in-out infinite;
    border-radius: 999px;
}
@keyframes loadingShimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.loading-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}
.loading-percent {
    flex: 0 0 auto;
    min-width: 38px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.85);
}
.loading-detail {
    flex: 1 1 auto;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.loading-slow-tip {
    position: absolute;
    top: clamp(16px, 3vh, 28px);
    right: clamp(16px, 4vw, 36px);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.loading-slow-tip.visible {
    opacity: 1;
}

/* ════════════════════════════════════════ */
/* 🎮 主容器：全屏绝对定位舞台                */
/* ════════════════════════════════════════ */
.game-root {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* 防止子元素绝对定位溢出导致滚动 */
    contain: layout size;
}

/* 场景背景：轻微柔化让主体更突出 */
.scene-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-out, opacity 0.4s, filter 0.5s;
    background-color: var(--pink-soft);
    background-image: linear-gradient(135deg, #ffd5e4 0%, #e8e4ff 100%);
    z-index: 0;
    filter: saturate(1.05) brightness(1.02);
}
.scene-bg.fading { opacity: 0.3; }

/* 全身模式：用白色遮罩盖住场景背景，避免半身透视背景与全身人物不协调 */
.scene-bg.fullbody-bg {
    background-image: none !important;
    background-color: #ffffff !important;
    filter: none !important;
    transition: background-color 0.4s ease-out, filter 0.3s;
}
.scene-overlay.fullbody-bg {
    opacity: 0 !important;
    transition: opacity 0.4s ease-out;
}

/* 柔光叠加层：加强暖光氛围 + 暗角，让人物更突出 */
.scene-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 60%, transparent 30%, rgba(255, 139, 179, 0.18) 100%),
        radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.35) 0%, transparent 45%),
        radial-gradient(ellipse at 75% 85%, rgba(255, 139, 179, 0.22) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

/* ════════════════════════════════════════ */
/* 📌 顶部栏（三段式：返回 / 标题 / 资源）     */
/* ════════════════════════════════════════ */
/* 顶部栏：在超宽屏上同样内收，保持跟左右UI一致的最大边距 */
.top-bar {
    position: absolute;
    top: 0;
    left: max(0px, calc(50% - 660px));
    right: max(0px, calc(50% - 660px));
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    z-index: 50;
    pointer-events: none; /* 让中间无内容区域可穿透点击 */
}
.top-bar > * { pointer-events: auto; }

.top-left, .top-right {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}
#userArea {
    display: inline-flex;
    min-width: 0;
    max-width: min(140px, 24vw);
    overflow: visible;
}

/* 胶囊按钮（顶部通用） —— 用 clamp 流式缩放 */
.pill-btn {
    width: clamp(44px, 5vw, 64px);
    height: clamp(44px, 5vw, 64px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: clamp(1.2rem, 1.6vw, 1.85rem);
    transition: all 0.18s;
    color: var(--pink-deep);
    text-decoration: none;
    padding: 0;
}
.pill-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 28px rgba(255, 94, 147, 0.35);
}
.pill-btn:active {
    transform: scale(0.95);
}

/* 音频静音按钮状态 */
.pill-btn.muted {
    opacity: 0.6;
    color: var(--text-mid);
}
.pill-btn.muted:hover {
    opacity: 0.8;
}

/* 章节胶囊 */
.chapter-pill {
    padding: clamp(8px, 1vw, 14px) clamp(16px, 2.2vw, 30px);
    border-radius: var(--radius-round);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    color: var(--text-dark);
    font-size: clamp(0.88rem, 1.1vw, 1.18rem);
    font-weight: 700;
    white-space: nowrap;
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 资源胶囊 */
.resource-pill {
    display: flex;
    align-items: center;
    gap: clamp(6px, 0.8vw, 10px);
    padding: clamp(6px, 0.9vw, 10px) clamp(14px, 1.8vw, 22px) clamp(6px, 0.9vw, 10px) clamp(8px, 1vw, 12px);
    border-radius: var(--radius-round);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    min-width: clamp(70px, 8vw, 110px);
}
.res-icon { font-size: clamp(1.1rem, 1.4vw, 1.6rem); }
.res-num {
    font-size: clamp(0.88rem, 1.1vw, 1.2rem);
    font-weight: 800;
    color: var(--pink-deep);
    letter-spacing: 0.3px;
}

/* ════════════════════════════════════════ */
/* 🌸 左侧竖向圆形功能导航                    */
/* ════════════════════════════════════════ */
/* 左右竖向功能导航：贴屏幕两侧 */
.side-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.4vw, 18px);
    z-index: 44;
    max-height: calc(100% - 200px);
    max-height: calc(100dvh - 200px);
    overflow: visible;
    scrollbar-width: none;  /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;
}
.side-nav::-webkit-scrollbar { display: none; }
.side-nav-left {
    left: clamp(8px, 1.8vw, 26px);
}
.side-nav-right {
    right: clamp(8px, 1.8vw, 26px);
    /* 避免与右上角信息卡重叠：垂直居中偏下 */
    top: 65%;
    transform: translateY(-50%);
}

.round-nav-btn {
    position: relative;
    width: clamp(64px, 7vw, 96px);
    height: clamp(64px, 7vw, 96px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    /* 深色友好：粉色外发光减小，避免深色/纯色背景下裁切不自然 */
    box-shadow:
        0 2px 8px rgba(255, 139, 179, 0.10),
        inset 0 1px 4px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s;
    padding: 4px;
    color: var(--pink-deep);
}
.round-nav-btn:hover {
    transform: scale(1.06) translateY(-2px);
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 255, 255, 0.85);
    /* 发光范围减半 + 透明度降低，保留反馈但不耸人 */
    box-shadow:
        0 4px 12px rgba(255, 94, 147, 0.18),
        inset 0 1px 6px rgba(255, 255, 255, 0.6);
}
.round-nav-btn:active {
    transform: scale(0.95);
}
.round-nav-btn.locked {
    background: rgba(245, 240, 242, 0.88);
    color: #b99aac;
    cursor: not-allowed;
}
.round-nav-btn.locked:hover {
    transform: none;
}

.nav-emoji {
    font-size: clamp(1.7rem, 2.2vw, 2.5rem);
    filter: drop-shadow(0 1px 2px rgba(255, 94, 147, 0.18));
    line-height: 1;
}
.nav-icon-img {
    width: clamp(1.7rem, 2.2vw, 2.5rem);
    height: clamp(1.7rem, 2.2vw, 2.5rem);
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(255, 94, 147, 0.18));
    pointer-events: none;
}
.nav-tag {
    font-size: clamp(0.68rem, 0.72vw, 0.86rem);
    color: var(--pink-deep);
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1;
    text-shadow: none;
}
.round-nav-btn .view-toggle-emoji {
    font-size: clamp(1.45rem, 1.8vw, 2.1rem);
    width: clamp(1.45rem, 1.8vw, 2.1rem);
    height: clamp(1.45rem, 1.8vw, 2.1rem);
    object-fit: contain;
}
.round-nav-btn .view-toggle-text {
    font-size: clamp(0.68rem, 0.72vw, 0.86rem);
    font-weight: 900;
}
.lock-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: #fff;
    color: var(--pink-deep);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: var(--radius-round);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    border: 1.5px solid var(--pink-soft);
}

.round-nav-btn.round-sm {
    width: 60px;
    height: 60px;
}
.round-nav-btn.round-sm .nav-emoji {
    font-size: 1.5rem;
}
.round-nav-btn.round-sm .nav-icon-img {
    width: 1.7rem;
    height: 1.7rem;
}

/* ════════════════════════════════════════ */
/* 🧁 右侧信息卡（角色 + 好感度）             */
/* ════════════════════════════════════════ */
/* 右侧角色信息卡：回到屏幕右边 */
.side-info-right {
    position: absolute;
    right: clamp(8px, 1.8vw, 26px);
    /* 用 max() 确保不与顶部栏重叠：至少在顶部栏下方 */
    top: clamp(80px, 12vh, 130px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1vw, 14px);
    z-index: 40;
    max-width: clamp(180px, 24vw, 340px);
    /* 防止信息卡溢出底部 */
    max-height: calc(100% - 260px);
    overflow: hidden;
}

.info-card {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 14px);
    padding: clamp(7px, 0.9vw, 12px) clamp(14px, 1.6vw, 22px) clamp(7px, 0.9vw, 12px) clamp(7px, 0.9vw, 12px);
    border-radius: var(--radius-round);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.info-avatar {
    width: clamp(44px, 5vw, 72px);
    height: clamp(44px, 5vw, 72px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.15rem, 1.5vw, 1.95rem);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(255, 94, 147, 0.3);
    flex-shrink: 0;
    overflow: hidden;
}
.info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.info-meta { display: flex; flex-direction: column; min-width: 0; }
.info-name {
    font-size: clamp(0.88rem, 1.15vw, 1.28rem);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.info-sub {
    font-size: clamp(0.66rem, 0.82vw, 0.92rem);
    color: var(--text-mid);
    margin-top: 3px;
    white-space: nowrap;
}

/* 属性条 */
.stat-chip {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    padding: clamp(6px, 0.8vw, 10px) clamp(12px, 1.6vw, 20px) clamp(6px, 0.8vw, 10px) clamp(8px, 0.9vw, 12px);
    border-radius: var(--radius-round);
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.stat-icon { font-size: clamp(1rem, 1.2vw, 1.45rem); }
.stat-bar {
    flex: 1;
    height: clamp(10px, 1.2vw, 15px);
    border-radius: var(--radius-round);
    background: rgba(255, 213, 228, 0.6);
    overflow: hidden;
    min-width: clamp(80px, 11vw, 170px);
}
.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pink-main), var(--pink-deep));
    border-radius: inherit;
    transition: width 0.4s;
}
.stat-fill.stat-star {
    background: linear-gradient(90deg, var(--gold), #ff9a3d);
}
.stat-val {
    font-size: clamp(0.82rem, 1.05vw, 1.15rem);
    font-weight: 800;
    color: var(--pink-deep);
    min-width: clamp(30px, 3.2vw, 46px);
    text-align: right;
}

.side-info-right .round-nav-btn {
    align-self: flex-end;
    margin-top: 4px;
}

/* ════════════════════════════════════════ */
/* 👧 角色立绘                                */
/* ════════════════════════════════════════ */
/* ═══ 角色立绘 ═══ */
/* 核心思路：锚定"头部位置"，身体向下延伸，超出部分由 mask 渐隐吃掉
   —— 这样无论 height 怎么变，头始终在画面视觉黄金位（上方 1/4 处） */
.character-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    /* 默认放开溢出：允许通过偏好设置左右微调位置时，立绘超出舞台边界的部分仍完整显示，
       不再被裁切（腿部渐隐由 .character-wrap 的 mask-image 控制，不受影响）。
       手机端会在媒体查询中重新设回 hidden，避免与右侧选项栏/边缘 UI 重叠。 */
    overflow: visible;
}
.character-wrap {
    position: absolute;
    /* 🔑 关键：用 top 锚定头顶位置，不再用 bottom
       这样身体向下延伸到哪里就在哪里渐隐，头的位置永远稳定 */
    top: 14%;                  /* 头部下移：脸落在画面上 1/4 处，不再顶到天花板 */
    /* 🎯 默认居中显示（无 NPC 时舞台只有主角一人，居中最美观）
       用 left:50% + 独立 translate 属性居中，与 transform 动画（charFloat/outfitBounce/charEntrance）不冲突 */
    left: 50%;
    right: auto;
    translate: -50% 0;
    height: 130%;              /* 身体向下长到超出画面，多出来的部分被 mask 吃掉 */
    aspect-ratio: 9 / 16;
    max-width: min(58vw, 720px);
    min-width: 0;              /* 允许在极窄视口下收缩 */
    width: fit-content;
    animation: charFloat 4s ease-in-out infinite;
    filter: drop-shadow(0 16px 32px rgba(255, 94, 147, 0.25));
    /* 渐隐延后：头→胸→腰完全不透明，大腿中段开始渐隐，膝盖以下完全透明 */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0,0,0,0.75) 78%, rgba(0,0,0,0) 92%);
            mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0,0,0,0.75) 78%, rgba(0,0,0,0) 92%);
    transition: top 0.4s, height 0.4s cubic-bezier(.34,1.56,.64,1), max-width 0.4s, left 0.4s, translate 0.4s ease;
    pointer-events: auto;
}

/* 🎭 剧情模式且 NPC 在场（双立绘）：主角偏左，给右侧 NPC 让位
   使用 :has() 选择器检测同级 .npc-layer.active 状态。
   现代浏览器（Chrome 105+/Safari 15.4+/Firefox 121+）均已支持。 */
.game-root:has(.npc-layer.active) .character-wrap {
    left: max(5%, min(18vw, 320px));
    right: auto;
    translate: 0 0;
}

/* 全身模式：头部上移 + 高度收为 94%（让脚回到画面底部附近），去 mask */
.character-layer.fullbody .character-wrap {
    top: 3%;
    height: 94%;
    aspect-ratio: 9 / 16;
    max-width: min(42vw, 720px);
    -webkit-mask-image: none;
            mask-image: none;
}
@keyframes charFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.char-part {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center; /* 🔑 头部贴容器顶：锚定头的位置，身体向下延伸，超出容器的部分由 mask 吃掉 */
    transition: opacity 0.3s;
    user-select: none;
    -webkit-user-drag: none;
}

/* ═══ 视图切换按钮（全身/胸像） ═══ */
.view-toggle-btn {
    position: absolute;
    right: clamp(72px, 8vw, 150px);
    bottom: clamp(150px, 17vh, 200px);
    width: clamp(54px, 5.8vw, 76px);
    height: clamp(54px, 5.8vw, 76px);
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 3px solid #fff;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    color: var(--pink-deep);
    transition: all 0.18s;
    z-index: 36;
    pointer-events: auto;
    padding: 0;
}
.view-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 22px rgba(255, 94, 147, 0.4);
}
.view-toggle-btn:active { transform: scale(0.94); }
.view-toggle-emoji {
    font-size: clamp(1.15rem, 1.3vw, 1.65rem);
    line-height: 1;
}
.view-toggle-text {
    font-size: clamp(0.6rem, 0.72vw, 0.78rem);
    font-weight: 800;
    letter-spacing: 0.5px;
}
.char-body { z-index: 1; }
.char-outfit { z-index: 2; }
.char-expression { z-index: 3; }

/* 舞台提示气泡 */
.stage-hint {
    position: absolute;
    top: 78px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-round);
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    z-index: 20;
    animation: hintFade 6s ease forwards;
    pointer-events: none;
}
@keyframes hintFade {
    0% { opacity: 0; transform: translate(-50%, -10px); }
    10%, 70% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -10px); }
}
.hint-emoji { font-size: 1.1rem; }
.hint-text { font-size: 0.8rem; color: var(--text-dark); font-weight: 600; }

/* ════════════════════════════════════════ */
/* 💖 左下：超大换装主按钮                    */
/* ════════════════════════════════════════ */
/* 左下换装按钮：贴屏幕左边 */
.main-action-btn {
    display: none; /* 已移除，换装功能移至底部Tab栏 */
}
@keyframes mainBtnPulse {
    0%, 100% {
        box-shadow:
            0 12px 28px rgba(255, 94, 147, 0.5),
            0 0 0 4px rgba(255, 94, 147, 0.15),
            inset 0 -5px 12px rgba(0, 0, 0, 0.1),
            inset 0 5px 10px rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow:
            0 12px 28px rgba(255, 94, 147, 0.6),
            0 0 0 10px rgba(255, 94, 147, 0.08),
            inset 0 -5px 12px rgba(0, 0, 0, 0.1),
            inset 0 5px 10px rgba(255, 255, 255, 0.4);
    }
}
.main-action-btn:hover {
    transform: scale(1.06);
}
.main-action-btn:active {
    transform: scale(0.94);
}
.main-action-text {
    font-size: clamp(2.1rem, 2.6vw, 3.6rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1;
    margin-bottom: 4px;
}
.main-action-sub {
    font-size: clamp(0.66rem, 0.8vw, 1rem);
    color: #fff;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ════════════════════════════════════════ */
/* 🎀 底部图标 Tab 栏                         */
/* ════════════════════════════════════════ */
.bottom-tabbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: var(--radius-round);
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 30;
    /* 桌面端限制最大宽度，超宽屏不拉伸 */
    max-width: min(600px, 90vw);
    /* 确保不溢出屏幕 */
    box-sizing: border-box;
}

.tab-btn {
    min-width: clamp(54px, 6.5vw, 86px);
    padding: clamp(6px, 0.9vw, 10px) clamp(10px, 1.4vw, 18px);
    border-radius: var(--radius-round);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.18s;
    color: var(--text-mid);
}
.tab-btn:hover {
    background: rgba(255, 94, 147, 0.15);
    color: var(--pink-deep);
    transform: scale(1.08);
}
.tab-btn.active {
    background: transparent;
    color: var(--text-mid);
    box-shadow: none;
    transform: none;
}
.tab-btn.active .tab-text { color: inherit; }

.tab-emoji {
    font-size: clamp(1.3rem, 1.6vw, 1.95rem);
    line-height: 1;
}
.tab-icon {
    width: clamp(34px, 3.8vw, 50px);
    height: clamp(34px, 3.8vw, 50px);
    object-fit: contain;
    border-radius: 6px;
    transition: all 0.18s;
}
/* 图标始终保持原色，不灰度化 */
.tab-btn .tab-icon {
    filter: none;
}
.tab-btn:hover .tab-icon {
    filter: none;
    transform: scale(1.08);
}
.tab-btn.active .tab-icon {
    filter: none;
    transform: none;
}
.tab-text {
    font-size: clamp(0.66rem, 0.82vw, 0.92rem);
    font-weight: 700;
    letter-spacing: 0.3px;
    color: inherit;
}

/* 中间突出按钮 */
.tab-btn-center {
    transform: translateY(-14px) scale(1.2);
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    box-shadow: 0 6px 16px rgba(255, 94, 147, 0.5);
    border: 3px solid #fff;
    border-radius: 50%;
    aspect-ratio: 1;
    padding: 10px;
    justify-content: center;
}
.tab-btn-center:hover {
    transform: translateY(-18px) scale(1.25);
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
}
.tab-btn-center .tab-text { color: #fff; }
.tab-btn-center .tab-icon {
    filter: none !important;
    transform: none !important;
}
.tab-btn-center.active {
    transform: translateY(-18px) scale(1.25);
}

/* ════════════════════════════════════════ */
/* 🗂 抽屉面板（底部弹出）                    */
/* ════════════════════════════════════════ */
.drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* 使用 min() 确保矮屏设备不会被抽屉完全遮挡 */
    max-height: min(68vh, calc(100% - 80px));
    max-height: min(68dvh, calc(100% - 80px));
    background: linear-gradient(180deg, #fff 0%, var(--pink-bg) 100%);
    border-radius: var(--radius-big) var(--radius-big) 0 0;
    box-shadow: 0 -12px 40px rgba(255, 94, 147, 0.25);
    z-index: 80;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.drawer.open {
    transform: translateY(0);
}
.drawer-mask {
    position: absolute;
    inset: 0;
    background: rgba(74, 42, 58, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    z-index: 75;
    backdrop-filter: blur(2px);
}
.drawer-mask.open {
    opacity: 1;
    visibility: visible;
}
.drawer-handle {
    width: 48px;
    height: 5px;
    background: var(--pink-soft);
    border-radius: var(--radius-round);
    margin: 10px auto 4px;
    flex-shrink: 0;
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 12px;
    flex-shrink: 0;
}
.drawer-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: 0.5px;
}
.drawer-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--pink-soft);
    color: var(--pink-deep);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}
.drawer-close:hover {
    background: var(--pink-main);
    color: #fff;
    transform: rotate(90deg);
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 24px;
    -webkit-overflow-scrolling: touch;
}
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--pink-main); border-radius: 3px; }

.panel-content { display: none; }
.panel-content.active {
    display: block;
    animation: tabFadeIn 0.25s ease-out;
}
@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════ */
/* 🃏 服装/场景卡片                           */
/* ════════════════════════════════════════ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.selectable-card {
    position: relative;
    aspect-ratio: 2 / 3;
    background: #fff;
    border: 3px solid transparent;
    border-radius: var(--radius-mid);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.15);
}
.selectable-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--pink-main);
    box-shadow: 0 10px 22px rgba(255, 94, 147, 0.3);
}
.selectable-card.active {
    border-color: var(--pink-deep);
    box-shadow:
        0 0 0 3px rgba(255, 94, 147, 0.25),
        0 10px 22px rgba(255, 94, 147, 0.4);
}
.selectable-card.active::after {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(255, 94, 147, 0.5);
}
.selectable-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}
.selectable-card.locked:hover {
    transform: none;
}

.card-thumbnail {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pink-bg), var(--pink-soft));
    overflow: hidden;
}
.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.card-label {
    padding: 8px 6px;
    background: #fff;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-rarity {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: var(--radius-round);
    z-index: 1;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}
.card-rarity.N { background: #b99aac; color: #fff; }
.card-rarity.R { background: var(--mint); color: #fff; }
.card-rarity.SR { background: linear-gradient(135deg, var(--purple-soft), var(--pink-main)); color: #fff; }
.card-rarity.SSR { background: linear-gradient(135deg, var(--gold), #ff9a3d); color: #fff; }

/* ════════════════════════════════════════ */
/* 📖 章节列表                               */
/* ════════════════════════════════════════ */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chapter-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: var(--radius-mid);
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.15);
}
.chapter-item:hover {
    border-color: var(--pink-main);
    transform: translateX(4px);
    box-shadow: 0 8px 18px rgba(255, 94, 147, 0.25);
}
.chapter-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.chapter-item.locked:hover { transform: none; }
.chapter-item.completed {
    background: linear-gradient(135deg, #fff 0%, var(--pink-bg) 100%);
}
.chapter-item.completed .chapter-icon {
    background: linear-gradient(135deg, var(--mint), #5ec4b0);
    color: #fff;
}
.chapter-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(255, 94, 147, 0.3);
    border: 2px solid #fff;
}
.chapter-info { flex: 1; min-width: 0; }
.chapter-name {
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.chapter-meta {
    font-size: 0.85rem;
    color: var(--text-mid);
}
.chapter-arrow {
    color: var(--pink-main);
    font-size: 1.4rem;
    font-weight: 800;
}

/* ════════════════════════════════════════ */
/* 📷 相册                                  */
/* ════════════════════════════════════════ */
.album-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.album-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-mid);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.9;
}
.album-item {
    aspect-ratio: 9 / 16;
    background: #fff;
    border: 2px solid transparent;
    border-radius: var(--radius-mid);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 139, 179, 0.15);
    transition: all 0.18s;
}
.album-item:hover {
    transform: translateY(-3px);
    border-color: var(--pink-main);
}
.album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ════════════════════════════════════════ */
/* 💬 对话框（剧情）                          */
/* ════════════════════════════════════════ */
.dialogue-box {
    position: absolute;
    left: 50%;
    /* 使用 max() 确保对话框不被底部栏遮挡 */
    bottom: max(110px, calc(env(safe-area-inset-bottom, 0px) + 100px));
    transform: translateX(-50%);
    width: calc(100% - 60px);
    max-width: 680px;
    background: var(--glass-bg);
    border: 3px solid #fff;
    border-radius: var(--radius-big);
    padding: 18px 24px 40px;
    backdrop-filter: blur(16px);
    z-index: 60;
    cursor: pointer;
    box-shadow: 0 14px 40px rgba(255, 94, 147, 0.3);
    animation: dialogueIn 0.3s ease-out;
    box-sizing: border-box;
}
@keyframes dialogueIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
.dialogue-speaker {
    display: inline-block;
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: var(--radius-round);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(255, 94, 147, 0.35);
}
.dialogue-speaker:empty { display: none; }

.dialogue-text {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-dark);
    min-height: 1.7em;
    letter-spacing: 0.3px;
    font-weight: 500;
}
.dialogue-text.typing::after {
    content: '▌';
    color: var(--pink-main, #f472b6);
    animation: cursorBlink 0.6s steps(2) infinite;
    margin-left: 1px;
    font-weight: 400;
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.dialogue-box.narration {
    background: rgba(255, 255, 255, 0.85);
}
.dialogue-box.narration .dialogue-text {
    color: var(--text-mid);
    font-style: italic;
    text-align: center;
}

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}
.dialogue-choices:empty { display: none; }
.dialogue-choice {
    padding: 12px 18px;
    background: #fff;
    border: 2px solid var(--pink-soft);
    border-radius: var(--radius-mid);
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-align: left;
}
.dialogue-choice:hover {
    background: linear-gradient(135deg, var(--pink-soft), var(--pink-bg));
    border-color: var(--pink-deep);
    transform: translateX(6px);
    box-shadow: 0 4px 10px rgba(255, 94, 147, 0.2);
}

.dialogue-indicator {
    position: absolute;
    right: 20px;
    bottom: 14px;
    color: var(--pink-deep);
    font-size: 0.8rem;
    font-weight: 700;
    animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
.dialogue-box.has-choices .dialogue-indicator { display: none; }

/* ── 对话框内容切换淡入效果 ── */
.dialogue-box .dialogue-text {
    transition: opacity 0.2s ease;
}
.dialogue-box.dialogue-switching .dialogue-text {
    opacity: 0;
}

/* ── 旁白装饰线 ── */
.dialogue-box.narration::before,
.dialogue-box.narration::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--pink-soft), transparent);
}
.dialogue-box.narration::before { left: 12px; }
.dialogue-box.narration::after { right: 12px; }

/* ── 选择分支入场动画 ── */
.dialogue-choice {
    opacity: 0;
    transform: translateY(12px);
    animation: choiceSlideIn 0.35s ease-out forwards;
}
.dialogue-choice:nth-child(1) { animation-delay: 0.05s; }
.dialogue-choice:nth-child(2) { animation-delay: 0.15s; }
.dialogue-choice:nth-child(3) { animation-delay: 0.25s; }
.dialogue-choice:nth-child(4) { animation-delay: 0.35s; }
@keyframes choiceSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 选择按钮点击涟漪效果 ── */
.dialogue-choice:active {
    transform: scale(0.97);
    box-shadow: 0 0 0 3px rgba(255, 94, 147, 0.25);
}

/* ── 好感度锁定选项样式 ── */
.dialogue-choice.choice-locked {
    opacity: 0.55;
    background: #f5f0f2;
    border-color: #ddd;
    color: #999;
    cursor: not-allowed;
    position: relative;
    animation: choiceSlideIn 0.35s ease-out forwards;
}
.dialogue-choice.choice-locked:hover {
    transform: none;
    box-shadow: none;
    background: #f5f0f2;
    border-color: #ddd;
}
.choice-lock-hint {
    font-size: 0.78rem;
    color: #bbb;
    font-weight: 400;
    margin-left: 4px;
}

/* ── 自动播放按钮激活状态 ── */
.dialogue-tool-btn#btnStoryAuto.active {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    border-color: var(--pink-deep);
    box-shadow: 0 2px 8px rgba(255, 94, 147, 0.4);
    animation: autoPulse 1.5s ease-in-out infinite;
}
@keyframes autoPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(255, 94, 147, 0.4); }
    50%      { box-shadow: 0 2px 14px rgba(255, 94, 147, 0.7); }
}

/* ── 对话说话者名字入场动画 ── */
.dialogue-speaker:not(:empty) {
    animation: speakerPop 0.25s ease-out;
}
@keyframes speakerPop {
    from { opacity: 0; transform: translateY(-4px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ════════════════════════════════════════ */
/* 🌸 菜单弹层                                */
/* ════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(74, 42, 58, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-overlay.active { display: flex; }

.modal-cute {
    background: #fff;
    border-radius: var(--radius-big);
    padding: 28px;
    min-width: min(300px, 90vw);
    max-width: 90vw;
    /* 限制最大高度，防止小屏溢出 */
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(255, 94, 147, 0.3);
    border: 3px solid var(--pink-soft);
    box-sizing: border-box;
}
/* 弹窗自定义滚动条 */
.modal-cute::-webkit-scrollbar {
    width: 6px;
}
.modal-cute::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
.modal-cute::-webkit-scrollbar-thumb {
    background: rgba(255, 139, 179, 0.35);
    border-radius: 3px;
}
.modal-cute::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 139, 179, 0.55);
}
.modal-cute {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 139, 179, 0.35) transparent;
}
.modal-cute h2 {
    margin: 0 0 20px;
    color: var(--pink-deep);
    font-size: 1.3rem;
    text-align: center;
    font-weight: 900;
}
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.menu-btn {
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--pink-bg), var(--pink-soft));
    border: 2px solid transparent;
    border-radius: var(--radius-mid);
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: all 0.18s;
    display: block;
}
.menu-btn:hover {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(255, 94, 147, 0.35);
}
.modal-actions {
    margin-top: 20px;
    text-align: center;
}
@media (max-width: 480px) {
    .modal-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .modal-actions .btn-cute {
        width: 100%;
    }
}
.btn-cute {
    padding: 10px 32px;
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    border: none;
    border-radius: var(--radius-round);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 94, 147, 0.4);
    transition: all 0.18s;
}
.btn-cute:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 94, 147, 0.5);
}

/* ════════════════════════════════════════ */
/* 🍬 Toast                                  */
/* ════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: max(80px, env(safe-area-inset-top, 0px) + 60px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 500;
    pointer-events: none;
    /* 防止 toast 溢出屏幕 */
    max-width: calc(100vw - 32px);
    width: max-content;
}
.toast {
    padding: 10px 22px;
    background: var(--glass-bg);
    border: 2px solid #fff;
    border-radius: var(--radius-round);
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    animation: toastIn 0.3s ease-out;
    /* 防止过长文本溢出 */
    max-width: 90vw;
    word-break: break-word;
    text-align: center;
    box-sizing: border-box;
}
.toast.success { color: var(--mint); border-color: var(--mint); }
.toast.error { color: #ff5e6c; border-color: #ff5e6c; }
.toast.warning { color: #ff9a3d; border-color: #ff9a3d; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════ */
/* 📱 移动端适配（平板 & 手机）              */
/* 注：大部分 UI 尺寸由 clamp() 已经连续缩放 */
/* 这里只处理需要"布局重构"的部分           */
/* ════════════════════════════════════════ */

/* 平板 / 窄桌面 (≤ 900px)：立绘居中 */
@media (max-width: 900px) {
    .character-wrap {
        /* 🎯 居中：与桌面端保持一致的方案（left:50% + translate） */
        left: 50%;
        right: auto;
        translate: -50% 0;
        width: auto;
        max-width: 70vw;
        margin-left: 0;
        margin-right: 0;
    }
    .character-layer.fullbody .character-wrap {
        max-width: 70vw;
    }
    /* 平板端剧情双立绘：主角偏左让位给 NPC */
    .game-root:has(.npc-layer.active) .character-wrap {
        left: 4%;
        right: auto;
        translate: 0 0;
    }
    /* 平板端右侧信息卡缩小 */
    .side-info-right {
        max-width: clamp(130px, 18vw, 220px);
    }
}

/* 手机端 (≤ 640px)：立绘完全居中，布局紧凑 */
@media (max-width: 640px) {
    /* ═══════════════════════════════════════════════════ */
    /* 📱 手机端 UI 全面适配（≤640px）                      */
    /* 设计原则：大按钮易操作，资源竖排右侧，不裁切不拥挤    */
    /* ═══════════════════════════════════════════════════ */

    /* ── 顶部栏：只保留导航按钮+章节名，资源移到右侧 ── */
    .top-bar {
        left: 0;
        right: 0;
        padding: 8px 10px;
        flex-wrap: nowrap;
        gap: 8px;
        overflow: hidden;
    }
    .top-left {
        gap: 6px;
        flex-shrink: 0;
        order: 1;
    }
    .top-center {
        order: 2;
        flex: 1;
        min-width: 0;
    }
    .top-right {
        order: 3;
        gap: 6px;
        flex-shrink: 0;
    }

    /* 顶部按钮：大尺寸易点击 */
    .pill-btn {
        width: 58px;
        height: 58px;
        font-size: 1.55rem;
        flex-shrink: 0;
    }

    /* 资源胶囊：手机端从顶栏移到右侧竖排 */
    .resource-pill {
        position: fixed;
        right: max(6px, env(safe-area-inset-right, 0px));
        z-index: 45;
        padding: 7px 11px 7px 8px;
        gap: 5px;
        min-width: 0;
        max-width: min(34vw, 132px);
        border-radius: 22px;
        background: rgba(255, 255, 255, 0.88);
        border: 2px solid rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 14px rgba(255, 139, 179, 0.22);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-shrink: 0;
    }
    /* 三个资源胶囊竖排定位 —— 使用 calc 基于安全区计算，适配不同设备 */
    .top-right > .resource-pill:first-child { top: max(62px, env(safe-area-inset-top, 0px) + 54px); }
    .resource-pill.res-gold { top: max(108px, env(safe-area-inset-top, 0px) + 100px); }
    .resource-pill.res-normal { top: max(154px, env(safe-area-inset-top, 0px) + 146px); }

    .res-icon { font-size: 1.05rem; flex: 0 0 auto; }
    .res-num { font-size: 0.92rem; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .res-coin-icon { width: 20px; height: 20px; flex: 0 0 auto; }

    /* 章节胶囊 */
    .chapter-pill {
        font-size: 0.95rem;
        padding: 8px 16px;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }

    /* 手机端隐藏全屏按钮和音量按钮（节省空间） */
    #btnFullscreen { display: none; }
    #btnAudioToggle { display: none; }
    /* 手机端隐藏右侧信息卡 */
    .side-info-right { display: none; }

    /* ── 左右侧导航：大按钮，图标+文字易操作 ── */
    .side-nav {
        top: 50%;
        gap: 10px;
        max-height: calc(100dvh - 190px);
    }
    .side-nav-left {
        left: 6px;
    }
    .side-nav-right {
        right: max(6px, env(safe-area-inset-right, 0px));
    }
    .side-nav .round-nav-btn {
        width: 68px;
        height: 68px;
        aspect-ratio: 1;
        border-radius: 50%;
        border-width: 1.5px;
        gap: 3px;
        padding: 4px;
    }
    .side-nav .nav-emoji { font-size: 1.55rem; }
    .side-nav .nav-icon-img { width: 1.55rem; height: 1.55rem; }
    .side-nav .nav-tag {
        display: block;
        font-size: 0.72rem;
    }
    .side-nav .lock-badge { font-size: 0.6rem; padding: 2px 5px; top: -3px; right: -6px; }

    /* ── 立绘：居中显示（手机端缩小避免过满）── */
    /* 📱 手机端：放开 overflow，立绘不裁切（与桌面端保持一致） */
    .character-layer {
        overflow: visible;
    }
    /* 胸像模式：放大到头胸区域，但比之前收敛一些（1.48 → 1.25 dvh 倍率） */
    .character-wrap {
        top: 4%;
        height: 125dvh;
        width: 70.3dvh;         /* 按 9:16 立绘比例由高度驱动 */
        max-width: none;
        min-width: 0;
        aspect-ratio: 9 / 16;
        left: calc(50vw - 35.15dvh);
        right: auto;
        margin-left: 0;
        margin-right: 0;
        /* 📱 手机端默认布局：上移 11% + 缩放 86%。
           使用独立的 translate/scale 属性（不是 transform 简写），
           这样与 .character-wrap 上的动画 transform（outfit-bounce / char-entrance）不冲突，而是复合叠加。 */
        translate: 0 -11%;
        scale: 0.86;
        transform-origin: 50% 100%;
    }
    /* 全身模式：稍微收一点，避免顶天立地 */
    .character-layer.fullbody .character-wrap {
        top: 7%;
        height: 75dvh;
        width: 42.2dvh;
        max-width: none;
        left: calc(50vw - 21.1dvh);
        right: auto;
        margin-left: 0;
        margin-right: 0;
    }
    /* 📱 剧情模式 + NPC 出场：主角让出中央，左移到画面左侧；NPC 仍在右侧 */
    .game-root:has(.npc-layer.active) .character-wrap {
        left: 2%;
    }
    .game-root:has(.npc-layer.active) .character-layer.fullbody .character-wrap {
        left: 2%;
    }

    /* ── 底部 tabbar：灰色底，按钮塞满，点击高亮 ── */
    .bottom-tabbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;  /* 手机端取消桌面端的最大宽度限制 */
        transform: none;
        padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px)) 4px;
        gap: 1px;
        border-radius: 22px 22px 0 0;
        flex-wrap: nowrap;
        background: rgba(230, 230, 235, 0.92);
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        z-index: 100;
    }
    /* 深色模式：手机端底部 tabbar 改用深紫底（覆盖上面硬编码的浅灰白） */
    html[data-theme="dark"] .bottom-tabbar {
        background: rgba(22, 22, 26, 0.94);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.5);
    }
    .tab-btn {
        min-width: 0;
        padding: 10px 1px 8px;
        flex: 1 1 0;
        gap: 3px;
        border-radius: 14px;
        color: rgba(80, 80, 90, 0.7);
        background: transparent;
        transition: color 0.2s, background 0.2s;
    }
    .tab-btn:hover {
        background: rgba(255, 94, 147, 0.15);
        color: var(--pink-deep);
        transform: scale(1.08);
    }
    .tab-btn.active {
        background: transparent;
        color: inherit;
        box-shadow: none;
        transform: none;
    }
    .tab-btn.active .tab-text { color: inherit; }
    .tab-btn.active .tab-emoji { filter: none; }
    /* emoji始终保持原色 */
    .tab-btn .tab-emoji {
        filter: none;
        transition: filter 0.2s;
    }
    .tab-btn:hover .tab-emoji {
        filter: none;
    }
    .tab-emoji { font-size: clamp(1.9rem, 7vw, 2.3rem); }
    .tab-icon {
        width: clamp(36px, 10vw, 48px);
        height: clamp(36px, 10vw, 48px);
        object-fit: contain;
        border-radius: 6px;
    }
    .tab-btn .tab-icon {
        filter: none;
    }
    .tab-btn:hover .tab-icon {
        filter: none;
    }
    .tab-btn.active .tab-icon {
        filter: none;
    }
    .tab-text { font-size: clamp(0.88rem, 3.5vw, 1.05rem); font-weight: 700; letter-spacing: 0; color: inherit; }
    /* 手机端中间换装按钮：保持高亮但不突出 */
    .tab-btn-center {
        transform: none;
        border: none;
        padding: 10px 1px 8px;
        box-shadow: none;
        background: rgba(255, 94, 147, 0.15);
        color: #ff8bb3;
    }
    .tab-btn-center .tab-emoji { filter: none !important; }
    .tab-btn-center .tab-icon { filter: none !important; }
    .tab-btn-center .tab-text { color: #ff8bb3; }
    .tab-btn-center:hover {
        transform: scale(1.08);
        background: rgba(255, 94, 147, 0.25);
    }
    .tab-btn-center.active {
        transform: none;
        background: rgba(255, 94, 147, 0.15);
    }

    /* ── 抽屉面板 ── */
    .drawer {
        /* 底部留出导航栏高度，防止内容被遮挡 */
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        max-height: min(58vh, calc(100dvh - 100px - 72px));
    }
    .drawer-body { padding: 0 10px 16px; }

    /* ── 卡片网格：手机上固定 3 列 ── */
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .album-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    /* ── 舞台提示 ── */
    .stage-hint { top: 90px; }

    /* ── 对话框 ── */
    .dialogue-box {
        width: calc(100% - 16px);
        padding: 12px 14px 28px;
        /* 使用 calc 基于底部栏高度动态计算，防止被遮挡 */
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
}

/* 超小手机 (≤ 380px)：卡片改为 2 列 */
@media (max-width: 380px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .album-list { grid-template-columns: repeat(2, 1fr); }
    .character-wrap { height: 160dvh; width: 90dvh; max-width: none; left: calc(50vw - 45dvh); right: auto; margin-left: 0; margin-right: 0; }
    .character-layer.fullbody .character-wrap { height: 73dvh; width: 41dvh; max-width: none; left: calc(50vw - 20.5dvh); }
    /* 超小屏幕左右导航只略微收紧，保持可点击面积 */
    .side-nav {
        gap: 8px;
    }
    .side-nav-left {
        left: 4px;
    }
    .side-nav-right {
        right: max(4px, env(safe-area-inset-right, 0px));
    }
    .side-nav .round-nav-btn {
        width: 62px;
        height: 62px;
        aspect-ratio: 1;
        border-radius: 50%;
    }
    .side-nav .nav-emoji { font-size: 1.42rem; }
    .side-nav .nav-icon-img { width: 1.42rem; height: 1.42rem; }
    .side-nav .nav-tag { font-size: 0.68rem; }
    /* 资源胶囊紧凑 */
    .resource-pill {
        padding: 6px 10px 6px 8px;
        right: 4px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .character-wrap { height: 85%; }
    .main-action-btn { bottom: 90px; }
    .stage-hint { display: none; }
    /* 横屏时底部栏紧凑 */
    .bottom-tabbar {
        padding: 6px 12px;
        bottom: 8px;
    }
    /* 横屏时抽屉不能太高，且底部留出导航栏空间 */
    .drawer {
        bottom: calc(52px + env(safe-area-inset-bottom, 0px));
        max-height: min(50vh, calc(100dvh - 60px - 52px));
    }
    /* 横屏时左右功能栏靠两侧紧凑排列 */
    .side-nav {
        top: 50%;
        transform: translateY(-50%);
        gap: 8px;
        max-height: calc(100dvh - 80px);
    }
    .side-nav-left {
        left: 8px;
    }
    .side-nav-right {
        right: 8px;
    }
    .side-nav .round-nav-btn {
        width: 58px;
        height: 58px;
        aspect-ratio: 1;
        border-radius: 50%;
    }
    .side-nav .nav-emoji { font-size: 1.28rem; }
    .side-nav .nav-icon-img { width: 1.28rem; height: 1.28rem; }
    .side-nav .nav-tag { font-size: 0.62rem; }
}

@media (max-width: 640px) and (max-height: 500px) and (orientation: landscape) {
    .character-wrap {
        top: -4%;
        height: 210dvh;
        width: 118dvh;
        max-width: none;
        left: calc(50vw - 59dvh);
    }
    .character-layer.fullbody .character-wrap {
        top: 3%;
        height: 82dvh;
        width: 46dvh;
        max-width: none;
        left: calc(50vw - 23dvh);
    }
    .view-toggle-btn {
        width: 64px;
        height: 64px;
        right: 12px;
        bottom: 18px;
    }
}
/* ════════════════════════════════════════ */
/* 🌸 两侧装饰层：桌面端填充空白的樱花/爱心/星星 */
/* ════════════════════════════════════════ */
.side-decor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22vw;
    max-width: 340px;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}
.side-decor-left { left: 0; }
.side-decor-right { right: 0; }

/* 柔光气泡（两侧更大的粉色光晕） */
.decor-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: blobDrift 14s ease-in-out infinite;
}
.decor-blob-1 {
    width: 220px; height: 220px;
    top: 25%; left: -110px;
    background: radial-gradient(circle, #ff8bb3 0%, transparent 70%);
}
.decor-blob-2 {
    width: 240px; height: 240px;
    bottom: 12%; right: -130px;
    background: radial-gradient(circle, #b8a5ff 0%, transparent 70%);
    animation-delay: -6s;
}
@keyframes blobDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%     { transform: translate(20px, -30px) scale(1.08); }
    66%     { transform: translate(-15px, 20px) scale(0.95); }
}

/* 飘落樱花/小花 */
.decor-sakura {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0;
    filter: drop-shadow(0 4px 8px rgba(255, 94, 147, 0.25));
    animation: sakuraFall 10s linear infinite;
    will-change: transform, opacity;
}
.decor-sakura-1 { left: 18%; font-size: 1.8rem; animation-delay: 0s;    animation-duration: 11s; }
.decor-sakura-2 { left: 62%; font-size: 1.3rem; animation-delay: -3s;   animation-duration: 9s;  }
.decor-sakura-3 { left: 40%; font-size: 2.1rem; animation-delay: -6s;   animation-duration: 13s; }
.decor-sakura-4 { left: 28%; font-size: 1.6rem; animation-delay: -1.5s; animation-duration: 10s; }
.decor-sakura-5 { left: 70%; font-size: 2rem;   animation-delay: -4.5s; animation-duration: 12s; }
.decor-sakura-6 { left: 50%; font-size: 1.4rem; animation-delay: -8s;   animation-duration: 14s; }

@keyframes sakuraFall {
    0%   { transform: translate(0, -10%) rotate(0deg);     opacity: 0; }
    10%  { opacity: 0.85; }
    50%  { transform: translate(20px, 50vh) rotate(180deg); }
    90%  { opacity: 0.9; }
    100% { transform: translate(-15px, 110vh) rotate(360deg); opacity: 0; }
}

/* 漂浮爱心/星星（轻微上下浮动，不掉落） */
.decor-heart, .decor-star {
    position: absolute;
    font-size: 1.6rem;
    filter: drop-shadow(0 3px 6px rgba(255, 94, 147, 0.3));
    animation: decorBob 5s ease-in-out infinite;
}
.decor-heart-1 { top: 22%; left: 10%; font-size: 1.8rem; animation-delay: -1s; }
.decor-heart-2 { top: 65%; right: 14%; font-size: 2rem; animation-delay: -2.5s; }
.decor-star-1  { top: 10%; right: 16%; font-size: 1.3rem; animation-delay: 0s;   }
.decor-star-2  { top: 70%; left: 24%;  font-size: 1.5rem; animation-delay: -1.5s; }
.decor-star-3  { top: 35%; left: 16%;  font-size: 1.2rem; animation-delay: -3s; }
.decor-star-4  { top: 50%; right: 24%; font-size: 1.7rem; animation-delay: -4s; }

@keyframes decorBob {
    0%, 100% { transform: translateY(0) rotate(0deg);   opacity: 0.7; }
    50%      { transform: translateY(-14px) rotate(8deg); opacity: 1; }
}

/* 窄屏自动隐藏装饰层，避免遮挡主UI */
@media (max-width: 1024px) {
    .side-decor { width: 14vw; }
    .decor-heart, .decor-star, .decor-sakura { opacity: 0.6; }
    .decor-blob { opacity: 0.35; }
}
@media (max-width: 720px) {
    .side-decor { display: none; }
}

/* 用户偏好关闭动效时，停掉装饰动画 */
@media (prefers-reduced-motion: reduce) {
    .decor-sakura, .decor-heart, .decor-star, .decor-blob { animation: none; }
}

/* 用户手动关闭两侧装饰粒子（偏好设置） */
html[data-no-decor="1"] .side-decor { display: none !important; }

/* 深色模式下隐藏巨型光晕气泡（在深色背景上 screen 混合会被起亮得不自然，留下樱花/爱心/星星更优雅） */
html[data-theme="dark"] .decor-blob { display: none !important; }

/* 全身模式下隐藏巨型光晕气泡（全身构图需要更纯净的视觉，避免左下/右上的粉/紫光斑遮挡或抢戏） */
html[data-fullbody="1"] .decor-blob { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   🎬 视频过场层（开场 / 结尾 / 剧情中插）
   ═══════════════════════════════════════════════════════════ */
.video-cutscene {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.video-cutscene.active {
    opacity: 1;
}
.video-cutscene-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    outline: none;
}

/* 顶部标签（小小的，不打扰画面） */
.video-cutscene-topbar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    pointer-events: none;
    opacity: 0.85;
}
.video-cutscene-label::before {
    content: '🎬 ';
    margin-right: 4px;
}

/* 跳过按钮（右下角，3 秒后出现） */
.video-cutscene-skip {
    position: absolute;
    right: 24px;
    bottom: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.14);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(14px);
    transition: opacity 0.35s ease, transform 0.35s ease, background 0.2s, border-color 0.2s;
}
.video-cutscene-skip.ready {
    opacity: 1;
    transform: translateX(0);
}
.video-cutscene-skip:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: #fff;
}
.video-cutscene-skip .skip-icon {
    font-size: 1.1rem;
    font-weight: 700;
    transform: translateY(-1px);
}

/* 底部小提示 */
.video-cutscene-hint {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* 手机端：跳过按钮更贴近拇指热区 */
@media (max-width: 720px) {
    .video-cutscene-skip {
        right: 14px;
        bottom: 20px;
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    .video-cutscene-topbar {
        font-size: 0.78rem;
        padding: 5px 11px;
    }
    .video-cutscene-hint {
        font-size: 0.7rem;
        bottom: 64px; /* 避免被跳过按钮压住 */
    }
}

/* ═══════════════════════════════════════════════════════════
   📖 对话框内工具按钮（退出剧情等）
   ═══════════════════════════════════════════════════════════ */
.dialogue-tools {
    position: absolute;
    top: 10px;
    right: 14px;
    display: flex;
    gap: 6px;
    z-index: 2;
}
.dialogue-tool-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 139, 179, 0.4);
    border-radius: 999px;
    font-size: 0.72rem;
    color: #ad4f7b;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.dialogue-tool-btn:hover {
    background: #fff;
    transform: translateY(-1px);
}
.dialogue-tool-btn:active {
    transform: translateY(0) scale(0.95);
}

/* ═══════════════════════════════════════════════════════════
   🎉 章节完成结算面板
   ═══════════════════════════════════════════════════════════ */
.chapter-result {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(255, 180, 210, 0.45), rgba(60, 20, 50, 0.75));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.26s ease;
}
.chapter-result.active {
    opacity: 1;
}
.chapter-result-card {
    width: min(420px, 88vw);
    padding: 32px 28px 24px;
    background: linear-gradient(180deg, #fff 0%, #fff5f8 100%);
    border-radius: 26px;
    box-shadow:
        0 30px 60px -20px rgba(255, 94, 147, 0.4),
        0 0 0 3px rgba(255, 180, 210, 0.35) inset;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chapter-result.active .chapter-result-card {
    transform: scale(1) translateY(0);
}
.result-badge {
    font-size: 3.2rem;
    margin-bottom: 6px;
    filter: drop-shadow(0 4px 10px rgba(255, 139, 179, 0.5));
    animation: badgeFloat 2.4s ease-in-out infinite;
}
@keyframes badgeFloat {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-6px) rotate(4deg); }
}
.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e5548a;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.result-chapter {
    font-size: 1.05rem;
    color: #7a4864;
    font-weight: 600;
}
.result-subtitle {
    font-size: 0.85rem;
    color: #b08096;
    margin-top: 2px;
    margin-bottom: 18px;
}
/* 🎯 章节结算评级（S/A/B/C/D） */
.result-tier {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 12px;
    margin: 0 auto 16px;
    border-radius: 999px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff5f8, #ffe4ef);
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.18);
    animation: tierPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.result-tier .tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.12);
}
.result-tier .tier-emoji { font-size: 1.15rem; }
.result-tier .tier-label { color: #6e3a52; font-size: 0.92rem; }
/* 各评级配色 */
.result-tier.tier-S { background: linear-gradient(135deg, #fff7d6, #ffd8a8); box-shadow: 0 6px 18px rgba(255, 184, 76, 0.35); }
.result-tier.tier-S .tier-badge { background: linear-gradient(135deg, #ffb84d, #ff8a3d); }
.result-tier.tier-A { background: linear-gradient(135deg, #ffe7f1, #ffc4dc); }
.result-tier.tier-A .tier-badge { background: linear-gradient(135deg, #ff7aa8, #e5548a); }
.result-tier.tier-B { background: linear-gradient(135deg, #f0f4ff, #d8e4ff); }
.result-tier.tier-B .tier-badge { background: linear-gradient(135deg, #6b9eff, #4a7ad8); }
.result-tier.tier-C { background: linear-gradient(135deg, #f3eaff, #e0d0f5); }
.result-tier.tier-C .tier-badge { background: linear-gradient(135deg, #a978d8, #7d4eb0); }
.result-tier.tier-D {
    background: linear-gradient(135deg, #2a1a2e, #4a2838);
    box-shadow: 0 6px 20px rgba(80, 20, 50, 0.5);
}
.result-tier.tier-D .tier-badge { background: linear-gradient(135deg, #6b3a52, #3a1828); }
.result-tier.tier-D .tier-label { color: #ffd0e0; }
@keyframes tierPop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
/* 倒扣好感时的负数样式 */
.reward-val.reward-negative { color: #c0306e; }
.result-rewards {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin: 4px 0 22px;
    flex-wrap: wrap;
}
.result-reward {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px;
    background: linear-gradient(180deg, #fff0f7, #ffe4ef);
    border-radius: 16px;
    min-width: 88px;
    box-shadow: 0 4px 10px rgba(255, 139, 179, 0.15);
}
.reward-icon {
    font-size: 1.6rem;
    margin-bottom: 2px;
}
.reward-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e5548a;
}
.reward-lbl {
    font-size: 0.72rem;
    color: #a26381;
    margin-top: 2px;
}
.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.result-actions .btn-cute {
    min-width: 110px;
}
.btn-cute-ghost {
    background: #fff !important;
    color: #e5548a !important;
    border: 1.5px solid #ffb8d2 !important;
    box-shadow: none !important;
}
.btn-cute-ghost:hover {
    background: #fff5f8 !important;
}

@media (max-width: 480px) {
    .chapter-result-card {
        padding: 26px 20px 20px;
    }
    .result-title { font-size: 1.3rem; }
    .result-badge { font-size: 2.6rem; }
    .result-rewards { gap: 10px; }
    .result-reward {
        min-width: 72px;
        padding: 8px 14px;
    }
}

/* ═══════════════════════════════════════════════════════════
   ✨ UI 动效增强 — 换装 / 场景转场 / 粒子
   ═══════════════════════════════════════════════════════════ */

/* ── 换装闪烁：短暂白闪 + 缩小 ── */
.character-wrap.outfit-changing {
    animation: outfitFlash 0.18s ease-out forwards;
}
@keyframes outfitFlash {
    0%   { filter: drop-shadow(0 16px 32px rgba(255, 94, 147, 0.25)) brightness(1); transform: translateY(0) scale(1); }
    50%  { filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.9)) brightness(1.6); transform: translateY(0) scale(0.96); }
    100% { filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5)) brightness(1.3); transform: translateY(0) scale(0.97); }
}

/* ── 换装弹跳：切换完成后弹回 ── */
.character-wrap.outfit-bounce {
    animation: outfitBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes outfitBounce {
    0%   { transform: translateY(0) scale(0.97); filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5)) brightness(1.3); }
    40%  { transform: translateY(-12px) scale(1.04); filter: drop-shadow(0 20px 36px rgba(255, 94, 147, 0.4)) brightness(1.05); }
    70%  { transform: translateY(3px) scale(0.99); }
    100% { transform: translateY(0) scale(1); filter: drop-shadow(0 16px 32px rgba(255, 94, 147, 0.25)) brightness(1); }
}

/* ── 场景转场：淡出 + 轻微缩放 ── */
.scene-bg.scene-transitioning {
    animation: sceneOut 0.35s ease-out forwards;
}
@keyframes sceneOut {
    0%   { opacity: 1; transform: scale(1); filter: saturate(1.05) brightness(1.02); }
    100% { opacity: 0; transform: scale(1.03); filter: saturate(0.5) brightness(0.7) blur(4px); }
}

/* ── 场景转场闪光覆盖 ── */
.scene-overlay.scene-flash {
    background: rgba(255, 255, 255, 0.6) !important;
    transition: background 0.3s ease;
}
.scene-overlay.scene-flash-in {
    animation: sceneFlashIn 0.4s ease-out forwards;
}
@keyframes sceneFlashIn {
    0%   { background: rgba(255, 255, 255, 0.4); }
    100% { background: transparent; }
}

/* ── 换装粒子特效 ── */
.outfit-particle {
    position: fixed;
    font-size: 1.4rem;
    pointer-events: none;
    z-index: 9999;
    animation: particleBurst 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}
@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(0.3) rotate(0deg);
        opacity: 1;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(180deg);
        opacity: 0;
    }
}

/* ── 角色入场动画（首次加载） ── */
.character-wrap.char-entrance {
    animation: charEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes charEntrance {
    0%   { opacity: 0; transform: translateY(40px) scale(0.9); }
    60%  { opacity: 1; transform: translateY(-8px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 底部Tab切换时的微弹动画 ── */
.tab-btn.tab-switching {
    animation: tabPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tabPop {
    0%   { transform: translateY(0) scale(1); }
    50%  { transform: translateY(-6px) scale(1.15); }
    100% { transform: translateY(-4px) scale(1); }
}

/* ── 抽屉打开时卡片依次入场 ── */
.panel-content.active .selectable-card,
.panel-content.active .chapter-item {
    animation: cardStagger 0.35s ease-out backwards;
}
.panel-content.active .selectable-card:nth-child(1),
.panel-content.active .chapter-item:nth-child(1) { animation-delay: 0.03s; }
.panel-content.active .selectable-card:nth-child(2),
.panel-content.active .chapter-item:nth-child(2) { animation-delay: 0.06s; }
.panel-content.active .selectable-card:nth-child(3),
.panel-content.active .chapter-item:nth-child(3) { animation-delay: 0.09s; }
.panel-content.active .selectable-card:nth-child(4),
.panel-content.active .chapter-item:nth-child(4) { animation-delay: 0.12s; }
.panel-content.active .selectable-card:nth-child(5),
.panel-content.active .chapter-item:nth-child(5) { animation-delay: 0.15s; }
.panel-content.active .selectable-card:nth-child(6),
.panel-content.active .chapter-item:nth-child(6) { animation-delay: 0.18s; }
@keyframes cardStagger {
    0%   { opacity: 0; transform: translateY(16px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 服装卡片选中时的脉冲光环 ── */
.selectable-card.active {
    animation: cardActivePulse 2s ease-in-out infinite;
}
@keyframes cardActivePulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 94, 147, 0.25), 0 10px 22px rgba(255, 94, 147, 0.4); }
    50%      { box-shadow: 0 0 0 6px rgba(255, 94, 147, 0.15), 0 10px 22px rgba(255, 94, 147, 0.5); }
}

/* ── 用户偏好：减少动效 ── */
@media (prefers-reduced-motion: reduce) {
    .character-wrap.outfit-changing,
    .character-wrap.outfit-bounce,
    .character-wrap.char-entrance,
    .scene-bg.scene-transitioning,
    .outfit-particle,
    .tab-btn.tab-switching,
    .panel-content.active .selectable-card,
    .panel-content.active .chapter-item,
    .selectable-card.active {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   💖 好感度系统 UI
   ═══════════════════════════════════════════════════════════ */

/* ── 好感度进度条动画增强 ── */
.stat-fill.stat-fill-animating {
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* ── 好感度获得浮动提示 ── */
.toast.affection-toast {
    background: linear-gradient(135deg, #fff0f7, #ffe4ef) !important;
    border-color: var(--pink-main) !important;
    color: var(--pink-deep) !important;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.affection-gain-icon {
    font-size: 1.1rem;
    animation: heartPop 0.4s ease-out;
}
.affection-gain-reason {
    font-size: 0.78rem;
    color: var(--text-mid);
    font-weight: 500;
}
@keyframes heartPop {
    0%   { transform: scale(0.5); opacity: 0; }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── 好感度下降浮动提示（负向选项 / 失联衰减） ── */
.toast.affection-toast.affection-toast-down {
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff) !important;
    border-color: #a855f7 !important;
    color: #6b21a8 !important;
}
[data-theme="dark"] .toast.affection-toast.affection-toast-down {
    background: linear-gradient(135deg, #2a1438, #3a1a52) !important;
    border-color: #a855f7 !important;
    color: #e9d5ff !important;
}

/* ── 升级弹窗 ── */
.levelup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(255, 180, 210, 0.5), rgba(60, 20, 50, 0.7));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}
.levelup-overlay.active {
    opacity: 1;
}
.levelup-card {
    width: min(380px, 88vw);
    padding: 36px 28px 28px;
    background: linear-gradient(180deg, #fff 0%, #fff5f8 100%);
    border-radius: 28px;
    box-shadow:
        0 30px 60px -20px rgba(255, 94, 147, 0.45),
        0 0 0 3px rgba(255, 180, 210, 0.4) inset,
        0 0 80px rgba(255, 139, 179, 0.2);
    text-align: center;
    transform: scale(0.85) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.levelup-overlay.active .levelup-card {
    transform: scale(1) translateY(0);
}
.levelup-sparkle {
    font-size: 2.8rem;
    margin-bottom: 8px;
    animation: sparkleFloat 1.5s ease-in-out infinite;
}
@keyframes sparkleFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-6px) scale(1.08); }
}
.levelup-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--pink-deep);
    margin-bottom: 8px;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 8px rgba(255, 94, 147, 0.2);
}
.levelup-level {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.levelup-relation {
    font-size: 1.1rem;
    color: var(--pink-main);
    font-weight: 800;
    margin-bottom: 12px;
    padding: 6px 18px;
    background: linear-gradient(135deg, #fff0f7, #ffe4ef);
    border-radius: var(--radius-round);
    display: inline-block;
}
.levelup-unlock {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 18px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid rgba(255, 200, 87, 0.5);
    border-radius: var(--radius-mid);
}
.levelup-close {
    margin-top: 8px;
    min-width: 120px;
}

/* ── 升级弹窗手机端适配 ── */
@media (max-width: 480px) {
    .levelup-card {
        padding: 28px 20px 22px;
    }
    .levelup-sparkle { font-size: 2.2rem; }
    .levelup-title { font-size: 1.3rem; }
    .levelup-level { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════
   📱 移动端体验增强
   ═══════════════════════════════════════════════════════════ */

/* ── iOS / Android 底部安全区适配 ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-tabbar {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    .main-action-btn {
        bottom: calc(92px + env(safe-area-inset-bottom));
    }
    .dialogue-box {
        bottom: calc(110px + env(safe-area-inset-bottom));
    }
    .drawer {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .video-cutscene-skip {
        bottom: calc(32px + env(safe-area-inset-bottom));
    }
    .video-cutscene-hint {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* 顶部安全区适配（刘海屏、打孔屏等） */
@supports (padding-top: env(safe-area-inset-top)) {
    .top-bar {
        padding-top: max(14px, env(safe-area-inset-top));
    }
}

/* 手机端安全区细化 */
@media (max-width: 640px) {
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .bottom-tabbar {
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }
        .main-action-btn {
            bottom: calc(96px + env(safe-area-inset-bottom));
        }
        .dialogue-box {
            bottom: calc(88px + env(safe-area-inset-bottom));
        }
        /* 抽屉面板底部安全区 */
        .drawer {
            padding-bottom: calc(4px + env(safe-area-inset-bottom));
        }
    }
    @supports (padding-top: env(safe-area-inset-top)) {
        .top-bar {
            padding-top: max(8px, env(safe-area-inset-top));
        }
        /* 资源胶囊位置跟随顶部安全区调整 */
        .top-right > .resource-pill:first-child {
            top: max(64px, calc(env(safe-area-inset-top) + 52px));
        }
        .resource-pill.res-gold {
            top: max(116px, calc(env(safe-area-inset-top) + 104px));
        }
        .resource-pill.res-normal {
            top: max(168px, calc(env(safe-area-inset-top) + 156px));
        }
    }
}

/* ── 触摸反馈增强：按下态 ── */
@media (hover: none) and (pointer: coarse) {
    /* 触屏设备：取消 hover 效果，改用 active 态 */
    .pill-btn:hover,
    .round-nav-btn:hover,
    .tab-btn:hover,
    .selectable-card:hover,
    .chapter-item:hover,
    .menu-btn:hover,
    .dialogue-choice:hover {
        transform: none;
        box-shadow: inherit;
    }

    /* 按下时的缩放反馈 */
    .pill-btn:active {
        transform: scale(0.9);
        transition: transform 0.08s;
    }
    .round-nav-btn:active {
        transform: scale(0.88);
        transition: transform 0.08s;
    }
    .tab-btn:active {
        transform: scale(0.92);
        transition: transform 0.08s;
    }
    .selectable-card:active {
        transform: scale(0.95);
        transition: transform 0.08s;
        border-color: var(--pink-main);
    }
    .chapter-item:active {
        transform: scale(0.97);
        transition: transform 0.08s;
        border-color: var(--pink-main);
    }
    .menu-btn:active {
        transform: scale(0.97);
        background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
        color: #fff;
    }
    .dialogue-choice:active {
        transform: scale(0.97);
        background: linear-gradient(135deg, var(--pink-soft), var(--pink-bg));
        border-color: var(--pink-deep);
    }
    .dialogue-choice.choice-locked:active {
        transform: none;
        background: #f5f0f2;
        border-color: #ddd;
    }
    .main-action-btn:active {
        transform: scale(0.88);
        transition: transform 0.08s;
    }
    .view-toggle-btn:active {
        transform: scale(0.88);
        transition: transform 0.08s;
    }

    /* 触屏设备上增大点击区域 */
    .drawer-close {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    .dialogue-tool-btn {
        padding: 8px 14px;
        font-size: 0.82rem;
    }
}

/* ── 抽屉拖拽手柄增强（触摸设备） ── */
.drawer-handle {
    cursor: grab;
    touch-action: none;
}
.drawer-handle:active {
    cursor: grabbing;
}
.drawer.dragging {
    transition: none !important;
}

/* ── 横屏提示遮罩 ── */
.landscape-warning {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, var(--pink-soft), var(--pink-bg));
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    padding: 20px;
}
.landscape-warning-icon {
    font-size: 3.5rem;
    animation: rotatePhone 2s ease-in-out infinite;
}
@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(-90deg); }
    50%      { transform: rotate(-90deg); }
    75%      { transform: rotate(0deg); }
}
.landscape-warning-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.6;
}
.landscape-warning-sub {
    font-size: 0.85rem;
    color: var(--text-mid);
}

/* 仅在手机横屏时显示提示（平板横屏不提示） */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 900px) {
    .landscape-warning {
        display: flex;
    }
}

/* ── 抽屉内滚动优化 ── */
.drawer-body {
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    /* 防止内容溢出抽屉 */
    min-height: 0;
}

/* ── 防止 iOS 橡皮筋效果导致的布局跳动 ── */
.game-root {
    overscroll-behavior: none;
    touch-action: manipulation;
    /* 防止子元素导致的意外滚动 */
    -webkit-overflow-scrolling: auto;
}

/* ── 对话框触摸区域优化 ── */
@media (max-width: 640px) {
    .dialogue-box {
        /* 增大对话框的点击区域，方便拇指操作 */
        min-height: 120px;
        padding-bottom: 38px;
    }
    .dialogue-indicator {
        font-size: 0.85rem;
        right: 16px;
        bottom: 12px;
    }
    .dialogue-choices {
        gap: 8px;
    }
    .dialogue-choice {
        padding: 14px 16px;
        font-size: 1rem;
        /* 增大触摸目标 */
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* ── 超小手机左右导航微调 ── */
@media (max-width: 480px) {
    .side-nav {
        gap: 8px;
    }
    .side-nav .round-nav-btn {
        width: 60px;
        height: 60px;
        aspect-ratio: 1;
        border-radius: 50%;
    }
    .side-nav .nav-emoji { font-size: 1.34rem; }
    .side-nav .nav-icon-img { width: 1.34rem; height: 1.34rem; }
    .side-nav .nav-tag { font-size: 0.66rem; }
    .side-nav .lock-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
        top: -3px;
        right: -5px;
    }
}

/* ── 手机端右侧信息卡精简 ── */
@media (max-width: 480px) {
    .side-info-right {
        max-width: 140px;
    }
    .side-info-right .round-nav-btn.round-sm {
        width: 40px;
        height: 40px;
    }
    .side-info-right .round-nav-btn.round-sm .nav-emoji {
        font-size: 1.1rem;
    }
    .side-info-right .round-nav-btn.round-sm .nav-icon-img {
        width: 1.1rem;
        height: 1.1rem;
    }
    .info-card {
        padding: 5px 10px 5px 5px;
    }
    .info-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    .info-name { font-size: 0.75rem; }
    .info-sub { font-size: 0.6rem; }
    .stat-chip {
        padding: 4px 8px 4px 6px;
    }
    .stat-icon { font-size: 0.85rem; }
    .stat-bar { min-width: 40px; height: 6px; }
    .stat-val { font-size: 0.7rem; min-width: 24px; }
}

/* ── 超小手机底部 Tab 栏微调 ── */
@media (max-width: 480px) {
    .bottom-tabbar {
        padding: 6px 3px calc(6px + env(safe-area-inset-bottom, 0px)) 3px;
        bottom: 0;
        left: 0;
        right: 0;
        gap: 1px;
        border-radius: 18px 18px 0 0;
    }
    .tab-btn {
        min-width: 0;
        padding: 8px 1px 6px;
    }
    .tab-icon {
        width: clamp(32px, 9vw, 42px);
        height: clamp(32px, 9vw, 42px);
    }
    .tab-emoji { font-size: clamp(1.7rem, 6vw, 2rem); }
    .tab-text { font-size: clamp(0.78rem, 3vw, 0.92rem); }
    .tab-btn-center {
        transform: none;
        padding: 8px 1px 6px;
    }
    .tab-btn-center.active {
        transform: none;
    }
}

/* ── 触摸设备：禁止长按弹出菜单（图片/按钮） ── */
@media (hover: none) {
    .char-part,
    .card-thumbnail img,
    .round-nav-btn,
    .pill-btn,
    .main-action-btn {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* ════════════════════════════════════════ */
/* 📷 相册预览弹窗                            */
/* ════════════════════════════════════════ */
.album-preview-modal {
    max-width: 420px;
    padding: 20px;
    text-align: center;
}
.album-preview-modal h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    color: var(--text-dark);
}
.album-preview-canvas-wrap {
    width: 100%;
    max-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    border-radius: var(--radius-mid);
    overflow: hidden;
    background: #f8f0f4;
    box-shadow: 0 4px 16px rgba(255, 139, 179, 0.2);
}
.album-preview-canvas-wrap canvas {
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-mid);
}
.album-preview-info {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: var(--text-mid);
}
.album-preview-outfit,
.album-preview-scene {
    background: rgba(255, 139, 179, 0.12);
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
}
.album-preview-time {
    opacity: 0.7;
    font-size: 0.75rem;
}
.album-preview-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.album-preview-actions .btn-cute {
    font-size: 0.82rem;
    padding: 8px 14px;
}

/* ── 相册项增强：悬浮信息条 ── */
.album-item {
    position: relative;
}
.album-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
    border-radius: 0 0 var(--radius-mid) var(--radius-mid);
    opacity: 0;
    transition: opacity 0.2s;
}
.album-item:hover .album-item-overlay {
    opacity: 1;
}
.album-item-outfit {
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.album-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ffd5e4, #e8e4ff);
}

/* ── 相册预览弹窗响应式 ── */
@media (max-width: 480px) {
    .album-preview-modal {
        max-width: 95vw;
        padding: 14px;
    }
    .album-preview-canvas-wrap {
        max-height: 45vh;
    }
    .album-preview-canvas-wrap canvas {
        max-height: 45vh;
    }
    .album-preview-actions {
        gap: 6px;
    }
    .album-preview-actions .btn-cute {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 🎴 抽卡系统（已迁出至 dressup/gacha.css）                     */
/* ════════════════════════════════════════════════════════════ */

/* 抽卡 v1 / v2 / fullscreen 全部样式现位于 dressup/gacha.css */

/* ════════════════════════════════════════════════════════════ */
/* 🔐 认证 & 用户 UI                                          */
/* ════════════════════════════════════════════════════════════ */

/* 用户胶囊（已登录状态） */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-round);
    padding: 4px 12px 4px 4px;
    font-size: 0.78rem;
    color: var(--text-dark);
    cursor: default;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--glass-shadow);
    max-width: 140px;
    overflow: hidden;
    height: clamp(44px, 5vw, 64px);
    box-sizing: border-box;
}

.user-pill-avatar {
    font-size: 0.9rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-pill-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 登录按钮（未登录状态） */
.pill-login {
    animation: pulseSoft 2.5s ease-in-out infinite;
}

@keyframes pulseSoft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 139, 179, 0); }
    50% { box-shadow: 0 0 0 4px rgba(255, 139, 179, 0.25); }
}

/* 登录弹窗输入框 */
.game-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-dark);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.game-input:focus {
    border-color: var(--pink-main);
    box-shadow: 0 0 0 3px rgba(255, 139, 179, 0.2);
}

.game-input::placeholder {
    color: var(--text-light);
}

/* 登录弹窗在深色模式下的适配 — 游戏页面始终保持浅色/粉色风格 */
@media (prefers-color-scheme: dark) {
    .game-input {
        background: rgba(255, 255, 255, 0.9);
        border-color: var(--glass-border);
        color: var(--text-dark, #1f2937);
    }
    .game-input:focus {
        border-color: var(--pink-main);
    }
    .game-input::placeholder {
        color: var(--text-light, #9ca3af);
    }
    .user-pill {
        background: var(--glass-bg);
        border-color: var(--glass-border);
        color: var(--text-dark, #1f2937);
    }
}

/* 移动端登录弹窗适配 */
@media (max-width: 480px) {
    #gameLoginModal .modal {
        max-width: 92vw;
        padding: 18px;
    }
    .game-input {
        padding: 12px 14px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
}

/* ═══════════════════════════════════════════════════════════
   💰 付费系统 — 双币图标 + 价格标签 + 购买弹窗
   ═══════════════════════════════════════════════════════════ */

/* ─── 顶部资源栏：币种图标 ─── */
.res-coin-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 2px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.resource-pill.res-gold,
.resource-pill.res-normal {
    gap: 3px;
}

/* ─── 服装卡片：锁定状态增强 ─── */
.selectable-card.locked {
    position: relative;
}
.selectable-card.locked .card-thumbnail {
    filter: brightness(0.5) grayscale(0.4);
}
.selectable-card.locked:hover {
    border-color: var(--accent-char);
    cursor: pointer;
    opacity: 1;
}
.selectable-card.locked:hover .card-thumbnail {
    filter: brightness(0.7) grayscale(0.2);
}
.card-lock-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.9rem;
    z-index: 3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ─── 角色卡片：锁定徽章 ─── */
.card-lock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.85rem;
    z-index: 3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    animation: lock-pulse 2s ease-in-out infinite;
}
@keyframes lock-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ─── 🌑 NTR 线封存：takagi 角色卡完全封存样式 ─── */
.selectable-card.sealed-by-yui {
    position: relative;
    /* 🌑 卡片仍可点击 — 触发"仪式性独白"对话 */
    cursor: pointer;
    opacity: 0.65;
}
.selectable-card.sealed-by-yui .card-thumbnail {
    filter: brightness(0.25) grayscale(1) sepia(0.3) hue-rotate(240deg) saturate(1.5);
    transition: filter 0.4s ease;
}
.selectable-card.sealed-by-yui:hover {
    opacity: 0.75;
    border-color: rgba(155, 89, 182, 0.5) !important;
}
.selectable-card.sealed-by-yui:hover .card-thumbnail {
    filter: brightness(0.3) grayscale(1) sepia(0.4) hue-rotate(240deg) saturate(1.6);
}
.selectable-card.sealed-by-yui .card-thumbnail img {
    /* 黑紫剪影：让人物轮廓变成"消失感" */
    opacity: 0.85;
}
.selectable-card.sealed-by-yui .card-label {
    color: rgba(155, 89, 182, 0.7);
    font-style: italic;
}
.card-coming-soon.sealed-overlay {
    background: linear-gradient(135deg, rgba(60, 20, 80, 0.85), rgba(30, 10, 50, 0.92));
    color: #c8a2d8;
    border: 1px dashed rgba(155, 89, 182, 0.5);
    font-style: italic;
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(155, 89, 182, 0.6);
    animation: sealed-fade 3s ease-in-out infinite;
}
@keyframes sealed-fade {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; text-shadow: 0 0 12px rgba(155, 89, 182, 0.9); }
}

/* ─── 🌑 NTR 封存"仪式性独白"模态框 ─── */
.sealed-ritual-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(ellipse at center, rgba(20, 5, 35, 0.85), rgba(0, 0, 0, 0.95));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.32s ease;
}
.sealed-ritual-overlay.show {
    opacity: 1;
}
.sealed-ritual-modal {
    max-width: 460px;
    width: 100%;
    padding: 2.4rem 2rem 1.6rem;
    background: linear-gradient(160deg, rgba(40, 20, 65, 0.96), rgba(20, 10, 35, 0.98));
    border: 1px solid rgba(155, 89, 182, 0.45);
    border-radius: 14px;
    box-shadow: 0 0 60px rgba(155, 89, 182, 0.28), 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    color: #e8d8f5;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sealed-ritual-overlay.show .sealed-ritual-modal {
    transform: translateY(0) scale(1);
}
.sealed-ritual-icon {
    font-size: 2.6rem;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 0 16px rgba(155, 89, 182, 0.7));
    animation: ritual-glow 3.4s ease-in-out infinite;
}
@keyframes ritual-glow {
    0%, 100% { filter: drop-shadow(0 0 14px rgba(155, 89, 182, 0.5)); }
    50% { filter: drop-shadow(0 0 24px rgba(195, 130, 220, 0.85)); }
}
.sealed-ritual-monologue {
    margin: 0 0 1.6rem;
}
.sealed-ritual-line {
    margin: 0.45rem 0;
    font-size: 0.98rem;
    line-height: 1.7;
    color: #d8c4ec;
    font-style: italic;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: ritual-line-in 0.6s ease forwards;
}
.sealed-ritual-line:nth-child(1) { animation-delay: 0.15s; }
.sealed-ritual-line:nth-child(2) { animation-delay: 0.55s; }
.sealed-ritual-line:nth-child(3) { animation-delay: 0.95s; }
.sealed-ritual-line:nth-child(4) {
    animation-delay: 1.35s;
    color: #c8a2d8;
    font-weight: 500;
    margin-top: 0.85rem;
}
@keyframes ritual-line-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 0.92; transform: translateY(0); }
}
.sealed-ritual-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.4rem;
    opacity: 0;
    animation: ritual-line-in 0.6s ease forwards 1.7s;
}
.sealed-ritual-btn {
    width: 100%;
    padding: 0.78rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.04em;
}
.sealed-ritual-btn-leave {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #cfc4dc;
}
.sealed-ritual-btn-leave:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}
.sealed-ritual-btn-restart {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.32), rgba(120, 60, 160, 0.4));
    border: 1px solid rgba(195, 130, 220, 0.5);
    color: #f0d8ff;
}
.sealed-ritual-btn-restart:hover {
    background: linear-gradient(135deg, rgba(180, 110, 210, 0.5), rgba(140, 70, 180, 0.55));
    border-color: rgba(220, 160, 240, 0.8);
    color: #fff;
    box-shadow: 0 0 20px rgba(180, 110, 210, 0.4);
}
.sealed-ritual-hint {
    margin-top: 1rem;
    font-size: 0.72rem;
    color: rgba(200, 162, 216, 0.6);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: ritual-line-in 0.6s ease forwards 2s;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .sealed-ritual-modal {
        padding: 2rem 1.4rem 1.4rem;
    }
    .sealed-ritual-icon {
        font-size: 2.2rem;
    }
    .sealed-ritual-line {
        font-size: 0.92rem;
    }
}

/* ─── 角色卡片：副标题（敬请期待） ─── */
.card-subtitle {
    font-size: 0.6rem;
    color: var(--text-muted, #999);
    text-align: center;
    padding: 0 4px 4px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── 服装卡片：价格标签 ─── */
.card-price-tag {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fbbf24;
    white-space: nowrap;
    z-index: 3;
}
.card-price-tag .price-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

/* ─── 购买弹窗 ─── */
.purchase-modal {
    max-width: 400px !important;
    text-align: left;
}
.purchase-outfit-preview {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 16px 0;
    padding: 12px;
    background: rgba(31, 41, 55, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-default);
}
.purchase-thumb {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.purchase-outfit-info {
    flex: 1;
    min-width: 0;
}
.purchase-outfit-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.purchase-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}
.purchase-rarity {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}
.purchase-rarity.SSR {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.3));
    color: #fbbf24;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
}
.purchase-rarity.SR {
    background: rgba(244, 114, 182, 0.2);
    color: #f472b6;
}
.purchase-rarity.R {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}
.purchase-rarity.N {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}
.purchase-desc {
    font-size: 0.82rem;
    color: var(--text-sub);
    line-height: 1.5;
    margin: 0;
}

/* 价格行 */
.purchase-price-row,
.purchase-balance-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 0.9rem;
}
.purchase-price-label,
.purchase-balance-label {
    color: var(--text-sub);
    min-width: 70px;
}
.purchase-price-row .price-icon,
.purchase-balance-row .price-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}
.purchase-price-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fbbf24;
}
.purchase-currency-name {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.purchase-balance-val {
    font-weight: 600;
    color: var(--text-main);
}

/* 错误提示 */
.purchase-error {
    margin: 10px 0;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.8rem;
    text-align: center;
}

/* 购买弹窗按钮区 */
.purchase-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.purchase-recharge-link {
    text-decoration: none;
    font-size: 0.82rem;
}

/* 购买成功动画 */
@keyframes purchaseSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.selectable-card.just-unlocked {
    animation: purchaseSuccess 0.5s ease;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

/* ─── 即将上线标签 ─── */
.selectable-card.coming-soon {
    opacity: 0.7;
    position: relative;
}
.selectable-card.coming-soon .card-thumbnail {
    filter: brightness(0.4) grayscale(0.5) blur(1px);
}
.selectable-card.coming-soon:hover {
    opacity: 0.85;
    cursor: not-allowed;
}
.card-coming-soon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(139, 92, 246, 0.85);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
    z-index: 5;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* ─── 移动端购买弹窗适配 ─── */
@media (max-width: 480px) {
    .purchase-modal {
        max-width: 92vw !important;
    }
    .purchase-outfit-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .purchase-thumb {
        width: 100px;
        height: 120px;
    }
    .purchase-outfit-name-row {
        justify-content: center;
    }
    .purchase-actions {
        justify-content: center;
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 🫳 触摸互动系统                                              */
/* ════════════════════════════════════════════════════════════ */

/* ─── 触摸热区容器 ─── */
.touch-zones {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* ─── 单个热区 ─── */
.touch-zone {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

/* 开发模式下可视化热区（正式上线去掉） */
.touch-zone:hover {
    background: rgba(244, 114, 182, 0.12);
    box-shadow: 0 0 12px rgba(244, 114, 182, 0.3);
}

.touch-zone:active {
    background: rgba(244, 114, 182, 0.25);
    transform: scale(0.95);
}

/* ─── 各部位热区位置（百分比定位，适配不同尺寸立绘）
   分区：头/脸 → 胸 → 腰/下体 → 腿/脚 ─── */
.touch-zone-head {
    top: 0%;
    left: 22%;
    width: 56%;
    height: 20%;
    border-radius: 40%;
}

.touch-zone-chest {
    top: 20%;
    left: 22%;
    width: 56%;
    height: 18%;
    border-radius: 30%;
}

.touch-zone-waist {
    top: 38%;
    left: 18%;
    width: 64%;
    height: 22%;
    border-radius: 30%;
}

.touch-zone-legs {
    top: 60%;
    left: 15%;
    width: 70%;
    height: 35%;
    border-radius: 30%;
}

/* ─── 台词气泡 ─── */
.touch-bubble {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    padding: 10px 18px;
    border-radius: 16px;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.5;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(244, 114, 182, 0.25), 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1.5px solid rgba(244, 114, 182, 0.3);
    z-index: 20;
    animation: bubbleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: normal;
    word-break: keep-all;
}

.touch-bubble-tail {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.95);
}

.touch-bubble.hiding {
    animation: bubbleOut 0.25s ease-in forwards;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(8px) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes bubbleOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px) scale(0.9);
    }
}

/* ─── 触摸粒子（爱心飘散） ─── */
.touch-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}

.touch-particle {
    position: absolute;
    font-size: 1.2rem;
    animation: particleFloat 1.2s ease-out forwards;
    pointer-events: none;
    opacity: 0;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.1) rotate(15deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.6) rotate(-10deg);
    }
}

/* ─── 角色触摸动画 ─── */
.character-wrap.anim-shake-head {
    animation: shakeHead 0.5s ease-in-out;
}

.character-wrap.anim-puff-cheeks {
    animation: puffCheeks 0.4s ease-in-out;
}

.character-wrap.anim-flinch {
    animation: flinch 0.35s ease-in-out;
}

.character-wrap.anim-squeeze {
    animation: squeeze 0.5s ease-in-out;
}

@keyframes shakeHead {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-3deg); }
    40% { transform: rotate(3deg); }
    60% { transform: rotate(-2deg); }
    80% { transform: rotate(2deg); }
}

@keyframes puffCheeks {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.03) translateX(2px); }
    60% { transform: scale(1.02) translateX(-2px); }
}

@keyframes flinch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px) translateY(-2px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

@keyframes squeeze {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(0.97); }
    70% { transform: scale(1.02); }
}

/* ─── 触摸时角色脸红效果 ─── */
.character-wrap.touch-blush::after {
    content: "";
    position: absolute;
    top: 22%;
    left: 30%;
    width: 40%;
    height: 10%;
    background: radial-gradient(ellipse, rgba(255, 150, 180, 0.35) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: blushFade 2s ease-out forwards;
}

@keyframes blushFade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ─── 移动端触摸热区适配 ─── */
@media (max-width: 640px) {
    .touch-bubble {
        font-size: 0.82rem;
        padding: 8px 14px;
        max-width: 75vw;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        /* 防止气泡溢出容器 */
        box-sizing: border-box;
    }

    /* 手机端胸像模式：立绘放大到240%高度，只有上半部分可见
       需要将热区集中在可见区域内（大约容器的前60%是可见的）
       分区：头/脸 → 胸 → 腰/下体 → 腿/脚 */
    .touch-zone-head {
        top: 0%;
        left: 18%;
        width: 64%;
        height: 18%;
        border-radius: 40%;
    }

    .touch-zone-chest {
        top: 18%;
        left: 18%;
        width: 64%;
        height: 14%;
        border-radius: 30%;
    }

    .touch-zone-waist {
        top: 32%;
        left: 14%;
        width: 72%;
        height: 16%;
        border-radius: 30%;
    }

    .touch-zone-legs {
        top: 48%;
        left: 10%;
        width: 80%;
        height: 14%;
        border-radius: 30%;
    }
}

/* 手机端全身模式：热区恢复正常比例
   分区：头/脸 → 胸 → 腰/下体 → 腿/脚 */
@media (max-width: 640px) {
    .character-layer.fullbody .touch-zone-head {
        top: 0%;
        left: 22%;
        width: 56%;
        height: 20%;
    }

    .character-layer.fullbody .touch-zone-chest {
        top: 20%;
        left: 22%;
        width: 56%;
        height: 18%;
    }

    .character-layer.fullbody .touch-zone-waist {
        top: 38%;
        left: 18%;
        width: 64%;
        height: 22%;
    }

    .character-layer.fullbody .touch-zone-legs {
        top: 60%;
        left: 15%;
        width: 70%;
        height: 32%;
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 🎬 特殊CG画廊                                               */
/* ════════════════════════════════════════════════════════════ */

/* ─── CG画廊弹窗 ─── */
.cg-gallery-modal {
    max-width: 560px !important;
}
.cg-gallery-desc {
    color: var(--text-sub);
    font-size: 0.85rem;
    margin: 0 0 16px;
    text-align: center;
}

/* ─── CG网格 ─── */
.cg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px;
}

/* ─── CG卡片 ─── */
.cg-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1.5px solid var(--border-default);
    cursor: pointer;
    transition: all 0.2s ease;
}
.cg-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 114, 182, 0.2);
}
.cg-card.unlocked {
    border-color: rgba(244, 114, 182, 0.4);
}
.cg-card.unlocked:hover {
    border-color: var(--accent-outfit);
}
.cg-card.locked {
    opacity: 0.7;
}
.cg-card.locked:hover {
    opacity: 0.85;
    cursor: not-allowed;
}

/* CG缩略图 */
.cg-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.cg-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 锁定状态 */
.cg-card-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
}
.cg-lock-icon {
    font-size: 1.5rem;
}
.cg-lock-level {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-char);
    background: rgba(251, 191, 36, 0.15);
    padding: 2px 8px;
    border-radius: 8px;
}

/* 视频播放标识 */
.cg-card-play {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* CG信息 */
.cg-card-info {
    padding: 8px 10px;
}
.cg-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}
.cg-card-hint {
    font-size: 0.72rem;
    color: var(--text-sub);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── CG全屏查看器 ─── */
.cg-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cg-viewer.active {
    opacity: 1;
}

.cg-viewer-content {
    max-width: 90vw;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cg-viewer-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.cg-viewer-video {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.cg-viewer-info {
    margin-top: 20px;
    text-align: center;
}
.cg-viewer-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.cg-viewer-desc {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.cg-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.cg-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ─── 移动端CG适配 ─── */
@media (max-width: 480px) {
    .cg-gallery-modal {
        max-width: 95vw !important;
    }
    .cg-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .cg-viewer-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    .cg-viewer-info {
        padding: 0 16px;
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 🎁 礼物商城系统                                              */
/* ════════════════════════════════════════════════════════════ */

.gift-shop-panel {
    padding: 8px 4px;
}

.gift-shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(255,182,193,0.3), rgba(255,218,233,0.4));
    border-radius: var(--radius-mid);
    border: 1px solid rgba(255,139,179,0.2);
}

.gift-shop-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--pink-deep);
}

.gift-shop-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

.gift-coin-icon {
    width: 20px;
    height: 20px;
}

/* ── 分类标签 ── */
.gift-category-tabs {
    display: flex;
    gap: 6px;
    padding: 0 8px;
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gift-cat-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    border: 2px solid rgba(255,139,179,0.25);
    border-radius: var(--radius-round);
    background: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-mid);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.gift-cat-btn:hover {
    border-color: var(--pink-main);
    color: var(--pink-deep);
    background: rgba(255,220,235,0.5);
}

.gift-cat-btn.active {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(255,94,147,0.3);
}

/* ── 礼物网格 ── */
.gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 0 8px;
    max-height: 50vh;
    overflow-y: auto;
}

.gift-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px 10px;
    border-radius: var(--radius-mid);
    background: rgba(255,255,255,0.85);
    border: 2px solid rgba(200,200,220,0.3);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.gift-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(255,139,179,0.25);
    border-color: var(--pink-main);
}

.gift-card:active {
    transform: scale(0.96);
}

/* 稀有度边框 */
.gift-card.gift-rarity-n { border-color: rgba(107,114,128,0.3); }
.gift-card.gift-rarity-r { border-color: rgba(59,130,246,0.4); }
.gift-card.gift-rarity-sr { border-color: rgba(139,92,246,0.5); box-shadow: 0 2px 10px rgba(139,92,246,0.15); }
.gift-card.gift-rarity-ssr {
    border-color: rgba(251,191,36,0.6);
    box-shadow: 0 2px 14px rgba(251,191,36,0.25);
    background: linear-gradient(135deg, rgba(255,250,230,0.95), rgba(255,245,200,0.9));
    animation: giftSSRGlow 3s ease-in-out infinite;
}

@keyframes giftSSRGlow {
    0%, 100% { box-shadow: 0 2px 14px rgba(251,191,36,0.25); }
    50% { box-shadow: 0 4px 24px rgba(251,191,36,0.5), 0 0 40px rgba(251,191,36,0.1); }
}

.gift-card-icon {
    font-size: 2rem;
    margin-bottom: 6px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
}

/* 礼物图片图标 */
.gift-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    image-rendering: pixelated;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.gift-icon-img.gift-icon-modal {
    width: 80px;
    height: 80px;
    border-radius: 12px;
}

.gift-icon-emoji {
    font-size: 2rem;
    line-height: 1;
}

.gift-card-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.gift-card-affection {
    font-size: 0.72rem;
    color: var(--pink-deep);
    font-weight: 600;
    margin-bottom: 4px;
}

.gift-card-price {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-mid);
}

.gift-card-price.gift-price-gold {
    color: #d4930a;
    font-weight: 800;
}

.gift-price-icon {
    width: 14px;
    height: 14px;
}

/* ── 送礼弹窗 ── */
.gift-modal .gift-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
}

.gift-modal-icon {
    font-size: 3.5rem;
    line-height: 1;
    animation: giftBounce 1s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 80px;
}

@keyframes giftBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.gift-modal-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-dark);
}

.gift-modal-desc {
    font-size: 0.85rem;
    color: var(--text-mid);
    text-align: center;
    max-width: 240px;
}

.gift-modal-affection {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: linear-gradient(135deg, rgba(255,220,235,0.6), rgba(255,182,193,0.4));
    border-radius: var(--radius-round);
}

.gift-aff-label {
    font-size: 0.8rem;
    color: var(--text-mid);
}

.gift-aff-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--pink-deep);
}

.gift-modal-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.gift-modal-response {
    margin-top: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(255,240,247,0.9), rgba(255,228,239,0.8));
    border-radius: var(--radius-mid);
    border: 1px solid rgba(255,139,179,0.2);
    animation: giftResponseFadeIn 0.4s ease-out;
}

@keyframes giftResponseFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.gift-response-text {
    font-size: 0.9rem;
    color: var(--pink-deep);
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}

/* ── 移动端适配 ── */
@media (max-width: 480px) {
    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .gift-card {
        padding: 10px 4px 8px;
    }
    .gift-card-icon {
        font-size: 1.6rem;
        width: 44px;
        height: 44px;
    }
    .gift-icon-img {
        width: 36px;
        height: 36px;
    }
    .gift-icon-img.gift-icon-modal {
        width: 64px;
        height: 64px;
    }
    .gift-icon-emoji {
        font-size: 1.6rem;
    }
    .gift-card-name {
        font-size: 0.72rem;
    }
    .gift-category-tabs {
        gap: 4px;
    }
    .gift-cat-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 🛡️ UI 全局加固 — 防偏移 / 防溢出 / 低端设备兼容              */
/* ════════════════════════════════════════════════════════════ */

/* ── 全局 box-sizing 统一 ── */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ── 防止任何绝对/固定定位元素导致水平溢出 ── */
html.dressup-html,
.dressup-body,
.game-root {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── 图片防溢出 ── */
.game-root img {
    max-width: 100%;
    height: auto;
}

/* ── 弹窗居中加固：确保在任何屏幕尺寸下都居中 ── */
.modal-overlay {
    padding: 16px;
    box-sizing: border-box;
}
.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 超宽屏（≥1400px）：限制主要 UI 区域宽度 ── */
@media (min-width: 1400px) {
    .top-bar {
        left: max(0px, calc(50% - 700px));
        right: max(0px, calc(50% - 700px));
    }
    .side-nav-left {
        left: max(26px, calc(50% - 680px));
    }
    .side-info-right {
        right: max(26px, calc(50% - 680px));
    }
    .side-nav-right {
        right: max(26px, calc(50% - 680px));
    }
}

/* ── 超矮屏幕（≤400px 高度）：紧凑模式 ── */
@media (max-height: 400px) {
    .top-bar {
        padding: 4px 8px;
    }
    .pill-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .bottom-tabbar {
        padding: 5px 3px;
        bottom: 0;
        gap: 0;
    }
    .tab-icon {
        width: 30px;
        height: 30px;
    }
    .tab-emoji { font-size: 1.55rem; }
    .tab-text { font-size: 0.74rem; }
    .side-nav {
        gap: 6px;
    }
    .side-nav .round-nav-btn {
        width: 54px;
        height: 54px;
        aspect-ratio: 1;
        border-radius: 50%;
    }
    .side-nav .nav-emoji { font-size: 1.18rem; }
    .side-nav .nav-icon-img { width: 1.18rem; height: 1.18rem; }
    .side-nav .nav-tag { font-size: 0.58rem; }
    .drawer {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        max-height: calc(100% - 50px - 56px);
    }
    .dialogue-box {
        bottom: 60px;
        padding: 10px 12px 24px;
    }
}

/* ── 极窄屏幕（≤320px）：最小化 UI ── */
@media (max-width: 320px) {
    .pill-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    .chapter-pill {
        font-size: 0.8rem;
        padding: 6px 10px;
        max-width: 100px;
    }
    .side-nav .round-nav-btn {
        width: 54px;
        height: 54px;
        aspect-ratio: 1;
        border-radius: 50%;
    }
    .side-nav .nav-emoji { font-size: 1.16rem; }
    .side-nav .nav-icon-img { width: 1.16rem; height: 1.16rem; }
    .side-nav .nav-tag { font-size: 0.56rem; }
    .side-nav-left {
        left: 2px;
    }
    .side-nav-right {
        right: max(2px, env(safe-area-inset-right, 0px));
    }
    .side-nav {
        gap: 6px;
    }
    .resource-pill {
        right: max(3px, env(safe-area-inset-right, 0px));
        padding: 4px 7px 4px 6px;
        max-width: 104px;
        font-size: 0.78rem;
    }
    .res-icon { font-size: 0.95rem; }
    .res-num { font-size: 0.8rem; }
    .res-coin-icon { width: 17px; height: 17px; }
    .bottom-tabbar {
        border-radius: 12px 12px 0 0;
        gap: 0;
    }
    .tab-icon {
        width: 28px;
        height: 28px;
    }
    .tab-emoji { font-size: 1.5rem; }
    .tab-text { font-size: 0.72rem; }
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px;
    }
    .gift-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px;
    }
    .dialogue-box {
        width: calc(100% - 8px);
        padding: 10px 10px 24px;
    }
    .dialogue-text {
        font-size: 0.9rem;
    }
}

/* ── 高 DPI 屏幕优化（Retina 等）── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pill-btn,
    .round-nav-btn,
    .tab-btn,
    .selectable-card,
    .gift-card {
        /* 确保边框在高 DPI 下清晰 */
        border-width: 2px;
    }
}

/* ── 低端设备性能优化：减少 backdrop-filter ── */
@media (max-width: 480px) and (max-height: 700px) {
    .pill-btn,
    .resource-pill,
    .chapter-pill,
    .info-card,
    .stat-chip {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

/* ── 打印样式（防止意外打印时布局崩溃）── */
@media print {
    .game-root { overflow: visible; height: auto; }
    .bottom-tabbar, .side-nav-left, .side-info-right, .top-bar { display: none; }
}

/* ═══════════════════════════════════════════
   💎 游戏内充值弹窗样式
   ═══════════════════════════════════════════ */

/* ── 两种点数说明区 ── */
.game-currency-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    background: rgba(255, 228, 240, 0.5);
    border: 1.5px solid rgba(255, 139, 179, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 16px 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #4b5563;
}

.game-currency-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.game-coin-icon {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    vertical-align: middle;
}

/* ── 套餐列表 ── */
.game-pay-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.game-pay-item {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: rgba(255, 228, 240, 0.5);
    border: 1.5px solid rgba(255, 139, 179, 0.2);
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.game-pay-item:hover {
    background: rgba(255, 210, 228, 0.7);
    border-color: rgba(255, 139, 179, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.2);
}

.game-pay-item:active {
    transform: scale(0.98);
}

.game-pay-item.recommend:hover {
    background: rgba(255, 200, 220, 0.6);
    border-color: var(--pink-main);
    box-shadow: 0 4px 15px rgba(255, 94, 147, 0.2);
}

.game-pay-item.selected {
    border-color: var(--pink-main);
    background: rgba(255, 200, 220, 0.5);
    box-shadow: 0 0 12px rgba(255, 94, 147, 0.25);
}

/* ── 推荐/HOT/VIP 标签 ── */
.game-rec-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--pink-main, #ff5e93);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-bottom-left-radius: 6px;
    font-weight: bold;
    z-index: 2;
}

.game-rec-badge.hot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.game-rec-badge.vip {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fffbeb;
}

/* ── 套餐内容 ── */
.game-pkg-title {
    color: var(--text-dark, #1f2937);
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-pkg-currency-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.game-pkg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: nowrap;
}

.game-pkg-badge .game-coin-icon {
    width: 14px;
    height: 14px;
}

.game-pkg-badge.normal {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border-color: #93c5fd;
}

.game-pkg-badge.gold {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border-color: #fbbf24;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.15);
}

.game-pkg-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}

.game-pkg-price {
    color: var(--pink-deep, #d6336c);
    font-weight: 800;
    font-size: 1.1rem;
    white-space: nowrap;
    margin-left: 12px;
}

/* ── 支付区域 ── */
#gamePaymentSection {
    width: 100%;
    max-width: 380px;
    margin: 16px auto 0;
    padding: 20px;
    text-align: center;
    background: rgba(255, 228, 240, 0.4);
    border: 1.5px solid rgba(255, 139, 179, 0.2);
    border-radius: 12px;
}

#gameQrcode {
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.15);
}

#gameQrcode img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* ── 移动端适配 ── */
@media (max-width: 520px) {
    .game-currency-intro {
        flex-direction: column;
        align-items: flex-start;
    }
    .game-currency-intro > span:nth-child(2) {
        display: none; /* 隐藏分隔符 */
    }
    .game-pay-item {
        padding: 12px;
    }
    .game-pkg-title {
        font-size: 0.9rem;
    }
    .game-pkg-price {
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════ */
/* 📬 邮件系统（公告/补偿/奖励）                              */
/* ═══════════════════════════════════════════════════════════ */

/* 菜单中邮件按钮的内联红点 */
.mail-badge-inline {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: bold;
    line-height: 16px;
    text-align: center;
    margin-left: 6px;
    vertical-align: middle;
    animation: mail-badge-pulse 2s ease-in-out infinite;
}

@keyframes mail-badge-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5); }
    50%      { transform: scale(1.15); box-shadow: 0 3px 10px rgba(239, 68, 68, 0.8); }
}

/* 邮件模态框 */
.mail-modal {
    width: 92%;
    background: #fff;
    border: 3px solid var(--pink-soft);
    border-radius: var(--radius-big);
    box-shadow: 0 20px 60px rgba(255, 94, 147, 0.25);
}

.mail-modal-header {
    background: linear-gradient(135deg, var(--pink-soft), var(--pink-bg));
    padding: 16px 20px;
    border-bottom: 2px solid var(--pink-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-big) var(--radius-big) 0 0;
}

.mail-modal-header h2 {
    color: var(--pink-deep);
    font-weight: 900;
}

.mail-modal-badge {
    font-size: 0.65rem;
    background: rgba(255, 94, 147, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--pink-deep);
    font-weight: 600;
}

.mail-modal-close {
    background: none;
    border: none;
    color: var(--text-mid);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.mail-modal-close:hover {
    color: var(--pink-deep);
    background: rgba(255, 139, 179, 0.15);
}

.mail-modal-tip {
    padding: 10px 20px;
    font-size: 0.75rem;
    line-height: 1.5;
    border-bottom: 2px solid var(--pink-soft);
    background: linear-gradient(135deg, #fff7ed, #fffbeb);
    color: #b45309;
}

.mail-modal-body {
    padding: 18px 20px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: #fff;
}

.mail-stat-chip {
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--pink-bg), var(--pink-soft));
    color: var(--pink-deep);
    padding: 3px 10px;
    border-radius: 8px;
    font-weight: 600;
}

.mail-refresh-btn {
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--pink-bg), var(--pink-soft));
    color: var(--pink-deep);
    border: 1.5px solid var(--pink-soft);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.18s;
}
.mail-refresh-btn:hover {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    border-color: var(--pink-main);
}

.mail-list-container {
    max-height: 48vh;
    overflow-y: auto;
    padding-right: 4px;
}
.mail-list-container::-webkit-scrollbar { width: 6px; }
.mail-list-container::-webkit-scrollbar-thumb { background: rgba(255, 139, 179, 0.35); border-radius: 3px; }
.mail-list-container::-webkit-scrollbar-thumb:hover { background: rgba(255, 139, 179, 0.55); }

.mail-helper-text {
    margin-top: 14px;
    font-size: 0.72rem;
    line-height: 1.7;
    color: var(--text-light);
}

/* 邮件卡片 */
.mail-card {
    background: linear-gradient(135deg, #fff 0%, var(--pink-bg) 100%);
    border: 1.5px solid var(--pink-soft);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}
.mail-card.unread {
    border-left: 3px solid var(--gold);
    background: linear-gradient(90deg, #fff 0%, #fffbeb 100%);
    box-shadow: 0 2px 8px rgba(255, 200, 87, 0.15);
}
.mail-card.read {
    opacity: 0.65;
}
.mail-card:hover {
    border-color: var(--pink-main);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 139, 179, 0.2);
}

.mail-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mail-icon {
    font-size: 1.1rem;
}
.mail-title {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    word-break: break-all;
}
.mail-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--pink-deep);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 94, 147, 0.6);
}
.mail-date {
    font-size: 0.65rem;
    color: var(--text-light);
}

.mail-body {
    color: var(--text-mid);
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: 10px;
    white-space: pre-wrap;
    padding: 8px 12px;
    background: var(--pink-bg);
    border-radius: var(--radius-sm);
    border-left: 2.5px solid var(--pink-main);
}

.mail-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.mail-reward {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: bold;
    border: 1.5px solid #fbbf24;
}
.mail-claimed {
    color: var(--mint);
    font-size: 0.7rem;
    font-weight: bold;
}

.mail-btn-claim, .mail-btn-read, .mail-btn-del {
    background: linear-gradient(135deg, var(--pink-bg), var(--pink-soft));
    color: var(--text-dark);
    border: 1.5px solid var(--pink-soft);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.18s ease;
}
.mail-btn-claim {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    border-color: var(--pink-main);
    font-weight: bold;
}
.mail-btn-claim:hover {
    background: linear-gradient(135deg, var(--pink-deep), #ff3d7f);
    box-shadow: 0 3px 10px rgba(255, 94, 147, 0.4);
    transform: translateY(-1px);
}
.mail-btn-read:hover {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    border-color: var(--pink-main);
}
.mail-btn-del:hover {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    border-color: #f87171;
    color: #991b1b;
}

/* 手机端适配 */
@media (max-width: 600px) {
    .mail-modal {
        max-width: 100% !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }
    .mail-modal-header {
        padding: 14px 16px;
        border-radius: 20px 20px 0 0;
    }
    .mail-modal-tip {
        padding: 8px 16px;
        font-size: 0.7rem;
    }
    .mail-modal-body {
        padding: 14px 16px;
    }
    .mail-list-container {
        max-height: 40vh;
    }
}

/* ════════════════════════════════════════════════════════════
   ⚙️ 显示偏好（立绘位置/缩放、全身白底开关）
   ════════════════════════════════════════════════════════════ */

/* 立绘 transform：通过 .character-wrap 上的 CSS 变量驱动，
   挂在 .char-part 上避免影响 .character-wrap 上的动画 transform */
.character-wrap.has-pref-transform .char-part {
    transform: translate(var(--pref-offset-x, 0%), var(--pref-offset-y, 0%))
               scale(var(--pref-scale, 1));
    transform-origin: 50% 100%; /* 以脚底为原点缩放，避免缩小后浮空 */
    transition: transform 0.18s ease-out;
}

/* 偏好弹窗 */
.prefs-modal {
    max-width: 460px;
    width: 92vw;
    text-align: left;
}
.prefs-hint {
    color: var(--text-sub, #6b7280);
    font-size: 0.82rem;
    margin: 0 0 14px;
    line-height: 1.5;
}
.prefs-section {
    background: rgba(252, 231, 243, 0.35);
    border: 1px solid rgba(244, 114, 182, 0.18);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.prefs-section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #be185d;
    margin-bottom: 8px;
}
.prefs-char-tip {
    font-size: 0.75rem;
    color: var(--text-sub, #6b7280);
    margin-bottom: 10px;
}
.prefs-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}
.prefs-label {
    flex: 0 0 70px;
    font-size: 0.82rem;
    color: #4b5563;
}
.prefs-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #fbcfe8, #e9d5ff);
    outline: none;
    cursor: pointer;
}
.prefs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #f472b6;
    box-shadow: 0 2px 6px rgba(244, 114, 182, 0.4);
    cursor: pointer;
    transition: transform 0.15s;
}
.prefs-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.prefs-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #f472b6;
    box-shadow: 0 2px 6px rgba(244, 114, 182, 0.4);
    cursor: pointer;
}
.prefs-value {
    flex: 0 0 50px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
    color: #be185d;
    font-variant-numeric: tabular-nums;
}
.prefs-row-actions {
    margin-top: 10px;
    justify-content: flex-end;
}
.prefs-row-actions .btn-cute-ghost {
    font-size: 0.78rem;
    padding: 6px 12px;
}
.prefs-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #374151;
}
.prefs-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #f472b6;
    cursor: pointer;
}
.prefs-toggle-hint {
    font-size: 0.72rem;
    color: var(--text-sub, #6b7280);
    margin-top: 6px;
    line-height: 1.5;
}

/* 🎨 主题切换三档 */
.prefs-theme-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 6px 0 4px;
}
.theme-opt {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--border-soft, var(--pink-soft));
    background: var(--surface-1, #fff);
    color: var(--text-dark);
    border-radius: var(--radius-mid);
    padding: 12px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}
.theme-opt:hover {
    transform: translateY(-2px);
    border-color: var(--pink-main);
    box-shadow: var(--shadow-soft);
}
.theme-opt.active {
    border-color: var(--pink-deep);
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    box-shadow: var(--shadow-pop);
}
.theme-opt-icon {
    font-size: 1.6rem;
    line-height: 1;
}
.theme-opt-label {
    font-size: 0.78rem;
    font-weight: 600;
}

@media (max-width: 600px) {
    .prefs-modal {
        max-height: 88vh;
        overflow-y: auto;
    }
    .prefs-label {
        flex: 0 0 60px;
        font-size: 0.78rem;
    }
}

/* ═══════════════════════════════════════════
   👁️ 隐藏 UI 模式
   - 手动按钮：body.ui-hidden-manual（用户主动）
   - 自动隐藏：body.ui-hidden-auto（拍照预览等场景）
   - 任一存在 → 隐藏所有装饰性 UI
   =══════════════════════════════════════════ */
body.ui-hidden-manual .top-bar,
body.ui-hidden-manual .side-nav-left,
body.ui-hidden-manual .side-nav-right,
body.ui-hidden-manual .side-info-right,
body.ui-hidden-manual .bottom-tabbar,
body.ui-hidden-manual .stage-hint,
body.ui-hidden-manual .drawer,
body.ui-hidden-manual .drawer-mask,
body.ui-hidden-auto .top-bar,
body.ui-hidden-auto .side-nav-left,
body.ui-hidden-auto .side-nav-right,
body.ui-hidden-auto .side-info-right,
body.ui-hidden-auto .bottom-tabbar,
body.ui-hidden-auto .stage-hint,
body.ui-hidden-auto .drawer,
body.ui-hidden-auto .drawer-mask {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(8px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

/* 手动隐藏时彻底让出位置：把 side-nav-right 整列收起，
   恢复入口统一交给右上角的浮动 .ui-restore-btn，避免「眼睛按钮」重影 */
body.ui-hidden-manual .side-nav-right {
    transform: translateX(120%);
}

/* 浮动恢复按钮：仅手动隐藏时显示 */
.ui-restore-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 9999;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(255, 139, 179, 0.35), 0 0 0 1.5px rgba(255, 139, 179, 0.5);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.2s ease;
}
.ui-restore-btn:hover {
    box-shadow: 0 6px 18px rgba(255, 139, 179, 0.5), 0 0 0 1.5px rgba(255, 139, 179, 0.8);
}
body.ui-hidden-manual .ui-restore-btn {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* 隐藏按钮自身激活态视觉提示 */
#btnHideUI.active .nav-icon-emoji,
#btnHideUI.active #hideUIEmoji {
    filter: grayscale(100%);
}

/* 默认其它 UI 元素带过渡，避免突兀 */
.top-bar,
.side-nav-left,
.side-nav-right,
.side-info-right,
.bottom-tabbar,
.stage-hint {
    transition: opacity 0.28s ease, transform 0.28s ease;
}

/* ════════════════════════════════════════════
   🚀 性能优化：GPU 合成层 / 渲染隔离
   减少"越用越卡"的根本原因之一
   ════════════════════════════════════════════ */

/* 立绘容器：独立合成层 + 渲染隔离，避免换装时影响周边布局 */
.character-wrap {
    will-change: transform, opacity;
    transform: translateZ(0); /* 强制独立合成层 */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout paint;
}

/* 立绘各层（base/outfit/expression）单独合成 + 减少图片重绘开销 */
.character-wrap img,
.char-part {
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 提示浏览器图片可异步解码，减少切换 src 时主线程阻塞 */
    image-rendering: auto;
}
.character-wrap img {
    transform: translateZ(0);
}

/* 场景背景：独立合成层 + 包含布局 */
.scene-bg {
    will-change: opacity, background-image;
    transform: translateZ(0);
    contain: layout paint;
}

/* 选项面板和侧边栏滚动容器：开启滚动惯性 + 渲染隔离，避免和立绘互相影响 */
.outfit-grid,
.scene-grid,
.character-grid,
.chapter-list,
.album-grid,
.gift-grid,
.cg-gallery {
    contain: layout paint;
    -webkit-overflow-scrolling: touch;
}

/* 隐藏 UI 时让上方元素脱离合成（释放 GPU 内存） */
body.ui-hidden-manual .top-bar,
body.ui-hidden-manual .side-nav-left,
body.ui-hidden-manual .side-nav-right,
body.ui-hidden-manual .side-info-right,
body.ui-hidden-manual .bottom-tabbar {
    will-change: auto;
}

/* ════════════════════════════════════════════════════════════ */
/* 💾 存档管理弹窗（多结局体验） */
/* ════════════════════════════════════════════════════════════ */
.save-slot-modal {
    max-width: 540px;
    text-align: left;
}
.save-slot-desc {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    margin: 0 0 14px;
    line-height: 1.5;
}
.save-slot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px 2px;
    -webkit-overflow-scrolling: touch;
}
.save-slot-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 139, 179, 0.25);
    background: linear-gradient(135deg, #fff5f8, #ffeaf2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.save-slot-card:hover {
    transform: translateY(-1px);
    border-color: #ff8bb3;
    box-shadow: 0 6px 16px rgba(255, 139, 179, 0.18);
}
.save-slot-card.is-empty {
    background: repeating-linear-gradient(
        135deg,
        #fafafa 0 10px,
        #f3f4f6 10px 20px
    );
    border-style: dashed;
    border-color: rgba(156, 163, 175, 0.4);
}
.save-slot-card.is-auto {
    border-color: rgba(96, 165, 250, 0.45);
    background: linear-gradient(135deg, #eef6ff, #e0efff);
}
[data-theme="dark"] .save-slot-card {
    background: linear-gradient(135deg, #2a1a32, #3a2240);
    border-color: rgba(255, 139, 179, 0.35);
}
[data-theme="dark"] .save-slot-card.is-empty {
    background: repeating-linear-gradient(
        135deg,
        #25192e 0 10px,
        #1c1326 10px 20px
    );
    border-color: rgba(156, 163, 175, 0.3);
}
[data-theme="dark"] .save-slot-card.is-auto {
    background: linear-gradient(135deg, #1a2236, #1f2c46);
    border-color: rgba(96, 165, 250, 0.5);
}
.save-slot-icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}
[data-theme="dark"] .save-slot-icon {
    background: rgba(255, 255, 255, 0.1);
}
.save-slot-main {
    flex: 1;
    min-width: 0;
}
.save-slot-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #be185d;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
[data-theme="dark"] .save-slot-title {
    color: #ff9ec0;
}
.save-slot-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(96, 165, 250, 0.15);
    color: #2563eb;
    font-weight: 600;
}
[data-theme="dark"] .save-slot-tag {
    background: rgba(96, 165, 250, 0.25);
    color: #93c5fd;
}
.save-slot-meta {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[data-theme="dark"] .save-slot-meta {
    color: #b8a9c4;
}
.save-slot-empty-text {
    font-size: 0.85rem;
    color: #9ca3af;
    font-style: italic;
}
.save-slot-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.save-slot-btn {
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.1s ease, opacity 0.15s ease;
    white-space: nowrap;
}
.save-slot-btn:active {
    transform: scale(0.95);
}
.save-slot-btn-save {
    background: linear-gradient(135deg, #ff8bb3, #ff6b9c);
    color: white;
}
.save-slot-btn-load {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}
.save-slot-btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.save-slot-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.save-slot-tip {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 228, 240, 0.5);
    border-radius: 10px;
    font-size: 0.75rem;
    color: #9d174d;
    line-height: 1.5;
}
[data-theme="dark"] .save-slot-tip {
    background: rgba(255, 139, 179, 0.1);
    color: #f9a8d4;
}

/* 云端恢复按钮区域 */
.save-slot-cloud-sync {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(147, 197, 253, 0.15);
    border-radius: 10px;
    border: 1px dashed rgba(59, 130, 246, 0.3);
}
.btn-cloud-sync {
    flex-shrink: 0;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    font-weight: 600;
}
.btn-cloud-sync:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transform: translateY(-1px);
}
.btn-cloud-sync:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}
.cloud-sync-hint {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}
[data-theme="dark"] .save-slot-cloud-sync {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(96, 165, 250, 0.3);
}
[data-theme="dark"] .cloud-sync-hint {
    color: #94a3b8;
}

/* ════════════════════════════════════════ */
/* 🧑‍🤝‍🧑 NPC 立绘层（剧情双立绘 galgame 风）  */
/* ════════════════════════════════════════ */
/* NPC 立绘容器：永远在右侧，与主角(.character-layer)同 z-index 层级。
   默认隐藏（display:none），由 JS 在剧情中需要时切换成 flex 显示。 */
.npc-layer {
    position: absolute;
    inset: 0;
    z-index: 11;            /* 略高于主角层一点点，以便在重叠区显示 NPC */
    pointer-events: none;
    overflow: hidden;
    display: none;
}
.npc-layer.active {
    display: block;
}
.npc-wrap {
    position: absolute;
    /* 🔑 与主角(.character-wrap)同款尺寸：脸大小、身体比例完全一致，只是站位左右镜像 */
    top: 14%;                                       /* 与主角对齐：脸约在画面 1/4 处 */
    right: max(5%, min(18vw, 320px));               /* 与主角 left 镜像：右侧也留出对称的安全边距 */
    height: 130%;                                   /* 与主角同高，多出部分由 mask 吃掉 */
    aspect-ratio: 9 / 16;
    max-width: min(58vw, 720px);                    /* 与主角同宽 */
    min-width: 0;
    width: fit-content;
    pointer-events: none;
    /* 出场：从右侧滑入 + 淡入 */
    transform: translateX(20%);
    opacity: 0;
    filter: brightness(0.6) saturate(0.65) drop-shadow(0 12px 28px rgba(0,0,0,0.25));
    transition:
        transform 0.45s cubic-bezier(.34,1.2,.64,1),
        opacity 0.45s ease,
        filter 0.35s ease;
    /* 与主角同款渐隐：62% 起腰部开始渐隐，膝盖以下完全透明 */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0,0,0,0.75) 78%, rgba(0,0,0,0) 92%);
            mask-image: linear-gradient(to bottom, #000 0%, #000 62%, rgba(0,0,0,0.75) 78%, rgba(0,0,0,0) 92%);
}
.npc-wrap.visible {
    transform: translateX(0);
    opacity: 1;
}
/* 离场：滑出右侧并淡出（hiding 类只在退场瞬间使用） */
.npc-wrap.hiding {
    transform: translateX(30%);
    opacity: 0;
}
.npc-portrait {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    user-select: none;
    -webkit-user-drag: none;
}

/* ── 焦点状态：谁说话谁亮，听众变暗 ── */
/* 当 NPC 是焦点（npc-wrap.focused），主角变暗 */
.character-wrap.dimmed {
    filter:
        drop-shadow(0 16px 32px rgba(255, 94, 147, 0.15))
        brightness(0.55)
        saturate(0.55);
    transition: filter 0.35s ease;
}
/* NPC 焦点时，自身保持亮（覆盖默认 brightness 0.6） */
.npc-wrap.focused {
    filter: drop-shadow(0 12px 28px rgba(0,0,0,0.3))
            brightness(1)
            saturate(1);
}
/* NPC 在场但不是焦点（主角说话） */
.npc-wrap.unfocused {
    filter: drop-shadow(0 12px 28px rgba(0,0,0,0.2))
            brightness(0.55)
            saturate(0.55);
}
/* 旁白：两边都暗（主角 dimmed + NPC 也走 unfocused） */

/* 窄屏适配：手机双立绘并排时，NPC 比桌面稍小一些，避免和主角挤满屏幕 */
@media (max-width: 768px) {
    .npc-wrap {
        right: max(3%, min(10vw, 180px));
        max-width: 50vw;                            /* 主角窄屏也是约 50vw 级别
，保持均衡 */
        height: 120%;                               /* 比桌面 130% 略收，避免顶
天立地 */
    }
}

/* ════════════════════════════════════════════════════════════ */
/* 💬 意见反馈弹窗                                             */
/* ════════════════════════════════════════════════════════════ */
.feedback-modal {
    max-width: 520px;
    padding: 0;
    overflow: hidden;
    text-align: left;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.feedback-header {
    background: var(--surface-2);
    padding: 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.feedback-header h2 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--text-dark);
}
.feedback-header-badge {
    font-size: 0.7rem;
    background: var(--pink-soft);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-mid);
}
.feedback-close-btn {
    background: none;
    border: none;
    color: var(--text-mid);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.feedback-close-btn:hover {
    background: var(--pink-soft);
    color: var(--pink-deep);
}

.feedback-tip {
    padding: 10px 25px;
    font-size: 0.8rem;
    line-height: 1.5;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-mid);
}

.feedback-body {
    padding: 22px 25px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.feedback-body::-webkit-scrollbar { width: 6px; }
.feedback-body::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 999px;
}

.feedback-highlight {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(255, 139, 179, 0.08));
    border: 1px solid var(--border-soft);
    color: var(--text-mid);
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.feedback-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.feedback-section + .feedback-section { margin-top: 16px; }

.feedback-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
}
.feedback-label-helper {
    color: var(--text-light);
    font-size: 0.78rem;
    font-weight: 500;
}

.feedback-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.feedback-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.18s ease;
}
.feedback-option:hover {
    border-color: var(--pink-main);
    background: var(--surface-2);
}
.feedback-option input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--pink-deep);
}
.feedback-option span {
    font-size: 0.92rem;
    font-weight: 600;
}

.feedback-textarea,
.feedback-input {
    width: 100%;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.feedback-textarea {
    min-height: 160px;
    padding: 14px 16px;
    line-height: 1.7;
    resize: vertical;
    margin: 0;
}
.feedback-input {
    padding: 13px 14px;
    margin: 0;
}
.feedback-textarea:focus,
.feedback-input:focus {
    border-color: var(--pink-main);
    box-shadow: 0 0 0 3px rgba(255, 139, 179, 0.15);
}

.feedback-count {
    text-align: right;
    font-size: 0.76rem;
    color: var(--text-light);
}

.feedback-footer {
    padding: 0 25px 22px;
}
.feedback-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
}
.feedback-btn-cancel,
.feedback-btn-submit {
    flex: 1;
    padding: 13px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.15s;
}
.feedback-btn-cancel {
    background: var(--surface-2);
    color: var(--text-dark);
    border: 1px solid var(--border-soft);
}
.feedback-btn-submit {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-deep));
    color: #fff;
    box-shadow: 0 8px 20px rgba(255, 94, 147, 0.25);
}
.feedback-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.feedback-helper-text {
    margin-top: 12px;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--text-light);
    text-align: center;
}

@media (max-width: 768px) {
    .feedback-modal {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px) !important;
        max-height: 88vh !important;
        border-radius: var(--radius-mid);
    }
    .feedback-header { padding: 16px; }
    .feedback-tip,
    .feedback-body,
    .feedback-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    .feedback-type-grid { grid-template-columns: 1fr; }
    .feedback-actions { flex-direction: column; }
}

