/* ============================================================================
   《云边有个小卖铺：蝉鸣与橘子汽水》 v3.0 长篇大师版 - 视觉小说演出与光影样式表
   ============================================================================ */

:root {
  --bg-dark: #0f172a;
  --glass-bg: rgba(15, 23, 42, 0.85);
  --glass-light: rgba(30, 41, 59, 0.78);
  --border-warm: rgba(251, 191, 36, 0.45);
  --border-sky: rgba(56, 189, 248, 0.42);
  --accent-orange: #fb923c;
  --accent-gold: #fbbf24;
  --accent-sky: #38bdf8;
  --accent-rose: #f43f5e;
  --accent-emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", "华文中宋", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #090d16;
  font-family: var(--font-sans);
  color: var(--text-main);
}

/* ==================== 1. 主舞台、镜头特效与背景视差层 ==================== */
#gameApp {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  transition: filter 0.6s ease;
}

/* 回忆杀怀旧滤镜 (Sepia Flashback) */
#gameApp.vfx-sepia #bgContainer,
#gameApp.vfx-sepia #spriteStage {
  filter: sepia(0.58) contrast(1.04) brightness(0.95);
}

/* 戏剧震屏特效 (Screen Shake) */
#gameApp.vfx-shake {
  animation: screenShake 0.48s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-9px, 6px); }
  30% { transform: translate(8px, -7px); }
  45% { transform: translate(-7px, -4px); }
  60% { transform: translate(6px, 5px); }
  75% { transform: translate(-4px, 3px); }
}

/* 雷电/快门闪白层 */
#vfxFlashOverlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease-out;
}

#vfxFlashOverlay.active {
  opacity: 0.78;
  transition: none;
}

#bgContainer {
  position: absolute;
  inset: -24px;
  z-index: 1;
  overflow: hidden;
  transition: transform 0.25s ease-out, filter 0.6s ease;
}

.bg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1), transform 12s ease-out;
  transform: scale(1.03);
}

.bg-layer.active {
  opacity: 1;
  transform: scale(1.0);
}

#bgVignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 55%, rgba(9, 13, 22, 0.52) 100%),
    linear-gradient(to bottom, rgba(9, 13, 22, 0.48) 0%, transparent 18%, transparent 70%, rgba(9, 13, 22, 0.84) 100%);
}

#weatherCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

/* ==================== 2. 场景可交互探索热点 (Hotspots) ==================== */
#hotspotLayer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.scene-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1.5px solid rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.45);
  backdrop-filter: blur(8px);
  color: #fef3c7;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.25s ease;
  animation: hotspotFloat 2.8s ease-in-out infinite;
}

.scene-hotspot:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(251, 146, 60, 0.94);
  color: #fff;
  box-shadow: 0 0 24px rgba(251, 146, 60, 0.85);
}

.scene-hotspot.discovered {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  opacity: 0.74;
}

@keyframes hotspotFloat {
  0%, 100% { margin-top: 0px; }
  50% { margin-top: -6px; }
}

/* ==================== 3. 角色立绘舞台 (含近景特写 Zoom 与环境光融合) ==================== */
#spriteStage {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  transition: filter 0.6s ease;
}

/* 根据当前背景自动赋予角色立绘环境色温 */
#spriteStage[data-lighting="sunset"] .char-sprite-img {
  filter: drop-shadow(0 12px 28px rgba(249, 115, 22, 0.32)) sepia(0.12) saturate(1.08);
}

#spriteStage[data-lighting="night"] .char-sprite-img {
  filter: drop-shadow(0 12px 32px rgba(56, 189, 248, 0.35)) brightness(0.94) contrast(1.04);
}

#spriteStage[data-lighting="snow"] .char-sprite-img {
  filter: drop-shadow(0 12px 30px rgba(251, 191, 36, 0.38)) brightness(1.02);
}

