@font-face {
  font-family: "ZCOOL KuaiLe";
  src: url("/static/assets/fonts/zcool-kuaile.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("/static/assets/fonts/fredoka-500.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("/static/assets/fonts/fredoka-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("/static/assets/fonts/fredoka-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --app-height: 100vh;
  --sheet-max-height: 92vh;
  --bg-bottom-bleed: 0px;
  --story-bg-size: cover;

  --cream: #fff9ee;
  --cream-2: #fff4e0;
  --cream-3: #fdf0dc;

  --sky: #5ec3e8;
  --sky-deep: #2f9fc8;
  --sky-soft: #d4eef8;
  --sky-tint: #eaf7fc;

  --sun: #ffb627;
  --sun-deep: #e89a0c;
  --sun-soft: #ffe9b8;
  --sun-tint: #fff6e0;

  --blossom: #ff89a8;
  --blossom-deep: #e8617f;
  --blossom-soft: #ffd6e0;
  --blossom-tint: #ffe9ef;

  --grass: #6fc15a;
  --grass-deep: #4a9a36;
  --grass-soft: #d6eccd;
  --grass-tint: #e9f6e2;

  --lavender: #b59fe0;
  --lavender-soft: #e6dcf3;
  --lavender-tint: #f1eafa;

  --ink: #5b4a3a;
  --ink-soft: #8b7560;
  --ink-faint: #b6a48f;
  --card: #ffffff;
  --card-soft: #fffdf8;
  --line: #f0e4d2;
  --line-soft: #f7eede;

  --warn: #e8704a;
  --warn-soft: #ffe2d4;

  --shadow-sm: 0 2px 6px rgba(91, 74, 58, 0.08);
  --shadow: 0 6px 18px rgba(91, 74, 58, 0.10);
  --shadow-lg: 0 14px 36px rgba(91, 74, 58, 0.14);
  --shadow-float: 0 10px 28px rgba(91, 74, 58, 0.16);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-display: "ZCOOL KuaiLe", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-reading: var(--font-body);
  --font-num: "Fredoka", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;

  /* 首页字号层级：少而统一，方便移动端整体调整。 */
  --home-title: 24px;
  --home-section-title: 20px;
  --home-item-title: 17px;
  --home-body: 14px;
  --home-small: 13px;
  --home-badge: 12px;
}

@supports (height: 100lvh) {
  :root {
    --app-height: 100lvh;
    --sheet-max-height: 92lvh;
  }
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
    --sheet-max-height: 92dvh;
  }
}

@media (max-width: 560px) {
  :root {
    --bg-bottom-bleed: clamp(180px, 28vh, 320px);
    --story-bg-size: 100% 100%;
  }
}

* { box-sizing: border-box; }

html {
  height: 100%;
  min-height: var(--app-height);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  height: var(--app-height);
  min-height: var(--app-height);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  background: var(--cream);
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-y: auto;
}
body.locked { overflow: hidden; }
body.scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  height: calc(var(--app-height) + var(--bg-bottom-bleed));
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,249,238,0.12), rgba(255,249,238,0.36) 38%, rgba(255,249,238,0.66) 100%),
    url("/static/assets/story-atmosphere.webp") center top / var(--story-bg-size) no-repeat;
}
body::after {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  height: calc(var(--app-height) + var(--bg-bottom-bleed));
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,249,238,0.42), transparent 24%, transparent 76%, rgba(255,249,238,0.42));
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- 跳转链接 ---------- */
.skip-link {
  position: fixed; left: 14px; top: 10px; z-index: 60;
  transform: translateY(-160%);
  border-radius: var(--r-pill); background: var(--ink); color: #fff;
  padding: 9px 14px; font-size: 13px; font-weight: 700; text-decoration: none;
  transition: transform 180ms var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- 按钮 ---------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border: 0; border-radius: var(--r-pill);
  background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-sm); cursor: pointer; font-weight: 700; padding: 0 20px;
  text-align: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 140ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease), opacity 160ms var(--ease);
  white-space: nowrap; font-family: var(--font-body);
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(94, 195, 232, 0.5); outline-offset: 2px;
}
button:active { transform: scale(0.96); }
button:disabled { cursor: not-allowed; opacity: 0.5; transform: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--blossom); color: #fff; box-shadow: 0 8px 18px rgba(232, 97, 127, 0.30); }
.btn-sky { background: var(--sky); color: #fff; box-shadow: 0 8px 18px rgba(47, 159, 200, 0.28); }
.btn-sun { background: var(--sun); color: #6b4a12; box-shadow: 0 8px 18px rgba(232, 154, 12, 0.28); }
.btn-grass { background: var(--grass); color: #fff; box-shadow: 0 8px 18px rgba(74, 154, 54, 0.28); }
.btn-ghost { background: var(--card-soft); color: var(--ink-soft); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
@media (hover: hover) {
  button:not(:disabled):hover { transform: translateY(-1px); }
  .btn-primary:not(:disabled):hover { background: var(--blossom-deep); }
  .btn-sky:not(:disabled):hover { background: var(--sky-deep); }
  .btn-sun:not(:disabled):hover { background: var(--sun-deep); color: #5a3e08; }
  .btn-grass:not(:disabled):hover { background: var(--grass-deep); }
}

/* ---------- 认证门 ---------- */
.auth-gate {
  position: fixed; top: 0; right: 0; bottom: auto; left: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  min-height: var(--app-height);
  background:
    radial-gradient(100% 50% at 50% 0%, var(--sky-tint) 0%, transparent 60%),
    radial-gradient(100% 50% at 50% 100%, var(--blossom-tint) 0%, transparent 60%),
    var(--cream);
}
.auth-card {
  position: relative; width: min(380px, 100%); background: var(--card);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 30px 24px 26px;
  text-align: center; animation: pop-in 360ms var(--ease-bounce) both;
}
.auth-art { margin: -8px auto 16px; width: 120px; height: 120px; position: relative; }
.auth-art img { position: relative; z-index: 1; width: 120px; height: 120px; object-fit: contain; }
.auth-card .eyebrow { margin: 0 0 6px; color: var(--blossom-deep); font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.auth-card h1 { margin: 0 0 18px; font-family: var(--font-display); font-size: 30px; line-height: 1.15; color: var(--ink); }
.auth-card label { text-align: left; }
.auth-card .form-error { text-align: left; }

/* ---------- 壳层 ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  height: var(--app-height);
  margin: 0 auto;
  padding: max(38px, calc(env(safe-area-inset-top) + 26px)) 16px max(10px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 顶部 ---------- */
.topbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 10px; }
.brand { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex: 0 0 auto; width: 50px; height: 50px; display: grid; place-items: center;
  border-radius: 18px; background: rgba(255,253,248,0.86);
  box-shadow: 0 6px 14px rgba(91, 74, 58, 0.12);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.brand-text { min-width: 0; }
.brand-title { font-family: var(--font-display); font-size: 22px; line-height: 1.1; color: var(--ink); letter-spacing: 0; }
.brand-sub {
  margin-top: 2px;
  color: #4f3f33;
  font-size: 12px;
  font-weight: 800;
  text-shadow: none;
}
.top-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.top-action {
  width: 44px; height: 44px; min-height: 44px; border-radius: 50%;
  background: rgba(255,253,248,0.9); box-shadow: var(--shadow-sm); color: var(--blossom-deep); padding: 0;
}
.top-refresh {
  font-size: 26px;
}
.top-refresh.spinning { animation: spin 0.8s linear infinite; }
.top-logout {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink-soft);
}

/* ---------- 视图切换 ---------- */
.view-toggle {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: rgba(255,253,248,0.9); border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1.5px rgba(240,228,210,0.92), 0 8px 22px rgba(91,74,58,0.12);
  padding: 4px; margin: 4px 0 2px;
  position: relative;
  z-index: 3;
}
.view-toggle .seg {
  min-height: 42px; padding: 0 12px; border-radius: var(--r-pill);
  background: transparent; box-shadow: none; color: var(--ink-soft);
  font-weight: 700; font-size: 15px;
}
.view-toggle .seg.active { background: var(--blossom); color: #fff; box-shadow: 0 4px 12px rgba(232, 97, 127, 0.28); }
.view-toggle .seg img { width: 22px; height: 22px; object-fit: contain; }
.video-tab-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 8px; background: var(--sky-tint); color: var(--sky-deep); font-size: 10px; }
.view-toggle .seg.active .video-tab-icon { background: rgba(255,255,255,0.22); color: #fff; }
.view-toggle .seg:active { transform: scale(0.97); }

/* ---------- 视图 ---------- */
.view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  animation: rise 260ms var(--ease) both;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ---------- 故事列表 ---------- */
.shelf {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 14px;
}
#bookShelf {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 10px 10px;
  border-radius: 24px;
  background: rgba(255,253,248,0.72);
  box-shadow: 0 16px 40px rgba(91,74,58,0.12), inset 0 0 0 1.5px rgba(240,228,210,0.9);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#voiceShelf {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255,253,248,0.70);
  box-shadow: 0 16px 40px rgba(91,74,58,0.12), inset 0 0 0 1.5px rgba(240,228,210,0.86);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#bookShelf,
#voiceShelf {
  width: 100%;
  min-width: 0;
}
#bookShelf,
#voiceShelf,
.shelf-scroll,
.sheet-body,
.detail-body {
  scrollbar-width: none;
}
#bookShelf::-webkit-scrollbar,
#voiceShelf::-webkit-scrollbar,
.shelf-scroll::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar,
.detail-body::-webkit-scrollbar {
  display: none;
}
#bookShelf > :not(.shelf-scroll),
#voiceShelf > :not(.shelf-scroll),
.shelf-scroll > * {
  flex-shrink: 0;
}
.shelf-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.story-list-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 8px;
}
.story-list-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}
.story-list-sub {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.shelf-play-control { flex: 0 0 auto; display: flex; align-items: center; min-height: 42px; padding: 3px; border-radius: var(--r-pill); background: rgba(255,253,248,0.88); box-shadow: 0 5px 14px rgba(91,74,58,0.09), inset 0 0 0 1px rgba(232,205,162,0.56); }
.shelf-play-all { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); background: var(--blossom-deep); color: #fff; box-shadow: 0 3px 8px rgba(190,76,105,0.20); font-size: 12px; font-weight: 800; }
.shelf-play-all .txt-icon { font-size: 11px; }
.shelf-play-mode { position: relative; width: 38px; min-width: 38px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--blossom-deep); box-shadow: none; display: grid; place-items: center; }
.mode-icon { width: 18px; height: 18px; display: block; flex: 0 0 auto; }
.shelf-play-mode .mode-icon { width: 19px; height: 19px; }

.shelf-play-all:active,
.shelf-play-mode:active { background: rgba(232,97,127,0.10); }
.shelf-play-all:active { background: var(--blossom); }
.story-row {
  position: relative;
  width: 100%;
  min-height: 68px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--cover, #fff) 46%, rgba(255,255,255,0.94));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--spine, var(--line)) 24%, var(--line)), 0 3px 10px rgba(91,74,58,0.07);
  padding: 10px 10px 10px 14px;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  transition: transform 140ms var(--ease), box-shadow 160ms var(--ease);
  border: 0; text-align: left; color: var(--ink); font-family: var(--font-body);
  animation: pop-in 280ms var(--ease-bounce) both;
}
.story-row:active { transform: scale(0.985); }
@media (hover: hover) { .story-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); } }

.story-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--cover, var(--sky-tint));
  color: var(--spine-deep, var(--sky-deep));
  flex: 0 0 auto;
}
.story-icon img, .img-icon { width: 30px; height: 30px; object-fit: contain; }
.story-main {
  display: block;
  min-width: 0;
}
.story-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--home-item-title);
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-meta {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 62px;
}
.story-status .mini-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 800;
  background: var(--cream-2); color: var(--ink-soft);
  box-shadow: none;
  font-family: var(--font-num);
}
.story-status .mini-badge.ready { background: var(--grass); color: #fff; }
.story-status .mini-badge.busy { background: var(--sky-deep); color: #fff; }
.story-status .mini-badge.fail { background: var(--warn); color: #fff; }
.story-status .mini-badge.idle { background: var(--cream-2); color: var(--ink-faint); }
.story-status .mini-badge.ready span { max-width: 38px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add,
.voice-add-row {
  min-height: 76px;
  margin-bottom: 8px;
  grid-template-columns: 44px minmax(0, 1fr);
  background: rgba(255,253,248,0.92);
  border: 1.5px dashed rgba(232,154,12,0.52);
  box-shadow: 0 3px 10px rgba(91,74,58,0.06);
}
.story-add .story-icon,
.voice-add-row .story-icon {
  width: 44px;
  height: 44px;
  background: var(--sun-tint);
  color: var(--sun-deep);
  box-shadow: inset 0 0 0 1px var(--sun-soft);
}
.story-add .story-title,
.voice-add-row .story-title { color: var(--ink); }
.story-add .story-meta,
.voice-add-row .story-meta { color: var(--ink-faint); }
.book {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-lg);
  background: var(--cover, var(--sky-tint));
  box-shadow: var(--shadow);
  padding: 0; overflow: hidden;
  cursor: pointer;
  transition: transform 140ms var(--ease), box-shadow 160ms var(--ease);
  border: 0; text-align: left; color: var(--ink); font-family: var(--font-body);
  animation: pop-in 280ms var(--ease-bounce) both;
}
.book::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; z-index: 3;
  background: var(--spine, var(--sky));
  box-shadow: inset -2px 0 4px rgba(0,0,0,0.08);
}
.book::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 5px; z-index: 3;
  background: repeating-linear-gradient(to bottom, #fff7e8 0 2px, #f3e6cc 2px 4px);
  opacity: 0.85;
}
.book:active { transform: scale(0.97); }
@media (hover: hover) { .book:hover { transform: translateY(-3px) rotate(-0.5deg); box-shadow: var(--shadow-lg); } }

.book-status .mini-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.92); color: var(--ink-soft);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(2px);
  font-family: var(--font-num);
}
.book-status .mini-badge.ready { background: var(--grass); color: #fff; }
.book-status .mini-badge.busy { background: var(--sky-deep); color: #fff; }
.book-status .mini-badge.fail { background: var(--warn); color: #fff; }
.book-status .mini-badge.idle { background: rgba(255,255,255,0.92); color: var(--ink-faint); }
.book-status .mini-badge.ready span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.mini-badge.busy .dot { animation: blink 1s ease-in-out infinite; }

/* 新建书 tile */
.book-add {
  border: 2.5px dashed var(--line); background: var(--card-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-faint); cursor: pointer; box-shadow: none;
}
.book-add::before, .book-add::after { display: none; }
.book-add .add-label { font-family: var(--font-display); font-size: 16px; color: var(--ink-soft); }
.book-add:active { transform: scale(0.97); }
@media (hover: hover) { .book-add:hover { border-color: var(--blossom); color: var(--blossom); transform: none; background: var(--blossom-tint); } }

/* 空状态插画 */
.empty-illu { position: relative; width: 140px; height: 140px; display: grid; place-items: center; }
.empty-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.empty-art { position: relative; z-index: 1; width: 140px; height: 140px; object-fit: contain; }

/* ---------- 声音卡片 ---------- */
.voice-tile {
  position: relative; background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 14px; overflow: hidden;
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 10px;
  animation: pop-in 280ms var(--ease-bounce) both;
}
#voiceShelf .voice-tile {
  border-radius: 16px;
  background: color-mix(in srgb, var(--voice-tint, #fff) 42%, rgba(255,255,255,0.95));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--voice-accent, var(--line)) 24%, var(--line)), 0 3px 12px rgba(91,74,58,0.08);
  padding: 12px 12px 12px 14px;
  margin: 0 0 8px;
}
.voice-tile::before { display: none; }
.voice-tile-top { display: flex; align-items: flex-start; gap: 10px; padding-left: 4px; }
.voice-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center; background: rgba(255,255,255,0.72); color: var(--voice-deep, var(--sky-deep));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.88);
}
.voice-icon img, .voice-icon .txt-icon { width: 20px; height: 20px; display: grid; place-items: center; }
.voice-main { flex: 1 1 auto; min-width: 0; }
.voice-name { font-family: var(--font-display); font-size: var(--home-item-title); font-weight: 400; color: var(--ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-meta { margin-top: 2px; font-size: 12px; color: var(--ink-faint); font-family: var(--font-num); }
.voice-tile .card-menu { flex: 0 0 auto; width: 32px; height: 32px; min-height: 32px; border-radius: 50%; background: transparent; box-shadow: none; color: var(--ink-faint); font-size: 18px; }
.voice-msg { padding: 8px 11px; border-radius: var(--r-md); background: var(--cream-2); color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.voice-msg.err { background: var(--warn-soft); color: var(--warn); }
#voiceShelf .voice-msg {
  padding: 2px 3px 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}
#voiceShelf .voice-msg.err {
  padding: 8px 11px;
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn);
}
.preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -4px; padding: 0 3px; color: var(--ink-faint); font-size: 11px; font-weight: 600; font-family: var(--font-num); }
.preview-new { flex: 0 0 auto; padding: 2px 7px; border-radius: var(--r-pill); background: var(--blossom-tint); color: var(--blossom-deep); font-family: var(--font-body); font-weight: 800; }
#voiceShelf .player {
  background: rgba(255,255,255,0.56);
  box-shadow: inset 0 0 0 1px rgba(240,228,210,0.78);
}
#voiceShelf .player-track {
  background: rgba(232,205,162,0.36);
}
.sample-nudge {
  width: auto; min-height: 36px; padding: 0 13px; align-self: flex-start;
  border-radius: var(--r-pill); background: var(--sun-tint); color: #8a5b0b;
  box-shadow: inset 0 0 0 1.5px rgba(232,154,12,0.30); font-size: 13px; font-weight: 700;
}
.sample-nudge .txt-icon { font-size: 13px; color: var(--sun-deep); }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; line-height: 1.4; }
.badge-ready { background: var(--grass-tint); color: var(--grass-deep); }
.badge-improve { background: var(--sky-tint); color: var(--sky-deep); }
.badge-busy { background: var(--sky-tint); color: var(--sky-deep); }
.badge-fail { background: var(--warn-soft); color: var(--warn); }
.badge-done { background: var(--blossom-tint); color: var(--blossom-deep); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-busy .badge-dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 加载条 */
.loadbar { height: 6px; border-radius: var(--r-pill); background: var(--cream-2); overflow: hidden; margin-top: 8px; }
.loadbar span { display: block; width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--blossom)); animation: sweep 1.3s var(--ease) infinite; }
@keyframes sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }

/* ---------- 自定义播放器 ---------- */
.player { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: var(--r-pill); background: var(--cream-2); box-shadow: inset 0 0 0 1.5px var(--line-soft); }
.player.expand { width: 100%; }
.player-play { flex: 0 0 auto; width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 50%; border: 0; color: #fff; display: grid; place-items: center; }
.player-play.sky { background: var(--sky-deep); }
.player-play.blossom { background: var(--blossom-deep); }
.player-play:active { transform: scale(0.92); }
.player-play .txt-icon { font-size: 15px; line-height: 1; }
.player-info { flex: 1 1 auto; min-width: 0; }
.player-track { height: 6px; border-radius: var(--r-pill); background: rgba(255,255,255,0.7); overflow: hidden; cursor: pointer; }
.player-fill { height: 100%; width: 0%; border-radius: inherit; transition: width 120ms linear; }
.player-fill.sky { background: var(--sky); }
.player-fill.blossom { background: var(--blossom); }
.player-time { margin-top: 4px; color: var(--ink-faint); font-size: 11px; font-weight: 600; font-family: var(--font-num); display: flex; justify-content: space-between; }

/* ---------- 表单元素 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%; min-height: 48px; border: 0; border-radius: var(--r-md);
  background: #fff; color: var(--ink);
  box-shadow: inset 0 0 0 1.5px #dfcfba, 0 2px 6px rgba(91,74,58,0.05); padding: 12px 14px;
  transition: box-shadow 160ms var(--ease), background 160ms var(--ease); font-family: var(--font-body);
}
input::placeholder, textarea::placeholder { color: #aa9885; }
input:focus, select:focus, textarea:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--sky-deep), 0 0 0 4px rgba(94,195,232,0.18); outline: none; }
textarea { line-height: 1.7; resize: vertical; min-height: 90px; }
#topic { background: #fff; }
input[type="file"] { padding: 10px; background: #fff; }
.field-hint { margin: -6px 0 14px; color: var(--ink-faint); font-size: 12px; line-height: 1.6; }
.form-error { margin: 8px 0 0; padding: 9px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; line-height: 1.5; }

/* ---------- 芯片选择组 ---------- */
.chip-group { margin-bottom: 16px; }
.chip-group-label { margin-bottom: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
details.chip-group > summary { list-style: none; cursor: pointer; }
details.chip-group > summary::-webkit-details-marker { display: none; }
details.chip-group > summary .txt-icon { transition: transform 200ms var(--ease); }
details.chip-group[open] > summary .txt-icon { transform: rotate(180deg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px; min-height: 38px; border-radius: var(--r-pill);
  background: var(--card); color: var(--ink-soft); box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 150ms var(--ease); user-select: none;
}
.chip:active { transform: scale(0.94); }
.chip[data-on="true"] { color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(91, 74, 58, 0.16); }
.chip-sky[data-on="true"] { background: var(--sky-deep); }
.chip-sun[data-on="true"] { background: var(--sun); color: #6b4a12; }
.chip-blossom[data-on="true"] { background: var(--blossom); }
.chip-grass[data-on="true"] { background: var(--grass-deep); }
.chip-lavender[data-on="true"] { background: var(--lavender); }

/* ---------- 录音 ---------- */
.recorder { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; border-radius: var(--r-lg); background: var(--cream-2); margin-bottom: 12px; }
.rec-btn {
  width: 92px; height: 92px; min-height: 92px; border-radius: 50%; padding: 0;
  background: linear-gradient(135deg, var(--blossom), var(--blossom-deep)); color: #fff;
  box-shadow: 0 10px 26px rgba(232, 97, 127, 0.36); display: grid; place-items: center; position: relative;
}
.rec-btn .txt-icon { font-size: 34px; line-height: 1; }
.rec-btn.recording { background: linear-gradient(135deg, var(--warn), #c54a28); }
.rec-btn.recording::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--warn); opacity: 0.5; animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(0.92); opacity: 0.6; } 100% { transform: scale(1.3); opacity: 0; } }
.rec-state { color: var(--ink-soft); font-size: 14px; font-weight: 600; text-align: center; }
.rec-level { width: min(220px, 82%); height: 8px; overflow: hidden; border-radius: var(--r-pill); background: rgba(91,74,58,0.10); box-shadow: inset 0 0 0 1px rgba(91,74,58,0.05); }
.rec-level i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--grass); transition: width 90ms linear, background 160ms var(--ease); }
.rec-level i[data-level="quiet"] { background: var(--sun); }
.rec-level i[data-level="loud"] { background: var(--warn); }
.rec-timer { font-family: var(--font-num); font-size: 20px; font-weight: 600; color: var(--ink); }
.rec-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* 三段声音采样 */
.sheet-samples .sheet-head-icon { background: var(--sky-tint); }
.sample-overview { margin-bottom: 14px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, var(--sky-tint), #fff); box-shadow: inset 0 0 0 1.5px var(--sky-soft); }
.sample-progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sample-progress-copy b { color: var(--sky-deep); font-size: 16px; }
.sample-progress-copy span { color: var(--ink-soft); font-size: 12px; text-align: right; }
.sample-progress { height: 7px; margin-top: 10px; overflow: hidden; border-radius: var(--r-pill); background: rgba(94,195,232,.16); }
.sample-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--grass)); transition: width 260ms var(--ease); }
.preview-refresh-state { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--sky-deep); font-size: 12px; font-weight: 700; }
.preview-spinner { width: 15px; height: 15px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--sky-soft); border-top-color: var(--sky-deep); animation: spin .8s linear infinite; }
.preview-loadbar { margin-top: 0; }
.sample-list { display: grid; gap: 10px; }
.sample-card { padding: 14px; border-radius: 18px; background: var(--card-soft); box-shadow: inset 0 0 0 1.5px var(--line); }
.sample-card.good { background: var(--grass-tint); box-shadow: inset 0 0 0 1.5px var(--grass-soft); }
.sample-card.bad { background: #fff8f3; box-shadow: inset 0 0 0 1.5px var(--warn-soft); }
.sample-card-head { display: grid; grid-template-columns: 34px 1fr 28px; align-items: center; gap: 10px; }
.sample-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--sky-tint); color: var(--sky-deep); font-family: var(--font-num); font-weight: 700; }
.sample-card.good .sample-number { background: #fff; color: var(--grass-deep); }
.sample-card-head b { display: block; font-size: 15px; color: var(--ink); }
.sample-card-head small { display: block; margin-top: 1px; color: var(--ink-faint); font-size: 12px; font-weight: 600; }
.sample-check { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--grass); color: #fff; font-weight: 800; }
.sample-card.empty .sample-check, .sample-card.bad .sample-check { background: transparent; }
.sample-card p { margin: 9px 0 10px 44px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.sample-card-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sample-rec-panel { padding-bottom: 8px; }
.sample-rec-kicker { display: inline-flex; padding: 5px 11px; border-radius: var(--r-pill); background: var(--sky-tint); color: var(--sky-deep); font-size: 12px; font-weight: 800; }
.sample-rec-text { margin: 12px 0; padding: 15px; border-radius: 18px; background: #fffaf0; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-size: 16px; line-height: 1.9; text-wrap: pretty; }
.recorder.compact { padding: 16px; }
.recorder.compact .rec-btn { width: 78px; height: 78px; min-height: 78px; }
.sample-rec-panel > .btn-block { margin-top: 9px; }

/* ---------- 抽屉 ---------- */
.sheet-overlay { position: fixed; top: 0; right: 0; bottom: auto; left: 0; height: var(--app-height); z-index: 40; background: rgba(70, 50, 35, 0.42); backdrop-filter: blur(2px); opacity: 0; transition: opacity 240ms var(--ease); }
.sheet-overlay.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: var(--sheet-max-height);
  background: var(--card); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform 320ms var(--ease);
  display: flex; flex-direction: column; overflow: hidden;
  overscroll-behavior: contain;
}
.sheet.show { transform: translateY(0); }
.sheet-grabber { flex: 0 0 auto; width: 44px; height: 5px; border-radius: var(--r-pill); background: var(--line); margin: 10px auto 4px; }
.sheet-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 18px 14px; position: relative; }
.sheet-head-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; }
.sheet-head-icon img { width: 30px; height: 30px; object-fit: contain; }
.sheet-voice .sheet-head-icon { background: var(--sky-tint); color: var(--sky-deep); }
.sheet-story .sheet-head-icon { background: var(--sun-tint); color: var(--sun-deep); }
.sheet-speech .sheet-head-icon { background: var(--blossom-tint); color: var(--blossom-deep); }
.sheet-edit .sheet-head-icon { background: var(--lavender-soft); color: var(--lavender); }
.sheet-title { font-family: var(--font-display); font-size: 20px; color: var(--ink); line-height: 1.1; flex: 1 1 auto; }
.sheet-title-wrap { flex: 1 1 auto; min-width: 0; }
.sheet-subtitle { margin-top: 4px; color: var(--ink-faint); font-size: 12px; font-weight: 700; line-height: 1.2; }
.sheet-close { flex: 0 0 auto; width: 36px; height: 36px; min-height: 36px; border-radius: 50%; background: var(--cream-2); box-shadow: none; color: var(--ink-faint); font-size: 18px; }
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 0 18px 16px;
  -webkit-overflow-scrolling: touch;
}
.sheet-foot { flex: 0 0 auto; padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--card); box-shadow: 0 -4px 14px rgba(91, 74, 58, 0.06); }

