/* theme.css — 场景化主题 (4 剧本主调 × 子调)
   每个剧本有个 scene 主调, 每章有 sub 调 (idle / tense / sad / triumph / reveal)
   通过 body.theme-<script> + .stage[data-sub] 双 selector
*/

:root {
  --bg:        #0a0a0f;
  --bg-2:      #14141c;
  --bg-3:      #1f1f2e;
  --fg:        #e8e8ef;
  --fg-2:      #8a8aa0;
  --fg-3:      #5a5a70;
  --accent:    #d4af37;
  --accent-hot: #ff6b35;
  --accent-cool: #58a6ff;
  --good:      #4caf50;
  --bad:       #e74c3c;
  --border:    #2a2a3a;
  --radius:    10px;

  /* 9/7 加: 液态玻璃 tokens (Apple Vision Pro 风格, 但适配深色背景)
     用半透明 rgba 让卡片浮在背景上, 配合 backdrop-filter blur + 1px 高光边 */
  --glass-bg:        rgba(255, 255, 255, 0.04);  /* 卡片背景 */
  --glass-bg-hover:  rgba(255, 255, 255, 0.08);  /* hover 状态更亮 */
  --glass-border:    rgba(255, 255, 255, 0.12);  /* 1px 高光边 */
  --glass-border-hi: rgba(255, 255, 255, 0.22);  /* hover/active 高亮边 */
  --glass-blur:      saturate(140%) blur(20px);   /* 背后折射模糊 */
  --glass-shadow:    0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-highlight: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.02) 40%, transparent 60%);
  /* 备用浅色版 (light theme 也 work) */
  --glass-bg-light:    rgba(255, 255, 255, 0.55);
  --glass-border-light: rgba(255, 255, 255, 0.65);
}

/* 9/7 加: 字号 body class (font-sm/md/lg) - 配合 settings screen */
body.font-sm { font-size: 13px; }
body.font-md { font-size: 14px; }
body.font-lg { font-size: 16px; }

/* 9/7 加: 减少动效 body class - 关掉 transition/animation */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}


/* ============ 4 剧本主调 (body.theme-XXX) ============ */

/* 9/7 加: 玻璃动效 — body 背景 gradient 流光
   让所有剧本主题的 radial-gradient 缓慢移动, 制造液态玻璃的流动感
   prefers-reduced-motion: 关掉 (用户在 settings 开了 reduce motion)
   性能: background-size 不变, 只 background-position 动 (GPU 友好)
*/
@keyframes bgFlow1 {
  0%, 100% { background-position: 0% 0%, 100% 100%, 0 0; }
  33% { background-position: 30% 20%, 70% 80%, 0 0; }
  66% { background-position: 60% 40%, 40% 60%, 0 0; }
}
body.theme-rebirth_2008,
body.theme-harem_system,
body.theme-wasteland,
body.theme-dual_time,
body.theme-fresh_grad,
body.theme-rebirth_1998,
body.theme-re_birth_door {
  background-attachment: fixed;
  animation: bgFlow1 24s ease-in-out infinite;
  will-change: background-position;  /* GPU 提示 */
}
/* prefers-reduced-motion + body.reduced-motion: 关掉 */
@media (prefers-reduced-motion: reduce) {
  body { animation: none !important; }
}
body.reduced-motion { animation: none !important; }