.char-sprite-wrap {
  position: absolute;
  bottom: -18px;
  height: 85vh;
  max-height: 810px;
  transform: translateX(-50%);
  transition: all 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.char-sprite-wrap.pos-left { left: 24%; }
.char-sprite-wrap.pos-center { left: 50%; }
.char-sprite-wrap.pos-right { left: 76%; }

/* 近景特写模式 (Close-up Zoom) */
.char-sprite-wrap.zoomed {
  height: 96vh;
  max-height: 920px;
  bottom: -55px;
  z-index: 5;
}

.char-sprite-img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
  transition: filter 0.35s ease, transform 0.35s ease;
  animation: spriteBreathe 4.2s ease-in-out infinite;
}

.char-sprite-wrap.speaking .char-sprite-img {
  filter: drop-shadow(0 14px 32px rgba(251, 191, 36, 0.45)) brightness(1.04) !important;
  transform: scale(1.03) translateY(-6px);
}

.char-sprite-wrap.dimmed .char-sprite-img {
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5)) brightness(0.73) saturate(0.85) !important;
  transform: scale(0.95) translateY(10px);
}

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

.char-emotion-bubble {
  position: absolute;
  top: 8%;
  right: 14%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 2.5px solid #fb923c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  animation: emotionPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), emotionBob 2s ease-in-out infinite;
  z-index: 6;
}

@keyframes emotionPop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes emotionBob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -7px; }
}

.char-interact-pill {
  position: absolute;
  top: 22%;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.65);
  padding: 5px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.char-sprite-wrap:hover .char-interact-pill {
  opacity: 1;
  transform: translateY(0);
}

.char-interact-pill button {
  background: transparent;
  border: none;
  color: #fde68a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 999px;
  transition: background 0.2s;
}

.char-interact-pill button:hover {
  background: rgba(251, 146, 60, 0.35);
  color: #fff;
}

/* ==================== 4. 顶部状态与快捷导航栏 (Top HUD) ==================== */
#topHud {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#topHud.hidden-ui,
#dialogueWrapper.hidden-ui {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(12px);
}

.hud-group {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.38);
}

.chapter-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 13.5px;
  color: #fde68a;
}

.chapter-date {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: #bae6fd;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.stat-chip span.val {
  color: #fbbf24;
  font-weight: 700;
}

.bond-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s;
}

.bond-chip:hover {
  background: rgba(251, 146, 60, 0.28);
  transform: translateY(-1px);
}

.hud-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-btn:hover {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.88), rgba(245, 158, 11, 0.88));
  border-color: #fde68a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(251, 146, 60, 0.4);
}

.hud-btn.highlight-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(251, 146, 60, 0.28));
  border-color: rgba(251, 191, 36, 0.55);
  color: #fef3c7;
}

.unread-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f43f5e;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.8);
}

/* ==================== 5. 底部经典视觉小说对话框 ==================== */
#dialogueWrapper {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1140px, 94vw);
  z-index: 20;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#speakerBadge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 22px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.93));
  border: 1.5px solid var(--border-warm);
  border-bottom: none;
  margin-left: 26px;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.28);
}

#speakerName {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 1px;
}

#speakerTag {
  font-size: 12px;
  color: #94a3b8;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

#dialogueBox {
  position: relative;
  min-height: 162px;
  padding: 22px 32px 50px 32px;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.88) 0%, rgba(23, 33, 53, 0.93) 100%);
  border: 1.5px solid var(--border-warm);
  backdrop-filter: blur(18px);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

#dialogueText {
  font-family: var(--font-serif);
  font-size: 19.5px;
  line-height: 1.82;
  color: #f8fafc;
  letter-spacing: 0.6px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#nextCursor {
  display: inline-block;
  margin-left: 8px;
  font-size: 18px;
  animation: cursorBounce 1s ease-in-out infinite;
}

@keyframes cursorBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-5px); opacity: 0.55; }
}

#vnQuickBar {
  position: absolute;
  bottom: 10px;
  right: 20px;
  left: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

.vn-hint-tip {
  font-size: 12px;
  color: rgba(203, 213, 225, 0.72);
}

