/* ============================================================
   亚马逊宫心计 v2 — Chat UI Stylesheet
   Palette: #1A1A1A (charcoal) · #D4A65C (gold) · #F5F1E8 (cream)
   ============================================================ */

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F5F1E8;
  --text:        #1A1A1A;
  --gold:        #D4A65C;
  --gold-light:  #E8C47A;
  --dark:        #1A1A1A;
  --panel-bg:    rgba(26, 26, 26, 0.92);
  --panel-text:  #F5F1E8;
  --bubble-npc:  #2A2A2A;
  --bubble-me:   #4A3520;
  --radius:      10px;
  --font:        "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;   /* 暗色主题:修正滚动条/原生控件在暗色下发白 */
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

/* 键盘焦点可见(规范:不可只 outline:none 不给替代);鼠标点击不显示,仅键盘 Tab 显示 */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 无障碍:尊重"减少动态效果"系统设置,关掉所有动画/过渡 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

#app-root {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ────────────────────────────────────────────────── */
button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--dark);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 14px;
}
.btn-primary:hover { background: var(--gold-light); }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
}
.btn-secondary:hover { background: rgba(212,166,92,0.12); }

.btn-back, .btn-back-sm {
  background: transparent;
  color: var(--gold);
  border: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}
.btn-back:hover, .btn-back-sm:hover { background: rgba(212,166,92,0.15); }

/* ── Main Menu ──────────────────────────────────────────────── */
.main-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;     /* 整体垂直居中,消掉底部大片黑空白 */
  min-height: 100vh;
  padding: 24px 16px;
  gap: 6px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212,166,92,0.10) 0%, transparent 60%),
    var(--dark);
}

/* 封面图:完整显示,标题叠在自带金框上 */
.main-cover {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  aspect-ratio: 1040 / 585;     /* cover.png 原始比例,保证金框位置稳定 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center top;
}

/* 标题盒子:定位到封面顶部金框中心(金框约在 8%~30% 高度) */
.cover-title-box {
  position: absolute;
  top: 8.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 56%;
  height: 19%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.main-title {
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 2px 16px rgba(212,166,92,0.6);
  white-space: nowrap;
}
.main-subtitle {
  font-size: clamp(0.5rem, 1vw, 0.8rem);
  color: rgba(245,241,232,0.7);
  letter-spacing: 2px;
  white-space: nowrap;
}

.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0 16px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

.character-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.character-card:hover {
  transform: translateY(-4px);
  border-color: var(--char-color, var(--gold));
  box-shadow: 0 8px 28px rgba(0,0,0,0.5), 0 0 0 1px var(--char-color, var(--gold));
}
.character-card.placeholder {
  opacity: 0.5;
  cursor: not-allowed;
}
.character-card.placeholder:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(255,255,255,0.08);
}

.card-avatar {
  height: 240px;
  background-size: contain;            /* 完整显示立绘,不裁切 */
  background-repeat: no-repeat;
  background-position: center top;
  background-color: #111;
}

.card-info {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card-emoji { font-size: 1.4rem; }
.card-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--panel-text);
}
.card-tagline {
  font-size: 0.78rem;
  color: rgba(245,241,232,0.5);
}
.card-start {
  font-size: 0.8rem;
  color: var(--char-color, var(--gold));
  margin-top: 4px;
  font-weight: 600;
}
.card-soon {
  font-size: 0.72rem;
  color: rgba(245,241,232,0.3);
  margin-top: 4px;
}

.main-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px 32px 8px;
}
.footer-hint {
  color: rgba(245,241,232,0.3);
  font-size: 0.78rem;
}