/* rebirth_2008 — 现代都市 + 80s 霓虹 */
body.theme-rebirth_2008 {
  --accent: #ff6ec7;          /* 80s 粉 */
  --bg:     #1a0a2e;
  --bg-2:   #261548;
  --bg-3:   #36216c;
  --fg:     #f0e6ff;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,110,199,0.15), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0,200,255,0.12), transparent 50%),
    linear-gradient(135deg, #1a0a2e 0%, #0a0518 100%);
  background-attachment: fixed;
}

/* harem_system — 古代宫庭 (水墨/朱红) */
body.theme-harem_system {
  --accent: #c9302c;          /* 朱红 */
  --bg:     #0e0808;
  --bg-2:   #1c0f0f;
  --bg-3:   #2a1a1a;
  --fg:     #f0e3d3;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201,48,44,0.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(212,175,55,0.08), transparent 50%),
    linear-gradient(180deg, #0e0808 0%, #050303 100%);
  background-attachment: fixed;
}
body.theme-harem_system .script-card.hero-card::before {
  background: linear-gradient(90deg, transparent, rgba(201,48,44,0.3), transparent);
}

/* wasteland — 末世铁灰 + 锈橙 */
body.theme-wasteland {
  --accent: #d4751f;          /* 锈橙 */
  --bg:     #0d0c0a;
  --bg-2:   #1a1815;
  --bg-3:   #2a261f;
  --fg:     #d8d2c8;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212,117,31,0.12), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(80,80,80,0.18), transparent 60%),
    linear-gradient(180deg, #0d0c0a 0%, #1a1815 100%);
  background-attachment: fixed;
}

/* fresh_grad — 现代明亮 + 橙黄向日葵色 (轻喜剧, 拒绝阴沉) */
body.theme-fresh_grad {
  --accent: #ff9c2e;        /* 向日葵橙 */
  --accent-hot: #ff6b35;
  --accent-cool: #58a6ff;
  --bg:     #fbf6ec;          /* 暖白 */
  --bg-2:   #f3ead7;          /* 麦穗米 */
  --bg-3:   #e8dbb8;          /* 沙土 */
  --fg:     #4a3a1a;          /* 深咖 */
  color: #4a3a1a;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,156,46,0.18), transparent 60%),
    radial-gradient(ellipse at 70% 100%, rgba(212,175,55,0.15), transparent 60%),
    linear-gradient(135deg, #fbf6ec 0%, #f3ead7 100%);
  background-attachment: fixed;
}
body.theme-fresh_grad .script-card.hero-card::before {
  background: linear-gradient(90deg, transparent, rgba(255,156,46,0.3), transparent);
}

/* dual_time — 紫蓝 + 时空交错 */
body.theme-dual_time {
  --accent: #b066ff;          /* 紫光 */
  --bg:     #0a0612;
  --bg-2:   #150e2a;
  --bg-3:   #1f1640;
  --fg:     #e8e0f5;
  background:
    radial-gradient(ellipse at 25% 50%, rgba(176,102,255,0.15), transparent 60%),
    radial-gradient(ellipse at 75% 50%, rgba(88,166,255,0.12), transparent 60%),
    linear-gradient(135deg, #0a0612 0%, #1a0f30 100%);
  background-attachment: fixed;
}

/* ============ 章节子调 (sub-XXX 在 .stage 上) ============ */
.stage[data-sub="tense"] {
  animation: stageTensePulse 2s ease-in-out infinite;
}
@keyframes stageTensePulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 24px 0 rgba(255,107,53,0.15); }
}

.stage[data-sub="sad"] {
  filter: saturate(0.85) brightness(0.95);
}

.stage[data-sub="triumph"] {
  box-shadow: 0 0 32px 0 rgba(212,175,55,0.25);
}

.stage[data-sub="reveal"] {
  position: relative;
}
.stage[data-sub="reveal"]::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(176,102,255,0.1) 90deg, transparent 180deg, rgba(88,166,255,0.1) 270deg, transparent 360deg);
  border-radius: 16px;
  animation: revealSpin 8s linear infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes revealSpin {
  to { transform: rotate(360deg); }
}

/* ============ Stage 容器 — 场景画布 ============ */
.stage {
  position: relative;
  padding: 32px 24px;
  min-height: 60vh;
  border-radius: 16px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* 章节插画占位 (SVG 横幅) */
.stage-art {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
  border: 1px solid var(--border);
}
.stage-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============ 结局图鉴 — 卡片网格 ============ */
.ledger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.ledger-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  position: relative;
  transition: all 0.3s;
  cursor: pointer;
}
.ledger-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.ledger-card.locked {
  opacity: 0.45;
  filter: grayscale(1);
}
.ledger-card.locked:hover {
  filter: grayscale(0.5);
  opacity: 0.7;
}
.ledger-card .thumb {
  width: 100%;
  height: 80px;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
}
.ledger-card .thumb svg { width: 100%; height: 100%; display: block; }
.ledger-card .tier-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ledger-card.tier-1 .tier-badge { background: var(--bad); color: #fff; }
.ledger-card.tier-2 .tier-badge { background: var(--accent-cool); color: #000; }
.ledger-card.tier-3 .tier-badge { background: var(--good); color: #000; }
.ledger-card .end-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}
.ledger-card .end-tier-label {
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============ 选项大按钮卡 ============ */
.choices {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(0,0,0,0.2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 64px;
}
.choice::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transition: left 0.5s;
}
.choice:hover:not(:disabled)::before { left: 100%; }
.choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(0,0,0,0.2));
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.choice .choice-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--fg-2);
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid var(--border);
  font-family: ui-monospace, "SF Mono", monospace;
}
.choice:hover:not(:disabled) .choice-num {
  border-color: var(--accent);
  color: var(--accent);
}
.choice.tier-critical {
  border-color: var(--bad);
  background: linear-gradient(135deg, rgba(231,76,60,0.08), rgba(0,0,0,0.2));
}
.choice.tier-critical .choice-num {
  border-color: var(--bad);
  color: var(--bad);
  background: rgba(231,76,60,0.15);
}
.choice.tier-critical::after {
  content: '⚠ 关键';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 10px;
  color: var(--bad);
  font-weight: 700;
  letter-spacing: 0.1em;
  background: rgba(231,76,60,0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ============ 左侧固定导航栏 (桌面) / 底部 tab (移动) ============ */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  min-height: 100vh;
}
.sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  box-shadow: 4px 0 32px rgba(0,0,0,0.3), inset -1px 0 0 rgba(255,255,255,0.06);
}
.sidebar-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
  padding: 0 8px;
}
.sidebar-brand .tag {
  font-size: 9px;
  background: var(--accent);
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.1em;
}
.sidebar-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-2);
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-item:hover {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--border);
}
.sidebar-item.active {
  background: var(--bg-3);
  color: var(--accent);
  border-color: var(--accent);
}
.sidebar-item .icon { font-size: 18px; }
.sidebar-stats {
  margin-top: auto;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  color: var(--fg-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}
.sidebar-stats .stat-row {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}
.sidebar-stats .stat-row b { color: var(--accent); }

/* 9/8 加: 进度条 (sidebar-stats 底部) */
.sidebar-stats .ss-progress {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.sidebar-stats .ss-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #ff6b35 100%);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}
.sidebar-stats .ss-progress-pct {
  position: absolute;
  right: 0;
  top: 6px;
  font-size: 9px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
}

@media (max-width: 768px) {
  .layout-with-sidebar { grid-template-columns: 1fr; padding-bottom: 80px; }
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: 64px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0 8px;
    gap: 0;
    z-index: 90;
  }
  .sidebar-brand, .sidebar-stats { display: none; }
  .sidebar-item { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; }
  .sidebar-item .icon { font-size: 20px; }
}

/* ============ 开场动画 ============ */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 9/23 修真: top-bar (z-index 1100) 修真修真, 修真 about 按钮修真 */
  pointer-events: none;
  flex-direction: column;
  /* 9/22 修真: 去掉 fadeOut 动画 (用户 OOB: "模块选择不应该是动画") */
}
/* 9/23 修真 v3: hideModuleMenu() 修真 body.intro-seen, CSS 修真 修真 修真 intro-overlay
     (修真 JS 修真 inline style 修真 Cache-Control: no-cache + 修真 Chrome cache 修真) */