.vn-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vn-tool-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.vn-tool-btn:hover,
.vn-tool-btn.active {
  background: rgba(251, 146, 60, 0.85);
  border-color: #fde68a;
  color: #fff;
}

/* ==================== 6. 分支选项覆盖层 & 限时心跳进度条 ==================== */
#choiceOverlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(9, 13, 22, 0.52);
  backdrop-filter: blur(5px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}

#choiceOverlay.show {
  display: flex;
  animation: fadeIn 0.28s ease-out;
}

.heartbeat-bar-wrap {
  width: min(780px, 90vw);
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #f43f5e;
  border-radius: 999px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.45);
}

.heartbeat-label {
  font-size: 13px;
  font-weight: 700;
  color: #fda4af;
  white-space: nowrap;
  animation: heartPulse 0.8s ease-in-out infinite;
}

.heartbeat-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.heartbeat-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f43f5e, #fb923c, #fbbf24);
  transition: width 0.1s linear;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.choice-card {
  width: min(780px, 90vw);
  padding: 15px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.94));
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.choice-card:hover {
  transform: translateY(-3px) scale(1.015);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(51, 65, 85, 0.96));
  border-color: #fbbf24;
  box-shadow: 0 16px 36px rgba(251, 146, 60, 0.38);
}

.choice-main-text {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #fef3c7;
}

.choice-sub-hint {
  font-size: 12.5px;
  color: #38bdf8;
}

/* ==================== 7. 主标题封面 (Title Screen) ==================== */
#titleScreen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to bottom, rgba(9, 13, 22, 0.35) 0%, rgba(9, 13, 22, 0.8) 100%),
    url("assets/images/bg_shop_day.webp") center/cover no-repeat;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#titleScreen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-card {
  text-align: center;
  padding: 38px 50px;
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(251, 191, 36, 0.48);
  backdrop-filter: blur(16px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75);
  max-width: 840px;
  width: 92vw;
}

.title-tag {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fde68a;
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 14px;
}

.title-main {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 4px 24px rgba(251, 146, 60, 0.65);
  margin-bottom: 8px;
}

.title-sub {
  font-family: var(--font-serif);
  font-size: 16.5px;
  color: #bae6fd;
  letter-spacing: 1.5px;
  margin-bottom: 24px;
}

.title-heroines-preview {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.title-char-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 8px 14px;
  border-radius: 16px;
}

.title-char-pill img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 2px solid #fbbf24;
  background: rgba(255, 255, 255, 0.15);
}

.title-menu-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.title-btn {
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  background: rgba(30, 41, 59, 0.88);
  color: #fef3c7;
}

.title-btn.primary {
  background: linear-gradient(135deg, #f97316, #eab308);
  color: #fff;
  border-color: #fef08a;
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.5);
}

.title-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(251, 191, 36, 0.45);
}

/* ==================== 8. 通用模态弹窗与互动小游戏舞台 ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 55;
  background: rgba(9, 13, 22, 0.78);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop.show {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.modal-panel {
  width: min(1020px, 95vw);
  max-height: 89vh;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.97));
  border: 1.5px solid rgba(251, 191, 36, 0.48);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #f8fafc;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #ef4444;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.interactive-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: all 0.22s ease;
}

.interactive-card:hover {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.char-gallery-card {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  align-items: center;
}

.char-gallery-img-box {
  width: 155px;
  height: 205px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.22), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(251, 191, 36, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.char-gallery-img-box img {
  height: 96%;
  width: auto;
  object-fit: contain;
}

.action-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.88), rgba(234, 179, 8, 0.88));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(251, 146, 60, 0.45);
}

.action-btn.secondary {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

.paper-note-sheet {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 100%);
  color: #1e293b;
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  font-family: var(--font-serif);
  border-left: 5px solid #f59e0b;
  line-height: 1.75;
}

.firefly-stage {
  position: relative;
  width: 100%;
  height: 330px;
  border-radius: 18px;
  overflow: hidden;
  background: url("assets/images/bg_mountain_night.webp") center/cover no-repeat;
  border: 1.5px solid #fbbf24;
  cursor: crosshair;
}

.clickable-firefly {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #fef08a 0%, #a3e635 45%, transparent 72%);
  box-shadow: 0 0 22px #bef264;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.15s;
  animation: emotionBob 1.6s ease-in-out infinite;
}

.clickable-firefly:hover {
  transform: scale(1.3);
}

#toastContainer {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.yunbian-toast {
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid #fbbf24;
  color: #fef3c7;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
  0% { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

#restoreUiBtn {
  position: absolute;
  bottom: 20px;
  right: 24px;
  z-index: 35;
  display: none;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #fbbf24;
  color: #fde68a;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 768px) {
  .char-gallery-card {
    grid-template-columns: 1fr;
  }
  .char-sprite-wrap {
    height: 72vh;
  }
  #dialogueText {
    font-size: 16.5px;
  }
}

/* ==================== 9. v4.0 五大主舞台内嵌高密度互动系统样式 ==================== */

