:root {
  --ink: #24302d;
  --muted: #68746f;
  --paper: rgba(255, 252, 245, 0.92);
  --paper-strong: rgba(255, 252, 245, 0.98);
  --line: rgba(62, 76, 71, 0.18);
  --green: #4d8b68;
  --sun: #e9a94a;
  --rose: #dc736b;
  --blue: #5b84a5;
  --shadow: 0 24px 70px rgba(31, 37, 32, 0.28);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #d9e0d2;
}

button {
  font: inherit;
}

.game-shell {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 8px;
  background: #f4eadc;
  box-shadow: var(--shadow);
  isolation: isolate;
  cursor: pointer;
}

.scene-art,
.scene-vignette,
.character-layer {
  position: absolute;
  inset: 0;
}

.scene-art {
  z-index: -3;
  background-image: url("../../public/images/campus-scenes.webp");
  background-size: 200% 200%;
  filter: saturate(1.03) contrast(0.98);
  transform: scale(1.015);
}

.stage:not(.is-started) .scene-art,
.stage:not(.is-started) .character-sprite,
.stage:not(.is-started) .speaker-avatar {
  background-image: none;
}

.scene-art.is-story-image {
  filter: saturate(1.02) contrast(0.98);
}

.stage.has-story-image .character-layer {
  opacity: 0;
  visibility: hidden;
}

.bg-study {
  background-position: 0 0;
}

.bg-library {
  background-position: 100% 0;
}

.bg-canteen {
  background-position: 0 100%;
}

.bg-tea-shop {
  background-position: 0 100%;
}

.bg-path {
  background-position: 100% 100%;
}

.bg-corridor,
.bg-dorm,
.bg-study-night,
.bg-classroom {
  background-image: url("../../public/images/campus-scenes-2.webp");
}

.bg-cafe {
  background-image: url("../../public/images/cafe-livestream.webp");
  background-position: center;
  background-size: cover;
}

.bg-corridor {
  background-position: 0 0;
}

.bg-dorm {
  background-position: 100% 0;
}

.bg-study-night {
  background-position: 0 100%;
}

.bg-classroom {
  background-position: 100% 100%;
}

.bg-bookclub-classroom {
  background-image:
    linear-gradient(180deg, rgba(255, 247, 225, 0.18), rgba(26, 31, 29, 0.28)),
    url("../../public/images/story/ch6/ch6-21-four-person-open-talk.webp"),
    url("../../public/images/campus-scenes-2.webp");
  background-position: center, center, 100% 100%;
  background-size: cover, cover, 200% 200%;
  filter: saturate(0.98) contrast(0.98) brightness(0.9);
}

.bg-bookclub-refusal {
  background-image:
    linear-gradient(180deg, rgba(233, 241, 244, 0.16), rgba(25, 31, 34, 0.38)),
    url("../../public/images/story/ch6/ch6-03-shuangwan-setup-wide.webp"),
    url("../../public/images/campus-scenes-2.webp");
  background-position: center, center, 100% 100%;
  background-size: cover, cover, 200% 200%;
  filter: saturate(0.92) contrast(0.98) brightness(0.86);
}

.bg-milk-tea-exterior {
  background-image:
    linear-gradient(180deg, rgba(255, 246, 221, 0.12), rgba(33, 37, 32, 0.2)),
    url("../../public/images/story/ch6/ch6-08-milk-tea-storm-front.webp"),
    url("../../public/images/campus-scenes.webp");
  background-position: center, center, 0 100%;
  background-size: cover, cover, 200% 200%;
  filter: saturate(1.05) contrast(1.02) brightness(0.96);
}

.bg-rainy-path {
  background-image:
    linear-gradient(180deg, rgba(204, 222, 229, 0.18), rgba(21, 28, 31, 0.42)),
    url("../../public/images/story/ch6/ch6-10-rain-shortcut.webp"),
    url("../../public/images/campus-scenes.webp");
  background-position: center, center, 100% 100%;
  background-size: cover, cover, 200% 200%;
  filter: saturate(0.86) contrast(1.03) brightness(0.78);
}

.scene-vignette {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(248, 244, 234, 0.24), rgba(33, 39, 34, 0.18) 54%, rgba(29, 31, 28, 0.46)),
    linear-gradient(90deg, rgba(245, 236, 219, 0.28), transparent 35%, rgba(245, 236, 219, 0.18));
}

