/* 星眠 StarSleep — 夜色、月光与一颗会呼吸的光球 */

:root {
  --bg: #050608;
  --bg-soft: #0a0c11;
  --ink: #e9e3d8;
  --ink-dim: #b1aba1;
  --muted: #82848c;
  --gold: #c6a17c;
  --gold-deep: #8a6548;
  --gold-pale: #e8dac6;
  --violet: #7d8a9a;
  --line: rgba(233, 227, 216, 0.1);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- 天空背景 ---------------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 85% at 78% -10%, rgba(65, 76, 140, 0.5) 0%, rgba(22, 26, 48, 0.3) 38%, transparent 70%),
    radial-gradient(100% 70% at 12% 108%, rgba(97, 66, 44, 0.28) 0%, transparent 62%),
    linear-gradient(180deg, #060812 0%, #080b16 46%, #05070f 100%);
  transition: filter 1.2s ease, opacity 1.2s ease;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora--one {
  width: 58vw; height: 58vw; max-width: 720px; max-height: 720px;
  left: -18vw; top: -22vw;
  background: radial-gradient(circle, rgba(94, 107, 190, 0.5) 0%, rgba(94, 107, 190, 0) 68%);
}
.aurora--two {
  width: 70vw; height: 70vw; max-width: 820px; max-height: 820px;
  right: -26vw; bottom: -30vw;
  background: radial-gradient(circle, rgba(198, 133, 70, 0.36) 0%, rgba(198, 133, 70, 0) 66%);
  animation-duration: 28s;
  animation-delay: -8s;
}

.moon {
  position: absolute;
  width: 108px;
  height: 108px;
  right: 6vw;
  top: 5vh;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 32%, #fff9ea 0%, #ffe9c2 30%, #f3c98d 62%, #c99a5c 100%);
  box-shadow:
    0 0 60px 18px rgba(244, 210, 160, 0.18),
    0 0 140px 50px rgba(244, 210, 160, 0.08),
    inset -14px -10px 38px rgba(120, 78, 32, 0.35);
  opacity: 0.82;
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
}
body[data-stage="story"] .moon,
body[data-stage="reading"] .moon,
body[data-stage="ended"] .moon {
  opacity: 0;
  transform: scale(0.82) translate(8%, -6%);
  filter: blur(1.5px);
}
body[data-stage="choices"] .moon { opacity: 0; }
.moon::after {
  content: "";
  position: absolute;
  inset: -46%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 178, 0.20) 0%, transparent 62%);
  filter: blur(18px);
}

.stars { position: absolute; inset: 0; }
.star {
  position: absolute;
  width: var(--size, 2px);
  height: var(--size, 2px);
  border-radius: 50%;
  background: #fff6e2;
  opacity: var(--base, 0.6);
  box-shadow: 0 0 4px rgba(255, 244, 220, 0.7);
  animation: twinkle var(--dur, 5s) ease-in-out var(--delay, 0s) infinite;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: radial-gradient(rgba(255, 255, 255, 0.8) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

@keyframes twinkle {
  0%, 100% { opacity: var(--base, 0.6); transform: scale(1); }
  50% { opacity: calc(var(--base, 0.6) * 0.35); transform: scale(0.85); }
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vh, 0) scale(1.08); }
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 10px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  padding: 4px;
  color: var(--ink);
}
.brand-mark {
  width: 30px; height: 30px;
  color: var(--gold);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 10px rgba(242, 192, 120, 0.45));
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-name {
  font-size: 17px;
  letter-spacing: 0.16em;
  font-weight: 500;
}

.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--glass); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------------- 配置提示 ---------------- */

.banner {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 4px 18px 0;
  padding: 10px 14px;
  border: 1px solid rgba(242, 192, 120, 0.28);
  border-radius: 14px;
  background: rgba(18, 22, 36, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--gold-pale);
  font-size: 13px;
}
.banner span { flex: 1; min-width: 0; line-height: 1.5; }
.banner button {
  flex: none;
  border: 0; background: var(--gold); color: #241708;
  padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 12px;
  white-space: nowrap;
}

/* ---------------- 主区域 ---------------- */

.main {
  position: relative;
  z-index: 5;
  height: calc(100vh - 74px);
  height: calc(100dvh - 74px);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  padding: 8px 22px calc(240px + var(--safe-bottom));
  max-width: 760px;
  margin: 0 auto;
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }

.view {
  max-width: 100%;
  min-width: 0;
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.26em;
  color: var(--gold);
  text-transform: uppercase;
  opacity: 0.9;
}

.muted { color: var(--muted); }
.home-sub, .section-head .muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* 首页 */
.view--home {
  min-height: calc(100vh - 360px);
  min-height: calc(100dvh - 360px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 4vh;
}
.home-title {
  margin: 0 0 16px;
  font-size: clamp(38px, 10.5vw, 58px);
  line-height: 1.16;
  font-weight: 300;
  letter-spacing: 0.02em;
}
.home-title em {
  font-style: normal;
  background: linear-gradient(110deg, var(--gold-pale) 0%, var(--gold) 42%, #d79a56 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(242, 192, 120, 0.22));
}
.home-sub { margin: 0 0 26px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  transition: transform 0.18s, background 0.18s, color 0.18s, border-color 0.18s;
}
.chip:hover, .chip:active {
  background: rgba(242, 192, 120, 0.12);
  border-color: rgba(242, 192, 120, 0.36);
  color: var(--gold-pale);
  transform: translateY(-1px);
}
.chips--suggest { margin-top: 14px; }

/* 选择页 */
.view--choices { padding-top: 4vh; padding-bottom: 110px; }
.section-head { margin-bottom: 20px; }
.section-head--row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.section-head--row > div { min-width: 0; }
.section-head--row .muted { overflow-wrap: anywhere; }
.mini-mic {
  flex: none;
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(242, 192, 120, 0.32);
  background: rgba(12, 16, 28, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: all 0.2s;
}
.mini-mic svg { width: 14px; height: 14px; }
.mini-mic.is-recording {
  background: linear-gradient(135deg, var(--gold-pale), var(--gold));
  border-color: transparent;
  color: #2a1a07;
  animation: micPulse 1.6s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 192, 120, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(242, 192, 120, 0); }
}
.mini-mic.is-cancel { background: rgba(255, 157, 138, 0.16); border-color: rgba(255, 157, 138, 0.5); color: #ff9d8a; }
.section-head h2, .story-head h2 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.choice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.choice-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  border-radius: 18px;
  padding: 12px 12px 11px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.choice-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.choice-card-head .emoji { font-size: 17px; }
.choice-card-head h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--ink-dim);
}
.options { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.option {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-dim);
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  transition: all 0.18s ease;
}
.option:hover { border-color: rgba(242, 192, 120, 0.4); color: var(--gold-pale); }
.option.is-selected {
  background: linear-gradient(135deg, var(--gold-pale), var(--gold));
  border-color: transparent;
  color: #2a1a07;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(242, 192, 120, 0.25);
}

.ticket {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 13px 16px;
  border: 1px dashed rgba(242, 192, 120, 0.3);
  border-radius: 15px;
  color: var(--gold-pale);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  background: rgba(242, 192, 120, 0.045);
}
.ticket .dot { color: rgba(255, 255, 255, 0.25); }

.primary-btn {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 17px;
  background: linear-gradient(135deg, #ffe3b4 0%, var(--gold) 45%, #dda05c 100%);
  color: #251708;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  box-shadow: 0 14px 34px rgba(242, 192, 120, 0.2);
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(242, 192, 120, 0.28); }
.primary-btn:active { transform: translateY(1px) scale(0.995); }
.primary-btn:disabled { filter: grayscale(0.6); opacity: 0.55; cursor: default; }
.primary-btn svg { width: 20px; height: 20px; }

.ghost-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.ghost-btn:hover { color: var(--ink); background: var(--glass); }
.ghost-btn--sm {
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 0 16px;
  font-size: 12px;
  border-radius: 10px;
}

/* 故事页 */
.view--story { padding-top: 2vh; }
.story-head { margin-bottom: 22px; }
.story-head h2 {
  font-family: var(--serif);
  font-size: clamp(27px, 7.6vw, 38px);
  line-height: 1.35;
  font-weight: 600;
}
.story-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  min-height: 16px;
}
.story-body {
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 2.02;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.story-head, .story-body { position: relative; z-index: 1; }
.story-head h2 { text-shadow: 0 2px 24px rgba(5, 7, 15, 0.8); }
.story-body p {
  position: relative;
  margin: 0 0 1.25em;
  padding-left: 14px;
  text-shadow: 0 1px 14px rgba(5, 7, 15, 0.65);
  color: rgba(247, 240, 228, 0.52);
  transition: color 0.7s ease, text-shadow 0.7s ease, opacity 0.7s ease;
}
.story-body p.is-read { color: rgba(247, 240, 228, 0.62); }
.story-body p.is-speaking {
  color: #fff8ea;
  text-shadow: 0 0 26px rgba(255, 226, 178, 0.2);
}
.story-body p.is-speaking::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 3px;
  height: 1.1em;
  border-radius: 3px;
  background: linear-gradient(var(--gold-pale), var(--gold-deep));
  box-shadow: 0 0 12px rgba(242, 192, 120, 0.6);
}
.story-body.streaming p:last-child::after {
  content: "▍";
  color: var(--gold);
  opacity: 0.7;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.story-loading {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  margin: 4px 0 18px;
}
.story-loading span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  opacity: 0.3;
  animation: dot 1.2s infinite;
}
.story-loading span:nth-child(2) { animation-delay: 0.15s; }
.story-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.story-error {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(224, 122, 95, 0.3);
  background: rgba(224, 122, 95, 0.07);
  border-radius: 16px;
  color: #f0b8a8;
  font-size: 14px;
}
.story-error p { margin: 0 0 10px; }

/* ---------------- 底部光球 ---------------- */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 30px 0 calc(18px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent 0%, rgba(5, 7, 15, 0.72) 38%, rgba(5, 7, 15, 0.96) 78%);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.5s ease;
}
.dock > * { pointer-events: auto; }