/* 9.1 现场搜证 & 心灵共鸣 & 自由行动 顶栏面板 */
.stage-interactive-panel {
  width: 100%;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.92));
  border: 1.5px solid rgba(251, 191, 36, 0.65);
  border-radius: 20px;
  padding: 16px 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: choicePopIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stage-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.stage-panel-title {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 700;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-panel-badge {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

/* 9.2 现场搜证线索卡片网格 */
.investigation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.clue-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(251, 191, 36, 0.42);
  border-radius: 14px;
  padding: 11px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clue-card:hover {
  background: rgba(251, 146, 60, 0.22);
  border-color: #fbbf24;
  transform: translateY(-2px);
}

.clue-card.inspected {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.55);
}

.clue-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.clue-card-sub {
  font-size: 12px;
  color: #cbd5e1;
}

/* 9.3 心灵共鸣交锋进度槽 */
.resonance-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resonance-track {
  width: 100%;
  height: 11px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.resonance-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f472b6, #fbbf24);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.resonance-prompt-box {
  font-size: 13.5px;
  color: #fde68a;
  background: rgba(251, 146, 60, 0.13);
  border-left: 3px solid #fbbf24;
  padding: 8px 12px;
  border-radius: 8px;
}

/* 9.4 属性检定徽章 */
.stat-check-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.stat-check-badge.pass {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid #34d399;
  color: #a7f3d0;
}

.stat-check-badge.roll {
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid #fbbf24;
  color: #fde68a;
}

/* 9.5 对话框内嵌主动互动快捷条 */
#activeInteractStrip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(251, 191, 36, 0.25);
}

.quick-act-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
  cursor: pointer;
  transition: all 0.18s ease;
}

.quick-act-pill:hover {
  background: rgba(251, 146, 60, 0.35);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

/* ==================== 10. v5.0 全栈联机上线版：实时飘屏弹幕与云端状态样式 ==================== */
#danmakuStage {
  position: absolute;
  top: 66px;
  left: 0;
  right: 0;
  height: 165px;
  pointer-events: none;
  overflow: hidden;
  z-index: 26;
}

.danmaku-bullet {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  animation: danmakuFly linear forwards;
}

.danmaku-bullet.self-bullet {
  background: rgba(249, 115, 22, 0.35);
  border: 1.5px solid #fbbf24;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
}

.danmaku-bullet .dm-nick {
  font-size: 12px;
  opacity: 0.82;
  margin-right: 4px;
}

@keyframes danmakuFly {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-135vw);
  }
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  margin-right: 5px;
}

.danmaku-send-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.danmaku-send-inline input {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 999px;
  padding: 4px 12px;
  color: #fef3c7;
  font-size: 12px;
  width: 185px;
  outline: none;
}

.danmaku-send-inline input:focus {
  border-color: #fbbf24;
  width: 230px;
  transition: width 0.2s ease;
}



