/* ============================================================
   最后的书店 v6.0 - 电影感样式（重写）
   ============================================================ */

:root {
  --color-wood: #8B6F47;
  --color-wood-dark: #5C4A2E;
  --color-wood-light: #B8975C;
  --color-paper: #F4ECD8;
  --color-paper-light: #FAF3E0;
  --color-gold: #D4A574;
  --color-gold-light: #E8C99B;
  --color-cream: #FAF3E0;
  --color-ink: #2A1F14;
  --color-text: #3E2723;
  --color-muted: #8D7B6A;
  --color-line: #C9B89A;

  --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --font-en: 'Cormorant Garamond', Georgia, serif;

  --shadow-soft: 0 4px 12px rgba(60, 40, 20, 0.15);
  --shadow-deep: 0 8px 24px rgba(60, 40, 20, 0.25);
  --ease-out: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-serif);
  color: var(--color-text);
  background: #1a0e08;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   通用：屏幕 / 隐藏
   ============================================================ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1;
}
.screen.active { display: block; }

.hidden { display: none !important; }

/* ============================================================
   每日清晨叙事面板
   ============================================================ */
.narrative-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-paper);
  animation: narFadeIn 0.6s var(--ease-smooth);
}
@keyframes narFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.nar-scene {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.nar-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
  padding: 40px 32px;
  animation: narContentUp 0.8s 0.2s both var(--ease-smooth);
}
@keyframes narContentUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.nar-day {
  font-family: var(--font-en);
  font-size: 13px;
  color: var(--color-gold);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.nar-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 20px;
  line-height: 1.4;
}

.nar-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 2;
  color: var(--color-text);
  text-align: left;
  white-space: pre-line;
  margin-bottom: 24px;
  padding: 0 8px;
  border-left: 2px solid var(--color-gold);
  padding-left: 16px;
}

.nar-goal {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 32px;
  padding: 10px 16px;
  background: rgba(212,165,116,0.08);
  border-radius: 6px;
  display: inline-block;
}

.nar-goal::before {
  content: '🎯 ';
}

#nar-continue {
  display: block;
  margin: 0 auto;
}

/* ============================================================
   启动画面
   ============================================================ */
#title-screen {
  background: linear-gradient(160deg, #1a0e08 0%, #3E2723 50%, #5D4037 100%);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#title-screen.active {
  display: flex;
}

.title-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.t-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 236, 179, 0.7);
  border-radius: 50%;
  animation: floatParticle 12s linear infinite;
}
.t-particle.p1 { left: 20%; top: 30%; animation-delay: 0s; }
.t-particle.p2 { left: 70%; top: 50%; animation-delay: -3s; }
.t-particle.p3 { left: 40%; top: 70%; animation-delay: -6s; }
.t-particle.p4 { left: 80%; top: 20%; animation-delay: -9s; }
.t-particle.p5 { left: 15%; top: 80%; animation-delay: -4s; }
.t-particle.p6 { left: 60%; top: 10%; animation-delay: -7s; }

@keyframes floatParticle {
  0%   { transform: translate(0,0) scale(1); opacity: 0.3; }
  50%  { opacity: 0.8; }
  100% { transform: translate(-30px,-100px) scale(0.5); opacity: 0; }
}

.t-book {
  position: absolute;
  font-size: 60px;
  opacity: 0.12;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  animation: floatBook 18s ease-in-out infinite;
}
.t-book.fb1 { left: 12%; top: 18%; }
.t-book.fb2 { right: 15%; top: 30%; animation-delay: -6s; }
.t-book.fb3 { left: 60%; top: 70%; animation-delay: -12s; }

@keyframes floatBook {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-30px) rotate(5deg); }
}

.title-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--color-cream);
  padding: 40px;
  max-width: 600px;
}

.title-logo {
  margin: 0 auto 24px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title-h1 {
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 8px;
  margin-bottom: 8px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.title-sub {
  font-family: var(--font-en);
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--color-gold-light);
  font-style: italic;
  margin-bottom: 14px;
}

.title-premise {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 14px;
  border: 1px solid rgba(232, 201, 155, 0.36);
  border-radius: 999px;
  color: rgba(250, 243, 224, 0.88);
  background: rgba(26, 14, 8, 0.28);
  font-size: 13px;
  line-height: 1.6;
}

.title-line {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 0 auto 22px;
}

.title-world {
  max-width: 520px;
  margin: 0 auto 24px;
  color: rgba(250, 243, 224, 0.82);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 0;
}

.title-quote {
  font-size: 16px;
  line-height: 2;
  color: rgba(250, 243, 224, 0.85);
  margin-bottom: 36px;
  letter-spacing: 1px;
}

.btn-start {
  padding: 14px 40px;
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-wood));
  color: var(--color-cream);
  border: 1px solid var(--color-gold-light);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255,236,179,0.3);
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.btn-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,236,179,0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(212,165,116,0.4);
}
.btn-start:hover::after { transform: translateX(100%); }
.btn-start:active { transform: translateY(0); }

.title-hint {
  margin-top: 20px;
  font-size: 12px;
  color: rgba(250, 243, 224, 0.5);
  letter-spacing: 2px;
}

/* ============================================================
   游戏画面
   ============================================================ */
#game-screen {
  background: #1a0e08;
  display: none;
}
#game-screen.active { display: block; }

/* 顶栏 */
#top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 80;
  background: linear-gradient(180deg, rgba(20,10,5,0.85) 0%, rgba(20,10,5,0) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-label {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--color-gold-light);
  padding: 6px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 4px;
  letter-spacing: 1px;
}

.hope-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 4px;
}

.hope-lbl {
  font-size: 13px;
  color: var(--color-gold-light);
  letter-spacing: 1px;
}

.hope-track {
  width: 200px;
  height: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  overflow: visible;
  border: 1px solid rgba(212,165,116,0.2);
  position: relative;
}