/* Shake animation for locked cards */
@keyframes shake {
  0%,100%{ transform: translateX(0); }
  20%    { transform: translateX(-6px); }
  40%    { transform: translateX(6px); }
  60%    { transform: translateX(-4px); }
  80%    { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

/* ── Scene Menu ─────────────────────────────────────────────── */
.scene-menu {
  min-height: 100vh;
  background: var(--dark);
  padding: 32px;
}

.scene-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}
.scene-char-info {
  display: flex;
  flex-direction: column;
}
.scene-char-emoji { font-size: 1.6rem; }
.scene-char-name  { font-size: 1.2rem; font-weight: bold; color: var(--gold); }
.scene-char-tagline { font-size: 0.8rem; color: rgba(245,241,232,0.5); }

.scene-list-title {
  font-size: 1rem;
  color: rgba(245,241,232,0.55);
  font-weight: normal;
  margin-bottom: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.scene-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 540px;
}

.scene-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,166,92,0.25);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.18s, background-color 0.18s;
}
.scene-btn:hover {
  border-color: var(--gold);
  background: rgba(212,166,92,0.08);
}
.scene-btn-title {
  font-size: 1rem;
  color: var(--panel-text);
  font-weight: 600;
}
.scene-btn-desc {
  font-size: 0.8rem;
  color: rgba(245,241,232,0.45);
}

.scene-empty {
  color: rgba(245,241,232,0.3);
  font-size: 0.9rem;
}

/* ── Chat Layout (场景铺底 + 左右立绘 + 中间透明聊天窗) ─────── */
.chat-layout {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 场景背景铺满整个舞台 */
.stage-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.7);
  z-index: 0;
}
/* 背景上压一层暗渐变,保证中间聊天文字可读 */
.stage-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.45) 100%);
}

/* 左右立绘:统一基线 + 统一高度,保证两边对称不一大一小 */
.actor {
  position: absolute;
  bottom: 0;
  height: 88vh;              /* 两边同高,以视口高为基准而非容器% */
  width: 30vw;              /* 同宽 */
  object-fit: contain;
  object-position: bottom center;
  z-index: 1;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.6));
  pointer-events: none;
}
/* 男主(玩家)在右,和微信绿气泡同侧;女主(对方)在左,和白气泡同侧 */
.actor-hero  { right: 0; }
.actor-npc   { left: 0; transform: scaleX(-1); }  /* 女主镜像朝向聊天窗 */

/* ── 中间透明聊天窗 (缩小居中) ──────────────────────────────── */
.chat-panel {
  position: relative;
  z-index: 2;
  width: 48vw;
  max-width: 600px;
  min-width: 360px;
  height: 86vh;
  margin-top: 40px;          /* 给顶部数值横条让位 */
  display: flex;
  flex-direction: column;
  background: rgba(20, 22, 26, 0.45);          /* 半透明,能透出场景 */
  backdrop-filter: blur(6px);                   /* 毛玻璃 */
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  overflow: hidden;
}

.chat-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.chat-scene-title {
  font-size: 0.82rem;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  min-width: 0;                /* 允许收缩 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-npc-name {
  font-size: 0.82rem;
  color: var(--gold);
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;             /* 角色名不被挤掉 */
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-log::-webkit-scrollbar { width: 4px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }

/* ── 微信风气泡 ─────────────────────────────────────────────── */
.bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  animation: bubbleIn 0.25s ease;
  word-break: break-word;
}

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