.poster-focus {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  place-items: center;
  padding: 0;
  background: #151712;
  cursor: pointer;
}

.stage.is-poster-view .poster-focus {
  display: grid;
}

.stage.is-poster-view .topbar,
.stage.is-poster-view .stats-panel,
.stage.is-poster-view .now-playing,
.stage.is-poster-view .dialogue-card,
.stage.is-poster-view .character-layer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.poster-focus-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.poster-focus-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  color: #fffdf5;
  background: linear-gradient(90deg, rgba(18, 20, 16, 0.78), rgba(18, 20, 16, 0.44));
  border: 1px solid rgba(255, 252, 245, 0.22);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.poster-focus-kicker {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 252, 245, 0.72);
  font-size: 12px;
  font-weight: 750;
}

.poster-focus-title {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.poster-focus-copy {
  max-width: 760px;
  margin: 6px 0 0;
  color: rgba(255, 252, 245, 0.82);
  font-size: 14px;
  line-height: 1.55;
}

.poster-focus-btn {
  min-width: 96px;
  min-height: 44px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 252, 245, 0.36);
  border-radius: 8px;
  color: #24302d;
  background: rgba(255, 252, 245, 0.9);
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, background 160ms ease;
}

.poster-focus-btn:hover {
  transform: translateY(-1px);
  background: #fffdf5;
}

.stage.is-guide-poster .poster-focus {
  background: #10140f;
}

.stage.is-guide-poster .poster-focus-image {
  object-fit: contain;
}

.stage.is-guide-poster .poster-focus-bar {
  left: auto;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100% - 36px));
  align-items: center;
  background: rgba(18, 20, 16, 0.7);
}

.stage.is-guide-poster .poster-focus-copy {
  font-size: 13px;
}

.cover-screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 48px);
  color: #fffdf5;
  cursor: default;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.cover-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-art,
.cover-scrim {
  position: absolute;
  inset: 0;
}

.cover-art {
  z-index: -2;
  background-image: url("../../public/images/cover-poster-8b054c3d.webp");
  background-size: cover;
  background-position: center;
}

.cover-scrim {
  z-index: -1;
  display: none;
}

.cover-scrim::before,
.cover-scrim::after {
  content: "";
  position: absolute;
  left: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}

.cover-scrim::before {
  top: 13%;
  width: min(720px, 76vw);
  height: 56%;
  background: linear-gradient(180deg, rgba(255, 246, 218, 0.26), rgba(255, 246, 218, 0));
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  opacity: 0.52;
}

.cover-scrim::after {
  top: 22%;
  width: min(780px, 82vw);
  height: 48%;
  border-top: 1px solid rgba(255, 248, 226, 0.16);
  border-bottom: 1px solid rgba(255, 248, 226, 0.1);
  background: radial-gradient(ellipse at center, rgba(16, 24, 22, 0.18), transparent 72%);
  opacity: 0.46;
}

.cover-content {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 92vw);
  display: grid;
  justify-items: center;
  align-content: center;
  padding: clamp(26px, 5vw, 52px) clamp(18px, 4vw, 42px);
  text-align: center;
  border-radius: 8px;
  transform: translate(-50%, -50%);
  text-shadow: 0 3px 14px rgba(12, 18, 16, 0.36);
}

.cover-kicker {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  color: rgba(255, 252, 245, 0.86);
}

.title-emblem {
  display: grid;
  place-items: center;
  width: 46px;
  height: 34px;
  margin-bottom: 14px;
  color: rgba(178, 236, 242, 0.72);
  opacity: 0.82;
  filter: drop-shadow(0 0 8px rgba(100, 200, 218, 0.18)) drop-shadow(0 12px 24px rgba(22, 29, 25, 0.2));
}

.title-emblem svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.cover-title {
  display: grid;
  gap: 0;
  margin: 0;
  color: #fffdf5;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(60px, 7.4vw, 108px);
  line-height: 0.98;
  font-weight: 850;
  letter-spacing: 0;
  text-shadow:
    0 1px 0 rgba(255, 236, 184, 0.24),
    0 10px 22px rgba(21, 29, 25, 0.38),
    0 24px 52px rgba(21, 29, 25, 0.42);
}