.hope-bar {
  height: 100%;
  background: linear-gradient(90deg, #D4A574, #B8844E);
  transition: width 0.6s var(--ease-smooth), background 0.4s;
  box-shadow: 0 0 8px rgba(212,165,116,0.4);
  border-radius: 4px;
}

/* 希望值阈值标记 */
.hope-threshold {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  z-index: 2;
  pointer-events: none;
}
.hope-th-40 { left: 40%; background: rgba(176,95,78,0.7); }
.hope-th-60 { left: 60%; background: rgba(184,132,78,0.7); }
.hope-th-80 { left: 80%; background: rgba(74,139,58,0.7); }

.hope-num {
  font-family: var(--font-en);
  font-size: 18px;
  color: var(--color-cream);
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}

.ico-btn {
  width: 36px;
  height: 36px;
  font-size: 18px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,165,116,0.3);
  color: var(--color-gold-light);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.ico-btn:hover {
  background: rgba(212,165,116,0.2);
  border-color: var(--color-gold);
}

/* ============================================================
   场景区
   ============================================================ */
#scene-area {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* 落地窗 */
.window-box {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  max-width: 720px;
  height: 60%;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.wnd-view {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  border: 8px solid var(--color-wood-dark);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.3);
  transition: opacity 1.2s, background-image 1.2s, filter 1.2s;
}

.wnd-morning   { background-image: url('assets/scenes/morning.png'); filter: brightness(1) saturate(1.05); }
.wnd-afternoon { background-image: url('assets/scenes/afternoon.png'); filter: brightness(0.95) saturate(1.1); }
.wnd-evening   { background-image: url('assets/scenes/evening.png'); filter: brightness(0.85) saturate(1.15); }
.wnd-night     { background-image: url('assets/scenes/night.png'); filter: brightness(0.7) saturate(0.9); }

.windowsill {
  position: absolute;
  bottom: -16px;
  left: -4%;
  right: -4%;
  height: 16px;
  background: linear-gradient(180deg, var(--color-wood-light), var(--color-wood-dark));
  border-radius: 2px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* 吊灯 */
.ceiling-lamp {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 140px;
  z-index: 3;
}
.lamp-chain {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 50px;
  background: linear-gradient(180deg, #444, #888);
}
.lamp-shade {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 30px;
  background: linear-gradient(180deg, var(--color-gold), var(--color-wood));
  border-radius: 50% 50% 5px 5px / 100% 100% 5px 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.lamp-bulb {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 20px;
  background: radial-gradient(ellipse, #FFEFB0 0%, #FFC870 50%, #B8844E 100%);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 200, 112, 0.8);
  animation: lampFlicker 4s ease-in-out infinite;
}
@keyframes lampFlicker {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(0.96); }
}
.lamp-glow {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(255, 200, 112, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* 招牌 */
.store-sign {
  position: absolute;
  top: 12%;
  right: 4%;
  z-index: 4;
  padding: 8px 20px;
  background: linear-gradient(180deg, var(--color-wood-dark), var(--color-wood));
  border: 2px solid var(--color-gold);
  border-radius: 4px;
  box-shadow: var(--shadow-deep);
  transform: rotate(-3deg);
}
.store-sign span {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-gold-light);
  letter-spacing: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* 书架 */
.shelf {
  position: absolute;
  width: 12%;
  min-width: 120px;
  height: 50%;
  z-index: 2;
}
.shelf-L { left: 2%; top: 35%; }
.shelf-R { right: 2%; top: 35%; }

.shelf-row {
  height: 22%;
  margin-bottom: 6%;
  background: linear-gradient(180deg,
    transparent 0%, transparent 88%,
    var(--color-wood-light) 88%, var(--color-wood) 100%);
  position: relative;
  border-radius: 2px;
}

.spine {
  display: inline-block;
  width: 14px;
  height: 80%;
  margin: 0 1px;
  border-radius: 1px 1px 0 0;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.2s;
  vertical-align: bottom;
}
.spine:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 0 2px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.3);
}

/* 地板 */
.floor {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(180deg, #5C4A2E 0%, #3E2E1E 100%);
  z-index: 1;
}
.floor::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0px, transparent 80px, rgba(0,0,0,0.15) 80px, rgba(0,0,0,0.15) 82px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 14px, rgba(0,0,0,0.1) 14px, rgba(0,0,0,0.1) 15px);
}

/* 柜台 */
.counter {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  max-width: 360px;
  height: 80px;
  z-index: 4;
  background: linear-gradient(180deg, #6B4F30 0%, #4A3520 100%);
  border-radius: 4px;
  box-shadow: var(--shadow-deep);
}
.counter::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(180deg, #8B6F47, #5C4A2E);
  border-radius: 4px 4px 0 0;
}

.desk-lamp {
  position: absolute;
  top: -32px;
  left: 16px;
  width: 32px;
  height: 50px;
}
.dl-shade {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 16px;
  background: linear-gradient(180deg, #4A3520, #2A1F14);
  border-radius: 50% 50% 30% 30% / 100% 100% 30% 30%;
}
.dl-stand {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 30px;
  background: #2A1F14;
}
.dl-glow {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 100px;
  background: radial-gradient(ellipse, rgba(255, 200, 112, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.desk-objects { position: absolute; right: 12px; top: 8px; }
.obj-cup {
  width: 16px; height: 22px;
  background: linear-gradient(180deg, #FAF3E0, #E8C99B);
  border-radius: 2px 2px 50% 50%;
  border: 1px solid #B8844E;
}
.obj-paper {
  position: absolute; right: -20px; top: 8px;
  width: 30px; height: 24px;
  background: #FFF8E1;
  border: 1px solid #C9B89A;
  transform: rotate(-8deg);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* NPC 立绘 */
.npc-wrap {
  position: absolute;
  bottom: 24%;
  left: 28%;
  z-index: 5;
  transition: all 0.5s var(--ease-out);
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.4));
}
.npc-sprite {
  width: 200px;
  height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: npcEnter 0.6s var(--ease-out);
}
@keyframes npcEnter {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.npc-portrait {
  width: 200px;
  height: 260px;
  object-fit: contain;
  object-position: bottom;
}
.npc-shadow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 18px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
  z-index: -1;
}

/* 门铃提示 */
.doorbell {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(255,236,179,0.95);
  color: #5C4A2E;
  border: 2px solid var(--color-gold);
  border-radius: 30px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: doorbellRing 2s ease-in-out infinite;
}
@keyframes doorbellRing {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  10% { transform: translateX(-50%) rotate(-8deg); }
  20% { transform: translateX(-50%) rotate(8deg); }
  30% { transform: translateX(-50%) rotate(-4deg); }
  40% { transform: translateX(-50%) rotate(0deg); }
}
.doorbell:hover { background: var(--color-gold-light); }

.db-icon { font-size: 24px; }

/* 浮尘粒子 */
.dust-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
@keyframes floatDust {
  0% { transform: translate(0,0) rotate(0deg); opacity: 0.2; }
  50% { opacity: 0.7; }
  100% { transform: translate(60px, -80px) rotate(360deg); opacity: 0; }
}

/* ============================================================
   对话面板
   ============================================================ */
.dlg-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  min-height: 200px;
  max-height: 50%;
  z-index: 20;
  background: linear-gradient(180deg,
    rgba(244, 236, 216, 0.95) 0%,
    rgba(244, 236, 216, 0.98) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 2px solid var(--color-gold);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
  padding: 20px 32px 24px;
  cursor: pointer;
  font-family: var(--font-serif);
}

.dlg-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.dlg-portrait {
  width: 56px;
  height: 72px;
  background: var(--color-paper);
  border: 2px solid var(--color-gold);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.dlg-portrait img { width: 100%; height: 100%; object-fit: cover; }

.dlg-name-box { display: flex; flex-direction: column; gap: 4px; }
.dlg-name { font-size: 18px; font-weight: 700; color: var(--color-ink); }
.dlg-tag {
  font-size: 12px;
  color: var(--color-muted);
  letter-spacing: 1px;
  padding: 2px 8px;
  background: rgba(212,165,116,0.15);
  border-radius: 3px;
  display: inline-block;
  width: fit-content;
}

.dlg-body { margin-bottom: 12px; }

.dlg-text {
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  min-height: 60px;
  letter-spacing: 0.5px;
}

.dlg-text.typing::after {
  content: '|';
  display: inline-block;
  animation: cursorBlink 0.8s step-end infinite;
  color: var(--color-gold);
  font-weight: 100;
}
@keyframes cursorBlink {
  50% { opacity: 0; }
}

.cursor-hint {
  display: inline-block;
  margin-left: 4px;
  color: var(--color-gold);
  font-size: 12px;
  animation: hintPulse 1.4s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(2px); }
}

.dlg-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(212,165,116,0.3);
}

.opt-btn {
  padding: 10px 16px;
  background: rgba(255, 248, 225, 0.6);
  border: 1px solid var(--color-gold-light);
  border-radius: 4px;
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.opt-btn:hover {
  background: var(--color-gold-light);
  transform: translateX(4px);
  box-shadow: var(--shadow-soft);
}

.dlg-act { margin-top: 12px; }

/* NPC AI 自由交谈按钮 */
.dlg-ai-chat {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(212,165,116,0.15);
}
.btn-ai-chat {
  padding: 7px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(212,165,116,0.35);
  background: rgba(212,165,116,0.06);
  color: var(--color-gold);
  font-family: var(--font-serif);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-ai-chat:hover {
  background: rgba(212,165,116,0.15);
  border-color: var(--color-gold);
  border-style: solid;
}

/* 书籍详情 AI 按钮 */
.dtl-ai-ask {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px dashed rgba(212,165,116,0.35);
  background: rgba(212,165,116,0.06);
  color: var(--color-gold);
  font-family: var(--font-serif);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
  margin-bottom: 4px;
}
.dtl-ai-ask:hover {
  background: rgba(212,165,116,0.15);
  border-color: var(--color-gold);
  border-style: solid;
}
.act-btn {
  padding: 12px 32px;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 1px;
  border: 1px solid var(--color-gold);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}
.act-rec {
  background: linear-gradient(135deg, var(--color-gold), var(--color-wood));
  color: var(--color-cream);
  box-shadow: var(--shadow-soft);
}
.act-rec:hover { transform: translateY(-2px); box-shadow: var(--shadow-deep); }
.act-next {
  background: transparent;
  border: 1px solid var(--color-muted);
  color: var(--color-muted);
}
.act-open {
  background: linear-gradient(135deg, var(--color-gold), var(--color-wood));
  color: var(--color-cream);
  padding: 14px 36px;
  font-size: 16px;
  margin-top: 20px;
}

/* ============================================================
   书架选书面板
   ============================================================ */
.bk-panel {
  position: absolute;
  inset: 60px 0 0 0;
  z-index: 90;
  background: linear-gradient(180deg, rgba(244, 236, 216, 0.97) 0%, rgba(244, 236, 216, 0.99) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px 32px;
  overflow-y: auto;
}

.bk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.bk-header h3 {
  font-size: 18px;
  color: var(--color-ink);
  letter-spacing: 1px;
}
.bk-close {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--color-muted);
  color: var(--color-muted);
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
}
.bk-close:hover { background: rgba(0,0,0,0.1); }

.bk-hint {
  font-size: 14px;
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(212,165,116,0.1);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
}

.bk-featured-theaters {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid rgba(75, 85, 99, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(31, 41, 51, 0.08), rgba(212, 165, 116, 0.12));
}
.bk-featured-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.bk-featured-head strong {
  color: var(--color-ink);
  font-size: 15px;
}
.bk-featured-head span {
  color: var(--color-muted);
  font-size: 12px;
}
.bk-featured-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.bk-featured-card {
  min-height: 86px;
  padding: 12px 14px;
  border: 1px solid rgba(232, 201, 155, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, #1f2933, #5c4033);
  color: #fff4d6;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.18);
}
.bk-featured-card span,
.bk-featured-card em {
  display: block;
  color: rgba(255, 244, 214, 0.72);
  font-size: 12px;
  font-style: normal;
}
.bk-featured-card strong {
  display: block;
  margin: 4px 0;
  font-size: 17px;
}

.bk-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.bk-count {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
}

.bk-cat-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bk-cat-tab {
  padding: 5px 12px;
  font-family: var(--font-serif);
  font-size: 12px;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--color-line);
  color: var(--color-muted);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.bk-cat-tab:hover {
  background: rgba(212,165,116,0.15);
  border-color: var(--color-gold);
  color: var(--color-ink);
}
.bk-cat-tab.active {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: #fff;
  font-weight: 600;
}

.bk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.bk-card {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  text-align: center;
}
.bk-card:hover {
  transform: translateY(-4px);
}
.bk-card.has-theater {
  filter: drop-shadow(0 8px 14px rgba(31, 41, 51, 0.14));
}

.bk-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 8px;
  overflow: hidden;
}
.bk-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.bk-cover-img ~ .bk-cover-title,
.bk-cover-img ~ .bk-cat-tag {
  z-index: 2;
  position: relative;
}
/* 封面图片加载成功时，标题和标签加渐变叠加层确保可读 */
.bk-cover-img.loaded ~ .bk-cover-title,
.bk-cover-img.loaded ~ .bk-cat-tag {
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 2px;
}
.bk-cover-icon {
  z-index: 2;
  position: relative;
}
/* icon 的显隐由 JS 图片 onload/onerror 控制 */
.bk-cover::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0,0,0,0.2);
}
.bk-cover-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.bk-cover-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  letter-spacing: 0.5px;
}
.bk-theater-mark {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(20, 14, 10, 0.72);
  color: #fff4d6;
  font-size: 10px;
  font-weight: 700;
}
.bk-cat-tag {
  font-size: 10px;
  color: var(--color-cream);
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 8px;
  align-self: flex-end;
}

.bk-title {
  font-size: 12px;
  color: var(--color-ink);
  margin: 6px 0 2px;
  font-weight: 500;
}
.bk-cat {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  display: inline-block;
}

/* ============================================================
   书籍详情弹窗
   ============================================================ */
#book-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dtl-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dtl-box {
  position: relative;
  background: var(--color-paper);
  border-radius: 12px;
  padding: 28px;
  max-width: 480px;
  width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 201;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: popIn 0.4s var(--ease-out);
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.dtl-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--color-muted);
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
}
.dtl-close:hover { background: rgba(192,57,43,0.1); color: #C0392B; }

.dtl-cover-wrap {
  width: 160px;
  height: 220px;
  margin: 0 auto 16px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  background: #eee;
}
.dtl-img { width: 100%; height: 100%; object-fit: cover; }
.dtl-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}

.dtl-info { text-align: left; }
.dtl-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-ink);
  margin: 4px 0 4px;
}
.dtl-author { font-size: 13px; color: var(--color-muted); margin: 2px 0; }
.dtl-isbn { font-size: 11px; color: #aaa; margin: 2px 0 8px; }
.dtl-cat-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  margin-bottom: 10px;
}
.dtl-theater {
  width: 100%;
  margin-top: 10px;
  padding: 13px 18px;
  border: 1px solid rgba(232, 201, 155, 0.55);
  border-radius: 8px;
  background: linear-gradient(135deg, #1f2933, #5c4033);
  color: #fff4d6;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.28);
}
.dtl-theater::before {
  content: "🕵 ";
}
.dtl-theater:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(31, 41, 51, 0.36);
}
.match-badge {
  background: linear-gradient(90deg, #FFD700, #FFA500);
  color: #5C4A2E;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  display: inline-block;
  box-shadow: 0 2px 6px rgba(255,165,0,0.3);
}
.dtl-blurb { font-size: 13px; line-height: 1.8; color: #555; margin: 8px 0; }
.dtl-blurb p { margin-bottom: 8px; }

.dtl-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.dtl-confirm {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-wood));
  color: var(--color-cream);
  border: none;
  border-radius: 6px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.dtl-confirm:hover { transform: scale(1.02); box-shadow: var(--shadow-soft); }
.dtl-back {
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--color-muted);
  color: var(--color-muted);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.dtl-back:hover { background: rgba(0,0,0,0.05); }

/* ============================================================
   结果面板
   ============================================================ */
.res-panel {
  position: absolute;
  inset: 60px 0 0 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(244, 236, 216, 0.97) 0%, rgba(244, 236, 216, 0.99) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.res-content {
  max-width: 480px;
  text-align: center;
  padding: 40px 32px;
}
.res-icon {
  font-size: 64px;
  margin-bottom: 12px;
  animation: resPop 0.5s var(--ease-out);
}
@keyframes resPop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.res-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 8px;
}
.res-book {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 16px;
}
.res-message {
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(255, 248, 225, 0.6);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
  text-align: left;
}
.res-world-note {
  font-size: 13px;
  line-height: 1.8;
  color: #5f4a34;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(42, 31, 20, 0.06);
  border: 1px solid rgba(184, 132, 78, 0.18);
  border-radius: 6px;
  text-align: left;
}
.res-afterword {
  font-size: 13px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 12px;
  font-style: italic;
}
.res-effects {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.efx-pos {
  padding: 4px 12px;
  background: rgba(127, 176, 105, 0.2);
  color: #4A8B3A;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}
.efx-neg {
  padding: 4px 12px;
  background: rgba(176, 95, 78, 0.2);
  color: #8B3A2E;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.act-mylist {
  display: block;
  margin: 10px auto 8px;
  background: rgba(255, 248, 225, 0.85);
  color: var(--color-ink);
  border: 1px solid rgba(184, 132, 78, 0.35);
}
.act-mylist:hover {
  background: var(--color-gold-light);
}
.act-mylist.added {
  background: rgba(127, 176, 105, 0.2);
  color: #3f7433;
  border-color: rgba(127, 176, 105, 0.35);
}

.end-mystore {
  display: block;
  margin: 22px auto 12px;
}

/* ============================================================
   我的书店 / 纸页方舟
   ============================================================ */
.mystore-screen {
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(232, 201, 155, 0.28), transparent 32%),
    linear-gradient(180deg, #21130b 0%, #4f3723 42%, #f4ecd8 42%, #f4ecd8 100%);
  color: var(--color-text);
}

.mystore-content {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.ms-hero {
  color: var(--color-cream);
  max-width: 760px;
  padding: 24px 0 38px;
}
.ms-mark {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border: 1px solid rgba(232, 201, 155, 0.35);
  border-radius: 999px;
  color: var(--color-gold-light);
  font-size: 13px;
}
.ms-hero h1 {
  font-size: 44px;
  letter-spacing: 0;
  margin-bottom: 12px;
}
.ms-hero p {
  max-width: 680px;
  color: rgba(250, 243, 224, 0.82);
  font-size: 16px;
  line-height: 1.9;
}

.ms-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.ms-stats > div {
  min-height: 92px;
  padding: 18px;
  background: rgba(250, 243, 224, 0.94);
  border: 1px solid rgba(184, 132, 78, 0.2);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}
.ms-stats strong {
  display: block;
  color: var(--color-ink);
  font-size: 30px;
  line-height: 1;
  margin-bottom: 8px;
}
.ms-stats span {
  color: var(--color-muted);
  font-size: 13px;
}

.ms-section {
  margin-top: 18px;
  padding: 24px;
  background: rgba(250, 243, 224, 0.96);
  border: 1px solid rgba(184, 132, 78, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}
.ms-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
}
.ms-section h2 {
  font-size: 22px;
  color: var(--color-ink);
}
.ms-section p {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.7;
}
.ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.ms-card {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  min-height: 122px;
  background: #fffaf0;
  border: 1px solid rgba(201, 184, 154, 0.55);
  border-radius: 8px;
}
.ms-card img {
  width: 70px;
  height: 96px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(42, 31, 20, 0.18);
}
.ms-card h3 {
  font-size: 15px;
  color: var(--color-ink);
  line-height: 1.35;
  margin-bottom: 5px;
}
.ms-card p,
.ms-card span {
  display: block;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.55;
}
.ms-card-want {
  border-color: rgba(127, 176, 105, 0.35);
  background: rgba(247, 255, 239, 0.85);
}
.ms-link {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border: 1px solid rgba(184, 132, 78, 0.28);
  border-radius: 6px;
  background: rgba(212, 165, 116, 0.13);
  color: var(--color-ink);
  font-family: var(--font-serif);
  cursor: pointer;
}
.ms-empty {
  padding: 18px;
  color: var(--color-muted);
  background: rgba(42, 31, 20, 0.04);
  border-radius: 8px;
}
.ms-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.ms-back-btn {
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid rgba(200,180,150,0.25);
  background: transparent;
  color: rgba(200,180,150,0.8);
  font-family: var(--font-serif);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.ms-back-btn:hover {
  background: rgba(200,180,150,0.1);
  color: #f7ead0;
}
.ms-primary,
.ms-secondary {
  min-width: 160px;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid rgba(184, 132, 78, 0.28);
  font-family: var(--font-serif);
  cursor: pointer;
}
.ms-primary {
  background: linear-gradient(135deg, var(--color-gold), var(--color-wood));
  color: var(--color-cream);
}
.ms-secondary {
  background: rgba(255, 248, 225, 0.8);
  color: var(--color-ink);
}

#ms-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(42, 31, 20, 0.92);
  color: var(--color-cream);
  box-shadow: var(--shadow-deep);
}

/* ============================================================
   现场演示工具条
   ============================================================ */
.demo-toolbar {
  position: fixed;
  right: 16px;
  top: 72px;
  bottom: auto;
  z-index: 200;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  transform: none;
  padding: 8px 10px;
  border: 1px solid rgba(232, 201, 155, 0.28);
  border-radius: 8px;
  background: rgba(26, 14, 8, 0.88);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(10px);
}
.demo-toolbar.collapsed {
  padding: 6px;
}
.demo-toolbar button {
  width: 88px;
  padding: 7px 11px;
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 999px;
  background: rgba(250, 243, 224, 0.08);
  color: var(--color-cream);
  font-family: var(--font-serif);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.demo-toolbar .demo-toggle {
  width: 66px;
  border-radius: 8px;
  background: rgba(212, 165, 116, 0.28);
  color: #fff4d6;
  font-weight: 700;
}
.demo-toolbar.collapsed button:not(.demo-toggle),
.demo-toolbar.collapsed #demo-ai-status {
  display: none;
}
.demo-toolbar button:hover {
  background: rgba(212, 165, 116, 0.25);
}
#demo-ai-status {
  color: #e8c99b;
  font-size: 12px;
  white-space: nowrap;
}
#demo-ai-status.live {
  color: #9be28b;
}

/* ============ 书中剧场 v4.0 (左立绘 + 右对话) ============ */
#book-theater {
  position: fixed;
  inset: 0;
  z-index: 260;
  color: #f7ead0;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#book-theater.bt-entered { opacity: 1; }

.bt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

/* ── VN 舞台（全屏，flex 左右分栏）── */
.bt-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

/* ══════════════════════════════════════
   左侧面板 — 场景背景 + 超大人物立绘
   ══════════════════════════════════════ */
.bt-left-panel {
  position: relative;
  width: 44%;
  min-width: 280px;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

/* 场景背景 */
.bt-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #111;
}
.bt-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bt-scene-image);
  background-size: cover;
  background-position: center;
  opacity: 1;
  transition: opacity 0.8s ease;
  clip-path: inset(0 3% 5% 0);
}
.bt-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 0%, transparent 75%,
    rgba(0,0,0,0.4) 90%,
    rgba(0,0,0,0.7) 100%);
}

