/* StoryNest - bookish & warm */
:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --ink: #1e2622;
  --muted: #5e6a64;
  --line: #e2dbcc;
  --line-strong: #cfc6b3;
  --accent: #1f5a48;
  --accent-hover: #184a3b;
  --accent-soft: #e2ece6;
  --accent-ink: #ffffff;
  --navy: #22344d;
  --ok: #2c6a4e;
  --ok-soft: #e1eee6;
  --warn: #855600;
  --warn-soft: #f5e9d0;
  --danger: #a3302b;
  --danger-soft: #f6e2df;
  --paper: #fffdf8;
  --paper-ink: #1e2622;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(30, 38, 34, .06), 0 4px 16px rgba(30, 38, 34, .05);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141917;
    --surface: #1c2320;
    --ink: #ebe6da;
    --muted: #a0a99f;
    --line: #2d3632;
    --line-strong: #3d4842;
    --accent: #86c3a9;
    --accent-hover: #9fd2bc;
    --accent-soft: #23342d;
    --accent-ink: #0f1f19;
    --ok: #8fd0b0;
    --ok-soft: #1f3329;
    --warn: #e7c178;
    --warn-soft: #362c18;
    --danger: #f0958e;
    --danger-soft: #3a2220;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 400 16px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 2rem; margin: 0; line-height: 1.15; }