.sheet-story {
  background:
    linear-gradient(180deg, rgba(255,249,238,0.96), #fff 34%, #fff 100%);
}
.story-sheet-head {
  min-height: 78px;
  padding-top: 12px;
  padding-bottom: 16px;
  overflow: hidden;
}
.story-sheet-head .sheet-title-wrap {
  padding-right: 114px;
}
.story-sheet-head .sheet-head-art {
  position: absolute;
  right: 48px;
  top: 8px;
  width: 112px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.sheet-story .sheet-body {
  padding-top: 2px;
}

/* 选声音列表 */
.pick-list { display: grid; gap: 8px; }
.pick-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--cream-2); box-shadow: inset 0 0 0 1.5px transparent; cursor: pointer;
  transition: all 140ms var(--ease); text-align: left; width: 100%; min-height: 44px;
  font-weight: 600; color: var(--ink); border: 0;
}
.pick-item:active { transform: scale(0.98); }
.pick-item[data-on="true"] { background: var(--blossom-tint); box-shadow: inset 0 0 0 2px var(--blossom); }
.pick-item[data-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.pick-item-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--card); color: var(--ink-soft); }
.pick-item-icon .txt-icon, .pick-item-icon img { width: 18px; height: 18px; display: grid; place-items: center; }
.pick-item[data-made="true"] .pick-item-sub { color: var(--grass-deep); }
.pick-item[data-current="true"] .pick-item-sub { color: var(--blossom-deep); }
.pick-item[data-failed="true"] .pick-item-sub { color: var(--warn); }
.pick-item-main { flex: 1 1 auto; min-width: 0; }
.pick-item-title { font-family: var(--font-display); font-size: 14px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item-sub { font-size: 12px; font-weight: 500; color: var(--ink-faint); font-family: var(--font-num); }
.pick-check { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; }
.pick-item[data-on="true"] .pick-check { background: var(--blossom); border-color: var(--blossom); color: #fff; }
.pick-check .txt-icon { font-size: 14px; line-height: 1; }

/* 空状态 */
.empty { display: grid; place-items: center; gap: 12px; text-align: center; padding: 36px 18px; grid-column: 1 / -1; }
.empty-text { color: var(--ink-soft); font-size: 15px; font-weight: 600; line-height: 1.6; max-width: 260px; }
.empty .empty-cta { margin-top: 4px; }

/* 骨架屏 */
.skeleton {
  border-radius: var(--r-lg); background: linear-gradient(100deg, var(--cream-2) 30%, var(--card-soft) 50%, var(--cream-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
  aspect-ratio: 3 / 4;
}
#bookShelf > .skeleton,
#voiceShelf > .skeleton {
  width: 100%;
  height: 68px;
  min-height: 68px;
  aspect-ratio: auto;
  border-radius: 16px;
  margin-bottom: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 故事详情（全屏） ---------- */
.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--app-height);
  z-index: 35;
  background:
    radial-gradient(circle at 50% -8%, rgba(255,235,184,0.58), transparent 38%),
    linear-gradient(180deg, rgba(255,246,224,0.98) 0%, rgba(255,249,238,0.98) 52%, #f5fbff 100%);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 320ms var(--ease);
  visibility: hidden;
  overflow: hidden;
}
.detail.show { transform: translateY(0); visibility: visible; }
.detail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 184px;
  background: url("/static/assets/detail-clouds.webp") center bottom / 100% auto no-repeat;
  filter: drop-shadow(0 -8px 18px rgba(91,74,58,0.05));
  pointer-events: none;
  z-index: 5;
}
.detail-head {
  position: static;
  display: block;
  height: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}
.detail-back,
.detail-head .card-menu {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  min-height: 46px;
  border-radius: 50%;
  background: rgba(255,253,248,0.9);
  box-shadow: 0 7px 18px rgba(91,74,58,0.12);
  color: var(--ink-soft);
  padding: 0;
  pointer-events: auto;
  z-index: 8;
}
.detail-back { font-size: 30px; line-height: 1; }
.detail-head .card-menu { font-size: 20px; color: var(--ink-faint); }
.detail-back {
  position: absolute;
  left: 18px;
  top: max(18px, calc(env(safe-area-inset-top) + 8px));
}
.detail-head .card-menu {
  position: absolute;
  right: 18px;
  top: max(18px, calc(env(safe-area-inset-top) + 8px));
}
.detail-title-wrap {
  position: absolute;
  left: 72px;
  right: 72px;
  top: max(25px, calc(env(safe-area-inset-top) + 13px));
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  z-index: 8;
}
.detail-title-copy { min-width: 0; max-width: 100%; text-align: center; }
.detail-title {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.12;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
  font-weight: 400;
  text-shadow: 0 2px 8px rgba(255,253,248,0.9), 0 1px 0 rgba(255,255,255,0.9);
}
.detail-subtitle {
  display: none;
}
.detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: max(86px, calc(env(safe-area-inset-top) + 72px)) 16px 152px;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 2;
}
.detail-paper {
  position: relative;
  min-height: calc(100% - 54px);
  border-radius: 30px 30px 18px 18px;
  padding: 68px 28px 152px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.28), transparent 14%, transparent 86%, rgba(255,255,255,0.32)),
    radial-gradient(circle at 24% 18%, rgba(255,246,224,0.95), transparent 34%),
    #fff8e9;
  box-shadow:
    inset 0 0 0 1.5px rgba(232,205,162,0.56),
    inset 8px 0 0 rgba(255,238,198,0.48),
    0 12px 30px rgba(91,74,58,0.10);
}
.detail-bookmark {
  position: absolute;
  right: 16px;
  top: -64px;
  width: 88px;
  height: auto;
  pointer-events: none;
  z-index: 2;
}
.detail-writing { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 58px; color: var(--ink-soft); text-align: center; }
.detail-writing .pen { width: 54px; height: 54px; color: var(--sun-deep); animation: wobble 1.6s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.detail-writing .loadbar { width: 160px; margin: 0; }
.story-text {
  font-family: var(--font-reading);
  font-size: 17px;
  line-height: 2.12;
  color: #5f584c;
  white-space: pre-wrap;
  text-wrap: pretty;
  font-weight: 500;
}
.story-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 32px;
  padding: 0 42px;
  position: relative;
  z-index: 3;
}
.story-chips .chip-tag {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 800;
  background: rgba(255,246,224,0.95);
  color: var(--sun-deep);
  box-shadow: inset 0 0 0 1px rgba(232,154,12,0.12);
}