/* ============================================================================
 * 11. 动态特效与深度可玩性豪华增强样式 (v6.1 Dynamic Deluxe FX & Systems)
 * ============================================================================ */

/* 11.1 全屏点击橘子汽水气泡与水波纹特效 */
.click-soda-ripple {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.65), inset 0 0 8px rgba(56, 189, 248, 0.45);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%) scale(0.3);
  animation: sodaRippleExpand 0.68s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sodaRippleExpand {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(4.2);
    opacity: 0;
  }
}

.click-soda-bubble {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #fde68a 45%, rgba(249, 115, 22, 0.8) 100%);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  animation: sodaBubbleBurst 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes sodaBubbleBurst {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.95;
  }
  70% {
    opacity: 0.85;
  }
  100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, -40px))) scale(0.2);
    opacity: 0;
  }
}

/* 11.2 角色立绘 Live2D 级3D透视微倾、摸头/戳脸颊热区与情绪粒子光环 */
.sprite-card {
  transform-style: preserve-3d;
  will-change: transform, filter;
}

.sprite-touch-zones {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.sprite-card.speaking .sprite-touch-zones,
.sprite-card:hover .sprite-touch-zones {
  pointer-events: auto;
}

.touch-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.2s ease, background 0.2s ease;
}

.zone-head {
  top: 4%;
  width: 120px;
  height: 54px;
}

.zone-cheek {
  top: 17%;
  width: 115px;
  height: 48px;
}

.sprite-card:hover .touch-zone {
  opacity: 0.92;
}

.touch-hint {
  font-size: 11px;
  font-weight: 700;
  color: #fef3c7;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(251, 191, 36, 0.65);
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease;
}

.touch-zone:hover .touch-hint {
  transform: scale(1.1);
  background: rgba(245, 158, 11, 0.9);
  color: #0f172a;
}

@keyframes headpatBounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  25% { transform: translateY(6px) scale(1.03, 0.96) rotate(-1.5deg); }
  55% { transform: translateY(-5px) scale(0.98, 1.03) rotate(1.5deg); }
  80% { transform: translateY(3px) scale(1.01, 0.99); }
}

@keyframes cheekpokeWobble {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(9px) rotate(2.5deg) scale(1.02, 0.98); }
  45% { transform: translateX(-7px) rotate(-2deg); }
  70% { transform: translateX(4px) rotate(1deg); }
}

.sprite-card.anim-headpat img {
  animation: headpatBounce 0.65s ease-in-out;
}

.sprite-card.anim-cheekpoke img {
  animation: cheekpokeWobble 0.62s ease-in-out;
}

.sprite-aura-particle {
  position: absolute;
  font-size: 16px;
  pointer-events: none;
  z-index: 15;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  animation: auraParticleFloat 1.55s ease-out forwards;
}

@keyframes auraParticleFloat {
  0% {
    transform: translateY(8px) scale(0.5) rotate(-10deg);
    opacity: 0;
  }
  25% {
    opacity: 0.96;
    transform: translateY(-6px) scale(1.12) rotate(6deg);
  }
  100% {
    transform: translateY(-48px) scale(0.85) rotate(-8deg);
    opacity: 0;
  }
}

/* 11.3 角色说话实时声波律动指示器 */
.voice-wave-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 13px;
  margin-left: 8px;
  vertical-align: middle;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

.voice-wave-bars.active {
  opacity: 1;
}

.voice-wave-bars i {
  display: inline-block;
  width: 2.5px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, #fde68a, #f97316);
}

.voice-wave-bars.active i:nth-child(1) { animation: voiceWaveBar 0.45s ease-in-out infinite alternate; }
.voice-wave-bars.active i:nth-child(2) { animation: voiceWaveBar 0.35s ease-in-out 0.1s infinite alternate; }
.voice-wave-bars.active i:nth-child(3) { animation: voiceWaveBar 0.52s ease-in-out 0.18s infinite alternate; }
.voice-wave-bars.active i:nth-child(4) { animation: voiceWaveBar 0.38s ease-in-out 0.06s infinite alternate; }