body.intro-seen .intro-overlay {
  display: none !important;
}
/* 9/23 修真: intro-overlay 修真 pointer-events: none, 修真孩子修真 auto (修真 module-card click) */
.intro-overlay .intro-logo,
.intro-overlay .intro-subtitle,
.intro-overlay .intro-credits,
.intro-overlay .module-menu,
.intro-overlay .module-menu .module-card {
  pointer-events: auto;
}
.intro-logo {
  font-size: 56px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.15em;
  animation: logoScale 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 0 24px var(--accent);
}
.intro-logo .tag {
  font-size: 22px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 6px;
  margin-left: 12px;
  letter-spacing: 0.2em;
  border: 1px solid rgba(212, 175, 55, 0.4);
  vertical-align: middle;
  font-weight: 600;
}
.intro-subtitle {
  color: var(--fg-2);
  font-size: 18px;
  margin-top: 20px;
  letter-spacing: 0.3em;
  opacity: 0;
  animation: subtitleIn 0.8s ease 1s forwards;
}
.intro-credits {
  position: absolute;
  bottom: 32px;
  color: var(--fg-3);
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0;
  animation: subtitleIn 0.6s ease 1.6s forwards;
}

@keyframes logoScale {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes subtitleIn {
  to { opacity: 1; }
}
@keyframes introFadeOut {
  0% { opacity: 1; pointer-events: auto; }
  99% { opacity: 0; pointer-events: none; }
  100% { opacity: 0; pointer-events: none; display: none; }
}

/* ============ 新手引导卡 ============ */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tutorialIn 0.4s ease;
  backdrop-filter: blur(4px);
}
@keyframes tutorialIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.tutorial-card {
  /* 9/7 升级: 液态玻璃 */
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-top: 3px solid var(--accent);
  border-radius: 18px;
  padding: 36px 32px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55),
              inset 0 1px 0 rgba(255,255,255,0.12),
              0 0 40px rgba(212,175,55,0.2);
  animation: tutorialCardIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.tutorial-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-highlight);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}
