@font-face { font-family: "Andika"; src: url("../fonts/andika-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../fonts/andika-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #fbf6ee;
  --bg-2: #f3eadb;
  --card: #ffffff;
  --paper: #fffdf8;
  --ink: #2d2a32;
  --ink-2: #5d5866;
  --muted: #8d8795;
  --line: #e8dfd0;
  --accent: #e8664f;
  --accent-ink: #ffffff;
  --accent-soft: #fde4dd;
  --teal: #2f8f8a;
  --teal-soft: #d9f0ee;
  --gold: #f2b441;
  --danger: #c6423a;
  --ok: #3f9a5a;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .08);
  --radius: 18px;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --read: "Andika", "Comic Neue", system-ui, sans-serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--teal); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: .9rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem max(1rem, env(safe-area-inset-left)) .6rem max(1rem, env(safe-area-inset-right));
  padding-top: max(.6rem, env(safe-area-inset-top));
  background: rgba(251, 246, 238, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-size: 1.35rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.topnav { display: none; gap: .25rem; margin-left: 1rem; }
.topnav a, .tabbar a {
  text-decoration: none; color: var(--ink-2); font-weight: 600;
}
.topnav a { padding: .45rem .8rem; border-radius: 999px; }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.topbar .spacer { flex: 1; }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem 1rem calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; white-space: nowrap; }
.tabbar a .ico { font-size: 1.35rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }
.kid .tabbar, .kid .topnav { display: none !important; }
.kid .main { padding-bottom: 2rem; }
@media (min-width: 820px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 2.5rem; }
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.1rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); color: var(--ink); font-weight: 600;
  text-decoration: none; transition: transform .08s ease, background .15s ease, opacity .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(232, 102, 79, .35); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: #fbe3e1; color: var(--danger); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: .7rem 1.6rem; }
.btn.icon { width: 44px; padding: 0; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: .3rem .8rem; font-size: .9rem; }