.dock-hint {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--muted);
  min-height: 17px;
  transition: color 0.3s;
}
.dock-tip {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(143, 147, 166, 0.65);
  min-height: 15px;
  opacity: 0;
  transition: opacity 0.3s;
}
body.recording .dock-tip { opacity: 1; }
body.recording .dock-hint { color: var(--gold); }

.orb-wrap { position: relative; width: 124px; height: 124px; }

.orb {
  position: relative;
  width: 124px;
  height: 124px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.orb-aura {
  position: absolute;
  inset: -34px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 192, 120, 0.42) 0%, rgba(242, 192, 120, 0.12) 45%, transparent 70%);
  filter: blur(12px);
  animation: aura 5.5s ease-in-out infinite;
  transition: opacity 0.4s, transform 0.4s;
}
@keyframes aura {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50% { opacity: 0.95; transform: scale(1.06); }
}

.orb-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 230, 189, 0.85) 44deg, rgba(242, 192, 120, 0.1) 100deg, transparent 180deg, rgba(143, 156, 255, 0.4) 300deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: spin 9s linear infinite;
  opacity: 0.8;
}
@keyframes spin { to { transform: rotate(360deg); } }

.orb-core {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, #fff6e4 0%, #ffe0ae 22%, #f2bd78 48%, #c98a45 74%, #7d4d28 100%);
  box-shadow:
    0 0 34px rgba(242, 192, 120, 0.5),
    0 0 90px rgba(242, 192, 120, 0.22),
    inset 0 -10px 24px rgba(98, 58, 24, 0.5),
    inset 0 8px 18px rgba(255, 247, 230, 0.4);
  animation: breathe 5.5s ease-in-out infinite;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.3s, box-shadow 0.3s;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.orb-wave {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.orb-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  color: rgba(64, 38, 14, 0.78);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.3));
  transition: opacity 0.25s, transform 0.25s;
}

.orb-cancel {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  color: #ff9d8a;
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
}

.text-toggle {
  position: absolute;
  right: -58px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s;
}
.text-toggle:hover { color: var(--gold-pale); border-color: rgba(242, 192, 120, 0.4); }
.text-toggle svg { width: 19px; height: 19px; }

/* 录音状态 */
body.recording .orb-core {
  animation: none;
  transform: scale(1.07);
  filter: brightness(1.12) saturate(1.08);
  box-shadow:
    0 0 46px rgba(242, 192, 120, 0.7),
    0 0 120px rgba(242, 192, 120, 0.32),
    inset 0 -10px 24px rgba(98, 58, 24, 0.45),
    inset 0 8px 18px rgba(255, 247, 230, 0.45);
}
body.recording .orb-aura { opacity: 1; transform: scale(1.1); animation-duration: 2.2s; }
body.recording .orb-ring { animation-duration: 2.1s; opacity: 1; }
body.recording .orb-wave { opacity: 0.85; }
body.recording .orb-icon { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }

body.cancel-armed .orb-core {
  filter: grayscale(0.85) brightness(0.7);
  transform: scale(0.94);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
}
body.cancel-armed .orb-cancel { opacity: 1; }
body.cancel-armed .dock-hint { color: #ff9d8a; }

body.thinking .orb-ring { animation-duration: 3s; }
body.thinking .orb-core { animation: breathe 2.4s ease-in-out infinite; }

body.busy .orb { pointer-events: none; }

/* 录音涟漪 */
.ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 1px solid rgba(255, 230, 189, 0.55);
  pointer-events: none;
  animation: ripple 0.9s ease-out forwards;
}
@keyframes ripple {
  from { transform: scale(0.9); opacity: 0.8; }
  to { transform: scale(2.1); opacity: 0; }
}

/* ---------------- 朗读控制条 ---------------- */

.reader-scrim {
  position: fixed;
  z-index: 34;
  left: 0;
  right: 0;
  bottom: 0;
  height: 230px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 6, 8, 0.55) 38%, rgba(5, 6, 8, 0.94) 76%, #050608 100%);
}
.reader-dock {
  position: fixed;
  z-index: 35;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  padding: 12px 14px 10px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(16, 20, 32, 0.82);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
  animation: readerIn 0.45s ease both;
}
@keyframes readerIn {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.reader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.round-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  display: grid; place-items: center;
  transition: all 0.2s;
}
.round-btn:hover { color: var(--ink); background: var(--glass-strong); }
.round-btn svg { width: 19px; height: 19px; }

.reader-mic { color: var(--gold-pale); border-color: rgba(198, 161, 124, 0.28); }
.reader-mic:hover { color: #fff6ea; border-color: rgba(198, 161, 124, 0.55); }
.reader-mic.is-listening {
  background: #e4d5c0;
  border-color: transparent;
  color: #1c1712;
  animation: micPulse 1.4s ease-in-out infinite;
}

.play-btn {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(140deg, #ffe3b4, var(--gold) 55%, #d99b57);
  color: #2a1a07;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(242, 192, 120, 0.26);
  transition: transform 0.15s;
}
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 22px; height: 22px; }

.timer-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.timer-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 9px 26px 9px 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.timer-select::after {
  content: "▾";
  position: absolute;
  right: 10px;
  color: var(--muted);
  pointer-events: none;
  font-size: 10px;
}

.progress {
  height: 2px;
  margin-top: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-pale));
  box-shadow: 0 0 8px rgba(242, 192, 120, 0.6);
  transition: width 0.3s linear;
}

/* ---------------- 弹出层 ---------------- */

.sheet-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 5, 10, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.25s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #101522 0%, #0a0d16 100%);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 10px 22px calc(26px + var(--safe-bottom));
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  animation: sheetUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sheet-grab {
  width: 38px; height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto 18px;
}
.sheet h3 { margin: 0 0 4px; font-size: 21px; font-weight: 500; }
.sheet p { margin: 4px 0 14px; font-size: 13px; line-height: 1.7; }
.sheet textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  padding: 14px;
  /* iOS 在小于 16px 的输入框上会自动放大页面，导致关闭键盘后整个界面错位 */
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.sheet textarea::placeholder { color: rgba(143, 147, 166, 0.6); }
.sheet .chips { margin: 12px 0 16px; }
.sheet .primary-btn { margin-top: 4px; }