.tutorial-card > * { position: relative; z-index: 1; }
@keyframes tutorialCardIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.tutorial-card .step-num {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 14px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.tutorial-card h3 {
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 12px;
}
.tutorial-card p {
  color: var(--fg-2);
  line-height: 1.7;
  font-size: 15px;
  margin-bottom: 24px;
}
.tutorial-card .tut-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.tutorial-card .btn-tut {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.tutorial-card .btn-tut.skip {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border);
}
/* 9/8 加: 大图标 + 上一步按钮 + 关闭按钮 */
.tutorial-card .tut-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(212,175,55,0.4));
  animation: tutIconBounce 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes tutIconBounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.tutorial-card .tut-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--fg-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tutorial-card .tut-close:hover {
  background: rgba(231,76,60,0.15);
  border-color: #e74c3c;
  color: #e74c3c;
}
.tutorial-card .btn-tut:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.tutorial-card .btn-tut-prev {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.tutorial-card .btn-tut-prev:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.tutorial-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.tutorial-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.tutorial-dots .dot.active { background: var(--accent); width: 20px; border-radius: 4px; }

/* 9/7 加: mobile disable backdrop-filter (GPU 杀手, 38 处磨砂玻璃会让 mobile 渲染慢)
   mobile 用 solid 背景替代, 性能提升 30-50% */
@media (max-width: 768px) {
  * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  /* 但保留部分关键元素的视觉 */
  .script-card, .ending-card, .modal, .tutorial-card, .minigame-card {
    background: var(--bg-2) !important;
  }
}

/* 9/21 加: 解决 "界面比较闷" — 给 lobby/剧本卡加 5 个新流光动画 (用户 OOB 报) */
@keyframes cardShine {
  0%, 100% { box-shadow: 0 0 12px -2px rgba(212, 175, 55, 0.15), 0 4px 12px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 28px 2px rgba(212, 175, 55, 0.45), 0 8px 24px rgba(212, 175, 55, 0.2); }
}
@keyframes cardShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.3)); }
  50% { filter: drop-shadow(0 0 14px rgba(212, 175, 55, 0.7)); }
}
@keyframes bgAurora {
  0%, 100% { background-position: 50% 50%, 50% 50%, 0 0; }
  50% { background-position: 60% 40%, 40% 60%, 0 0; }
}