/* ── 人物立绘（左侧超大显示！）── */
.bt-character-model {
  position: absolute;
  z-index: 10;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 94%;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bt-portrait {
  width: 100%;
  height: 100%;
  background-image: var(--bt-character-image);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  /* 呼吸动画 — 轻微上下浮动，模拟人物呼吸感 */
  animation: portrait-breathe 3.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.6))
          drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
/* 立绘切换时淡入 + 微微上浮 */
.bt-character-model.fade-in .bt-portrait {
  animation: portrait-enter 0.5s ease-out forwards, 
             portrait-breathe 3.5s ease-in-out 0.5s infinite;
}

/* 呼吸动画：轻微缩放+位移 */
@keyframes portrait-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.005); }
}

/* 立绘入场动画 */
@keyframes portrait-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.bt-figure {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bt-figure-icon {
  font-size: 120px;
  opacity: 0.4;
}

/* 热点（在左侧场景上） */
.bt-hotspots { position:absolute; inset:0; z-index:8; pointer-events:none; }
.bt-hotspot {
  position: absolute;
  transform: translate(-50%,-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  z-index: 8;
}
.bt-hotspot span {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,238,190,0.95);
  border-radius: 50%;
  background: rgba(212,165,116,0.4);
  box-shadow: 0 0 0 6px rgba(212,165,116,0.1), 0 0 24px rgba(255,229,169,0.4);
  display: block;
  animation: hotspot-pulse 2s ease-in-out infinite;
}
@keyframes hotspot-pulse {
  0%,100% { transform:scale(1); opacity:0.8; }
  50%     { transform:scale(1.2); opacity:1; }
}
.bt-hotspot em {
  position: absolute;
  top: 26px; left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border: 1px solid rgba(255,238,190,0.3);
  border-radius: 999px;
  background: rgba(10,8,7,0.78);
  font-style: normal;
  font-size: 12px;
  white-space: nowrap;
  color: #fff2d4;
  opacity: 0;
  transition: all 0.18s;
}
.bt-hotspot:hover em { opacity:1; transform: translateX(-50%) translateY(-2px); }

/* ══════════════════════════════════════
   右侧面板 — 对话/旁白/聊天
   ══════════════════════════════════════ */
.bt-right-panel {
  position: relative;
  width: 56%;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg,
    rgba(12,10,8,0.96) 0%,
    rgba(18,14,12,0.95) 50%,
    rgba(14,11,9,0.97) 100%);
  border-left: 1px solid rgba(212,165,116,0.15);
}