@keyframes voiceWaveBar {
  0% { height: 3px; }
  100% { height: 13px; }
}

/* 11.4 关键词动态流光高亮 */
.kw-shimmer {
  display: inline-block;
  font-weight: 700;
  color: #fde68a;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.16), rgba(56, 189, 248, 0.18), rgba(251, 191, 36, 0.16));
  background-size: 200% 100%;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 5px;
  border-bottom: 1px dashed rgba(251, 191, 36, 0.65);
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.35);
  animation: kwShimmerMove 3.2s linear infinite;
}

@keyframes kwShimmerMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* 11.5 电影级章节转场画卷横幅 */
.chapter-scroll-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -18px) scale(0.95);
  z-index: 88;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.chapter-scroll-banner.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.csb-inner {
  min-width: 360px;
  padding: 16px 36px;
  text-align: center;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.92) 20%, rgba(15, 23, 42, 0.92) 80%, rgba(15, 23, 42, 0.15) 100%);
  border-top: 1px solid rgba(251, 191, 36, 0.55);
  border-bottom: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.csb-tag {
  font-size: 10px;
  letter-spacing: 3px;
  color: #fbbf24;
  margin-bottom: 4px;
}

.csb-title {
  font-size: 22px;
  font-weight: 900;
  color: #fef3c7;
  letter-spacing: 2px;
  text-shadow: 0 2px 12px rgba(245, 158, 11, 0.55);
}