.cover-title span {
  position: relative;
  display: block;
  white-space: nowrap;
}

.cover-title span:first-child {
  font-size: 0.84em;
}

.cover-title span:last-child {
  font-size: 1em;
}

.title-wave {
  color: #fffdf5;
  background: linear-gradient(180deg, #ffffff 0%, #fff9e7 56%, #eafcff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 0 10px rgba(125, 221, 235, 0.14),
    0 9px 22px rgba(24, 38, 35, 0.34),
    0 22px 48px rgba(21, 29, 25, 0.4);
}

.title-lamp {
  color: #fff8df;
  background: linear-gradient(180deg, #fffdf4 0%, #ffe7a9 45%, #fff7d7 72%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 0 10px rgba(255, 228, 143, 0.36),
    0 0 32px rgba(244, 187, 74, 0.32),
    0 12px 28px rgba(31, 29, 21, 0.4),
    0 28px 58px rgba(21, 29, 25, 0.44);
}

.title-lamp::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  z-index: -1;
  width: 1.6em;
  height: 1.2em;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 223, 125, 0.42), rgba(255, 223, 125, 0.12) 42%, transparent 72%);
  filter: blur(9px);
}

.cover-subtitle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 0;
  color: rgba(255, 248, 226, 0.92);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(18px, 2.5vw, 30px);
  line-height: 1.25;
  font-weight: 760;
  text-shadow: 0 8px 24px rgba(20, 28, 24, 0.45);
}

.cover-subtitle span {
  display: block;
  width: clamp(34px, 7vw, 82px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 226, 0.82));
}

.cover-subtitle span:last-child {
  background: linear-gradient(90deg, rgba(255, 248, 226, 0.82), transparent);
}

.cover-copy {
  max-width: 520px;
  margin: 22px 0 32px;
  color: rgba(255, 252, 245, 0.9);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.7;
  font-weight: 650;
}