.sheet--small { max-width: 440px; }
.sheet--settings { max-height: 92dvh; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sheet-head h3 { margin: 0; }

.form-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.form-section h4 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--gold);
}
.tag {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(143, 156, 255, 0.14);
  color: var(--violet);
  font-size: 9px;
  letter-spacing: 0.06em;
  vertical-align: middle;
}
.field { display: block; margin-bottom: 12px; }
.field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.field em {
  font-style: normal;
  font-size: 10px;
  color: var(--gold);
}
.field b { color: var(--gold-pale); font-weight: 500; }
.field input[type="url"],
.field input[type="password"],
.field input[type="text"],
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 16px;
}
.field select { appearance: none; -webkit-appearance: none; }
.field input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}
.test-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.test-result {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.test-result.ok { color: #8fd8a8; }
.test-result.err { color: #f0a08d; }

.form-note {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(143, 147, 166, 0.7);
}
.text-btn {
  display: block;
  margin: 12px auto 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 14px;
}

/* 故事库 */
.drawer-backdrop { align-items: stretch; justify-content: flex-end; }
.drawer {
  width: min(420px, 100%);
  height: 100dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f1421 0%, #080b14 100%);
  border-left: 1px solid var(--line);
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(24px + var(--safe-bottom));
  animation: drawerIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.drawer-head h3 { margin: 0; font-size: 24px; font-weight: 500; }

.story-list { display: flex; flex-direction: column; gap: 10px; }
.story-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 15px;
  transition: background 0.2s, border-color 0.2s;
}
.story-card:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(242, 192, 120, 0.25); }
.story-card h4 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}
.story-card .meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.story-card .preview {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(185, 179, 168, 0.66);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-card-main { border: 0; background: none; text-align: left; width: 100%; padding: 0; color: inherit; }
.story-card-del {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.25);
  font-size: 13px;
  padding: 6px;
}
.story-card-del:hover { color: #f0a08d; }
.empty-state {
  padding: 40px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

/* 听到你说 */
.heard {
  position: fixed;
  z-index: 40;
  inset-inline: 0;
  bottom: calc(190px + var(--safe-bottom));
  margin-inline: auto;
  width: min(440px, calc(100vw - 44px));
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(242, 192, 120, 0.18);
  background: rgba(14, 18, 30, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  animation: rise 0.35s ease both;
  pointer-events: none;
}
.heard-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold);
}
.heard p { margin: 5px 0 0; font-size: 14px; line-height: 1.55; }
.heard-reply { color: var(--ink-dim); font-size: 13px !important; }
.heard-reply:empty { display: none; }

/* Toast */
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(164px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  max-width: min(440px, calc(100vw - 40px));
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(247, 240, 228, 0.94);
  color: #201508;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 渐暗 */
body.dim .sky { filter: brightness(0.35); }
body.dim .topbar,
body.dim .main,
body.dim .dock,
body.dim .reader-dock { opacity: 0.16; }
body.dim .main, body.dim .topbar { transition: opacity 1.5s ease; }
body.dim .dock, body.dim .reader-dock { transition: opacity 1.5s ease; }


/* ---------------- 成年人的夜色：更克制的颜色与排版 ---------------- */

.sky {
  background:
    radial-gradient(120% 85% at 76% -12%, rgba(72, 82, 98, 0.42) 0%, rgba(20, 23, 32, 0.25) 40%, transparent 70%),
    radial-gradient(100% 70% at 10% 108%, rgba(120, 86, 58, 0.2) 0%, transparent 62%),
    linear-gradient(180deg, #06070b 0%, #080a10 46%, #050608 100%);
}
.aurora { filter: blur(88px); opacity: 0.34; }
.aurora--one {
  background: radial-gradient(circle, rgba(80, 94, 112, 0.46) 0%, rgba(80, 94, 112, 0) 68%);
}
.aurora--two {
  background: radial-gradient(circle, rgba(150, 105, 70, 0.28) 0%, rgba(150, 105, 70, 0) 66%);
}
.moon {
  width: 88px;
  height: 88px;
  right: 8vw;
  top: 9vh;
  background: radial-gradient(circle at 38% 32%, #f6f2ea 0%, #e6ded1 42%, #c2b4a1 72%, #8a7d6b 100%);
  box-shadow:
    0 0 46px 12px rgba(232, 226, 214, 0.14),
    0 0 120px 44px rgba(232, 218, 198, 0.05),
    inset -10px -8px 30px rgba(80, 56, 36, 0.35);
  opacity: 0.62;
  filter: blur(0.3px);
}
.moon::after { background: radial-gradient(circle, rgba(232, 218, 198, 0.16) 0%, transparent 62%); }

.brand { gap: 10px; }
.brand-mark { width: 26px; height: 26px; filter: drop-shadow(0 0 8px rgba(198, 161, 124, 0.3)); }
.brand-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.brand-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1;
}
.brand-tag {
  font-size: 7.5px;
  letter-spacing: 0.28em;
  color: var(--muted);
  line-height: 1;
}

.eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.34em;
  color: #a98d72;
}

.home-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 10vw, 54px);
  line-height: 1.32;
  letter-spacing: 0.02em;
}
.home-title em {
  background: linear-gradient(110deg, #f2e8d8 0%, #d8c4aa 44%, #b08d6b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: none;
}
.home-sub {
  max-width: 28em;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.9;
}

.chip {
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.025);
}
.chip::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.65;
  vertical-align: 2px;
}
.chip:hover, .chip:active {
  background: rgba(198, 161, 124, 0.08);
  border-color: rgba(198, 161, 124, 0.32);
  color: var(--gold-pale);
  transform: none;
}

