/* 梦境故事本 · 「湖上晨雾」H5 样式（真实 PNG 图层 + 原生交互） */
:root {
  --ink-night: #0D1130;
  --sheet: #10142F;
  --moon: #F6EFE4;
  --text-2: #C7CBE8;
  --text-3: #8F96C0;
  --dawn: #FFC79A;
  --dawn-deep: #F39A78;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-line: rgba(255, 255, 255, 0.13);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --tabbar-h: 76px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  background: #06091F;
  scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  min-height: 100svh;
  background: #06091F;
  color: var(--moon);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.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;
}

.book {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100svh;
  margin: 0 auto;
  background: var(--ink-night);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.48);
  overflow-x: clip;
}

.panel { min-height: 100svh; }

/* ---------- 录梦：满屏「湖上晨雾」真实图片舞台 ---------- */
.lake-scene {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: #0B0F2C;
}

/* 完整无字湖景底图（与 390×844 原稿同像素，100svh 满屏取景） */
.lake-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  transition: filter 1.1s ease;
  filter: brightness(calc(1 + var(--amp, 0) * 0.128)) saturate(calc(1 + var(--amp, 0) * 0.26));
}

.lake-scene[data-state="pause"] .lake-backdrop {
  filter: brightness(0.91) saturate(0.9);
}

.lake-scene[data-state="done"] .lake-backdrop {
  filter: brightness(1.06) saturate(1.06);
}

/* 涟漪：仅在真实底图上叠加细线水纹响应音量 */
.lake-ripples {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(50% + 159px);
  width: 0;
  height: 0;
  pointer-events: none;
}

.lake-ripple {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  border: 1.4px solid rgba(255, 216, 176, calc(0.24 + var(--amp, 0) * 0.54));
  opacity: 0;
  animation: lakeRipple 4.8s cubic-bezier(.15, .6, .3, 1) infinite;
}
.lake-ripple.r1 { animation-delay: 0s; }
.lake-ripple.r2 { animation-delay: -1.2s; }
.lake-ripple.r3 { animation-delay: -2.4s; }
.lake-ripple.r4 { animation-delay: -3.6s; }

.lake-scene[data-state="idle"] .lake-ripple,
.lake-scene[data-state="done"] .lake-ripple {
  animation: none;
  opacity: 0;
}

.lake-scene[data-state="speaking"] .lake-ripple {
  animation-duration: 2.8s;
  border-color: rgba(255, 216, 176, calc(0.32 + var(--amp, 0) * 0.56));
}
.lake-scene[data-state="speaking"] .lake-ripple.r2 { animation-delay: -0.7s; }
.lake-scene[data-state="speaking"] .lake-ripple.r3 { animation-delay: -1.4s; }
.lake-scene[data-state="speaking"] .lake-ripple.r4 { animation-delay: -2.1s; }

.lake-scene[data-state="pause"] .lake-ripple {
  animation-duration: 5.4s;
  border-color: rgba(255, 216, 176, 0.24);
}
.lake-scene[data-state="pause"] .lake-ripple.r3,
.lake-scene[data-state="pause"] .lake-ripple.r4 {
  animation: none;
  opacity: 0;
}

@keyframes lakeRipple {
  from { width: 26px; height: 5px; margin: -2.5px 0 0 -13px; opacity: 0.92; }
  to { width: 360px; height: 70px; margin: -35px 0 0 -180px; opacity: 0; }
}

/* 独立透明暖灯与湖面光柱 PNG 图层（仅变换与透明度响应 --amp） */
.lake-glow {
  position: absolute;
  z-index: 2;
  left: calc(50% - 35px);
  top: calc(50% + 127px);
  width: 140px;
  height: 240px;
  pointer-events: none;
  transform-origin: 50% 70px;
  transform: translate(-50%, -70px) scale(calc(0.75 + var(--amp, 0) * 1.35));
  opacity: calc(0.55 + var(--amp, 0) * 0.45);
  transition: transform 0.14s linear, opacity 0.24s ease;
}

/* 独立透明小船与倒影 PNG 图层（x=216 船身暗线锁定在 y=570–578） */
.lake-boat {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(50% + 98px);
  width: 110px;
  height: 90px;
  margin-left: -55px;
  pointer-events: none;
}