.start-btn {
  min-width: 210px;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: #25342f;
  background: linear-gradient(135deg, #fffaf0, #f3cf84);
  box-shadow: 0 18px 38px rgba(18, 23, 20, 0.28);
  cursor: pointer;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: 0;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.start-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 22px 46px rgba(18, 23, 20, 0.34);
}

.start-btn:active {
  transform: translateY(0);
}

.music-panel {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: min(330px, calc(100% - 48px));
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background: rgba(31, 42, 37, 0.46);
  box-shadow: 0 18px 46px rgba(18, 23, 20, 0.28);
  backdrop-filter: blur(16px);
}

.cover-screen .music-panel {
  display: none;
}

.music-panel p,
.music-panel strong,
.music-panel span {
  margin: 0;
}

.music-panel p {
  color: rgba(255, 252, 245, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.music-panel strong {
  font-size: 18px;
}

.music-panel span {
  color: rgba(255, 252, 245, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.music-toggle {
  justify-self: start;
  margin-top: 4px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  padding: 6px 12px;
  color: #fffdf5;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.character-layer {
  z-index: -1;
  pointer-events: none;
}

.character-sprite {
  position: absolute;
  bottom: 132px;
  width: min(31vw, 330px);
  height: min(68vh, 610px);
  opacity: 0;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  filter: drop-shadow(0 24px 26px rgba(31, 37, 32, 0.24)) saturate(0.86);
  transform: translateY(18px) scale(0.96);
  transition: opacity 260ms ease, transform 260ms ease, filter 260ms ease;
}

.sprite-yunshu {
  left: max(28px, 8vw);
  background-image: url("../../public/images/yunshu-cg.webp");
}

.sprite-xingmian {
  right: max(20px, 8vw);
  background-image: url("../../public/images/xingmian-cg.webp");
}

.sprite-fengyin {
  left: clamp(190px, 26vw, 430px);
  width: min(29vw, 305px);
  background-image: url("../../public/images/fengyin-cg.webp");
}

.sprite-shuangwan {
  right: clamp(180px, 25vw, 410px);
  width: min(28vw, 290px);
  background-image: url("../../public/images/shuangwan-cg.webp");
}

.character-sprite.is-visible {
  opacity: 0.82;
}

.character-sprite.is-speaking {
  opacity: 1;
  filter: drop-shadow(0 26px 28px rgba(31, 37, 32, 0.3)) saturate(1.05);
  transform: translateY(0) scale(1.02);
  animation: spriteBreath 2600ms ease-in-out infinite;
}

.character-sprite.is-idle {
  opacity: 0.58;
}

.sprite-yunshu.is-entering {
  animation: yunshuEnter 760ms cubic-bezier(0.2, 0.9, 0.2, 1) both, spriteBreath 2600ms ease-in-out 760ms infinite;
}

.sprite-xingmian.is-entering {
  animation: xingmianEnter 820ms cubic-bezier(0.2, 0.9, 0.2, 1) both, spriteBreath 2600ms ease-in-out 820ms infinite;
}

.sprite-fengyin.is-entering {
  animation: yunshuEnter 760ms cubic-bezier(0.2, 0.9, 0.2, 1) both, spriteBreath 2600ms ease-in-out 760ms infinite;
}

.sprite-shuangwan.is-entering {
  animation: xingmianEnter 820ms cubic-bezier(0.2, 0.9, 0.2, 1) both, spriteBreath 2600ms ease-in-out 820ms infinite;
}

.motion-bounce.is-speaking {
  animation: spriteBounce 700ms ease both, spriteBreath 2600ms ease-in-out 700ms infinite;
}

.motion-shake.is-speaking {
  animation: spriteShake 520ms ease both, spriteBreath 2600ms ease-in-out 520ms infinite;
}

.motion-sway.is-speaking {
  animation: spriteSway 900ms ease both, spriteBreath 2600ms ease-in-out 900ms infinite;
}

@keyframes yunshuEnter {
  0% {
    opacity: 0;
    transform: translateX(-120px) translateY(16px) scale(0.9);
  }

  70% {
    opacity: 1;
    transform: translateX(10px) translateY(0) scale(1.04);
  }

  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1.02);
  }
}

@keyframes xingmianEnter {
  0% {
    opacity: 0;
    transform: translateX(140px) translateY(12px) scale(0.88);
  }

  68% {
    opacity: 1;
    transform: translateX(-12px) translateY(0) scale(1.07);
  }

  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1.02);
  }
}

@keyframes spriteBreath {
  0%, 100% {
    transform: translateY(0) scale(1.02);
  }

  50% {
    transform: translateY(-5px) scale(1.025);
  }
}

@keyframes spriteBounce {
  0%, 100% {
    transform: translateY(0) scale(1.02);
  }

  40% {
    transform: translateY(-14px) scale(1.06);
  }
}

@keyframes spriteShake {
  0%, 100% {
    transform: translateX(0) translateY(0) scale(1.02);
  }

  25% {
    transform: translateX(-8px) translateY(0) scale(1.02);
  }

  55% {
    transform: translateX(7px) translateY(0) scale(1.02);
  }
}

@keyframes spriteSway {
  0%, 100% {
    transform: translateX(0) translateY(0) rotate(0) scale(1.02);
  }

  28% {
    transform: translateX(-5px) translateY(-3px) rotate(-1.2deg) scale(1.025);
  }

  64% {
    transform: translateX(4px) translateY(0) rotate(0.9deg) scale(1.02);
  }
}

.topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.game-title-badge {
  max-width: min(300px, 44vw);
  padding: 10px 13px 11px;
  border: 1px solid rgba(255, 252, 245, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 252, 245, 0.22), rgba(255, 252, 245, 0.08));
  box-shadow: 0 14px 34px rgba(20, 29, 25, 0.18);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 3px;
  color: rgba(255, 252, 245, 0.86);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
}

h1 {
  margin: 0;
  color: #fffdf5;
  font-family: "Hannotate SC", "Yuanti SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
}

.game-subtitle {
  margin: 4px 0 0;
  color: rgba(255, 252, 245, 0.84);
  font-family: "Yuanti SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: clamp(11px, 1.2vw, 14px);
  line-height: 1.2;
  font-weight: 650;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
}

.top-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  color: #2f3b36;
  background: rgba(255, 252, 245, 0.88);
  box-shadow: 0 8px 24px rgba(31, 37, 32, 0.18);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: #fffdf7;
}