/* ══════════════════════════════════════
   关闭按钮
   ══════════════════════════════════════ */
.bt-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 60;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(232,201,155,0.3);
  border-radius: 50%;
  background: rgba(15,12,10,0.75);
  color: #f7ead0;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.2s;
}
.bt-close:hover {
  background: rgba(212,165,116,0.35);
  transform: scale(1.08);
}

/* ══════════════════════════════════════
   VN 对话框 — 右侧面板核心组件
   ══════════════════════════════════════ */
.vn-box {
  flex: 1;
  display: none;
  flex-direction: column;
  margin: 24px 28px 20px;
  padding: 28px 32px;
  border: 1px solid rgba(232,201,155,0.25);
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(20,16,12,0.82) 0%,
    rgba(14,11,9,0.85) 100%
  );
  backdrop-filter: blur(20px);
  box-shadow:
    0 4px 30px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.05);
  cursor: pointer;
  min-height: 200px;
  overflow-y: auto;
}
.vn-box.active { display: flex; }

/* 名字标签 — 金色竖条 + 角色名 */
.vn-nameplate {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(212,165,116,0.15);
  flex-shrink: 0;
}
.vn-nameplate::before {
  content: "";
  display: block;
  width: 4px;
  height: 22px;
  background: #d4a574;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(212,165,116,0.5);
}
.vn-speaker-name {
  font-family: var(--font-serif), 'Georgia', serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #d4a574;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}

/* 文字区域 — 可滚动 */
.vn-text-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding-right: 60px;
  overflow-y: auto;
  min-height: 80px;
}
.vn-text {
  margin: 0;
  font-family: var(--font-serif), 'Georgia', serif;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.9;
  color: #f7ead0;
  text-shadow: 0 1px 12px rgba(0,0,0,0.55);
  word-break: break-word;
}