/* 讲完态升空光点 */
.lake-orb {
  position: absolute;
  z-index: 4;
  left: calc(50% - 35px);
  top: calc(50% + 127px);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #FFF1D2;
  box-shadow: 0 0 14px 6px rgba(255, 214, 160, 0.7), 0 0 40px 18px rgba(255, 190, 140, 0.3);
  opacity: 0;
  pointer-events: none;
}

.lake-scene[data-state="done"] .lake-orb {
  animation: lakeOrbRise 2.4s cubic-bezier(.3, .7, .3, 1) forwards;
}
.lake-scene[data-state="done"] .lake-glow {
  opacity: 0.4;
  transform: translate(-50%, -70px) scale(0.72);
}

@keyframes lakeOrbRise {
  0% { opacity: 0; transform: translate(0, 0) scale(0.9); }
  18% { opacity: 1; }
  100% { opacity: 1; transform: translate(54px, -248px) scale(1.25); }
}

/* 顶栏：品牌与环境声开关 */
.lake-topbar {
  position: absolute;
  z-index: 12;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 8px;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--moon);
  transition: opacity 0.35s ease;
}

.brand-mark {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFE7C2, #F3A27F);
  box-shadow: 0 0 10px rgba(255, 190, 140, 0.65);
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 10, 30, 0.44);
  color: var(--moon);
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.sound-toggle[aria-pressed="true"] {
  border-color: rgba(255, 199, 154, 0.55);
  background: rgba(255, 199, 154, 0.16);
}