/* 朗读栏 */
.detail-foot {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 28px));
  z-index: 7;
  padding: 0;
  background: transparent;
  filter: drop-shadow(0 20px 26px rgba(79, 96, 112, 0.20));
}
.narrate-empty { text-align: center; color: var(--ink-faint); font-size: 13px; }
.narrate-progress {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 15px;
  border-radius: 24px;
  background: rgba(255,248,232,0.98);
  box-shadow: inset 0 0 0 1.5px rgba(232,205,162,0.58), 0 18px 38px rgba(91,74,58,0.18);
}
.speech-progress-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.speech-progress-head .msg { min-width: 0; font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speech-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sky-deep); box-shadow: 0 0 0 5px rgba(94,195,232,0.18); animation: speech-pulse 1.5s ease-in-out infinite; }
.speech-elapsed { font-family: var(--font-num); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.speech-progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.speech-progress-step { position: relative; display: grid; justify-items: center; gap: 5px; color: var(--ink-faint); font-size: 11px; font-weight: 700; }
.speech-progress-step::before { content: ""; position: absolute; left: -52%; right: 52%; top: 5px; height: 2px; background: var(--line); }
.speech-progress-step:first-child::before { display: none; }
.speech-progress-step i { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; background: var(--line); box-shadow: 0 0 0 3px rgba(255,248,232,1); }
.speech-progress-step.done { color: var(--grass-deep); }
.speech-progress-step.done::before,
.speech-progress-step.done i { background: var(--grass); }
.speech-progress-step.active { color: var(--sky-deep); }
.speech-progress-step.active::before { background: linear-gradient(90deg, var(--grass), var(--sky)); }
.speech-progress-step.active i { background: var(--sky-deep); animation: speech-pulse 1.5s ease-in-out infinite; }
.speech-progress-step b { font: inherit; }
.speech-progress-note { text-align: center; font-size: 12px; line-height: 1.45; color: var(--ink-soft); }
.narrate-progress .btn-block { min-height: 42px; }
@keyframes speech-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.82); } }
.narrate-played { display: flex; flex-direction: column; gap: 10px; }
.player-secondary-controls { align-self: flex-start; display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 3px; border-radius: var(--r-pill); background: rgba(255,253,248,0.92); box-shadow: inset 0 0 0 1px rgba(232,205,162,0.58), 0 4px 12px rgba(91,74,58,0.08); }
.detail-foot .player-option-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 11px; border-radius: var(--r-pill); color: var(--ink-soft); background: transparent; box-shadow: none; white-space: nowrap; font-family: var(--font-body); font-size: 12px; font-weight: 800; }
.detail-foot .player-option-btn:active { background: rgba(232,97,127,0.10); }
.detail-foot .player-option-btn + .player-option-btn { border-left: 1px solid rgba(232,205,162,0.52); border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.detail-foot .player-mode-btn { color: var(--blossom-deep); }
.narrate-meta { display: flex; align-items: center; gap: 8px; }
.narrate-meta .spacer { flex: 1 1 auto; }
.narrate-played .voice-tag { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--blossom-deep); background: var(--blossom-tint); padding: 4px 10px; border-radius: var(--r-pill); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrate-fail { display: flex; flex-direction: column; gap: 8px; }
.narrate-fail .err-msg { font-size: 13px; color: var(--warn); font-weight: 600; line-height: 1.5; }
.detail-foot .player {
  min-height: 66px;
  padding: 9px 12px 9px 9px;
  border-radius: 28px;
  background: rgba(255,248,232,0.98);
  box-shadow:
    inset 0 0 0 1.5px rgba(232,205,162,0.58),
    0 18px 38px rgba(91,74,58,0.22),
    0 4px 10px rgba(91,74,58,0.10);
  gap: 11px;
}
.detail-foot .player-play {
  width: 48px;
  height: 48px;
  min-height: 48px;
  background: linear-gradient(135deg, var(--blossom), var(--blossom-deep));
}
.detail-foot .player-track { height: 8px; background: rgba(232,205,162,0.35); }
.detail-foot .player-time { font-size: 12px; color: var(--ink-soft); }
.detail-foot .btn-sm {
  min-height: 40px;
  padding: 0 14px;
  background: rgba(255,253,248,0.9);
}


/* ---------- 卡片菜单 ---------- */
.menu-pop {
  position: fixed; z-index: 45; min-width: 156px; background: var(--card);
  border-radius: var(--r-md); box-shadow: var(--shadow-float); padding: 6px;
  transform-origin: top right; animation: pop-in 160ms var(--ease) both;
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); background: transparent; box-shadow: none; color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; justify-content: flex-start; }
.menu-item .txt-icon, .menu-item img { width: 18px; height: 18px; color: var(--ink-soft); object-fit: contain; }
.menu-item.danger { color: var(--warn); }
.menu-item.danger .txt-icon { color: var(--warn); }
.menu-item:active { transform: scale(0.97); background: var(--cream-2); }
@media (hover: hover) { .menu-item:hover { background: var(--cream-2); transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--warn); }