label.field { display: block; }
label.field > span { display: block; font-weight: 600; margin-bottom: .3rem; }
label.field > small { display: block; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: .6rem .8rem;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  outline: none; transition: border-color .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.notice { padding: .8rem 1rem; border-radius: 14px; background: var(--teal-soft); color: #1d5e5a; }
.notice.warn { background: #fff1d6; color: #7a5410; }
.notice.error { background: #fbe3e1; color: #8c2a24; }
.notice.ok { background: #e1f3e6; color: #245f36; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.badge.ok { background: #e1f3e6; color: var(--ok); }
.badge.warn { background: #fff1d6; color: #8a5d0c; }
.badge.err { background: #fbe3e1; color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .25rem .8rem .25rem .25rem; min-height: 40px;
  background: var(--teal-soft); color: #1d5e5a; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600;
}
.chip img, .chip .ph { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #fff; }
.chip .x { opacity: .6; font-weight: 400; }
.chip.add { background: var(--bg-2); color: var(--ink-2); padding-left: .8rem; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 12px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); border-radius: 999px; transition: width .6s ease; }

/* ---------------------------------------------------------------- modal / toast */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(40, 30, 20, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 1.2rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); animation: up .2s ease; }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 14px; max-width: min(92vw, 520px); box-shadow: var(--shadow); animation: up .2s ease; }
.toast.error { background: var(--danger); }

.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: .7rem; justify-content: center; margin: 1rem 0; }
.pinpad button { height: 72px; border-radius: 50%; border: 0; background: var(--bg-2); font-size: 1.6rem; font-family: var(--display); cursor: pointer; }
.pindots { display: flex; gap: .7rem; justify-content: center; }
.pindots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-2); }
.pindots span.on { background: var(--ink-2); }

/* ---------------------------------------------------------------- auth screens */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.2rem; background: radial-gradient(circle at 20% 10%, #ffe9d2, transparent 50%), radial-gradient(circle at 90% 90%, #d9f0ee, transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto .8rem; box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- library */
.lib-tools { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.lib-tools input[type=search] { flex: 1 1 220px; }
.lib-tools select { flex: 0 1 200px; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
@media (min-width: 640px) { .books { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.3rem; } }
.book-tile { text-decoration: none; color: inherit; display: block; }
.book-tile .cover {
  aspect-ratio: 1 / 1; border-radius: 6px 14px 14px 6px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--accent-soft), var(--teal-soft));
  box-shadow: inset 6px 0 8px -4px rgba(0,0,0,.25), 0 8px 18px rgba(60,40,20,.18);
  transition: transform .15s ease;
}
.book-tile:hover .cover { transform: translateY(-3px) rotate(-.5deg); }
.book-tile .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-tile .cover .state { position: absolute; inset: 0; display: flex; flex-direction: column; gap: .4rem; align-items: center; justify-content: center; color: var(--ink-2); font-weight: 600; text-align: center; padding: .6rem; }
.book-tile .title { font-family: var(--display); font-weight: 600; margin-top: .55rem; line-height: 1.2; }
.book-tile .sub { font-size: .8rem; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-2); }
.empty .big-emoji { font-size: 3.5rem; }

/* ---------------------------------------------------------------- characters */
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.char-tile { text-decoration: none; color: inherit; text-align: center; }
.char-tile .pic { aspect-ratio: 3/4; border-radius: 16px; background: var(--bg-2); overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.char-tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.char-tile .name { font-family: var(--display); font-weight: 600; margin-top: .4rem; }
.portrait-big { width: 100%; max-width: 340px; aspect-ratio: 3/4; object-fit: cover; border-radius: 18px; box-shadow: var(--shadow); background: var(--bg-2); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.thumbs .t { position: relative; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; }
.thumbs .t button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; font-size: .8rem; }
.thumbs .t button.crop { position: static; display: block; width: 76px; height: 28px; margin-top: .3rem; border-radius: 999px; background: var(--bg-2); color: var(--ink); font-weight: 600; }
.versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.versions .v { position: relative; text-align: center; font-size: .8rem; }
.versions img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; cursor: pointer; border: 3px solid transparent; display: block; }
.versions .v.on img { border-color: var(--accent, #e8753a); }
.versions .v.on span { font-weight: 700; }
.versions button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; font-size: .8rem; }
.two-col { display: grid; gap: 1.2rem; }
@media (min-width: 820px) { .two-col { grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; } }

/* ---------------------------------------------------------------- create */
.create { max-width: 720px; margin: 0 auto; }
.idea-box { position: relative; }
.idea-box textarea { font-size: 1.1rem; min-height: 130px; padding-right: 60px; }
.mic { position: absolute; right: 8px; bottom: 10px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--teal-soft); cursor: pointer; font-size: 1.3rem; }
.mic.on { background: var(--accent); color: #fff; animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(232,102,79,.18); } }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.style-opt { border: 2px solid var(--line); border-radius: 14px; padding: .6rem .7rem; background: var(--card); cursor: pointer; text-align: left; font-weight: 600; min-height: 52px; }
.style-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.estimate { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.estimate .amount { font-family: var(--display); font-size: 1.5rem; }

/* ---------------------------------------------------------------- reader */
.reader {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at center, #5a4a3f 0%, #3a2f29 100%);
  color: var(--ink);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.reader-bar { display: flex; align-items: center; gap: .4rem; padding: .5rem .7rem; color: #fff; }
.reader-bar .btn { background: rgba(255,255,255,.14); color: #fff; }
.reader-bar .btn.on { background: var(--accent); }
.reader-bar .title { flex: 1; font-family: var(--display); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.reader-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: .4rem .6rem 1rem; min-height: 0; }
.book { position: relative; perspective: 2200px; }
.book .face { position: absolute; top: 0; bottom: 0; background: var(--paper); overflow: hidden; }
.page-image { width: 100%; height: 100%; object-fit: cover; background: #efe6d6; }
.page-text {
  font-family: var(--read); color: var(--ink);
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.55; letter-spacing: .01em;
}
.page-text p { margin: 0; }
.page-text .w { border-radius: 6px; transition: background .12s; padding: 0 .04em; }
.page-text .w.hl { background: #ffe08a; box-shadow: 0 0 0 2px #ffe08a; }
.page-num { position: absolute; bottom: .7rem; left: 0; right: 0; text-align: center; font-family: var(--display); color: var(--muted); font-size: .85rem; }
.placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; color: var(--ink-2); font-family: var(--display); text-align: center; padding: 1rem;
  background: linear-gradient(110deg, #f4ecdf 8%, #fbf6ee 18%, #f4ecdf 33%); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; }
.placeholder .e { font-size: 2.6rem; animation: bob 2s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }

/* Single page (portrait phones): image above text */
.book.single { width: min(100%, 560px); height: 100%; max-height: 100%; }
.book.single .face { left: 0; right: 0; border-radius: 6px 16px 16px 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.book.single .img-wrap { flex: 0 0 auto; width: 100%; aspect-ratio: 1/1; max-height: 58%; overflow: hidden; }
.book.single .page-text { flex: 1; padding: 1rem 1.3rem 2.2rem; font-size: clamp(1.15rem, 5.2vw, 1.6rem); min-height: 0; overflow: auto; justify-content: flex-start; }
.book.single .page-text.center { justify-content: center; }

/* Two-page spread (landscape tablet/desktop) */
.book.spread { height: min(100%, 76vw * .5 + 40px); aspect-ratio: 2 / 1; max-width: 100%; }
.book.spread .face.left { left: 0; width: 50%; border-radius: 10px 0 0 10px; box-shadow: inset -24px 0 30px -20px rgba(0,0,0,.35); }
.book.spread .face.right { left: 50%; width: 50%; border-radius: 0 10px 10px 0; box-shadow: inset 24px 0 30px -20px rgba(0,0,0,.25); }
.book.spread::before { content: ""; position: absolute; inset: -8px -10px; border-radius: 14px; background: #7a4f33; box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.book.spread .page-text { height: 100%; padding: 8% 10%; font-size: clamp(1.1rem, 2.1vw, 2rem); overflow-y: auto; }
.page-text p + p { margin-top: .8em; }
.book.single .page-text.len-m { font-size: clamp(1.02rem, 4.4vw, 1.35rem); }
.book.single .page-text.len-l { font-size: clamp(.98rem, 4vw, 1.2rem); line-height: 1.5; }
.book.spread .page-text.len-m { font-size: clamp(1rem, 1.55vw, 1.55rem); padding: 7% 8%; }
.book.spread .page-text.len-l { font-size: clamp(.92rem, 1.2vw, 1.25rem); padding: 6% 7%; justify-content: flex-start; line-height: 1.5; }

/* The turning leaf */
.leaf { position: absolute; top: 0; bottom: 0; transform-style: preserve-3d; z-index: 5; will-change: transform; }
.leaf .side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--paper); }
.leaf .side.back { transform: rotateY(180deg); }
.leaf .shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.leaf.fwd .shade { background: linear-gradient(to left, rgba(0,0,0,.28), rgba(0,0,0,0) 60%); animation: shadeIn var(--flip-ms) ease-in-out forwards; }
.leaf.back-turn .shade { background: linear-gradient(to right, rgba(0,0,0,.28), rgba(0,0,0,0) 60%); animation: shadeIn var(--flip-ms) ease-in-out forwards; }
@keyframes shadeIn { 50% { opacity: 1; } 100% { opacity: 0; } }
.book.spread .leaf.fwd { left: 50%; width: 50%; transform-origin: left center; animation: flipFwd var(--flip-ms) ease-in-out forwards; }
.book.spread .leaf.back-turn { left: 0; width: 50%; transform-origin: right center; animation: flipBack var(--flip-ms) ease-in-out forwards; }
.book.single .leaf.fwd { left: 0; right: 0; transform-origin: left center; animation: flipFwd var(--flip-ms) ease-in-out forwards; border-radius: 6px 16px 16px 6px; }
.book.single .leaf.back-turn { left: 0; right: 0; transform-origin: left center; animation: flipIn var(--flip-ms) ease-in-out forwards; border-radius: 6px 16px 16px 6px; }
@keyframes flipFwd { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes flipBack { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@keyframes flipIn { from { transform: rotateY(-180deg); } to { transform: rotateY(0); } }
@media (prefers-reduced-motion: reduce) { .leaf { animation-duration: 1ms !important; } }

.nav-zone { position: absolute; top: 0; bottom: 0; width: 18%; z-index: 8; display: flex; align-items: center; background: none; border: 0; cursor: pointer; color: #fff; font-size: 2.2rem; opacity: .0; transition: opacity .2s; }
.nav-zone.prev { left: 0; justify-content: flex-start; padding-left: .3rem; }
.nav-zone.next { right: 0; justify-content: flex-end; padding-right: .3rem; }
@media (hover: hover) { .nav-zone:hover { opacity: .85; } }
.nav-zone span { background: rgba(0,0,0,.35); width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.reader-foot { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .3rem .7rem .7rem; color: #fff; flex-wrap: wrap; }
.reader-foot .btn { background: rgba(255,255,255,.14); color: #fff; }
.reader-foot .btn.play { background: var(--gold); color: var(--ink); width: 64px; height: 64px; font-size: 1.6rem; }
.reader-foot .dots { font-family: var(--display); opacity: .8; min-width: 70px; text-align: center; }

.cover-title { font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 4vw, 2.8rem); line-height: 1.1; color: var(--ink); text-align: center; }
.title-page { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 8%; text-align: center; background: radial-gradient(circle at 50% 35%, #fff6e3, var(--paper) 70%); }
.title-page .starring { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.title-page .starring img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: var(--shadow); }

/* Progress screen */
.progress-screen { max-width: 520px; margin: 1.5rem auto; text-align: center; }
.progress-screen .magic { font-size: 4rem; animation: bob 2.2s ease-in-out infinite; }
.steps { text-align: left; margin: 1.2rem 0; }
.steps .step { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; }
.steps .step .s { width: 28px; text-align: center; }

/* Settings */
.settings-section { margin-bottom: 1.2rem; }
.settings-grid { display: grid; gap: .9rem; }
@media (min-width: 700px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.price-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.price-table td, .price-table th { padding: .35rem .3rem; border-bottom: 1px solid var(--line); text-align: left; }
.price-table input { min-height: 36px; padding: .3rem .5rem; width: 90px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.logbox { background: #221f26; color: #e9e3ef; font: 12px/1.45 ui-monospace, Consolas, monospace; padding: .8rem; border-radius: 12px; max-height: 360px; overflow: auto; white-space: pre-wrap; }

/* Narrator recording */
.rec-script { font-family: var(--read); font-size: 1.15rem; line-height: 1.6; background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 1rem; }
.meter { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--teal); transition: width .08s; }
.voice-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.voice-row .n { flex: 1; font-weight: 600; }

/* Story characters (collapsible section on the Characters page) */
.story-chars summary { cursor: pointer; font-size: 1.05rem; padding: .2rem 0; }
.story-chars[open] summary { margin-bottom: .6rem; }
.char-tile.retired { opacity: .55; }

/* Settings tabs + Models list */
.settings-tabs { padding: .2rem 0; }
.model-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.model-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- series */
.series-shelf { display: flex; gap: .7rem; overflow-x: auto; padding: .2rem .1rem .6rem; margin-bottom: .6rem; scroll-snap-type: x proximity; }
.series-card { flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; padding: .45rem .9rem .45rem .45rem; border-radius: 14px;
  background: var(--card); border: 1.5px solid var(--line); text-decoration: none; color: inherit; scroll-snap-align: start; max-width: 260px; }
.series-card .pic { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--bg-2); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.series-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.series-card .name { font-family: var(--display); font-weight: 600; line-height: 1.15; }
.series-card.add { border-style: dashed; color: var(--ink-2); }
.series-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .8rem; }
.log-entry { border-top: 1px solid var(--line); padding-top: .6rem; }
.log-entry:first-of-type { border-top: 0; padding-top: 0; }
.chip.static { cursor: default; }
.chip .x { background: none; border: 0; cursor: pointer; font-size: .9rem; padding: 0 .2rem; color: inherit; }
.world-notes { white-space: pre-wrap; margin: 0; line-height: 1.5; }
.series-pick { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-text.recap { font-style: italic; }
.recap-pic { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: .4rem;
  background: var(--bg-2); color: var(--ink-2); font-family: var(--display); font-size: 1.4rem; }
ol.plan { margin: 0; padding-left: 1.3rem; display: grid; gap: .3rem; }
ol.plan a { text-decoration: none; }