/* 继续提示（右下角闪烁箭头）*/
.vn-continue-hint {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-size: 12px;
  color: rgba(232,201,155,0.55);
  letter-spacing: 0.06em;
  animation: vnHintBlink 1.4s ease-in-out infinite;
  pointer-events: none;
  opacity: 0;
}
@keyframes vnHintBlink {
  0%,100% { opacity:0.3; }
  50%     { opacity:1;   }
}

/* 旁白模式：隐藏名字标签，斜体文字 */
.vn-box.vn-narration-mode .vn-nameplate { display: none; }
.vn-box.vn-narration-mode .vn-nameplate + .vn-text-area { padding-top: 0; }
.vn-box.vn-narration-mode .vn-text {
  font-style: italic;
  color: rgba(247,234,208,0.88);
}

/* ══════════════════════════════════════
   角色选择界面（覆盖层）
   ══════════════════════════════════════ */
.bt-select-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.bt-select-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.bt-select-inner {
  text-align: center;
  max-width: 900px;
  width: 100%;
}
.bt-select-kicker {
  font-family: var(--font-en);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: rgba(212,165,116,0.6);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.bt-select-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4.5vw, 44px);
  color: #f7ead0;
  margin: 4px 0 8px;
  text-shadow: 0 2px 24px rgba(0,0,0,0.7);
}
.bt-select-subtitle {
  color: rgba(247,234,208,0.55);
  font-size: 14px;
  margin-bottom: 36px;
}
.bt-select-cards {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
}
.bt-select-card {
  width: 200px;
  padding: 28px 18px 22px;
  border: 1px solid rgba(232,201,155,0.2);
  border-radius: 18px;
  background: rgba(20,16,12,0.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
  text-align: left;
  transition: all 0.28s ease;
}
.bt-select-card:hover {
  border-color: rgba(232,201,155,0.55);
  background: rgba(212,165,116,0.12);
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}
.bt-select-card-img {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  background: rgba(30,24,18,0.7);
  display: grid;
  place-items: center;
}
.bt-select-portrait {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center top;
}
.bt-select-avatar {
  font-size: 64px;
}
.bt-select-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: #f7ead0;
}
.bt-select-role {
  margin: 0 0 6px;
  font-size: 12px;
  color: rgba(212,165,116,0.78);
}
.bt-select-goal {
  margin: 0 0 8px;
  font-size: 11px;
  color: rgba(247,234,208,0.48);
  line-height: 1.5;
}
.bt-select-arrow {
  float: right;
  font-size: 20px;
  color: rgba(232,201,155,0.4);
  transition: all 0.2s;
}
.bt-select-card:hover .bt-select-arrow {
  color: #d4a574;
  transform: translateX(4px);
}