h2 { font-size: 1.3rem; margin: 0 0 .3rem; }
h3 { font-size: 1.1rem; margin: 0 0 .6rem; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
svg.i { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }
.loading { display: grid; place-items: center; min-height: 100vh; font-family: var(--serif); font-size: 1.4rem; color: var(--muted); }

/* ---------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 .95rem var(--sans); padding: .55rem 1rem; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 42px;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: .3rem .75rem; font-size: .88rem; min-height: 36px; }
.btn.big { width: 100%; padding: .75rem; font-size: 1rem; }
.btn:disabled { opacity: .45; pointer-events: none; }

label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 1rem; }
.lbl { font-weight: 600; font-size: .92rem; margin: 1rem 0 .45rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: .3rem;
  font: 400 1rem var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .6rem .75rem; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; display: block; margin-top: .3rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 1.25rem; }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 4px; padding: .75rem 1rem; margin: 0 0 1.4rem; }
.note.warn { background: var(--warn-soft); border-color: var(--warn); }
.note.ok { background: var(--ok-soft); border-color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; border: 1px dashed var(--line-strong); border-radius: 10px; }

/* ---------- top bar & nav */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1.5rem; padding-top: max(.7rem, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; text-decoration: none; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: .5rem; }
.logo svg { width: 26px; height: 26px; }
.nav { display: flex; gap: .2rem; flex: 1; }
.nav a {
  position: relative; display: flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border-radius: var(--radius); text-decoration: none; color: var(--muted);
  font-weight: 500; font-size: .95rem;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.badge { background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 0 .4rem; min-width: 1.2rem; text-align: center; line-height: 1.2rem; }
.me { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 600; font-size: .9rem; flex: none; }
.me-name { font-weight: 500; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.search { max-width: 280px; margin: 0; }

@media (max-width: 760px) {
  .topbar { padding-left: 1rem; padding-right: 1rem; }
  .logo { flex: 1; }
  .me-name { display: none; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 0;
  }
  .nav a { flex-direction: column; gap: .15rem; font-size: .72rem; padding: .35rem .9rem; }
  .nav a.on { background: transparent; }
  .nav svg.i { width: 22px; height: 22px; }
  .nav .badge { position: absolute; top: 0; right: .4rem; }
  .main { padding: 1.2rem 1rem calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.65rem; }
  .search { max-width: none; width: 100%; }
}

/* ---------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-box { width: 100%; max-width: 440px; }
.hero { text-align: center; margin-bottom: 1.6rem; }
.hero .logo { justify-content: center; font-size: 2rem; }
.hero .logo svg { width: 38px; height: 38px; }
.hero p { color: var(--muted); margin: .4rem 0 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.switch-auth { text-align: center; margin: 1.1rem 0 0; font-size: .92rem; }
.choice-grid { display: grid; gap: .7rem; }
.choice-card {
  display: block; text-align: left; width: 100%; padding: 1rem 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; font: inherit;
}
.choice-card:hover, .choice-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.choice-card b { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; display: block; }
.choice-card span.d { color: var(--muted); font-size: .9rem; }
.step-head { display: flex; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.step-head h2 { margin: 0; }

/* ---------- covers & shelves */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.6rem 1.3rem; align-items: start; }
.grid > * { min-width: 0; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 1.3rem 1rem; } }
.shelf { margin-bottom: 2.6rem; }
.shelf > p { margin: 0 0 1.2rem; }
.book-card { text-decoration: none; color: var(--ink); display: block; }
.book-card:hover .cover { transform: translateY(-3px); box-shadow: inset 6px 0 0 rgba(0, 0, 0, .14), 0 10px 22px rgba(0, 0, 0, .16); }
.bc-meta { padding: .6rem .1rem 0; }
.bc-title { font-family: var(--serif); font-weight: 600; line-height: 1.25; font-size: 1.02rem; }
.bc-author { color: var(--muted); font-size: .85rem; }
.bc-stats { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.cover {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: 2px 6px 6px 2px; background: var(--c);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(0, 0, 0, .12));
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .14), inset 7px 0 0 rgba(255, 255, 255, .08), 0 4px 12px rgba(0, 0, 0, .14);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-emoji { font-size: 2.8rem; margin-bottom: .4rem; }
.cover-title {
  color: #fff; font-family: var(--serif); font-weight: 600; text-align: center;
  padding: 0 .8rem 0 1rem; line-height: 1.2; font-size: .98rem; max-width: 100%; overflow-wrap: break-word; hyphens: auto;
}
.cover:not(:has(img))::after { content: ""; position: absolute; left: 18%; right: 14%; bottom: 12%; height: 1px; background: rgba(255, 255, 255, .5); }
.cover:has(img) .cover-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem .7rem .7rem 1rem; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
.cover.lg .cover-emoji { font-size: 3.6rem; }
.cover.lg .cover-title { font-size: 1.2rem; }
.cover.xl { width: min(240px, 66vw); margin: 0 auto 1.4rem; }
.cover.xl .cover-emoji { font-size: 4rem; }
.cover.xl .cover-title { font-size: 1.35rem; }
.status { display: inline-block; font-size: .76rem; font-weight: 600; border-radius: 4px; padding: .1rem .45rem; margin-top: .35rem; }
.status.draft { background: var(--line); color: var(--muted); }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.approved { background: var(--ok-soft); color: var(--ok); }
.status.changes { background: var(--danger-soft); color: var(--danger); }
.fb { font-size: .84rem; background: var(--danger-soft); border-radius: 4px; padding: .4rem .6rem; margin-top: .4rem; }
.new-book {
  aspect-ratio: 2 / 3; width: 100%; border: 1px dashed var(--line-strong); border-radius: 2px 6px 6px 2px;
  display: grid; place-items: center; text-align: center; color: var(--accent); background: transparent;
  font: 500 .95rem var(--sans); cursor: pointer;
}
.new-book:hover { border-color: var(--accent); background: var(--accent-soft); }
.new-book svg { width: 28px; height: 28px; display: block; margin: 0 auto .4rem; }

/* ---------- editor */
.ed-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.save-state { color: var(--muted); font-size: .85rem; }
.editor { display: grid; grid-template-columns: 310px 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }
.cover-preview { width: 150px; margin: 0 auto 1.2rem; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: .3rem; }
.emo { font-size: 1.35rem; padding: .15rem; border-radius: 6px; border: 1px solid transparent; background: var(--bg); cursor: pointer; aspect-ratio: 1; }
.emo.on { border-color: var(--accent); background: var(--accent-soft); }
.emo.none { font: 500 .7rem var(--sans); color: var(--muted); }
.color-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.page-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.pt { min-width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); font: 500 .92rem var(--sans); cursor: pointer; color: var(--ink); }
.pt.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pt.add { color: var(--accent); border-style: dashed; display: grid; place-items: center; }
.pe-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.ptitle { flex: 1; min-width: 160px; margin: 0; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.pe-pic { margin-bottom: .9rem; }
.pe-pic img { max-height: 300px; border-radius: 4px; margin-bottom: .6rem; background: #fff; border: 1px solid var(--line); }
.pbody { min-height: 320px; font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; background: var(--paper); color: var(--paper-ink); padding: 1rem 1.1rem; }
.ed-danger { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- reader */
.reader { max-width: 760px; margin: 0 auto; }
.r-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.rp {
  background: var(--paper); color: var(--paper-ink); border: 1px solid var(--line);
  border-radius: 3px 8px 8px 3px; box-shadow: inset 8px 0 12px -10px rgba(0, 0, 0, .25), var(--shadow);
  padding: 2.4rem 2.4rem 3rem 2.8rem; min-height: 60vh; position: relative;
  touch-action: pan-y;
}
@media (max-width: 560px) { .rp { padding: 1.6rem 1.3rem 2.8rem 1.6rem; } }
.rp h1, .rp h2 { color: var(--paper-ink); }
.rp h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.rp-cover, .rp-end { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rp .by { color: #6a736e; font-style: italic; font-family: var(--serif); margin: .4rem 0; font-size: 1.1rem; }
.rp .blurb { max-width: 30rem; font-family: var(--serif); font-size: 1.05rem; color: #3f4843; }
.rp-img { border-radius: 4px; margin: 0 auto 1.4rem; max-height: 46vh; object-fit: contain; }
.rp-text { font-family: var(--serif); font-size: 1.22rem; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.pno { position: absolute; bottom: .9rem; left: 0; right: 0; text-align: center; color: #9a9f99; font-family: var(--serif); font-size: .9rem; }
.end { font-family: var(--serif); font-style: italic; font-size: 2.4rem; color: var(--paper-ink); margin-bottom: 1rem; }
.r-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1rem 0; }
.r-nav .btn { min-width: 104px; }
.dots { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; margin-top: .3rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.dot.on { background: var(--accent); }
.heart-btn.on { color: var(--danger); border-color: var(--danger); }
.speak-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.panel { margin-top: 1.2rem; }
.panel textarea { min-height: 90px; }

/* ---------- lists */
.list { display: grid; gap: .6rem; }
.list-item { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; flex-wrap: wrap; }
.list-item .mini-cover { width: 46px; flex: none; }
.list-item .mini-cover .cover-emoji { font-size: 1.2rem; margin: 0; }
.list-item .mini-cover .cover-title, .list-item .mini-cover .cover::after { display: none; }
.li-main { flex: 1; min-width: 160px; }
.li-main b { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.02rem; }
.code-box { font: 600 1.6rem/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .45rem .9rem; display: inline-block; }
.switch { display: flex; gap: .8rem; align-items: flex-start; cursor: pointer; margin: 0; }
.switch input { width: 22px; height: 22px; margin: .1rem 0 0; flex: none; accent-color: var(--accent); }
.kid-stats { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
details.add-kid summary { cursor: pointer; list-style: none; }
details.add-kid summary::-webkit-details-marker { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.section-gap { margin-top: 2.2rem; }

/* ---------- modal & drawing pad */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(15, 20, 18, .5); display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: 10px; padding: 1.4rem; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; }
.choice { display: flex; gap: .6rem; align-items: center; font-weight: 400; margin: 0 0 .55rem; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.drawpad { background: var(--surface); border-radius: 10px; padding: .9rem; width: min(980px, 100%); max-height: 96vh; display: flex; flex-direction: column; gap: .7rem; }
.dp-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.dp-tools .sw { width: 30px; height: 30px; }
.dp-tools .tool.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dp-canvas-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; }
.drawpad canvas { background: #fff; border-radius: 4px; border: 1px solid var(--line-strong); touch-action: none; max-width: 100%; max-height: 66vh; aspect-ratio: 4 / 3; width: 100%; height: auto; cursor: crosshair; }
.sep { width: 1px; height: 26px; background: var(--line-strong); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); z-index: 200;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: .65rem 1.1rem; border-radius: var(--radius); font-size: .92rem; font-weight: 500;
  transition: .2s ease; max-width: calc(100vw - 2rem); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- header links */
.me-link { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); padding: .2rem .5rem .2rem .2rem; border-radius: 999px; }
.me-link:hover, .me-link.on { background: var(--accent-soft); }
.btn.on { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) { .hide-sm { display: none; } }
.auth-links { text-align: center; font-size: .88rem; margin-top: 1rem; color: var(--muted); }
.footer { max-width: 1080px; margin: 0 auto; padding: 1.5rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .88rem; }

/* ---------- welcome */
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--accent); margin: 0 0 .5rem; }
.lead { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; color: var(--muted); max-width: 36rem; }
.landing-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2.5rem; align-items: center; padding: 1.5rem 0 1rem; }
.landing-hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }
.lh-books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: end; }
.lh-books .cover:nth-child(2) { transform: translateY(-1.5rem); }
.lh-books .cover-title { font-size: .85rem; padding: 0 .5rem 0 .8rem; }
.lh-books .cover-emoji { font-size: 2rem; }
@media (max-width: 760px) {
  .landing-hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .lh-books { max-width: 340px; margin-top: 1.5rem; }
  .lh-books .cover-title { font-size: .72rem; }
}
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.step { border-top: 2px solid var(--accent); padding-top: .9rem; }
.step h3 { margin: .4rem 0 .3rem; }
.step p { margin: 0; }
.step-n { font-family: var(--serif); font-size: 1.6rem; color: var(--accent); font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1rem; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.safety-band { display: flex; gap: 1rem; align-items: flex-start; }
.safety-band svg.i { width: 30px; height: 30px; color: var(--accent); }

/* ---------- help */
.help { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; align-items: start; }
.help-toc { position: sticky; top: 5rem; display: flex; flex-direction: column; gap: .15rem; }
.help-toc a { text-decoration: none; color: var(--muted); padding: .35rem .6rem; border-radius: 6px; font-size: .92rem; }
.help-toc a:hover { color: var(--ink); background: var(--accent-soft); }
.help-body section { margin-bottom: 2.4rem; scroll-margin-top: 5rem; }
.help-body li { margin-bottom: .45rem; }
.help-body details { border-bottom: 1px solid var(--line); padding: .8rem 0; }
.help-body summary { cursor: pointer; font-weight: 600; }
.help-body details p { margin: .6rem 0 0; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: .93rem; }
.tbl th, .tbl td { text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--bg); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
@media (max-width: 760px) {
  .help { grid-template-columns: 1fr; gap: 1rem; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .help-toc a { border: 1px solid var(--line); }
}

/* ---------- book details */
.details { display: grid; grid-template-columns: 240px 1fr; gap: 2.2rem; align-items: start; }
.details h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.details .by { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.15rem; margin: .35rem 0 1rem; }
.meta { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; margin: 1.2rem 0 1.4rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta div { padding: .7rem 1.6rem .7rem 0; margin-right: 1.4rem; }
.meta div:not(:last-child) { border-right: 1px solid var(--line); }
.meta dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta dd { margin: .1rem 0 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
@media (max-width: 640px) {
  .details { grid-template-columns: 1fr; gap: 1.2rem; }
  .details-cover { width: 170px; margin: 0 auto; }
  .meta { grid-template-columns: repeat(4, 1fr); }
  .meta div { padding: .6rem .5rem; margin: 0; }
  .meta div:first-child { padding-left: 0; }
  .meta dd { font-size: 1.05rem; }
}

/* ---------- profile */
.profile-head { display: flex; gap: 1.1rem; align-items: center; padding-bottom: 1.2rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.avatar.xl { width: 68px; height: 68px; font-size: 1.7rem; font-family: var(--serif); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .7rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.tile-v { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1; }
.tile-l { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
input:disabled { color: var(--muted); background: var(--bg); }

/* ---------- email review page */
.review-page { min-height: 0; margin-bottom: 1rem; }

/* ---------- AI helper */
.ai-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--navy); background: #e6ebf3; border-radius: 4px; padding: .15rem .45rem; }
.ai-label svg.i { width: 13px; height: 13px; }
@media (prefers-color-scheme: dark) { .ai-label { color: #c9d6ea; background: #26324a; } }
.ai-card { border: 1px dashed var(--line-strong); background: var(--bg); border-radius: 10px; padding: .9rem 1rem; margin: .8rem 0; }
.ai-level { display: inline-block; font-size: .8rem; font-weight: 600; border-radius: 4px; padding: .1rem .5rem; }
.ai-level.none { background: var(--ok-soft); color: var(--ok); }
.ai-level.minor { background: var(--warn-soft); color: var(--warn); }
.ai-level.attention { background: var(--danger-soft); color: var(--danger); }
.ai-concerns, .ai-list { margin: .6rem 0 0; padding-left: 1.1rem; }
.ai-concerns li, .ai-list li { margin-bottom: .6rem; }
.ai-list li .btn { margin-top: .3rem; }
.ai-list li.done { opacity: .6; }
.ai-quote { font-family: var(--serif); font-style: italic; margin: .2rem 0; }
.strike { text-decoration: line-through; color: var(--muted); }
.idea { border-top: 1px solid var(--line); padding: .8rem 0 .2rem; margin-top: .8rem; }
.questions { margin: 1rem auto; max-width: 30rem; text-align: left; }
.questions ol { font-family: var(--serif); font-size: 1.05rem; padding-left: 1.3rem; }
.questions li { margin-bottom: .5rem; }