/* 应用到 lobby 脚本卡 */
.script-card {
  animation: cardShine 4s ease-in-out infinite, floatY 6s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.script-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(212, 175, 55, 0.12) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: cardShimmer 3.5s linear infinite;
  pointer-events: none;
}
.script-card:nth-child(odd)  { animation-delay: 0s, 0s; }
.script-card:nth-child(even) { animation-delay: 0.5s, 1s; }

/* 顶部 accent 徽章发光 */
.script-card-tag,
.card-tag {
  animation: glowPulse 3s ease-in-out infinite;
}

/* lobby 背景极光流动 (在 body.theme-lobby 上, 不影响剧情页) */
body.theme-lobby {
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(88, 166, 255, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-size: 200% 200%, 200% 200%, 100% 100%;
  animation: bgAurora 12s ease-in-out infinite;
}

/* light theme 也适配 (古金 + 浅色背景) */
:root[data-theme="light"] body.theme-lobby {
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(212, 175, 55, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(88, 166, 255, 0.10) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

/* 9/22 加: 3 大模块主菜单 (用户 OOB 报 "Drama + Novel + Journal 三个") */
.module-menu {
  display: grid;
  /* 9/22 修真: auto-fit 让 4 个模块都能显示 (用户 OOB 报"缺 Creator")
     之前 repeat(3, 1fr) 写死只有 3 列, 第 4 个卡被挤掉 */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1200px;
  width: 90%;
  margin: 30px auto;
  padding: 0 20px;
}
.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px 22px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--fg);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(212, 175, 55, 0.15) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: cardShimmer 3.5s linear infinite;
  pointer-events: none;
}
.module-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.3);
}
.module-card[data-module="drama"]:hover { box-shadow: 0 12px 32px rgba(212, 175, 55, 0.4); }
.module-card[data-module="novel"]:hover { box-shadow: 0 12px 32px rgba(88, 166, 255, 0.4); }
.module-card[data-module="journal"]:hover { box-shadow: 0 12px 32px rgba(255, 107, 53, 0.4); }
.module-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(212, 175, 55, 0.4));
  animation: floatY 6s ease-in-out infinite;
}
.module-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.module-name-zh {
  font-size: 14px;
  color: var(--fg-2);
  margin-bottom: 14px;
}
.module-desc {
  font-size: 13px;
  color: var(--fg-3);
  line-height: 1.6;
  margin-bottom: 16px;
}
.module-cta {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
  width: 100%;
}
.intro-hint {
  text-align: center;
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 20px;
  opacity: 0.7;
}
@media (max-width: 768px) {
  .module-menu { grid-template-columns: 1fr; gap: 14px; }
  .module-icon { font-size: 44px; }
  .module-name { font-size: 20px; }
}


/* 9/22 修真 v2: top-bar brand 统一格式 (.brand-icon / .brand-module / .brand-dejavu) */
.top-bar-brand .brand-text {
  font-size: 13px;
  color: var(--fg-2, rgba(255,255,255,0.7));
  letter-spacing: 0.05em;
}
.top-bar-brand .brand-icon {
  font-size: 16px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
}
.top-bar-brand .brand-module {
  font-weight: 600;
  color: var(--fg-2, rgba(255,255,255,0.85));
  letter-spacing: 0.05em;
}
.top-bar-brand .brand-divider {
  color: var(--fg-3, rgba(255,255,255,0.35));
  margin: 0 10px;
  font-weight: 300;
}
.top-bar-brand .brand-dejavu {
  color: var(--fg-3, rgba(255,255,255,0.55));
  font-size: 12px;
  letter-spacing: 0.1em;
}