/* ---------- 首页排版精修 ---------- */
.brand-title { font-size: var(--home-title); }
.brand-sub {
  font-size: var(--home-small);
  line-height: 1.35;
  font-weight: 700;
}
.view-toggle .seg { font-size: 16px; }
.story-list-title { font-size: var(--home-section-title); }
.story-list-sub {
  font-size: var(--home-small);
  line-height: 1.45;
  font-weight: 600;
}
.story-row { min-height: 72px; }
.story-meta { font-size: var(--home-small); }
.story-status { min-width: 68px; }
.story-status .mini-badge {
  padding: 4px 9px;
  font-size: var(--home-badge);
  font-weight: 700;
}
.voice-meta {
  margin-top: 3px;
  font-size: var(--home-small);
}
.voice-msg {
  font-size: var(--home-body);
  line-height: 1.55;
}
.badge { font-size: var(--home-badge); }
.player-time { font-size: var(--home-badge); }

/* 页脚 */
.foot { flex: 0 0 auto; margin-top: 8px; text-align: center; color: var(--ink-faint); font-size: var(--home-small); padding: 6px 10px 0; }
.foot-heart { color: var(--blossom); }

/* 动画 */
@keyframes pop-in { from { opacity: 0; transform: scale(0.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 大屏 */
@media (min-width: 560px) {
  .shelf { grid-template-columns: 1fr 1fr 1fr; }
}
@media (min-width: 720px) {
  .shelf { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  .view.active {
    align-items: stretch;
  }
  #bookShelf,
  #voiceShelf {
    flex: 0 1 auto;
    max-height: calc(var(--app-height) - 214px);
    background: rgba(255,253,248,0.60);
  }
  .shelf-scroll {
    flex: 0 1 auto;
    max-height: 100%;
  }
}

@media (max-height: 720px) {
  .shell {
    padding-top: max(24px, calc(env(safe-area-inset-top) + 16px));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .topbar { padding: 8px 0; }
  .brand-mark { width: 44px; height: 44px; border-radius: 16px; }
  .brand-mark img { width: 100%; height: 100%; }
  .brand-title { font-size: 22px; }
  .brand-sub { margin-top: 1px; font-size: 12px; }
  .top-action { width: 40px; height: 40px; min-height: 40px; }
  .top-refresh { font-size: 24px; }
  .top-logout { font-size: 12px; }
  .view-toggle { margin: 3px 0 2px; }
  .view-toggle .seg { min-height: 40px; }
  #bookShelf,
  #voiceShelf {
    padding: 8px;
    border-radius: 22px;
  }
  .story-list-head { padding: 0 6px 6px; }
  .story-add,
  .voice-add-row {
    min-height: 72px;
    margin-bottom: 6px;
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .story-add .story-icon,
  .voice-add-row .story-icon {
    width: 42px;
    height: 42px;
  }
  .foot { display: none; }
  .detail::after { height: 164px; }
  .detail-head {
    height: 0;
    min-height: 0;
    padding: 0;
  }
  .detail-back,
  .detail-head .card-menu {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
  .detail-back { left: 14px; top: max(14px, calc(env(safe-area-inset-top) + 6px)); }
  .detail-head .card-menu { right: 14px; top: max(14px, calc(env(safe-area-inset-top) + 6px)); }
  .detail-title-wrap {
    left: 62px;
    right: 62px;
    top: max(22px, calc(env(safe-area-inset-top) + 10px));
  }
  .detail-title { font-size: 22px; }
  .detail-body { padding: max(74px, calc(env(safe-area-inset-top) + 62px)) 12px 128px; }
  .detail-paper {
    border-radius: 24px 24px 16px 16px;
    padding: 54px 22px 126px;
  }
  .detail-bookmark { width: 70px; right: 10px; top: -52px; }
  .story-text { font-size: 16px; line-height: 2.05; }
  .story-chips { gap: 8px; margin: 8px 0 28px; padding: 0 36px; }
  .story-chips .chip-tag { padding: 6px 12px; font-size: 13px; }
  .detail-foot {
    left: 14px;
    right: 14px;
    bottom: max(26px, calc(env(safe-area-inset-bottom) + 18px));
  }
  .detail-foot .player { min-height: 58px; border-radius: 24px; gap: 9px; }
  .detail-foot .player-play { width: 44px; height: 44px; min-height: 44px; }
  .detail-foot .player-voice-btn,
  .detail-foot .player-mode-btn { min-height: 38px; padding: 0 10px; font-size: 11px; }
}

@media (max-width: 360px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .view-toggle .seg { font-size: 14px; }
  .story-title { font-size: 15.5px; }
  .story-status { min-width: 58px; }
  .story-status .mini-badge { padding: 4px 7px; }
  .story-status .mini-badge.ready span { max-width: 30px; }
}

/* ---------- 视频库 ---------- */
#videoShelf { flex: 1 1 auto; min-height: 0; width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 0; padding: 10px; border-radius: 24px; background: rgba(255,253,248,0.70); box-shadow: 0 16px 40px rgba(91,74,58,0.12), inset 0 0 0 1.5px rgba(240,228,210,0.86); overflow: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
#videoShelf::-webkit-scrollbar { display: none; }
#videoShelf > :not(.shelf-scroll) { flex-shrink: 0; }
.video-season-head { padding: 10px 8px 7px; color: var(--ink); font-family: var(--font-display); font-size: 16px; }
.video-season-tabs { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 4px 0 9px; background: rgba(255,253,248,0.96); }
.video-season-tabs button { min-height: 38px; padding: 0 10px; border-radius: var(--r-pill); background: var(--cream-2); color: var(--ink-soft); box-shadow: inset 0 0 0 1px rgba(232,205,162,0.54); font-size: 13px; font-weight: 800; }
.video-season-tabs button.active { background: var(--blossom); color: #fff; box-shadow: 0 3px 9px rgba(232,97,127,0.22); }
.video-resume { width: 100%; min-height: 62px; display: grid; grid-template-columns: minmax(0,1fr) 34px; align-items: center; gap: 8px; margin-bottom: 9px; padding: 10px 12px; border-radius: 16px; background: linear-gradient(135deg, var(--sun-tint), rgba(255,253,248,0.98)); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(232,205,162,0.64); text-align: left; }
.video-resume span { grid-column: 1; color: var(--sun-deep); font-size: 11px; font-weight: 800; }
.video-resume b { grid-column: 1; font-family: var(--font-display); font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-resume i { grid-column: 2; grid-row: 1 / span 2; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--sun); color: #fff; font-style: normal; font-size: 11px; }
.video-card { width: 100%; min-height: 86px; display: grid; grid-template-columns: 116px minmax(0, 1fr) 42px; align-items: center; gap: 11px; padding: 9px; margin-bottom: 8px; border: 1.5px solid rgba(232,205,162,0.62); border-radius: 17px; background: linear-gradient(135deg, rgba(235,247,255,0.96), rgba(255,253,248,0.96)); box-shadow: 0 5px 13px rgba(91,74,58,0.07); text-align: left; }
.video-card:active { transform: scale(0.985); }
.video-card.last-watched { border-color: rgba(240,179,73,0.78); background: linear-gradient(135deg, var(--sun-tint), rgba(255,253,248,0.98)); }
.video-pagination { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px 2px 16px; }
.video-pagination span { color: var(--ink-soft); font-family: var(--font-num); font-size: 12px; font-weight: 800; }
.video-page-btn { min-height: 40px; border-radius: var(--r-pill); background: var(--cream-2); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(232,205,162,0.64); font-size: 13px; font-weight: 800; }
.video-page-btn:disabled { opacity: 0.4; }
.video-pagination .video-page-btn:last-child { justify-self: stretch; }
.video-pagination-top { padding: 0 2px 9px; }
.video-thumb { position: relative; width: 116px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--sky-tint); }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-copy { min-width: 0; }
.video-title { color: var(--ink); font-family: var(--font-display); font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-meta { display: block; margin-top: 5px; color: var(--ink-soft); font-family: var(--font-num); font-size: 11px; font-weight: 700; }
.video-play { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--grass); color: #fff; font-size: 13px; box-shadow: 0 4px 10px rgba(85,154,110,0.24); }
.video-dialog { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 18px; background: rgba(70,50,35,0.48); backdrop-filter: blur(4px); }
.video-dialog[hidden] { display: none; }
.video-dialog-card { width: min(620px, 100%); max-height: calc(100dvh - 24px); overflow-x: hidden; overflow-y: auto; border-radius: 24px; background: var(--card); box-shadow: 0 22px 60px rgba(70,50,35,0.28); }
.video-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 18px; }
.video-dialog-kicker { color: var(--blossom-deep); font-family: var(--font-num); font-size: 11px; font-weight: 800; }
.video-dialog-title { margin-top: 2px; color: var(--ink); font-family: var(--font-display); font-size: 19px; line-height: 1.2; }
.video-dialog-close { width: 42px; height: 42px; flex: 0 0 auto; padding: 0; border-radius: 50%; background: var(--cream-2); color: var(--ink-soft); font-size: 25px; box-shadow: none; }
.video-frame-wrap { width: 100%; aspect-ratio: 16 / 9; background: #171717; }
.video-frame-wrap video { width: 100%; height: 100%; display: block; border: 0; background: #171717; }

@media (max-width: 390px) {
  .view-toggle .seg { padding: 0 8px; font-size: 14px; }
  .video-card { grid-template-columns: 102px minmax(0, 1fr) 38px; gap: 9px; }
  .video-thumb { width: 102px; }
  .video-play { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