/* ══════════════════════════════════════
   探索提示（右侧面板内）
   ══════════════════════════════════════ */
.vn-explore-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
}
.vn-explore-hint.active { display: block; }
#vn-explore-text {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid rgba(232,201,155,0.35);
  border-radius: 999px;
  background: rgba(10,8,7,0.78);
  backdrop-filter: blur(12px);
  font-size: 14px;
  color: #f7ead0;
  animation: explorePulseIn 0.5s ease;
  cursor: pointer;
}
@keyframes explorePulseIn {
  from { opacity:0; transform: translateY(12px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   自由对话面板（右侧面板内）
   ══════════════════════════════════════ */
.bt-chat-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg,
    rgba(12,10,8,0.96) 0%,
    rgba(14,11,9,0.98) 100%);
}
.bt-chat-panel.active { display: flex; }

.bt-chat-header {
  position: relative;
  z-index: 31;
  margin-top: auto;
  padding: 16px 28px 8px;
}
.bt-chat-title {
  font-family: var(--font-serif);
  font-size: clamp(18px, 2.2vw, 26px);
  color: #f7ead0;
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.bt-chat-characters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.bt-chip {
  padding: 5px 14px;
  border: 1px solid rgba(232,201,155,0.2);
  border-radius: 999px;
  background: rgba(0,0,0,0.4);
  color: rgba(247,234,208,0.7);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.bt-chip:hover { background: rgba(212,165,116,0.15); }
.bt-chip.active {
  border-color: rgba(232,201,155,0.6);
  background: rgba(212,165,116,0.22);
  color: #f7ead0;
}

.bt-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 28px 14px;
  min-height: 80px;
  max-height: 42vh;
}
.bt-msg { max-width: 88%; margin-bottom: 10px; }
.bt-msg span {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  color: #d4a574;
}
.bt-msg p {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  background: rgba(255,248,225,0.07);
  color: #f7ead0;
}
.bt-msg.player {
  margin-left: auto;
}
.bt-msg.player span { text-align: right; }
.bt-msg.player p {
  background: rgba(212,165,116,0.2);
}
.bt-typing-msg {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.bt-typing-msg span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(232,201,155,0.5);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.bt-typing-msg span:nth-child(2) { animation-delay: 0.15s; }
.bt-typing-msg span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%,80%,100% { opacity:0.3; transform:scale(0.8); }
  40%        { opacity:1;   transform:scale(1); }
}

.bt-chat-prompts {
  display: flex;
  gap: 6px;
  padding: 8px 28px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(232,201,155,0.1);
}
.bt-prompt-chip {
  padding: 5px 13px;
  border: 1px solid rgba(232,201,155,0.2);
  border-radius: 999px;
  background: rgba(247,234,208,0.05);
  color: rgba(247,234,208,0.8);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.bt-prompt-chip:hover { background: rgba(212,165,116,0.18); }

.bt-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 28px 20px;
}
#bt-input {
  flex: 1;
  border: 1px solid rgba(232,201,155,0.2);
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(0,0,0,0.35);
  color: #f7ead0;
  font-size: 14px;
  outline: none;
}
#bt-input:focus { border-color: rgba(232,201,155,0.45); }
#bt-input::placeholder { color: rgba(247,234,208,0.3); }
#bt-send {
  width: 72px;
  border: 0;
  border-radius: 999px;
  background: #d4a574;
  color: #1a120c;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.2s;
}
#bt-send:hover { filter: brightness(1.15); }