/* 女主(对方): 白气泡靠左 */
.bubble-npc {
  align-self: flex-start;
  background: #ffffff;
  color: #1a1a1a;
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* 玩家(自己): 微信绿气泡靠右 */
.bubble-player {
  align-self: flex-end;
  background: #95EC69;
  color: #1a1a1a;
  border-bottom-right-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.bubble-player .bubble-label { display: none; }   /* 微信不显示"你"标签 */

.bubble-system {
  align-self: center;
  font-size: 0.74rem;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.35);
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ── Typing indicator ───────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  width: 64px;
}
.dot {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%,80%,100% { opacity:0.2; transform:scale(0.8); }
  40%         { opacity:1;   transform:scale(1); }
}

/* ── Choices Area ───────────────────────────────────────────── */
.choices-area {
  flex-shrink: 0;
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.choice-btn {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  text-align: left;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.choice-btn:hover {
  background: rgba(212,166,92,0.35);
  border-color: var(--gold);
  color: #fff;
  transform: translateX(3px);
}
.choice-btn:active { transform: translateX(1px); }

.free-input-row {
  display: flex;
  gap: 8px;
}

.free-input {
  flex: 1;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.free-input::placeholder { color: rgba(255,255,255,0.5); }
.free-input:focus { border-color: var(--gold); }   /* 边框高亮即焦点反馈;:focus-visible 仍补金色环 */
.free-input:disabled { opacity: 0.4; }

.send-btn {
  background: var(--gold);
  color: var(--dark);
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.83rem;
  flex-shrink: 0;
}
.send-btn:hover:not(:disabled) { background: var(--gold-light); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Stats Bar (顶部浮层,横向一条) ──────────────────────────── */
.stats-panel {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 9px 20px;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(212,166,92,0.3);   /* 金边呼应主题 */
  border-radius: 14px;
  max-width: 94vw;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.stats-title { display: none; }   /* 横条模式不显示标题 */

.stat-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-label {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}
.stat-bar-wrap {
  width: 48px;
  height: 6px;
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
  overflow: hidden;
}
.stat-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.stat-value {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.78);
  min-width: 28px;
  font-variant-numeric: tabular-nums;   /* 数字等宽,不跳动 */
}

/* ── Ending Overlay ─────────────────────────────────────────── */
.ending-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.ending-box {
  background: #1A1A1A;
  border: 2px solid currentColor;
  border-radius: 16px;
  padding: 36px 40px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ending-type {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 3px;
}
.ending-desc {
  color: rgba(245,241,232,0.7);
  font-size: 0.95rem;
  line-height: 1.7;
}
.ending-stats {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: rgba(245,241,232,0.55);
  line-height: 1.9;
}
.ending-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Scrollbar global ───────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(212,166,92,0.25) transparent;
}

/* ── Responsive: 窄屏(手机) ─────────────────────────────────── */
@media (max-width: 800px) {
  /* 立绘缩到两侧边缘半透明衬托,聊天窗占满 */
  .actor { opacity: 0.4; height: 70%; }
  .actor-hero  { max-width: 40vw; }
  .actor-npc   { max-width: 42vw; }
  .chat-panel {
    width: 92vw;
    max-width: none;
    height: 90vh;
  }
  .stats-panel {
    gap: 4px 8px;
    padding: 6px 10px;
    font-size: 0.66rem;
  }
  .stat-bar-wrap { width: 30px; }

  .character-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .card-avatar { height: 140px; }
}

@media print {
  .choices-area, .stats-panel, .actor { display: none; }
}

/* ── 知识卡 toast ─────────────────────────────────────────── */
.knowledge-toast{position:fixed;right:16px;bottom:90px;max-width:260px;background:#1A1A1A;color:#F5E9D0;border:1px solid #D4A65C;border-radius:10px;padding:10px 14px;opacity:0;transform:translateY(8px);transition:.35s;z-index:60;font-size:13px}
.knowledge-toast.show{opacity:1;transform:translateY(0)}
.knowledge-toast b{color:#D4A65C}
/* ── 点评小字 ────────────────────────────────────────────── */
.lesson-line{align-self:center;color:#9CA3AF;font-size:12px;margin:4px 0}
/* ── 学习手册面板 ─────────────────────────────────────────── */
.codex-modal{position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;z-index:80}
.codex-box{background:#1A1A1A;color:#F5E9D0;border:1px solid #D4A65C;border-radius:14px;max-width:340px;max-height:70vh;overflow:auto;padding:18px}
.codex-box h3{color:#D4A65C;margin:0 0 10px}
.codex-box ul{list-style:none;padding:0;margin:0}
.codex-box li{border-bottom:1px solid #333;padding:8px 0;font-size:13px}
.codex-box li b{color:#D4A65C}

/* ─── 模式选择 ─── */
.mode-select{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:30px;padding:24px;background:radial-gradient(circle at 50% 30%,#241f18,#0e0c0a)}
.mode-cover{text-align:center}
.mode-title{color:#D4A65C;font-size:30px;margin:0 0 8px;letter-spacing:3px}
.mode-sub{color:#cfc4ac;font-size:13px;margin:0}
.mode-cards{display:flex;gap:20px;flex-wrap:wrap;justify-content:center}
.mode-card{width:220px;background:rgba(26,24,22,.9);border:1px solid #D4A65C;border-radius:16px;padding:28px 20px;cursor:pointer;color:#F5E9D0;transition:.2s;text-align:center}
.mode-card:hover{transform:translateY(-4px);box-shadow:0 8px 24px rgba(212,166,92,.25)}
.mode-card.paid{border-color:#F4C76A;background:linear-gradient(160deg,#2a2114,#1a1512)}
.mode-card-emoji{font-size:40px;margin-bottom:10px}
.mode-card-name{font-size:20px;font-weight:700;color:#D4A65C;margin-bottom:6px}
.mode-card-tag{font-size:12.5px;color:#cfc4ac;line-height:1.5}
/* ─── 解锁 ─── */
.unlock-view{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:#14110d}
.unlock-box{background:#1A1A1A;border:1px solid #D4A65C;border-radius:16px;padding:30px;max-width:360px;width:100%;color:#F5E9D0;text-align:center}
.unlock-box h2{color:#D4A65C;margin:0 0 8px}
.unlock-desc{font-size:13px;color:#cfc4ac;margin:0 0 18px}
.unlock-input{width:100%;padding:11px 14px;border-radius:10px;border:1px solid #D4A65C;background:#0e0c0a;color:#F5E9D0;font-size:15px;margin-bottom:8px}
.unlock-input:focus{outline:none;box-shadow:0 0 0 2px rgba(212,166,92,.5)}
.unlock-msg{color:#EF6B6B;font-size:13px;min-height:18px;margin-bottom:8px}
.unlock-buy{font-size:12px;color:#9a9180;margin:14px 0}
.unlock-buy span{color:#6f685c}
.unlock-box .btn-primary{width:100%;margin-bottom:10px}
/* ─── 剧情视图 ─── */
.story-view{position:relative;min-height:100vh;display:flex;flex-direction:column;justify-content:flex-end}
.story-bg{position:absolute;inset:0;background-size:cover;background-position:center;filter:brightness(.5);z-index:0}
.story-box{position:relative;z-index:2;margin:0 auto 6vh;max-width:680px;width:92%;background:rgba(20,18,16,.85);border:1px solid #D4A65C;border-radius:14px;padding:20px 22px;color:#F5E9D0;backdrop-filter:blur(3px)}
.story-title{color:#D4A65C;font-weight:700;margin-bottom:12px;font-size:15px}
.story-script{font-size:15px;line-height:1.8;max-height:42vh;overflow:auto}
.story-narr{color:#C9BBA1;font-style:italic;margin:6px 0}
.story-line{margin:8px 0}.story-line b{color:#D4A65C}
.story-choices{display:flex;flex-direction:column;gap:8px;margin-top:16px}
.story-choice{background:#1A1A1A;color:#F5E9D0;border:1px solid #D4A65C;border-radius:10px;padding:11px 14px;cursor:pointer;font-size:14px;text-align:left;transition:.2s}
.story-choice:hover{background:#D4A65C;color:#1A1A1A}
.milestone-overlay,.story-ending{position:fixed;inset:0;background:rgba(0,0,0,.78);display:flex;align-items:center;justify-content:center;z-index:90}
.milestone-box,.story-ending-box{background:#1A1A1A;color:#F5E9D0;border:1px solid #D4A65C;border-radius:16px;max-width:420px;width:90%;padding:26px;text-align:center}
.milestone-badge{color:#D4A65C;font-weight:700;font-size:18px;margin-bottom:14px}
.lesson-toast{position:fixed;left:50%;top:14%;transform:translateX(-50%) translateY(-8px);background:#1A1A1A;border:1px solid #D4A65C;border-radius:10px;padding:8px 16px;opacity:0;transition:.35s;z-index:95;color:#F5E9D0;max-width:80%}
.lesson-toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.codex-btn{background:none;border:none;font-size:18px;cursor:pointer}

.story-react{margin-bottom:14px;animation:reactin .25s ease}
@keyframes reactin{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.story-lesson{margin-top:10px;padding:8px 12px;background:rgba(212,166,92,.12);border-left:3px solid #D4A65C;border-radius:6px;color:#E8D9BC;font-size:13.5px}
/* ─── 首页/标题屏 ─── */
.home-btns{display:flex;flex-direction:column;gap:14px;align-items:center}
.home-btn{min-width:220px;background:rgba(26,24,22,.9);border:1px solid #D4A65C;border-radius:12px;padding:16px 20px;color:#F5E9D0;font-size:17px;cursor:pointer;transition:.2s;display:flex;flex-direction:column;align-items:center;gap:4px}
.home-btn:hover{transform:translateY(-2px);background:rgba(212,166,92,.15)}
.home-btn.primary{border-color:#F4C76A;background:linear-gradient(160deg,#2a2114,#1a1512);font-weight:700;color:#D4A65C}
.home-btn .home-sub{font-size:12px;color:#9a9180}

/* ═══════════════════════════════════════════════════════════════
   视觉小说 (VN / Galgame) 剧情界面
   .vn-view > .vn-bg · img.vn-sprite · .stats-hud · .vn-box · .vn-choices
   ═══════════════════════════════════════════════════════════════ */

/* ── 外层全屏容器 ─────────────────────────────────────────────── */
.vn-view {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #0e0c0a;
  cursor: pointer;
  user-select: none;
}

/* ── 背景 ─────────────────────────────────────────────────────── */
.vn-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.62);
  z-index: 0;
  pointer-events: none;
}

/* ── 女主立绘 ─────────────────────────────────────────────────── */
.vn-sprite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 72vh;
  max-height: 820px;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.7));
  transition: opacity 0.18s ease;
}

/* ── 数值 HUD（顶部浮层，不遮立绘太多） ────────────────────────── */
.stats-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
}

/* stats-hud 内部 #stats-panel 复用全局 .stats-panel 样式，
   但在 VN 模式下覆盖 position 让它 static（父级已定位） */
.stats-hud #stats-panel {
  position: static;
  transform: none;
  font-size: 0.9rem;
  padding: 10px 16px;
  gap: 0 16px;
  max-width: 98vw;
  flex-wrap: nowrap;       /* 所有数值挤在一行,不换行 */
  overflow-x: auto;        /* 放不下就横向滚动,绝不折行 */
  justify-content: flex-start;
}
.stats-hud .stat-row      { gap: 7px; flex-shrink: 0; }   /* 不被压扁 */
.stats-hud .stat-bar-wrap { width: 72px; height: 11px; }
.stats-hud .stat-value    { min-width: 30px; font-size: 0.9rem; color: rgba(255,255,255,0.96); }
.stats-hud .stat-label    { font-size: 0.9rem; color: rgba(255,255,255,0.96); white-space: nowrap; }

/* ── 底部对话框 ───────────────────────────────────────────────── */
.vn-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  min-height: 26vh;
  padding: 0 0 0 0;
  pointer-events: none;   /* 允许点击穿透到 .vn-view，选项区再开 */
}

/* 对话框内容卡（白金边深色面板）*/
.vn-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 14, 0.90);
  border-top: 2px solid #D4A65C;
  border-radius: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 0;
}

/* 内部文字层，pointer-events none（点击传到 .vn-view） */
.vn-name,
.vn-text,
.vn-next {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* 说话人名牌 */
.vn-name {
  display: inline-block;
  position: absolute;
  top: -1.35em;
  left: 28px;
  background: #D4A65C;
  color: #1A1A1A;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 6px 6px 0 0;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* 对白文字 */
.vn-text {
  display: block;
  margin: 20px 28px 10px;
  color: #F5F1E8;
  font-size: 16px;
  line-height: 1.9;
  min-height: 4em;
  word-break: break-word;
}

/* lesson 行（choice.lesson）：金色左边框高亮 */
.vn-text.vn-text-lesson {
  color: #E8D9BC;
  font-size: 14.5px;
  font-style: italic;
  padding: 8px 12px;
  margin: 10px 28px 10px;
  background: rgba(212,166,92,0.10);
  border-left: 3px solid #D4A65C;
  border-radius: 0 6px 6px 0;
  min-height: auto;
}

/* 旁白 行：斜体米色（name 隐藏时 text 无名牌，上边距收窄） */
.vn-name[style*="display: none"] ~ .vn-text,
.vn-name:not([style]) ~ .vn-text {
  margin-top: 20px;
}

/* 点击继续指示符 ▼ */
.vn-next {
  position: absolute;
  bottom: 14px;
  right: 26px;
  color: #D4A65C;
  font-size: 13px;
  animation: vn-blink 1.1s ease-in-out infinite;
  display: none;   /* JS 控制显示 */
}
@keyframes vn-blink {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50%       { opacity: 0.35; transform: translateY(3px); }
}

/* ── 选项区 ───────────────────────────────────────────────────── */
.vn-choices {
  position: absolute;
  bottom: 30vh;    /* 紧贴在 vn-box 上方 */
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;   /* JS 控制 */
  flex-direction: column;
  gap: 10px;
  width: min(560px, 88vw);
  pointer-events: auto;
}

/* 当 display 不是 none 时显示为 flex（JS 把 display 改为 ''） */
.vn-choices:not([style*="none"]) {
  display: flex;
}

/* 选项按钮：复用 .story-choice，无需改样式 */
.vn-choices .story-choice {
  background: rgba(18,16,14,0.88);
  color: #F5F1E8;
  border: 1px solid #D4A65C;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.vn-choices .story-choice:hover {
  background: #D4A65C;
  color: #1A1A1A;
  transform: translateX(4px);
}
.vn-choices .story-choice:active { transform: translateX(2px); }

/* ── 响应式 ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .vn-sprite { height: 60vh; left: 50%; transform: translateX(-50%); }
  .vn-text   { font-size: 14.5px; margin: 18px 16px 10px; }
  .vn-name   { left: 16px; font-size: 0.78rem; }
  .vn-next   { right: 14px; }
  .vn-choices { bottom: 28vh; }
  .stats-hud #stats-panel { gap: 7px 13px; padding: 8px 12px; font-size: 0.82rem; }
  .stats-hud .stat-bar-wrap { width: 64px; height: 10px; }
  .stats-hud .stat-value { font-size: 0.82rem; }
  .stats-hud .stat-label { font-size: 0.82rem; }
}

/* ── 恋爱场景覆盖层 ─────────────────────────────────────────────────────────── */
.romance-overlay{position:fixed;inset:0;background:radial-gradient(circle at 50% 40%,rgba(60,20,40,.85),rgba(0,0,0,.9));display:flex;align-items:center;justify-content:center;z-index:92;animation:romfade .4s ease}
@keyframes romfade{from{opacity:0}to{opacity:1}}
.romance-box{background:linear-gradient(160deg,#2a1a22,#1a1216);color:#F5E9D0;border:1px solid #E8A0B8;border-radius:18px;max-width:440px;width:90%;padding:26px 24px;box-shadow:0 0 40px rgba(232,160,184,.25);text-align:left}
.romance-title{color:#F4A6C0;font-weight:700;font-size:20px;text-align:center;margin-bottom:16px;letter-spacing:1px}
.romance-narr{color:#C9A9B5;font-style:italic;margin:7px 0;font-size:14.5px;line-height:1.8}
.romance-box .story-line{margin:9px 0;line-height:1.85}
.romance-box .story-line b{color:#F4A6C0}
.romance-box .btn-primary{display:block;margin:20px auto 0}