.now-playing {
  position: absolute;
  top: 126px;
  left: 18px;
  max-width: min(270px, calc(100% - 230px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  color: #fffdf5;
  background: rgba(39, 52, 46, 0.35);
  box-shadow: 0 10px 28px rgba(31, 37, 32, 0.16);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.now-playing span {
  color: rgba(255, 252, 245, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.now-playing strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-panel {
  position: static;
  flex: 1 1 440px;
  width: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-left: 8px;
  pointer-events: none;
}

.stat {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: rgba(57, 70, 65, 0.78);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  transform-origin: center;
  will-change: transform;
}

.stat::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--stat-a, var(--green));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--stat-a, var(--green)) 18%, transparent);
}

.stat span {
  color: #394641;
  font-weight: 680;
}

.stat strong {
  color: #24302d;
  font-size: 14px;
  text-align: left;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.stat i {
  display: none;
}

.stat i::before {
  content: "";
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--stat-a, var(--green)), var(--stat-b, #92b57c));
  transition: width 220ms ease;
}

.stat[data-stat="chengxin"] {
  --stat-a: #5d9b83;
  --stat-b: #b7d79b;
}

.stat[data-stat="weiyong"] {
  --stat-a: #d49d48;
  --stat-b: #f0cf75;
}

.stat[data-stat="xinchao"] {
  --stat-a: #dc736b;
  --stat-b: #e9a94a;
}

.stat[data-stat="tongpin"] {
  --stat-a: #6aa8a8;
  --stat-b: #a9d6c7;
}

.stat[data-stat="zhangdeng"] {
  --stat-a: #c58a3d;
  --stat-b: #f5d37d;
}

.stat[data-stat="qisheng"] {
  --stat-a: #7c9ec8;
  --stat-b: #c3d5ee;
}

.stat.is-tide i::before {
  background: linear-gradient(90deg, var(--rose), var(--sun));
}

.stat-pop {
  position: absolute;
  left: 50%;
  top: -32px;
  z-index: 2;
  padding: 0;
  color: var(--stat-a, var(--green));
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    0 1px 0 rgba(255, 252, 245, 0.95),
    0 -1px 0 rgba(255, 252, 245, 0.85),
    1px 0 0 rgba(255, 252, 245, 0.85),
    -1px 0 0 rgba(255, 252, 245, 0.85),
    0 6px 14px rgba(31, 37, 32, 0.28);
  animation: statPop 3600ms ease-in-out both;
}

.stat.is-bumping {
  animation: statBump 2400ms ease-in-out both;
}

.stat.is-tide-up {
  animation: statTideShake 2600ms ease-in-out both;
}

.stat.is-tide-down .stat-pop {
  color: var(--green);
}

@keyframes statPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) rotate(-2deg) scale(0.88);
  }

  12% {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) rotate(2deg) scale(1.04);
  }

  28% {
    opacity: 1;
    transform: translateX(calc(-50% - 4px)) translateY(-8px) rotate(-1deg) scale(1);
  }

  46% {
    opacity: 1;
    transform: translateX(calc(-50% + 5px)) translateY(-9px) rotate(1deg) scale(1.02);
  }

  68% {
    opacity: 1;
    transform: translateX(calc(-50% - 3px)) translateY(-10px) rotate(-1deg) scale(1);
  }

  86% {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px) rotate(1deg) scale(0.99);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px) rotate(2deg) scale(0.96);
  }
}

@keyframes statBump {
  0%, 100% {
    transform: translateX(0);
  }

  16% {
    transform: translateX(-3px) rotate(-1deg);
  }

  34% {
    transform: translateX(3px) rotate(1deg);
  }

  54% {
    transform: translateX(-2px) rotate(-0.7deg);
  }

  74% {
    transform: translateX(2px) rotate(0.7deg);
  }
}

@keyframes statTideShake {
  0%, 100% {
    transform: translateX(0);
  }

  16% {
    transform: translateX(-5px) rotate(-1.2deg);
  }

  34% {
    transform: translateX(4px) rotate(1.2deg);
  }

  54% {
    transform: translateX(-3px) rotate(-0.8deg);
  }

  76% {
    transform: translateX(2px) rotate(0.6deg);
  }
}