/* ══════════════════════════════════════
   移动端适配 — 上下堆叠
   ══════════════════════════════════════ */
@media (max-width: 800px) {
  .bt-stage {
    flex-direction: column;
  }
  .bt-left-panel {
    width: 100%;
    height: 42vh;
    min-height: 280px;
  }
  .bt-right-panel {
    width: 100%;
    height: 58vh;
    border-left: none;
    border-top: 1px solid rgba(212,165,116,0.15);
  }
  .bt-character-model {
    height: 92%;
  }
  .vn-box {
    margin: 14px 14px 12px;
    padding: 18px 16px 14px;
    min-height: 140px;
  }
  .vn-text { font-size: 15px; }
  .bt-select-card { width: 46vw; max-width: 180px; padding: 18px 12px 14px; }
  .bt-select-card-img { height: 160px; }
  .bt-select-title { font-size: 26px; }
  .bt-chat-messages { max-height: 26vh; padding: 6px 14px; }
  .bt-chat-prompts { padding: 6px 14px; }
  .bt-prompt-chip { font-size: 11px; padding: 4px 10px; }
  .bt-chat-input-row { padding: 8px 14px 14px; }
  #bt-send { width: 58px; }
}
#ms-reply-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
}
.ms-reply-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 14, 8, 0.68);
}
.ms-reply-box {
  position: relative;
  width: min(560px, calc(100% - 32px));
  margin: 12vh auto;
  padding: 28px;
  background: #f8efd9;
  border: 1px solid rgba(184, 132, 78, 0.35);
  border-radius: 8px;
  box-shadow: var(--shadow-deep);
}
.ms-reply-close {
  position: absolute;
  right: 14px;
  top: 12px;
  border: 0;
  background: transparent;
  font-size: 24px;
  color: var(--color-muted);
  cursor: pointer;
}
.ms-reply-kicker {
  color: var(--color-gold);
  font-size: 13px;
  margin-bottom: 8px;
}
.ms-reply-box h3 {
  color: var(--color-ink);
  font-size: 22px;
  margin-bottom: 18px;
}
.ms-reply-paper {
  min-height: 150px;
  padding: 18px;
  white-space: pre-line;
  line-height: 1.9;
  background: rgba(255, 250, 240, 0.78);
  border-left: 3px solid var(--color-gold);
}

/* ============================================================
   夜间面板
   ============================================================ */
.night-panel {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(20, 12, 30, 0.97) 0%, rgba(30, 18, 45, 0.99) 100%);
  backdrop-filter: blur(12px);
}

.night-content {
  max-width: 480px;
  text-align: center;
  padding: 40px 32px;
  color: var(--color-cream);
}
.night-moon {
  font-size: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(255, 236, 179, 0.6));
  animation: moonFloat 4s ease-in-out infinite;
}
@keyframes moonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.night-content h3 {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 4px;
  margin-bottom: 16px;
  color: var(--color-gold-light);
}
.night-diary {
  font-size: 15px;
  line-height: 1.8;
  font-style: italic;
  margin: 16px 0;
  padding: 16px 20px;
  background: rgba(255,236,179,0.05);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
  text-align: left;
  color: rgba(250, 243, 224, 0.9);
}
.night-summary {
  font-size: 13px;
  color: rgba(250, 243, 224, 0.6);
  margin: 12px 0;
  font-style: italic;
}
.night-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.night-stat {
  font-size: 13px;
  padding: 4px 12px;
  background: rgba(255,236,179,0.1);
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 12px;
  color: var(--color-gold-light);
}

/* ============================================================
   结局画面
   ============================================================ */
.ending-screen {
  background: linear-gradient(180deg, #0a0612 0%, #1a0e2a 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.ending-screen.active { display: flex; }

.ending-content {
  max-width: 640px;
  text-align: center;
  color: var(--color-cream);
  position: relative;
  z-index: 1;
}

.ending-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
}
@keyframes twinkle {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.ending-type {
  font-family: var(--font-en);
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--color-gold-light);
  margin-bottom: 8px;
}
.ending-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 24px;
  color: var(--color-cream);
  text-shadow: 0 4px 20px rgba(212,165,116,0.3);
}
.ending-summary {
  text-align: left;
  font-size: 15px;
  line-height: 2;
  color: rgba(250, 243, 224, 0.9);
  margin: 24px 0;
  padding: 24px;
  background: rgba(255,236,179,0.04);
  border: 1px solid rgba(212,165,116,0.2);
  border-radius: 8px;
  min-height: 200px;
}
.ending-summary p {
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeInUp 0.6s forwards;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ending-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 24px 0;
  font-size: 14px;
  color: var(--color-gold-light);
}
.ending-stats > div {
  padding: 8px 16px;
  background: rgba(255,236,179,0.05);
  border-radius: 4px;
  border: 1px solid rgba(212,165,116,0.2);
}

/* ============================================================
   浮层菜单（存档 / 主菜单）
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.menu-box {
  background: var(--color-paper);
  border-radius: 12px;
  padding: 24px 32px;
  min-width: 360px;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: popIn 0.3s var(--ease-out);
}
.menu-box h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--color-ink);
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 2px;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin: 6px 0;
  background: transparent;
  border: 1px solid var(--color-line);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 15px;
  text-align: left;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.menu-item:hover {
  background: var(--color-gold-light);
  border-color: var(--color-gold);
}

.save-list { margin: 12px 0; }
.save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin: 6px 0;
  background: rgba(0,0,0,0.03);
  border-radius: 4px;
}
.save-info { font-size: 13px; }
.save-day { color: var(--color-ink); font-weight: 600; }
.save-time { color: var(--color-muted); font-size: 11px; }
.save-btns { display: flex; gap: 6px; }
.sl-btn {
  padding: 4px 10px;
  background: var(--color-gold);
  border: none;
  color: var(--color-cream);
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}
.sl-btn:hover { background: var(--color-wood); }
.slot-empty { color: var(--color-muted); font-size: 13px; font-style: italic; }

/* ============================================================
   时段背景色调
   ============================================================ */