.sound-disc {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.sound-slash {
  stroke: var(--dawn);
  transition: opacity 0.25s ease;
}
.sound-toggle[aria-pressed="true"] .sound-slash { opacity: 0; }
.sound-label { white-space: nowrap; }

/* 待开口引导文案 */
.lake-intro {
  position: absolute;
  z-index: 10;
  top: calc(74px + env(safe-area-inset-top, 0px));
  left: 24px;
  right: 76px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.journal-date {
  margin: 0;
  font-size: 13px;
  color: #C9C3E6;
  letter-spacing: 0.04em;
}

.lake-intro h1 {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: 0.02em;
  color: var(--moon);
  text-shadow: 0 2px 18px rgba(10, 12, 40, 0.45);
}

.lake-sub {
  margin: 12px 0 0;
  font-size: 15px;
  color: #DCD6F0;
  text-shadow: 0 1px 10px rgba(10, 12, 40, 0.5);
}

.lake-scene:not([data-state="idle"]) .lake-intro {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* 顶部状态胶囊（非待开口态显示；计时器置于底部声纹上方与定稿一致） */
.lake-live-bar {
  position: absolute;
  z-index: 11;
  top: calc(74px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.lake-scene:not([data-state="idle"]) .lake-live-bar {
  opacity: 1;
}

.rec-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(8, 10, 30, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13px;
  font-weight: 600;
  color: var(--moon);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF8A7A;
  box-shadow: 0 0 0 4px rgba(255, 138, 122, 0.22);
  animation: recBlink 1.2s ease-in-out infinite;
}

.lake-scene[data-state="pause"] .rec-dot {
  background: var(--dawn);
  box-shadow: 0 0 0 4px rgba(255, 199, 154, 0.2);
  animation: none;
}

.lake-scene[data-state="done"] .rec-dot {
  background: #9FE0B5;
  box-shadow: none;
  animation: none;
}

@keyframes recBlink {
  50% { opacity: 0.35; }
}

.lake-status:empty::before { content: "录音中"; }
.lake-scene[data-state="pause"] .lake-status:empty::before { content: "停顿中 · 仍在录音"; }
.lake-scene[data-state="done"] .lake-status:empty::before { content: "已录好"; }

/* ---------- 控制区锚点：待开口与录音中独立定位 ---------- */
/* 待开口态：无暗色底遮罩（保留 #3d3a68 湖水原色），92px 主键圆心锁定 390×844 下 y=672 */
.lake-dock {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 20px calc(96px + env(safe-area-inset-bottom, 0px));
  background: transparent;
}

.record-time {
  display: none;
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--moon);
}
.record-time:empty { display: none !important; }

.lake-wave {
  display: none;
  margin: 8px auto 14px;
  width: min(280px, 82%);
  height: 38px;
  align-items: center;
  justify-content: space-between;
}

.lake-wave i {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 210, 170, 0.85);
  height: calc(4px + var(--amp, 0) * var(--w, 0.6) * 34px);
  transition: height 0.08s linear, background 0.3s ease;
}

.lake-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
}

.dock-side {
  justify-self: center;
  margin-top: 22px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #C7C1E3;
  font-size: 11px;
  text-decoration: none;
}

.side-disc {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 30, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #E9E3F2;
}

.record-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.record-orb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #4A2233;
  background: radial-gradient(circle at 35% 30%, #FFE9C6 0%, #FFC491 45%, #F3906F 100%);
  box-shadow:
    0 0 0 9px rgba(255, 196, 150, 0.16),
    0 0 0 20px rgba(255, 196, 150, 0.07),
    0 10px 40px rgba(255, 160, 110, 0.55);
  animation: orbBreathe 3.6s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.14s linear, opacity 0.2s ease;
}

.record-orb:active { transform: scale(0.96); }
.record-orb:disabled { opacity: 0.6; cursor: wait; }

@keyframes orbBreathe {
  50% {
    box-shadow:
      0 0 0 12px rgba(255, 196, 150, 0.2),
      0 0 0 26px rgba(255, 196, 150, 0.06),
      0 10px 46px rgba(255, 160, 110, 0.65);
  }
}

.orb-mic { display: grid; place-items: center; }
.orb-stop {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #4A1F2C;
}

.record-label {
  margin-top: 12px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: #EDE6F7;
  letter-spacing: 0.06em;
}

/* 录音中 / 停顿态：隐藏底部导航，控制区贴底，76px 停止键圆心锁定 390×844 下 y=741（比待开口低 69px） */
.lake-scene[data-state="speaking"] .lake-dock,
.lake-scene[data-state="pause"] .lake-dock,
.lake-scene:has(#record[data-active]) .lake-dock {
  height: calc(264px + env(safe-area-inset-bottom, 0px));
  padding: 20px 20px calc(36px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(8, 10, 32, 0) 0%, rgba(8, 10, 32, 0.74) 32%, rgba(8, 10, 32, 0.94) 100%);
}

.lake-scene[data-state="speaking"] .record-time,
.lake-scene[data-state="pause"] .record-time,
.lake-scene:has(#record[data-active]) .record-time {
  display: block;
}

.lake-scene[data-state="speaking"] .lake-wave,
.lake-scene[data-state="pause"] .lake-wave,
.lake-scene:has(#record[data-active]) .lake-wave {
  display: flex;
}

.lake-scene[data-state="speaking"] .lake-wave i {
  animation: wavePulse 1.05s ease-in-out var(--d, 0ms) infinite alternate;
}

.lake-scene[data-state="pause"] .lake-wave i {
  background: rgba(200, 196, 230, 0.45);
  height: 4px;
  animation: none;
}

@keyframes wavePulse {
  from { transform: scaleY(0.76); }
  to { transform: scaleY(1.12); }
}

.lake-scene[data-state="speaking"] .record-orb,
.lake-scene[data-state="pause"] .record-orb,
.record-orb[data-active] {
  width: 76px;
  height: 76px;
  animation: none;
  background: radial-gradient(circle at 35% 30%, #FFE3BC, #F3906F);
  box-shadow:
    0 0 0 calc(6px + var(--amp, 0.25) * 14px) rgba(255, 190, 140, 0.18),
    0 8px 26px rgba(243, 144, 111, 0.5);
}

.lake-scene[data-state="speaking"] .dock-side,
.lake-scene[data-state="pause"] .dock-side,
.lake-scene:has(#record[data-active]) .dock-side {
  margin-top: 14px;
}

.lake-scene[data-state="speaking"] .record-label,
.lake-scene[data-state="pause"] .record-label,
.lake-scene:has(#record[data-active]) .record-label {
  margin-top: 10px;
  font-weight: 600;
  color: #FFE1C6;
  letter-spacing: 0.08em;
}

.lake-scene[data-state="speaking"] .orb-mic,
.lake-scene[data-state="pause"] .orb-mic,
.record-orb[data-active] .orb-mic {
  display: none;
}

.lake-scene[data-state="speaking"] .orb-stop,
.lake-scene[data-state="pause"] .orb-stop,
.record-orb[data-active] .orb-stop {
  display: block;
}

body:has(#lake-scene[data-state="speaking"]) .tabs,
body:has(#lake-scene[data-state="pause"]) .tabs,
body:has(#record[data-active]) .tabs {
  opacity: 0;
  pointer-events: none;
}

/* 讲完态：在状态条下轻柔展示录好时长 */
.lake-scene[data-state="done"] .record-time {
  display: block;
  margin-bottom: 10px;
  font-size: 22px;
  color: #D9D3EF;
}

/* ---------- 湖底手写与转写面板 ---------- */
.sheet-intake {
  padding: 22px 18px 26px;
  background: linear-gradient(180deg, #0B0F2C 0%, #10142F 18%, #0E122C 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.audio-card {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.audio-card audio {
  width: 100%;
  height: 38px;
}

.audio-bar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.audio-bar small {
  font-size: 12px;
  color: var(--text-3);
}

.sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sheet-bar h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--moon);
}

.aside {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.input-surface textarea,
.editor-fields input,
.editor-fields textarea,
.followup-body input,
.followup-body textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--moon);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
  padding: 13px 15px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.input-surface textarea:focus,
.editor-fields input:focus,
.editor-fields textarea:focus,
.followup-body input:focus,
.followup-body textarea:focus {
  border-color: rgba(255, 199, 154, 0.65);
  background: rgba(255, 255, 255, 0.075);
}

::placeholder { color: #7C84B0; }

.followup {
  margin-top: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.followup summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.followup summary::-webkit-details-marker { display: none; }
.followup summary span {
  font-size: 11px;
  color: var(--dawn);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 199, 154, 0.35);
}

.followup-body {
  padding: 0 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.followup-body label,
.field {
  display: block;
  font-size: 13px;
  color: var(--text-3);
  margin: 4px 0 4px;
}

.tag-grid { display: grid; gap: 10px; }

.original-preview {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
}

.intake-foot { margin-top: 18px; }

.mode {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

.btn-primary {
  display: block;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 25px;
  background: linear-gradient(135deg, #FFDAB0, #F39A78);
  color: #3B1C2A;
  font: 700 16px/1 var(--sans);
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(243, 154, 120, 0.32);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.btn-ghost,
.plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--moon);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  text-decoration: none;
}

/* ---------- 故事插画页（编辑态） ---------- */
.story-view {
  background: var(--sheet);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.story-hero {
  position: relative;
  min-height: 148px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  overflow: hidden;
  background: #121847;
}

.story-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.story-hero-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 10, 30, 0.48);
  color: var(--moon);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.pill-source {
  font-size: 11px;
  color: var(--dawn);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 10, 30, 0.52);
  border: 1px solid rgba(255, 199, 154, 0.45);
}

.illustration-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picture-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 12, 34, 0.6);
}

.picture-frame img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.picture-download {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--moon);
  font-size: 12px;
  text-decoration: none;
}

.hero-illustrate {
  align-self: flex-start;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 199, 154, 0.45);
  background: rgba(12, 16, 44, 0.62);
  color: #FFE4CB;
  font: 500 13px/1 var(--sans);
  cursor: pointer;
}

.story-sheet {
  position: relative;
  z-index: 3;
  margin-top: -24px;
  padding: 22px 20px 26px;
  border-radius: 26px 26px 0 0;
  background: var(--sheet);
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.32);
}

.privacy-note { font-size: 12px; color: var(--text-3); }

.editor-fields .title-input {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.editor-fields .body-input {
  font-size: 15.5px;
  line-height: 1.8;
}

.actions { margin-top: 20px; }

.story-title { margin: 16px 0 10px; font-size: 24px; line-height: 1.35; }
.story-text { margin: 0 0 20px; color: #f8f3e9; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag-grid strong { color: #d9c4b4; font-size: 13px; }
.tag-grid p { margin: 4px 0 0; color: #e8e2ef; }
.wallet-link {
  width: fit-content;
  min-height: 44px;
  padding: 0 12px;
  color: #ffdbb5;
  border: 1px solid #796077;
  border-radius: 24px;
  background: #242140;
  font-size: 14px;
}
.intake-foot .wallet-link, .night-head .wallet-link { margin-top: 10px; }
.wallet-panel {
  box-sizing: border-box;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 26px;
  color: #faf2e8;
  border: 1px solid #6f617e;
  border-radius: 26px;
  background: #191933;
  box-shadow: 0 22px 80px #07091fba;
}
.wallet-panel::backdrop { background: #080b23ba; }
.wallet-panel h2 { margin: 0 36px 12px 0; font-size: 26px; }
.wallet-panel p { margin: 12px 0; color: #d7cfdf; line-height: 1.55; }
.wallet-panel .wallet-balance { color: #ffdbb5; font-weight: 650; }
.wallet-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; color: #f7eddf; background: transparent; border: 0; font-size: 25px; }
.wallet-offer { display: grid; gap: 5px; padding: 15px; margin: 14px 0; border: 1px solid #665579; border-radius: 16px; background: #302442; }
.wallet-offer strong { color: #fff0d8; font-size: 22px; }
.wallet-offer span, .wallet-footnote { font-size: 13px; }
.wallet-offer select, .wallet-account input { width: 100%; color: #faf2e8; background: #242140; border: 1px solid #796077; border-radius: 10px; padding: 8px; }
.wallet-checkout { display: grid; justify-items: start; gap: 12px; margin: 12px 0; }
.wallet-checkout img { background: white; border-radius: 12px; }
.wallet-account { margin-top: 14px; font-size: 14px; }
.wallet-account label, .wallet-account output { display: block; margin-top: 8px; overflow-wrap: anywhere; }
.wallet-account summary { cursor: pointer; }
.wallet-panel .btn-primary { width: 100%; }
.wallet-panel .btn-ghost { margin-top: 8px; }
.wallet-panel button:disabled { opacity: .58; }
@media (max-width: 560px) {
  .wallet-panel { margin: auto 0 0; width: 100%; max-width: none; border-radius: 26px 26px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ---------- 故事本与梦境地图 ---------- */
.panel-night {
  position: relative;
  background: linear-gradient(180deg, #151B44 0%, #10142F 38%, #0D1130 100%);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.night-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 160px;
  overflow: hidden;
  opacity: 0.34;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
}

.night-banner img { width: 100%; height: 100%; object-fit: cover; }

.night-body {
  position: relative;
  z-index: 2;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px 26px;
}

.night-head { margin-bottom: 20px; }

.night-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--moon);
}

.section-lead { margin: 6px 0 0; font-size: 13.5px; color: var(--text-3); }

.empty {
  margin: 12px 0;
  padding: 28px 20px;
  border-radius: 20px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
  background: linear-gradient(135deg, rgba(255, 199, 154, 0.08), rgba(140, 150, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entries li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.entries li:first-child {
  background: linear-gradient(135deg, rgba(255, 199, 154, 0.14), rgba(79, 72, 130, 0.28));
  border-color: rgba(255, 199, 154, 0.28);
}

.entry-button {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--moon);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-date { font-size: 12px; color: var(--text-3); }
.entries li .plain { flex: none; min-height: 32px; padding: 0 11px; font-size: 12px; color: var(--text-2); }

.groups { display: flex; flex-direction: column; gap: 14px; }

.group {
  padding: 16px 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 199, 154, 0.1), rgba(140, 150, 255, 0.07));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.group h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--moon);
  display: flex;
  align-items: center;
  gap: 8px;
}

.group h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dawn);
  box-shadow: 0 0 8px rgba(255, 199, 154, 0.7);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #EFE8F7;
  font-size: 13.5px;
}

.feedback {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  max-width: calc(100vw - 36px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(16, 20, 47, 0.94);
  border: 1px solid rgba(255, 199, 154, 0.4);
  color: var(--moon);
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.book-foot {
  padding: 14px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  text-align: center;
  font-size: 11.5px;
  color: #6B739E;
  background: var(--ink-night);
}

/* 底部三页导航 */
.tabs {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: rgba(6, 8, 26, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 0.35s ease;
}

.tabs button {
  flex: 1;
  border: 0;
  background: none;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #7D85B0;
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
  transition: color 0.2s ease;
}

.tabs button svg { width: 23px; height: 23px; }
.tabs button[aria-current="page"] { color: var(--dawn); }

/* 短屏适配（如 375×667）：保持船体水色对齐与待机/录音双态分离 */
@media (max-height: 700px) {
  :root { --tabbar-h: 64px; }
  .lake-intro { top: calc(64px + env(safe-area-inset-top, 0px)); }
  .lake-intro h1 { font-size: 28px; }
  .lake-boat { top: calc(50% + 70px); width: 98px; height: 80px; margin-left: -49px; }
  .lake-glow { top: calc(50% + 96px); left: calc(50% - 31px); width: 124px; height: 214px; transform-origin: 50% 62px; transform: translate(-50%, -62px) scale(calc(0.75 + var(--amp, 0) * 1.35)); }
  .lake-ripples { top: calc(50% + 126px); }
  .lake-dock { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .record-orb { width: 80px; height: 80px; }
  .dock-side { margin-top: 16px; }
  .lake-scene[data-state="speaking"] .lake-dock,
  .lake-scene[data-state="pause"] .lake-dock,
  .lake-scene:has(#record[data-active]) .lake-dock {
    height: calc(222px + env(safe-area-inset-bottom, 0px));
    padding: 14px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .record-time { font-size: 28px; }
  .lake-wave { height: 30px; margin: 6px auto 10px; }
  .lake-scene[data-state="speaking"] .record-orb,
  .lake-scene[data-state="pause"] .record-orb,
  .record-orb[data-active] { width: 70px; height: 70px; }
}

/* 超短小屏适配（如 320×568）：确保录音停止键与导航栏完整落入屏内 */
@media (max-height: 600px) {
  :root { --tabbar-h: 56px; }
  .lake-topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .lake-intro { top: calc(52px + env(safe-area-inset-top, 0px)); left: 18px; right: 40px; }
  .lake-intro h1 { font-size: 24px; margin-top: 6px; }
  .lake-sub { font-size: 13px; margin-top: 6px; }
  .lake-live-bar { top: calc(52px + env(safe-area-inset-top, 0px)); }
  .lake-boat { top: calc(50% + 48px); width: 88px; height: 72px; margin-left: -44px; }
  .lake-glow { top: calc(50% + 71px); left: calc(50% - 28px); width: 112px; height: 192px; transform-origin: 50% 56px; transform: translate(-50%, -56px) scale(calc(0.75 + var(--amp, 0) * 1.35)); }
  .lake-ripples { top: calc(50% + 98px); }
  .lake-dock { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .record-orb { width: 72px; height: 72px; }
  .record-label { margin-top: 8px; font-size: 12px; }
  .dock-side { margin-top: 10px; }
  .side-disc { width: 40px; height: 40px; }
  .lake-scene[data-state="speaking"] .lake-dock,
  .lake-scene[data-state="pause"] .lake-dock,
  .lake-scene:has(#record[data-active]) .lake-dock {
    height: calc(194px + env(safe-area-inset-bottom, 0px));
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .record-time { font-size: 24px; }
  .lake-wave { height: 24px; margin: 4px auto 8px; }
  .lake-scene[data-state="speaking"] .record-orb,
  .lake-scene[data-state="pause"] .record-orb,
  .record-orb[data-active] { width: 64px; height: 64px; }
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lake-ripple,
  .lake-orb,
  .rec-dot,
  .record-orb,
  .lake-wave i {
    animation: none !important;
  }
  .lake-backdrop,
  .lake-glow,
  .lake-intro,
  .lake-live-bar,
  .record-orb,
  .tabs {
    transition: none !important;
  }
  .lake-scene[data-state="done"] .lake-orb {
    opacity: 1;
    transform: translate(54px, -248px) scale(1.2);
  }
}