@media (min-width: 821px) and (max-width: 1040px) {
  .stats-panel {
    flex: 0 0 calc(100% - 78px);
    width: calc(100% - 78px);
    margin-left: 78px;
    gap: 8px 14px;
  }

  .now-playing {
    top: 126px;
  }
}

.dialogue-card {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  min-height: 220px;
  padding: 16px 18px 40px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 48px rgba(30, 38, 34, 0.24);
  backdrop-filter: blur(18px);
}

.chapter-row {
  position: absolute;
  right: 18px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: calc(100% - 36px);
  margin: 0;
  padding: 5px 9px;
  border: 1px solid rgba(77, 139, 104, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.72);
  font-size: 12px;
  font-weight: 750;
}

#hintLabel {
  color: rgba(70, 84, 78, 0.62);
}

.speaker-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
}

.speaker-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
  flex: 1 1 auto;
}

.speaker-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(44, 54, 48, 0.22);
  background: linear-gradient(135deg, #c6d4c5, #fff5d7);
  position: relative;
  overflow: hidden;
}

.speaker-avatar::before,
.speaker-avatar::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.avatar-yunshu,
.avatar-xingmian {
  background-size: cover;
  background-position: center;
}

.avatar-yunshu {
  background-image: url("../../public/images/avatar-yunshu-small.webp");
}

.avatar-xingmian {
  background-image: url("../../public/images/avatar-xingmian-small.webp");
}

.avatar-yunshu::before,
.avatar-yunshu::after,
.avatar-xingmian::before,
.avatar-xingmian::after {
  display: none;
}

.avatar-fengyin,
.avatar-shuangwan {
  background-size: 185%;
  background-repeat: no-repeat;
}

.avatar-fengyin {
  background-image: url("../../public/images/fengyin-cg.webp");
  background-position: 50% 8%;
}

.avatar-shuangwan {
  background-image: url("../../public/images/shuangwan-cg.webp");
  background-position: 50% 6%;
}

.avatar-fengyin::before,
.avatar-fengyin::after,
.avatar-shuangwan::before,
.avatar-shuangwan::after {
  display: none;
}

.avatar-narrator {
  background-image: url("../../public/images/shuimu-cg.webp");
  background-size: cover;
  background-position: center;
}

.avatar-narrator::before,
.avatar-narrator::after {
  display: none;
}

.avatar-xiaolongxia {
  background-image: url("../../public/images/xiaolongxia-avatar.webp");
  background-size: cover;
  background-position: center;
}

.avatar-xiaolongxia::before,
.avatar-xiaolongxia::after {
  display: none;
}

.avatar-live {
  background-image: url("../../public/images/laowang-cg.webp");
  background-size: cover;
  background-position: center;
}

.avatar-live::before,
.avatar-live::after {
  display: none;
}

.speaker-name {
  margin: 0;
  font-weight: 800;
  font-size: 22px;
}