.tod-morning   #scene-area { background: radial-gradient(ellipse at top, #F4E4C1 0%, #5C4A2E 70%); }
.tod-afternoon #scene-area { background: radial-gradient(ellipse at top, #E8C99B 0%, #4A3520 70%); }
.tod-evening   #scene-area { background: radial-gradient(ellipse at top, #C9A66B 0%, #2E1F14 75%); }
.tod-night     #scene-area { background: radial-gradient(ellipse at top, #2A1F3A 0%, #0a0612 80%); }

/* ============================================================
   AI 聊天面板
   ============================================================ */
.ai-chat-panel {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  background: rgba(30,18,12,0.95);
  animation: aiPanelIn 0.35s var(--ease-smooth);
}
@keyframes aiPanelIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(212,165,116,0.15);
  background: rgba(0,0,0,0.3);
}
.ai-chat-header h3 {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--color-gold);
  margin: 0;
}
.ai-chat-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: var(--color-muted);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.ai-chat-close:hover {
  background: rgba(176,95,78,0.3);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.ai-chat-messages::-webkit-scrollbar {
  width: 4px;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(212,165,116,0.2);
  border-radius: 2px;
}

/* 消息气泡 */
.ai-msg {
  max-width: 82%;
  animation: msgIn 0.3s var(--ease-smooth) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-msg.ai-msg-player {
  align-self: flex-end;
}
.ai-msg.ai-msg-ai {
  align-self: flex-start;
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}
.ai-msg-player .ai-msg-bubble {
  background: rgba(212,165,116,0.2);
  border: 1px solid rgba(212,165,116,0.35);
  color: #F4ECD8;
}
.ai-msg-ai .ai-msg-bubble {
  background: rgba(45,32,20,0.9);
  border: 1px solid rgba(212,165,116,0.15);
  color: #E8DCC8;
}

.ai-msg-sender {
  font-size: 11px;
  color: var(--color-muted);
  margin-bottom: 4px;
  padding: 0 4px;
}
.ai-msg-player .ai-msg-sender {
  text-align: right;
}

/* 打字指示器 */
.ai-typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  background: rgba(45,32,20,0.9);
  border: 1px solid rgba(212,165,116,0.15);
  border-radius: 14px;
  animation: msgIn 0.3s var(--ease-smooth);
}
.ai-typing-dot {
  width: 6px; height: 6px;
  background: var(--color-gold);
  border-radius: 50%;
  animation: dotPulse 1.2s infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.2); }
}

/* 输入区 */
.ai-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid rgba(212,165,116,0.15);
  background: rgba(0,0,0,0.3);
}
#ai-chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid rgba(212,165,116,0.2);
  background: rgba(0,0,0,0.4);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#ai-chat-input:focus {
  border-color: var(--color-gold);
}
#ai-chat-input::placeholder {
  color: rgba(200,180,150,0.4);
}
.ai-chat-send-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--color-gold);
  background: rgba(212,165,116,0.15);
  color: var(--color-gold);
  font-family: var(--font-serif);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ai-chat-send-btn:hover {
  background: var(--color-gold);
  color: #fff;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .title-content { padding: 28px 22px; }
  .title-h1 { font-size: 36px; letter-spacing: 4px; }
  .title-sub { font-size: 14px; }
  .title-premise { font-size: 12px; padding: 5px 10px; }
  .title-world { font-size: 13px; line-height: 1.75; margin-bottom: 18px; }
  .title-quote { font-size: 13px; }
  .btn-start { padding: 12px 24px; font-size: 16px; }
  .window-box { width: 80%; height: 45%; top: 8%; }
  .shelf { width: 14%; }
  .npc-sprite, .npc-portrait { width: 130px; height: 170px; }
  .hope-track { width: 100px; }
  .stat-label { font-size: 12px; padding: 4px 8px; }
  .dlg-text { font-size: 14px; }
  .bk-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .ending-title { font-size: 24px; }
  .mystore-content { width: min(100% - 20px, 1080px); padding-top: 32px; }
  .ms-hero h1 { font-size: 32px; }
  .ms-hero p { font-size: 14px; }
  .ms-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ms-section { padding: 18px; }
  .ms-section-head { display: block; }
  .ms-grid { grid-template-columns: 1fr; }
  .ms-reply-box { margin-top: 8vh; padding: 22px; }
}

/* ============ 书中剧场角色选择对话框 (从书籍详情页触发) ============ */
.theater-char-select-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.theater-char-select-box {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 16px;
  padding: 32px;
  max-width: 680px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.theater-char-select-box h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--color-gold);
  margin: 0 0 6px 0;
  text-align: center;
}
.theater-char-subtitle {
  font-size: 13px;
  color: rgba(200,180,150,0.6);
  text-align: center;
  margin: 0 0 20px 0;
}
.theater-char-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.theater-char-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,165,116,0.2);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}
.theater-char-card:hover {
  background: rgba(212,165,116,0.12);
  border-color: var(--color-gold);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.theater-char-card-img {
  width: 100%;
  height: 160px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  background: rgba(0,0,0,0.3);
}
.theater-char-portrait {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: top center;
}
.theater-char-avatar {
  font-size: 64px;
  line-height: 160px;
}
.theater-char-card h4 {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--color-gold);
  margin: 0 0 4px 0;
}
.theater-char-role {
  font-size: 12px;
  color: rgba(200,180,150,0.7);
  margin: 0 0 6px 0;
}
.theater-char-goal {
  font-size: 11px;
  color: rgba(200,180,150,0.5);
  margin: 0;
  line-height: 1.4;
}
.theater-char-cancel {
  display: block;
  margin: 0 auto;
  padding: 8px 28px;
  border-radius: 20px;
  border: 1px solid rgba(200,180,150,0.3);
  background: transparent;
  color: rgba(200,180,150,0.6);
  font-family: var(--font-serif);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.theater-char-cancel:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(200,180,150,0.9);
}

@media (max-width: 760px) {
  .theater-char-select-box { padding: 20px; }
  .theater-char-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .theater-char-card-img { height: 120px; }
}