.choice-card {
  border-radius: 13px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.022);
  border-color: rgba(233, 227, 216, 0.09);
}
.choice-card-head { gap: 9px; margin-bottom: 10px; }
.choice-card-head .idx {
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--gold);
  opacity: 0.85;
}
.choice-card-head h4 {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.option {
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  letter-spacing: 0.02em;
  background: transparent;
}
.option.is-selected {
  background: #e4d5c0;
  color: #1c1712;
  font-weight: 500;
  box-shadow: none;
}
.ticket {
  border-radius: 9px;
  border-color: rgba(198, 161, 124, 0.24);
  background: rgba(198, 161, 124, 0.035);
  color: #cdbba5;
  font-size: 11.5px;
  letter-spacing: 0.08em;
}
.primary-btn {
  min-height: 52px;
  border-radius: 9px;
  background: linear-gradient(135deg, #e9dcc9 0%, #c6a17c 58%, #a8835f 100%);
  color: #1d1610;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.18em;
  box-shadow: 0 12px 32px rgba(198, 161, 124, 0.14);
}
.primary-btn:hover { box-shadow: 0 16px 38px rgba(198, 161, 124, 0.2); }
.ghost-btn { border-radius: 8px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.06em; }

.story-head h2 {
  font-size: clamp(26px, 6.8vw, 36px);
  font-weight: 500;
  line-height: 1.42;
}
.story-body { font-size: 18.5px; line-height: 2.12; color: #ded7cb; }
.story-body p { color: rgba(233, 227, 216, 0.55); }
.story-body p.is-read { color: rgba(233, 227, 216, 0.68); }
.story-body p.is-speaking { color: #f2ebe0; text-shadow: 0 0 22px rgba(232, 218, 198, 0.12); }

.reader-dock {
  border-radius: 15px;
  background: rgba(9, 11, 15, 0.9);
  border-color: rgba(233, 227, 216, 0.1);
  box-shadow:
    0 -26px 54px rgba(5, 6, 8, 0.62),
    0 22px 56px rgba(0, 0, 0, 0.6);
}
.round-btn { border-color: rgba(233, 227, 216, 0.1); background: rgba(255, 255, 255, 0.025); }
.play-btn {
  background: linear-gradient(140deg, #e9dcc9, #c6a17c 56%, #a8835f);
  box-shadow: 0 8px 22px rgba(198, 161, 124, 0.2);
}

.sheet {
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #0e1016 0%, #08090d 100%);
  border-color: rgba(233, 227, 216, 0.1);
}
.sheet h3 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.06em; }
.form-section h4 { letter-spacing: 0.22em; color: var(--gold); }
.field input[type="url"], .field input[type="password"], .field input[type="text"], .field select {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}
.story-card { border-radius: 12px; }
.toast {
  background: rgba(18, 21, 28, 0.94);
  color: var(--ink);
  border: 1px solid rgba(233, 227, 216, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.banner {
  border-color: rgba(198, 161, 124, 0.24);
  background: rgba(14, 17, 24, 0.86);
  color: #d8c4aa;
}

/* 光球：从糖果金变成一颗更安静的月长石 */
.orb-wrap, .orb { width: 116px; height: 116px; }
.orb-aura {
  inset: -30px;
  background: radial-gradient(circle, rgba(198, 161, 124, 0.28) 0%, rgba(198, 161, 124, 0.08) 45%, transparent 70%);
  filter: blur(16px);
  animation: aura 7s ease-in-out infinite;
}
.orb-ring {
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(232, 218, 198, 0.5) 42deg,
    rgba(198, 161, 124, 0.08) 110deg,
    transparent 185deg,
    rgba(125, 138, 154, 0.22) 300deg,
    transparent 360deg);
  opacity: 0.55;
  animation-duration: 14s;
}
.orb-core {
  inset: 10px;
  background:
    radial-gradient(circle at 35% 27%, #f7f1e6 0%, #e9dcc9 20%, #c6a17c 47%, #96704f 73%, #463326 100%);
  box-shadow:
    0 0 30px rgba(198, 161, 124, 0.32),
    0 0 80px rgba(198, 161, 124, 0.14),
    inset 0 -9px 22px rgba(62, 42, 26, 0.55),
    inset 0 7px 16px rgba(250, 244, 232, 0.32);
  animation: breathe 7s ease-in-out infinite;
}
.orb-icon { color: rgba(48, 34, 22, 0.72); }
.orb-cancel { color: #d99a86; }
.dock-hint { font-size: 10.5px; letter-spacing: 0.28em; color: var(--muted); }
.dock-tip { letter-spacing: 0.16em; }
.text-toggle { border-color: rgba(233, 227, 216, 0.1); background: rgba(255, 255, 255, 0.035); }

body.recording .orb-core {
  box-shadow:
    0 0 36px rgba(198, 161, 124, 0.48),
    0 0 100px rgba(198, 161, 124, 0.2),
    inset 0 -9px 22px rgba(62, 42, 26, 0.5),
    inset 0 7px 16px rgba(250, 244, 232, 0.38);
}

.mini-mic {
  border-radius: 6px;
  background: rgba(10, 12, 17, 0.66);
  border-color: rgba(198, 161, 124, 0.26);
  color: var(--gold-pale);
  letter-spacing: 0.08em;
}
.mini-mic.is-recording { background: #e4d5c0; color: #1c1712; }

.heard {
  border-radius: 12px;
  background: rgba(12, 15, 21, 0.9);
  border-color: rgba(233, 227, 216, 0.1);
}
.heard-label { color: #a98d72; letter-spacing: 0.26em; }

.story-body p.is-speaking::before { background: linear-gradient(var(--gold-pale), var(--gold-deep)); box-shadow: 0 0 10px rgba(198, 161, 124, 0.4); }
.story-body.streaming p:last-child::after { color: var(--gold); }

@media (max-width: 600px) {
  .moon { width: 76px; height: 76px; top: 12vh; right: 5vw; opacity: 0.55; }
}


.mode-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 0 14px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
  flex: none;
  border: 1px solid rgba(233, 227, 216, 0.1);
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  transition: all 0.18s ease;
}
.mode-tab:hover { color: var(--ink); border-color: rgba(198, 161, 124, 0.32); }
.mode-tab.is-active {
  background: #e4d5c0;
  border-color: transparent;
  color: #1c1712;
}

/* 不同类型的气质：只在选择/阅读时轻轻换一点色 */
body[data-mode="power"] { --gold: #d9926a; --gold-pale: #f0d0b8; --gold-deep: #8f5d43; }
body[data-mode="novel"] { --gold: #9fb0c4; --gold-pale: #dbe4ee; --gold-deep: #647889; }
body[data-mode="audiobook"] { --gold: #b4ad8b; --gold-pale: #e4dec8; --gold-deep: #7d7659; }


#choicesHint {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 选择页的主按钮固定在底部：长回复、长自定义值也不会把「开始吧」顶出屏幕 */
body[data-stage="choices"] .view--choices {
  /* .view 的 rise 动画会留下 transform，transform 祖先会让 fixed 子元素相对它定位 */
  animation: choicesIn 0.45s ease both;
  padding-bottom: 170px;
}
.choices-cta-scrim {
  position: fixed;
  z-index: 34;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 6, 8, 0.68) 36%, rgba(5, 6, 8, 0.97) 82%, #050608 100%);
}
@keyframes choicesIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body[data-stage="choices"] #startStoryBtn {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(716px, calc(100vw - 44px));
  margin: 0;
  z-index: 36;
  box-shadow:
    0 -26px 46px rgba(5, 6, 8, 0.72),
    0 18px 48px rgba(0, 0, 0, 0.62);
}
body[data-stage="choices"] #randomAllBtn {
  margin-top: 10px;
  margin-bottom: 10px;
}

.zoom-warning {
  position: fixed;
  z-index: 200;
  left: 16px;
  right: 16px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  padding: 12px 14px;
  border: 1px solid rgba(233, 227, 216, 0.22);
  border-radius: 12px;
  background: rgba(12, 15, 21, 0.96);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}
.zoom-warning b { color: var(--gold-pale); }
.zoom-warning button {
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
}

/* 响应式 */
@media (min-width: 720px) {
  .choice-list { gap: 14px; }
  .choice-card { padding: 16px 16px 14px; }
  .option { padding: 8px 13px; font-size: 13px; }
  .view--home { min-height: calc(100dvh - 380px); }
  .main { padding-left: 32px; padding-right: 32px; }
  .story-body { font-size: 20px; }
}

@media (max-width: 600px) {
  .moon {
    width: 92px;
    height: 92px;
    top: 13vh;
    right: 4vw;
  }
}

@media (max-width: 380px) {
  .mode-tabs { gap: 5px; }
  .mode-tab {
    flex: 1;
    min-width: 0;
    padding: 8px 3px;
    font-size: 11.5px;
    text-align: center;
    white-space: nowrap;
  }
  .reader-row { gap: 6px; }
  .round-btn { width: 38px; height: 38px; }
  .play-btn { width: 50px; height: 50px; }
  .timer-select select { padding: 8px 20px 8px 9px; font-size: 10px; }
  .timer-select::after { right: 8px; }
  .orb-wrap, .orb { width: 108px; height: 108px; }
  .text-toggle { right: -52px; width: 40px; height: 40px; }
  .home-title { font-size: 36px; }
  .story-body { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .star { animation: none; }
}

/* 无 JS 提示 */
.noscript {
  position: fixed;
  z-index: 100;
  inset: auto 0 0;
  padding: 18px;
  background: #1a0f0a;
  color: #ffd9a0;
  text-align: center;
}

/* ---------------- 白天：纸张、日光与铜色 ---------------- */

html[data-theme="day"] {
  --bg: #f4efe5;
  --bg-soft: #fbf7ef;
  --ink: #2c2822;
  --ink-dim: #61594d;
  --muted: #857b6e;
  --gold: #a2653d;
  --gold-deep: #78482c;
  --gold-pale: #78482c;
  --violet: #697b8c;
  --line: rgba(60, 47, 33, 0.14);
  --glass: rgba(255, 252, 246, 0.58);
  --glass-strong: rgba(255, 252, 246, 0.82);
  --shadow: 0 24px 60px rgba(80, 55, 30, 0.16);
  color-scheme: light;
}

html[data-theme="day"] body { background: var(--bg); color: var(--ink); }

html[data-theme="day"] .sky {
  background:
    radial-gradient(90% 70% at 82% -10%, rgba(255, 244, 218, 0.95) 0%, rgba(246, 226, 194, 0.35) 38%, transparent 68%),
    radial-gradient(90% 70% at 8% 108%, rgba(218, 190, 158, 0.28) 0%, transparent 62%),
    linear-gradient(180deg, #f8f2e7 0%, #f3ecdf 46%, #eee6d8 100%);
}
html[data-theme="day"] .aurora { opacity: 0.18; filter: blur(82px); }
html[data-theme="day"] .aurora--one {
  background: radial-gradient(circle, rgba(255, 207, 148, 0.42) 0%, rgba(255, 207, 148, 0) 68%);
}
html[data-theme="day"] .aurora--two {
  background: radial-gradient(circle, rgba(166, 190, 200, 0.25) 0%, rgba(166, 190, 200, 0) 66%);
}
html[data-theme="day"] .moon {
  background: radial-gradient(circle at 36% 32%, #fffef8 0%, #fff5df 34%, #f2d6a7 68%, #d4ac78 100%);
  box-shadow:
    0 0 46px 14px rgba(238, 194, 132, 0.34),
    0 0 110px 38px rgba(238, 194, 132, 0.14),
    inset -12px -9px 30px rgba(150, 105, 55, 0.16);
  opacity: 0.9;
}
html[data-theme="day"] .star {
  background: #a47e55;
  box-shadow: none;
  opacity: calc(var(--base, 0.6) * 0.34);
}
html[data-theme="day"] .grain { opacity: 0.025; mix-blend-mode: multiply; }

html[data-theme="day"] .brand-mark { color: var(--gold); filter: drop-shadow(0 2px 8px rgba(150, 90, 45, 0.18)); }
html[data-theme="day"] .brand-tag { color: #9a8d7c; }
html[data-theme="day"] .eyebrow { color: #9b744f; }
html[data-theme="day"] .home-sub,
html[data-theme="day"] .section-head .muted { color: var(--muted); }
html[data-theme="day"] .icon-btn:hover { background: var(--glass); }
html[data-theme="day"] .banner {
  background: rgba(255, 250, 241, 0.86);
  border-color: rgba(162, 101, 61, 0.28);
  color: var(--ink);
}
html[data-theme="day"] .banner button { background: var(--gold); color: #fff8ee; }

html[data-theme="day"] .chip {
  background: rgba(255, 252, 246, 0.62);
  color: var(--ink-dim);
}
html[data-theme="day"] .chip:hover,
html[data-theme="day"] .chip:active {
  background: rgba(162, 101, 61, 0.1);
  border-color: rgba(162, 101, 61, 0.34);
  color: var(--gold-deep);
}

html[data-theme="day"] .mini-mic {
  background: rgba(255, 252, 246, 0.76);
  border-color: rgba(162, 101, 61, 0.28);
  color: var(--gold);
}
html[data-theme="day"] .mini-mic.is-recording {
  background: linear-gradient(135deg, #b97a4c, #965a35);
  color: #fff8ee;
}
html[data-theme="day"] .mini-mic.is-cancel { background: rgba(180, 70, 50, 0.1); color: #a64735; }

html[data-theme="day"] .choice-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.7), rgba(255, 252, 246, 0.42));
  border-color: var(--line);
  box-shadow: 0 8px 26px rgba(90, 60, 35, 0.05);
}
html[data-theme="day"] .choice-card-head h4 { color: var(--ink-dim); }
html[data-theme="day"] .option {
  background: rgba(255, 252, 246, 0.7);
  color: var(--ink-dim);
}
html[data-theme="day"] .option:hover { border-color: rgba(162, 101, 61, 0.38); color: var(--gold-deep); }
html[data-theme="day"] .option.is-selected {
  background: linear-gradient(135deg, #8f5532, #b47446);
  color: #fff9ef;
  box-shadow: 0 4px 16px rgba(140, 85, 50, 0.2);
}
html[data-theme="day"] .mode-tab {
  color: var(--muted);
  border-color: var(--line);
}
html[data-theme="day"] .mode-tab:hover { color: var(--ink); border-color: rgba(162, 101, 61, 0.32); }
html[data-theme="day"] .mode-tab.is-active {
  background: #8f5532;
  color: #fff9ef;
}
html[data-theme="day"] .ticket {
  background: rgba(162, 101, 61, 0.055);
  border-color: rgba(162, 101, 61, 0.28);
  color: var(--gold-deep);
}
html[data-theme="day"] .ticket .dot { color: rgba(60, 47, 33, 0.28); }
html[data-theme="day"] .primary-btn {
  background: linear-gradient(135deg, #965833 0%, #b47446 58%, #8f5532 100%);
  color: #fff9ef;
  box-shadow: 0 12px 30px rgba(140, 85, 50, 0.2);
}
html[data-theme="day"] .primary-btn:hover { box-shadow: 0 16px 36px rgba(140, 85, 50, 0.26); }
html[data-theme="day"] .ghost-btn { color: var(--muted); }
html[data-theme="day"] .ghost-btn:hover { color: var(--ink); background: var(--glass); }

html[data-theme="day"] .home-title em {
  background: linear-gradient(110deg, #78482c 0%, #a2653d 48%, #bd8558 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: none;
}
html[data-theme="day"] .story-head h2 { text-shadow: none; }
html[data-theme="day"] .story-body { color: var(--ink); }
html[data-theme="day"] .story-body p {
  color: rgba(44, 40, 34, 0.56);
  text-shadow: none;
}
html[data-theme="day"] .story-body p.is-read { color: rgba(44, 40, 34, 0.7); }
html[data-theme="day"] .story-body p.is-speaking {
  color: #2c2822;
  text-shadow: none;
}
html[data-theme="day"] .story-body p.is-speaking::before {
  background: linear-gradient(#a2653d, #78482c);
  box-shadow: 0 0 8px rgba(162, 101, 61, 0.25);
}
html[data-theme="day"] .story-error {
  background: rgba(180, 70, 50, 0.06);
  border-color: rgba(180, 70, 50, 0.26);
  color: #9a4d3b;
}
html[data-theme="day"] .story-loading { color: var(--muted); }

html[data-theme="day"] .dock {
  background: linear-gradient(180deg, transparent 0%, rgba(244, 239, 229, 0.7) 38%, rgba(244, 239, 229, 0.97) 78%, #f4efe5 100%);
}
html[data-theme="day"] .dock-hint { color: var(--muted); }
html[data-theme="day"] .dock-tip { color: rgba(90, 78, 64, 0.6); }
html[data-theme="day"] .orb-aura {
  background: radial-gradient(circle, rgba(196, 132, 78, 0.3) 0%, rgba(196, 132, 78, 0.09) 45%, transparent 70%);
}
html[data-theme="day"] .orb-core {
  background: radial-gradient(circle at 34% 27%, #fffdf7 0%, #fbe6c8 25%, #edc08b 55%, #c98d59 80%, #9b633c 100%);
  box-shadow:
    0 0 30px rgba(176, 112, 62, 0.28),
    0 0 80px rgba(176, 112, 62, 0.12),
    inset 0 -10px 22px rgba(120, 70, 35, 0.22),
    inset 0 8px 18px rgba(255, 255, 255, 0.55);
}
html[data-theme="day"] .orb-ring {
  background: conic-gradient(from 0deg, transparent 0deg, rgba(162, 101, 61, 0.72) 44deg, rgba(162, 101, 61, 0.08) 100deg, transparent 180deg, rgba(105, 123, 140, 0.3) 300deg, transparent 360deg);
}
html[data-theme="day"] .orb-icon { color: rgba(88, 52, 26, 0.78); }
html[data-theme="day"] .text-toggle {
  background: rgba(255, 252, 246, 0.7);
  color: var(--ink-dim);
}

html[data-theme="day"] .reader-scrim {
  background: linear-gradient(180deg, transparent 0%, rgba(244, 239, 229, 0.6) 38%, rgba(244, 239, 229, 0.96) 76%, #f4efe5 100%);
}
html[data-theme="day"] .reader-dock {
  background: rgba(255, 251, 244, 0.92);
  border-color: var(--line);
  box-shadow: 0 18px 46px rgba(80, 55, 30, 0.16);
}
html[data-theme="day"] .round-btn {
  background: rgba(255, 252, 246, 0.7);
  color: var(--ink-dim);
}
html[data-theme="day"] .round-btn:hover { color: var(--ink); background: #fffdf8; }
html[data-theme="day"] .reader-mic { color: var(--gold); border-color: rgba(162, 101, 61, 0.28); }
html[data-theme="day"] .reader-mic:hover { color: var(--gold-deep); border-color: rgba(162, 101, 61, 0.5); }
html[data-theme="day"] .reader-mic.is-listening { background: #8f5532; color: #fff9ef; }
html[data-theme="day"] .play-btn {
  background: linear-gradient(140deg, #b47446, #8f5532);
  color: #fff9ef;
  box-shadow: 0 8px 24px rgba(140, 85, 50, 0.22);
}
html[data-theme="day"] .timer-select select {
  background: rgba(255, 252, 246, 0.7);
  color: var(--ink-dim);
}
html[data-theme="day"] .progress { background: rgba(60, 47, 33, 0.12); }
html[data-theme="day"] .progress span {
  background: linear-gradient(90deg, #78482c, #b47446);
  box-shadow: 0 0 6px rgba(162, 101, 61, 0.28);
}

html[data-theme="day"] .sheet-backdrop,
html[data-theme="day"] .drawer-backdrop { background: rgba(70, 55, 40, 0.34); }
html[data-theme="day"] .sheet {
  background: linear-gradient(180deg, #fbf7ef 0%, #f3ecdf 100%);
  border-color: var(--line);
  box-shadow: 0 -20px 56px rgba(70, 50, 30, 0.16);
}
html[data-theme="day"] .sheet-grab { background: rgba(60, 47, 33, 0.2); }
html[data-theme="day"] .sheet textarea,
html[data-theme="day"] .field input[type="url"],
html[data-theme="day"] .field input[type="password"],
html[data-theme="day"] .field input[type="text"],
html[data-theme="day"] .field select {
  background: rgba(255, 252, 246, 0.8);
  color: var(--ink);
}
html[data-theme="day"] .sheet textarea::placeholder,
html[data-theme="day"] .field input::placeholder { color: rgba(90, 78, 64, 0.5); }
html[data-theme="day"] .form-section { border-color: rgba(60, 47, 33, 0.1); }
html[data-theme="day"] .form-note { color: rgba(90, 78, 64, 0.7); }
html[data-theme="day"] .field b { color: var(--gold-deep); }
html[data-theme="day"] .tag { background: rgba(105, 123, 140, 0.12); color: #4f6475; }
html[data-theme="day"] .test-result.ok { color: #3f7a52; }
html[data-theme="day"] .test-result.err { color: #a64735; }
html[data-theme="day"] .drawer {
  background: linear-gradient(180deg, #fbf7ef 0%, #f3ecdf 100%);
  border-color: var(--line);
}
html[data-theme="day"] .story-card {
  background: rgba(255, 252, 246, 0.64);
  border-color: var(--line);
}
html[data-theme="day"] .story-card:hover {
  background: rgba(255, 252, 246, 0.86);
  border-color: rgba(162, 101, 61, 0.24);
}
html[data-theme="day"] .story-card .preview { color: rgba(70, 60, 48, 0.66); }
html[data-theme="day"] .story-card-del { color: rgba(60, 47, 33, 0.28); }
html[data-theme="day"] .story-card-del:hover { color: #a64735; }

html[data-theme="day"] .heard {
  background: rgba(255, 251, 244, 0.9);
  border-color: rgba(162, 101, 61, 0.2);
  box-shadow: 0 16px 36px rgba(80, 55, 30, 0.14);
}
html[data-theme="day"] .heard-label { color: var(--gold); }
html[data-theme="day"] .heard-reply { color: var(--ink-dim); }
html[data-theme="day"] .toast {
  background: #2c2822;
  color: #fbf7ef;
  box-shadow: 0 14px 32px rgba(60, 45, 30, 0.24);
}
html[data-theme="day"] .zoom-warning {
  background: #fbf7ef;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(80, 55, 30, 0.18);
}
html[data-theme="day"] .zoom-warning b { color: var(--gold-deep); }
html[data-theme="day"] body.dim .sky { filter: brightness(0.72) sepia(0.08); }
html[data-theme="day"] body.dim .topbar,
html[data-theme="day"] body.dim .main,
html[data-theme="day"] body.dim .dock,
html[data-theme="day"] body.dim .reader-dock { opacity: 0.3; }

html[data-theme="day"] body[data-mode="power"] { --gold: #a85c33; --gold-pale: #75401f; --gold-deep: #8a4d2a; }
html[data-theme="day"] body[data-mode="novel"] { --gold: #5d7485; --gold-pale: #4f6475; --gold-deep: #6b7f8e; }
html[data-theme="day"] body[data-mode="audiobook"] { --gold: #80764f; --gold-pale: #645c3d; --gold-deep: #71684a; }

html[data-theme="day"] .choices-cta-scrim {
  background: linear-gradient(180deg, transparent 0%, rgba(244, 239, 229, 0.7) 36%, rgba(244, 239, 229, 0.97) 82%, #f4efe5 100%);
}
html[data-theme="day"] body[data-stage="choices"] #startStoryBtn {
  box-shadow:
    0 -26px 46px rgba(244, 239, 229, 0.85),
    0 18px 40px rgba(80, 55, 30, 0.18);
}

/* 白天也要遵守页面阶段：故事/选择页不把太阳留在标题后面 */
html[data-theme="day"] body[data-stage="story"] .moon,
html[data-theme="day"] body[data-stage="reading"] .moon,
html[data-theme="day"] body[data-stage="ended"] .moon {
  opacity: 0;
  transform: scale(0.82) translate(8%, -6%);
  filter: blur(1.5px);
}
html[data-theme="day"] body[data-stage="choices"] .moon { opacity: 0; }

/* ---------------- 2026-11 交互改版：粗黑体、六方向、时长滑杆、段落起播 ---------------- */

/* 标题和正文都换成更有分量的黑体，避免细宋体在手机上的飘 */
.home-title,
.section-head h2,
.story-head h2,
.drawer-head h3,
.sheet h3,
.brand-name {
  font-family: var(--font);
}

.home-title {
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.section-head h2,
.story-head h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.14em;
}
.eyebrow { font-weight: 600; }
.story-body {
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 2.05;
}
.story-body p { font-weight: 500; }
.story-body p.is-speaking { font-weight: 600; }

/* 首页类型集中居中 */
.view--home .chips { justify-content: center; }
@media (max-width: 600px) {
  .view--home .chip { padding: 8px 11px; font-size: 12px; }
}

/* 六方向 */
.view--choices { padding-bottom: 195px; }
.choices-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 2px 0 8px;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.choices-label-actions {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.choices-label small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: right;
}
.choices-shuffle {
  flex: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.choices-shuffle:hover { color: var(--gold-pale); }
.direction-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-bottom: 16px;
}
.direction-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-dim);
  padding: 11px 13px;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.direction-option:hover {
  border-color: rgba(198, 161, 124, 0.4);
  background: rgba(198, 161, 124, 0.06);
  color: var(--ink);
}
.direction-option.is-selected {
  border-color: rgba(198, 161, 124, 0.6);
  background: rgba(198, 161, 124, 0.13);
  color: var(--ink);
}
.dir-index {
  flex: none;
  width: 21px;
  padding-top: 2px;
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.dir-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.68;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.direction-option.is-random {
  border-style: dashed;
  color: var(--muted);
}
.dir-random-icon {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  opacity: 0.7;
}
.dir-random-icon svg { width: 100%; height: 100%; }
@media (min-width: 320px) {
  .direction-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .direction-option { padding: 10px 11px; gap: 8px; }
  .dir-text { font-size: 13px; line-height: 1.62; }
  .dir-index { width: 18px; font-size: 10px; }
}

/* 时长滑杆 */
.length-control {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  padding: 12px 14px 10px;
  margin: 0 0 16px;
}
.length-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.07em;
}
.length-head b {
  color: var(--gold-pale);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.length-row {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 11px 0 4px;
}
.length-row input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--gold) 0%,
    var(--gold) var(--range-fill, 20%),
    rgba(233, 227, 216, 0.18) var(--range-fill, 20%),
    rgba(233, 227, 216, 0.18) 100%
  );
  accent-color: var(--gold);
  -webkit-appearance: none;
  appearance: none;
}
.length-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gold-deep);
  background: var(--gold-pale);
  box-shadow: 0 0 12px rgba(198, 161, 124, 0.4);
}
.length-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gold-deep);
  background: var(--gold-pale);
}
.length-row input[type="range"]:disabled { opacity: 0.28; }
.length-toggle {
  flex: none;
  min-width: 54px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  transition: all 0.18s;
}
.length-toggle:hover { color: var(--ink); border-color: rgba(198, 161, 124, 0.4); }
.length-toggle.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold-pale), var(--gold));
  color: #2a1a07;
  font-weight: 600;
}
.length-scale {
  display: flex;
  justify-content: space-between;
  color: rgba(130, 132, 140, 0.72);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}
.length-control.is-unlimited .length-scale { opacity: 0.4; }

/* 每段右侧的小播放箭头 */
.story-body p { padding-right: 38px; }
.para-play {
  position: absolute;
  right: 0;
  top: 0.48em;
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  background: rgba(198, 161, 124, 0.05);
  opacity: 0.62;
  transition: opacity 0.18s, background 0.18s, color 0.18s;
}
.para-play svg { width: 14px; height: 14px; }
.para-play:hover,
.story-body p.is-speaking .para-play {
  opacity: 0.95;
  background: rgba(198, 161, 124, 0.12);
  color: var(--gold-pale);
}
.story-body.streaming p:last-child::after { content: none; }
.story-body.streaming p:last-child .para-text::after {
  content: "▍";
  color: var(--gold);
  opacity: 0.7;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
}

/* 白天：方向、滑杆、段落箭头 */
html[data-theme="day"] .choices-label { color: var(--ink); }
html[data-theme="day"] .choices-label small { color: rgba(90, 78, 64, 0.68); }
html[data-theme="day"] .direction-option {
  background: rgba(255, 252, 246, 0.64);
  border-color: rgba(60, 47, 33, 0.12);
  color: rgba(44, 40, 34, 0.72);
}
html[data-theme="day"] .direction-option:hover {
  border-color: rgba(162, 101, 61, 0.34);
  background: rgba(162, 101, 61, 0.06);
  color: var(--ink);
}
html[data-theme="day"] .direction-option.is-selected {
  border-color: rgba(162, 101, 61, 0.52);
  background: rgba(162, 101, 61, 0.11);
  color: var(--ink);
}
html[data-theme="day"] .dir-index { color: var(--gold-deep); }
html[data-theme="day"] .direction-option.is-random { color: rgba(90, 78, 64, 0.72); }
html[data-theme="day"] .length-control {
  background: rgba(255, 252, 246, 0.58);
  border-color: rgba(60, 47, 33, 0.12);
}
html[data-theme="day"] .length-head { color: rgba(90, 78, 64, 0.72); }
html[data-theme="day"] .length-head b { color: var(--gold-deep); }
html[data-theme="day"] .length-row input[type="range"] {
  background: linear-gradient(
    to right,
    #a2653d 0%,
    #a2653d var(--range-fill, 20%),
    rgba(60, 47, 33, 0.16) var(--range-fill, 20%),
    rgba(60, 47, 33, 0.16) 100%
  );
}
html[data-theme="day"] .length-row input[type="range"]::-webkit-slider-thumb {
  border-color: #fff8ee;
  background: #a2653d;
  box-shadow: 0 0 10px rgba(140, 85, 50, 0.24);
}
html[data-theme="day"] .length-toggle { color: rgba(90, 78, 64, 0.75); border-color: rgba(60, 47, 33, 0.14); }
html[data-theme="day"] .length-toggle.is-active { background: #8f5532; color: #fff9ef; }
html[data-theme="day"] .length-scale { color: rgba(90, 78, 64, 0.52); }
html[data-theme="day"] .para-play { color: var(--gold-deep); opacity: 0.62; }
html[data-theme="day"] .para-play:hover,
html[data-theme="day"] .story-body p.is-speaking .para-play {
  background: rgba(162, 101, 61, 0.1);
  color: var(--gold-deep);
}
html[data-theme="day"] .story-body p { color: rgba(44, 40, 34, 0.64); }
html[data-theme="day"] .story-body p.is-read { color: rgba(44, 40, 34, 0.76); }
html[data-theme="day"] .story-body p.is-speaking { color: #2c2822; }
html[data-theme="day"] .story-body.streaming p:last-child .para-text::after { color: var(--gold); }


/* 选择页：方向与时长已经在上面表达清楚，避免摘要条被固定按钮压住 */
body[data-stage="choices"] #ticket { display: none; }

/* 段落起播箭头再明确一点 */
.para-play {
  color: var(--gold-pale);
  background: rgba(198, 161, 124, 0.08);
  opacity: 0.8;
}
.para-play svg { width: 15px; height: 15px; }
html[data-theme="day"] .para-play {
  color: #7f4527;
  background: rgba(162, 101, 61, 0.1);
  opacity: 0.86;
}
html[data-theme="day"] .para-play:hover,
html[data-theme="day"] .story-body p.is-speaking .para-play {
  color: #5f321b;
  background: rgba(162, 101, 61, 0.18);
}


/* 小屏：先选时长，再看六条方向，避免滑杆被固定按钮或卡片挤出首屏 */
@media (max-width: 380px) {
  .view--choices {
    display: flex;
    flex-direction: column;
    padding-bottom: 150px;
  }
  .view--choices .section-head { order: 0; }
  .view--choices .mode-tabs { order: 1; }
  .view--choices .length-control { order: 2; margin: 0 0 14px; }
  .view--choices .choices-label { order: 3; margin-top: 2px; }
  .view--choices .direction-list { order: 4; }
}

/* 换一批已经移到“故事方向”标题旁，不再需要底部的间距 */
.choices-label .choices-shuffle { margin: 0; }

/* ---------------- v21 改版：常驻输入卡 / 理解卡 / 题材篇幅 / 故事卡 ---------------- */

/* 首页输入卡：麦克风 + 输入框 + 发送并排，390px 也不换行、不横向溢出 */
.dock { padding: 26px 14px calc(14px + var(--safe-bottom)); }

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.composer .orb { width: 58px; height: 58px; flex: none; }
.composer .orb-aura { inset: -12px; filter: blur(8px); }
.composer .orb-core { inset: 4px; }
.composer .orb-icon { width: 22px; height: 22px; }
.composer .orb-wave { inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); }
.composer .orb-cancel { bottom: -26px; font-size: 11px; }
.composer .orb-ring { inset: -2px; }

.composer-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  padding: 0 14px;
  font-size: 16px; /* 16px 以下 iOS 会自动放大页面 */
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.composer-input::placeholder { color: var(--muted); }
.composer-input:focus { background: rgba(255, 255, 255, 0.08); }
.composer-input:focus-visible { outline: none; }
.composer:focus-within { border-color: rgba(242, 192, 120, 0.45); }

.composer-send {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #3a2410;
  background: linear-gradient(135deg, var(--gold-pale) 0%, var(--gold) 55%, #b98557 100%);
  transition: transform 0.18s, filter 0.18s;
}
.composer-send:hover, .composer-send:active { transform: scale(1.06); filter: brightness(1.08); }
.composer-send svg { width: 20px; height: 20px; }

/* 输入卡变矮了，首页内容不用再留那么大的底部空隙 */
body[data-stage="home"] .main { padding-bottom: calc(190px + var(--safe-bottom)); }

/* 理解卡：把「我理解到的」摊开 */
.understanding {
  margin: 18px 0 0;
  padding: 14px 14px 12px;
  border: 1px solid rgba(242, 192, 120, 0.26);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(242, 192, 120, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%);
  text-align: left;
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.understanding-label {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-weight: 600;
}
.understanding-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.understanding-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
}
.understanding-tag i {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  flex: none;
}
.understanding-tag b { font-weight: 600; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.understanding-tag.is-empty { color: var(--muted); }
.understanding-reply {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.understanding-reply.is-degraded { color: var(--ink-dim); }
.understanding-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.understanding .chips--suggest { margin-top: 12px; }
.understanding .chip { padding: 7px 12px; font-size: 12.5px; }

.primary-btn--sm, .ghost-btn--sm { padding: 9px 16px; font-size: 13.5px; }

/* 选择页：题材横滑 + 篇幅 segmented */
.choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  min-width: 0;
}
.choice-row-label {
  flex: none;
  width: 34px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.genre-list {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 4px;
}
.genre-list::-webkit-scrollbar { display: none; }
.genre-chip {
  flex: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.genre-chip.is-active {
  background: rgba(242, 192, 120, 0.16);
  border-color: rgba(242, 192, 120, 0.5);
  color: var(--gold-pale);
}
.kind-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}
.kind-tab {
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  padding: 7px 4px;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
  transition: background 0.18s, color 0.18s;
}
.kind-tab.is-active {
  background: rgba(242, 192, 120, 0.2);
  color: var(--gold-pale);
  font-weight: 600;
}

/* 故事卡 */
.view--plan { padding-bottom: 40px; }
.plan-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 22px 4px;
  color: var(--muted);
  font-size: 13px;
}
.plan-loading span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.1s ease-in-out infinite;
}
.plan-loading span:nth-child(2) { animation-delay: 0.15s; }
.plan-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

.plan-card {
  margin-top: 14px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.plan-tone {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}
.plan-tone b { color: var(--gold-pale); font-weight: 600; font-size: 13px; }
.plan-beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.plan-beats li { display: flex; gap: 10px; min-width: 0; }
.plan-beat-index {
  flex: none;
  width: 22px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--gold);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.plan-beats b { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.plan-beats p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-dim); overflow-wrap: anywhere; }
.plan-ending {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.plan-ending span { display: block; font-size: 11px; letter-spacing: 0.2em; color: var(--gold); margin-bottom: 4px; }
.plan-ending p { margin: 0; font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; }
.plan-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.plan-actions { display: grid; gap: 9px; margin-top: 16px; }
.text-btn {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-btn:hover { color: var(--gold-pale); }

.story-warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(242, 192, 120, 0.3);
  background: rgba(242, 192, 120, 0.08);
  color: var(--ink-dim);
  font-size: 12.5px;
  line-height: 1.6;
}

/* 小屏：输入卡、题材、篇幅、故事卡都不许把内容挤出首屏 */
@media (max-width: 380px) {
  .composer { gap: 7px; padding: 6px 6px 6px 8px; }
  .composer .orb { width: 50px; height: 50px; }
  .composer-input { height: 40px; padding: 0 11px; font-size: 16px; }
  .composer-send { width: 40px; height: 40px; }
  .choice-row-label { width: 30px; }
  .kind-tab { padding: 7px 2px; font-size: 11.5px; }
  .genre-chip { padding: 6px 10px; font-size: 12px; }
  .view--choices .choice-row--genre { order: 1; }
  .view--choices .choice-row--kind { order: 2; }
  .view--choices .length-control { order: 3; }
  .view--choices .choices-label { order: 4; }
  .view--choices .direction-list { order: 5; }
  body[data-stage="home"] .main { padding-bottom: calc(170px + var(--safe-bottom)); }
}

/* 白天主题 */
html[data-theme="day"] .composer {
  background: rgba(255, 252, 246, 0.82);
  border-color: rgba(90, 78, 64, 0.16);
  box-shadow: 0 12px 34px rgba(120, 96, 66, 0.16);
}
html[data-theme="day"] .composer-input { background: rgba(90, 78, 64, 0.06); color: var(--ink); }
html[data-theme="day"] .composer-input::placeholder { color: rgba(90, 78, 64, 0.55); }
html[data-theme="day"] .composer:focus-within { border-color: rgba(176, 112, 62, 0.5); }
html[data-theme="day"] .understanding {
  border-color: rgba(176, 112, 62, 0.3);
  background: linear-gradient(180deg, rgba(196, 132, 78, 0.12) 0%, rgba(255, 255, 255, 0.5) 100%);
}
html[data-theme="day"] .understanding-tag { background: rgba(255, 255, 255, 0.7); border-color: rgba(90, 78, 64, 0.16); }
html[data-theme="day"] .understanding-tag b { color: var(--ink); }
html[data-theme="day"] .genre-chip { background: rgba(255, 255, 255, 0.7); border-color: rgba(90, 78, 64, 0.16); }
html[data-theme="day"] .genre-chip.is-active {
  background: rgba(196, 132, 78, 0.2);
  border-color: rgba(176, 112, 62, 0.5);
  color: #7a4a26;
}
html[data-theme="day"] .kind-tabs { background: rgba(90, 78, 64, 0.06); border-color: rgba(90, 78, 64, 0.16); }
html[data-theme="day"] .kind-tab.is-active { background: rgba(196, 132, 78, 0.24); color: #7a4a26; }
html[data-theme="day"] .plan-card { background: rgba(255, 255, 255, 0.7); border-color: rgba(90, 78, 64, 0.16); }
html[data-theme="day"] .plan-beats p { color: rgba(44, 40, 34, 0.72); }
html[data-theme="day"] .plan-tone b { color: #7a4a26; }
html[data-theme="day"] .story-warning { background: rgba(196, 132, 78, 0.1); border-color: rgba(176, 112, 62, 0.3); }

/* 故事卡没到手时，「就这样讲」不可点 */
.primary-btn.is-disabled,
.primary-btn:disabled {
  opacity: 0.42;
  filter: grayscale(0.5);
  pointer-events: none;
}

/* ---------------- v22 字阶收敛：界面文字整体小一档，标题收窄 ----------------
   原则：
   - 朗读正文（.story-body）不动，那是给眼睛长时间读的。
   - 输入框保持 16px，低于 16px iOS 会自动放大整个页面。
   - 其余界面文字统一降一档，标题从「广告牌」收回到「书名」的量级。
   ------------------------------------------------------------------ */

/* 标题：首页 / 故事卡 / 故事页 / 抽屉 / 弹层 */
.home-title { font-size: clamp(30px, 7.6vw, 42px); line-height: 1.3; }
.section-head h2,
.story-head h2 { font-size: clamp(21px, 5.6vw, 28px); line-height: 1.42; }
.drawer-head h3 { font-size: 19px; }
.sheet h3 { font-size: 17px; }
.brand-name { font-size: 15px; }

/* 首页 */
.home-sub, .section-head .muted { font-size: 12.5px; line-height: 1.85; }
.eyebrow { font-size: 10px; letter-spacing: 0.3em; }
.chip { font-size: 11.5px; padding: 8px 11px; }

/* 按钮 */
.primary-btn { font-size: 13px; min-height: 48px; letter-spacing: 0.16em; }
.ghost-btn { font-size: 12px; }
.ghost-btn--sm, .primary-btn--sm { font-size: 12.5px; }
.text-btn { font-size: 12px; }

/* 选择页 */
.mode-tab { font-size: 11.5px; padding: 7px 11px; }
.choice-row-label { font-size: 11px; }
.choices-label { font-size: 11.5px; }
.choices-label small { font-size: 10px; }
.choices-shuffle { font-size: 11px; }
.genre-chip { font-size: 11.5px; padding: 6px 10px; }
.kind-tab { font-size: 11.5px; }
.direction-option .dir-text { font-size: 12.5px; line-height: 1.62; }
.dir-index { font-size: 9.5px; }
.length-head { font-size: 11.5px; }
.length-head b { font-size: 12.5px; }
.length-toggle { font-size: 11px; }
.length-scale { font-size: 9px; }
.ticket { font-size: 11px; }

/* 理解卡 */
.understanding-label { font-size: 10.5px; }
.understanding-tag { font-size: 11.5px; }
.understanding-tag i { font-size: 10.5px; }
.understanding-reply { font-size: 13.5px; line-height: 1.7; }
.understanding .chip { font-size: 11.5px; }

/* 故事卡 */
.plan-loading { font-size: 12px; }
.plan-tone { font-size: 11px; }
.plan-tone b { font-size: 12px; }
.plan-beat-index { font-size: 10.5px; }
.plan-beats b { font-size: 12.5px; }
.plan-beats p { font-size: 12.5px; line-height: 1.62; }
.plan-ending span { font-size: 10.5px; }
.plan-ending p { font-size: 12.5px; line-height: 1.62; }
.plan-note { font-size: 11px; }

/* 故事页附属信息（正文不动） */
.story-meta { font-size: 11px; }
.story-loading { font-size: 11.5px; }
.story-error { font-size: 13px; }
.story-warning { font-size: 11.5px; }

/* 输入卡：输入框本身保持 16px */
.composer .orb-cancel { font-size: 10.5px; }
.dock-hint { font-size: 10px; }
.dock-tip { font-size: 10.5px; }

/* 设置 / 抽屉 / 提示 */
.sheet p { font-size: 12px; }
.form-section h4 { font-size: 11.5px; }
.field > span { font-size: 11.5px; }
.field em { font-size: 9.5px; }
.test-result, .form-note { font-size: 10.5px; }
.story-card h4 { font-size: 15px; }
.story-card .meta { font-size: 10.5px; }
.story-card-del { font-size: 12px; }
.empty-state { font-size: 12px; }
.heard-label { font-size: 9.5px; }
.heard p { font-size: 13px; }
.heard-reply { font-size: 12px !important; }
.toast { font-size: 12px; }
.banner { font-size: 12px; }
.timer-select select { font-size: 10.5px; }
.mini-mic { font-size: 10.5px; }

/* 小屏再收一点 */
@media (max-width: 380px) {
  .home-title { font-size: 28px; }
  .section-head h2,
  .story-head h2 { font-size: 20px; }
  .mode-tab { font-size: 11px; padding: 7px 3px; }
  .kind-tab { font-size: 11px; padding: 6px 2px; }
  .genre-chip { font-size: 11px; padding: 5px 9px; }
  .understanding-reply { font-size: 13px; }
}