.speaker-mood {
  max-width: 100%;
  margin: 0;
  padding: 3px 10px;
  border: 1px solid rgba(77, 139, 104, 0.18);
  border-radius: 999px;
  color: #53645d;
  background: rgba(232, 244, 235, 0.68);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dialogue-text {
  min-height: 62px;
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.72;
  font-weight: 650;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.choice-btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(77, 102, 92, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.choice-btn span {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fffdf5;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.choice-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(77, 139, 104, 0.48);
  background: rgba(255, 255, 255, 0.9);
}

.poster-choices {
  gap: 12px;
}

.poster-choice {
  min-height: 0;
  padding: 8px;
  display: grid;
  gap: 8px;
  align-items: stretch;
  background: rgba(255, 253, 247, 0.72);
}

.poster-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 1672 / 941;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(31, 37, 32, 0.16);
}

.poster-choice strong {
  display: block;
  min-height: 22px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

.poster-choice:hover img {
  filter: saturate(1.04) contrast(1.02);
}

.primary-choice {
  grid-column: 1 / -1;
  justify-content: center;
  text-align: center;
  background: #fffdf7;
}

.theme-choice {
  border-color: rgba(77, 139, 104, 0.42);
  color: #fdfbf3;
  background: linear-gradient(135deg, #3f7c58, #243d35);
}

.theme-choice span {
  color: #243d35;
  background: #fff5c7;
}

.theme-choice:hover {
  border-color: rgba(255, 245, 199, 0.72);
  background: linear-gradient(135deg, #4f9168, #2b4a40);
}

.history-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.history-dialog::backdrop {
  background: rgba(33, 39, 34, 0.42);
}

.theme-video-dialog {
  width: min(960px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: #101615;
  box-shadow: var(--shadow);
}

.theme-video-dialog::backdrop {
  background: rgba(12, 18, 16, 0.72);
}

.theme-video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  color: #fffdf5;
  background: #17231f;
}

.theme-video-head span {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 253, 245, 0.62);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-video-head h2 {
  margin: 0;
  font-size: 20px;
}

.theme-video-dialog video {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  background: #050706;
}

.history-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fffdf7;
}

.history-head h2 {
  margin: 0;
  font-size: 20px;
}

.history-list {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.history-item strong {
  margin-right: 8px;
}

.history-item span {
  color: var(--muted);
  font-size: 13px;
}

.history-item p,
.empty-history {
  margin: 6px 0 0;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fffdf5;
  background: rgba(42, 52, 47, 0.88);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  .game-shell {
    padding: 0;
  }

  .stage {
    min-height: 100vh;
    border-radius: 0;
  }

  .topbar {
    top: 14px;
    left: 14px;
    right: 14px;
  }

  .game-title-badge {
    max-width: 210px;
    padding: 8px 10px 9px;
  }

  h1 {
    font-size: 20px;
  }

  .stats-panel {
    flex: 0 0 calc(100% - 68px);
    width: calc(100% - 68px);
    margin-left: 68px;
    gap: 7px 12px;
    padding: 0;
    background: transparent;
  }

  .stat {
    gap: 4px;
    font-size: 12px;
  }

  .now-playing {
    top: 192px;
    left: 14px;
    max-width: min(260px, calc(100% - 28px));
  }

  .dialogue-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 13px 14px 40px;
    min-height: 256px;
  }

  .chapter-row {
    right: 12px;
    bottom: 10px;
    max-width: calc(100% - 24px);
    font-size: 11px;
  }

  .speaker-row {
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
  }

  .speaker-avatar {
    width: 56px;
    height: 56px;
  }

  .speaker-name {
    font-size: 21px;
  }

  .speaker-mood {
    font-size: 15px;
  }

  .dialogue-text {
    min-height: 78px;
    font-size: 18px;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .choice-btn {
    min-height: 44px;
  }

  .poster-focus {
    padding: 0;
  }

  .poster-focus-image {
    align-self: start;
    height: calc(100% - 146px);
  }

  .poster-focus-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .poster-focus-title {
    font-size: 19px;
  }

  .poster-focus-copy {
    font-size: 13px;
  }

  .poster-focus-btn {
    width: 100%;
  }

  .cover-screen {
    padding: 22px;
    place-items: center;
  }

  .cover-art {
    background-position: center;
  }

  .cover-content {
    width: min(520px, 100%);
    padding: 28px 16px 30px;
    transform: translate(-50%, -50%);
  }

  .cover-kicker {
    font-size: 12px;
  }

  .title-emblem {
    width: 40px;
    height: 30px;
    margin-bottom: 12px;
  }

  .cover-title {
    font-size: clamp(50px, 15vw, 72px);
  }

  .cover-subtitle {
    gap: 10px;
    margin-top: 16px;
    font-size: clamp(17px, 5vw, 24px);
  }

  .cover-subtitle span {
    width: clamp(24px, 12vw, 54px);
  }

  .cover-copy {
    max-width: 340px;
    margin-top: 18px;
    margin-bottom: 22px;
    font-size: 16px;
    line-height: 1.62;
  }

  .start-btn {
    min-width: 184px;
    min-height: 54px;
    font-size: 18px;
  }

  .music-panel {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
  }

  .character-sprite {
    bottom: 292px;
    width: min(44vw, 230px);
    height: min(48vh, 430px);
  }

  .sprite-yunshu {
    left: -18px;
  }

  .sprite-xingmian {
    right: -20px;
  }

  .sprite-fengyin {
    left: clamp(82px, 24vw, 142px);
    width: min(42vw, 210px);
  }

  .sprite-shuangwan {
    right: clamp(78px, 23vw, 136px);
    width: min(40vw, 200px);
  }
}