.csb-divider {
  width: 120px;
  height: 2px;
  margin: 7px auto;
  background: linear-gradient(90deg, transparent, #fbbf24, transparent);
}

.csb-date {
  font-size: 12.5px;
  color: #cbd5e1;
  letter-spacing: 1px;
}

/* 11.6 舞台左上角小卖铺已装潢镇店陈设挂件条 */
.shop-stage-decor-bar {
  position: fixed;
  top: 58px;
  left: 16px;
  z-index: 26;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.stage-deco-pill {
  font-size: 11px;
  font-weight: 700;
  color: #fde68a;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(251, 191, 36, 0.42);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stage-deco-pill:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #fbbf24;
}

/* 11.7 云边拍立得相纸与暗房摇晃显影动画 */
.polaroid-frame {
  background: #f8fafc;
  color: #0f172a;
  padding: 10px 10px 14px 10px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.polaroid-frame:hover {
  transform: translateY(-4px) rotate(-0.8deg);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.6);
}

.polaroid-frame.shaking {
  animation: polaroidShakeAnim 0.45s ease-in-out infinite;
}

@keyframes polaroidShakeAnim {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(-5deg) translateX(-7px) translateY(-3px); }
  50% { transform: rotate(5deg) translateX(7px) translateY(2px); }
  75% { transform: rotate(-3deg) translateX(-4px); }
}

.polaroid-photo-box {
  position: relative;
  width: 100%;
  height: 158px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.polaroid-char-img {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  height: 152px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  transition: filter 0.8s ease;
}

.polaroid-frame.undeveloped .polaroid-char-img {
  filter: blur(8px) grayscale(0.9) brightness(0.4);
}

.polaroid-dark-mask {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
  cursor: pointer;
  transition: opacity 0.85s ease;
}

.polaroid-frame.developed .polaroid-dark-mask {
  opacity: 0;
  pointer-events: none;
}

.polaroid-sticker {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #fef3c7;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  backdrop-filter: blur(4px);
}

.polaroid-caption {
  margin-top: 9px;
}

/* 自由恋爱模式 · 里程碑庆祝横幅 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}


/* v6.1: keep the original stage usable on small screens and in short windows. */
input, textarea, select { user-select: text; -webkit-user-select: text; min-width: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #fde68a; outline-offset: 3px;
}
button:disabled { opacity: .6; cursor: wait; }
html, body, #gameApp { height: 100dvh; }
#titleScreen { overflow-y: auto; justify-content: flex-start; padding: 20px 0; }
.title-card { flex-shrink: 0; margin: auto; }
.hud-group { max-width: 100%; min-width: 0; }
#topHud > .hud-group:last-child { overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
#topHud > .hud-group:last-child > button { flex-shrink: 0; white-space: nowrap; }
.modal-panel { max-height: 89dvh; }
.modal-close { flex-shrink: 0; }
.modal-body, .interactive-card { min-width: 0; overflow-wrap: anywhere; }
.free-chat-panel { grid-template-columns: 200px minmax(0, 1fr); }
.free-chat-panel > div { min-width: 0; }
.free-chat-compose input { min-width: 0; }
#npcChatScroll { overflow-wrap: anywhere; }
@media (max-width: 768px) {
  #titleScreen { padding: max(12px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom)); }
  .title-card { padding: 24px 18px; border-radius: 20px; }
  .title-tag { font-size: 11px; letter-spacing: .6px; line-height: 1.7; }
  .title-sub { font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
  .title-heroines-preview { gap: 7px; margin-bottom: 18px; }
  .title-char-pill { padding: 6px 9px; gap: 6px; }
  .title-menu-btns { gap: 8px; }
  .title-btn { width: 100%; padding: 11px 12px; font-size: 14px; }
  #topHud { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; gap: 5px; }
  .hud-group { padding: 5px 8px; gap: 4px; overflow-x: auto; border-radius: 16px; }
  .hud-group > * { flex-shrink: 0; }
  #topHud > .hud-group:last-child { width: 100%; }
  #hudStatsGroup, #hudBondsGroup { max-width: 100%; }
  .stat-chip, .bond-chip { font-size: 11px; padding: 3px 5px; }
  .chapter-badge { font-size: 12px; gap: 5px; }
  .chapter-date { font-size: 10px; }
  #dialogueWrapper { width: calc(100% - 16px); bottom: max(8px, env(safe-area-inset-bottom)); }
  #dialogueBox { padding: 14px; max-height: 49dvh; overflow-y: auto; border-radius: 15px; }
  #dialogueText { font-size: 16px; line-height: 1.7; }
  #speakerBadge { margin-left: 12px; padding: 5px 12px; }
  #speakerName { font-size: 16px; }
  #speakerTag { font-size: 10px; }
  #activeInteractStrip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; }
  #activeInteractStrip > * { flex-shrink: 0; }
  #vnQuickBar { position: static; margin-top: 8px; display: block; }
  .vn-hint-tip { display: none; }
  .vn-tools { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .vn-tools > button { flex-shrink: 0; min-height: 32px; }
  .modal-backdrop { padding: 8px; }
  .modal-panel { width: 100%; max-height: 94dvh; border-radius: 18px; }
  .modal-header { padding: 12px; gap: 8px; }
  .modal-title { font-size: 17px; }
  .modal-body { padding: 14px 12px; gap: 12px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
  .free-chat-panel { grid-template-columns: minmax(0, 1fr); padding: 10px !important; }
  .free-chat-panel > div:first-child { flex-direction: row !important; justify-content: center; flex-wrap: wrap; }
  #chatPortraitImg { height: 100px !important; }
  .free-chat-panel > div:first-child > div:last-child { width: auto !important; min-width: 130px; }
  .free-chat-compose { flex-wrap: wrap; }
  .free-chat-compose input { flex-basis: calc(100% - 90px) !important; font-size: 16px !important; }
  .free-chat-compose #npcSendBtn { margin-left: auto; }
  .csb-inner { min-width: 0; width: 90vw; padding: 14px 20px; }
  .csb-title { font-size: 18px; }
}

#choiceOverlay { overflow-y: auto; }
#choiceOverlay > * { flex-shrink: 0; }
@media (max-width: 768px), (max-height: 600px) {
  #choiceOverlay { justify-content: flex-start; padding: 18px 12px; }
  #choiceOverlay > :first-child { margin-top: auto; }
  #choiceOverlay > :last-child { margin-bottom: auto; }
}
