/* Kan Sipur: a warm family listening app. Navy ink and teal from the hoopoe logo, on clean white.
   (Token names --gold / --gold-soft are kept from v1; they hold the teal accent.) */
:root {
  --bg: #f4f8f9;
  --bg-deep: #dcecef;
  --surface: #ffffff;
  --surface-2: #eaf3f5;
  --ink: #0e3445;
  --ink-soft: #2e5464;
  --muted: #526b77;
  --gold: #0b7584;          /* teal accent, AA on white and on --bg */
  --gold-bright: #0e8798;   /* logo teal, for fills and art */
  --gold-soft: #d5edf1;
  --sand: #f3e9d6;
  --star: #e0a526;
  --on-accent: #ffffff;
  --terracotta: #c2573a;
  --line: rgba(14, 52, 69, 0.12);
  --line-strong: rgba(14, 52, 69, 0.26);
  --focus: #1f6fd1;
  --ok: #2b7c55;
  --warn: #9a5d0c;
  --bad: #b03a2e;
  --shadow-sm: 0 1px 2px rgba(14, 52, 69, .06), 0 2px 8px rgba(14, 52, 69, .05);
  --shadow: 0 1px 2px rgba(14, 52, 69, .06), 0 8px 24px rgba(14, 52, 69, .08);
  --shadow-lg: 0 2px 6px rgba(14, 52, 69, .08), 0 18px 44px rgba(14, 52, 69, .14);
  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --serif: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hebrew: "Frank Ruhl Libre", "David", "Times New Roman", serif;
  --brand-hebrew: "Rubik", "Arial Hebrew", sans-serif;
  /* story cover palettes */
  --cv0a: #0e3445; --cv0b: #0e8798;
  --cv1a: #0b6a78; --cv1b: #4fb3bf;
  --cv2a: #1b3a52; --cv2b: #4d7d97;
  --cv3a: #8a6a2f; --cv3b: #d8b36a;
  --cv4a: #1d5a5c; --cv4b: #4f9e8a;
  --cv5a: #7c3f2c; --cv5b: #c97a58;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1820; --bg-deep: #0c2530; --surface: #10242e; --surface-2: #17303c;
    --ink: #e6f1f4; --ink-soft: #c2d5db; --muted: #93abb5; --gold: #4cc6d6; --gold-bright: #3fc1d2; --gold-soft: #123e49; --on-accent: #032029;
    --sand: #2a2618; --star: #f1c04f;
    --terracotta: #ec8d6c; --line: rgba(230, 241, 244, .11); --line-strong: rgba(230, 241, 244, .24);
    --focus: #8cb8ff; --ok: #7fd1a3; --warn: #e6b062; --bad: #f08d7c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3); --shadow-lg: 0 18px 44px rgba(0,0,0,.45);
    --cv0a: #0b2a38; --cv0b: #0d6f7d; --cv1a: #0a4f5a; --cv1b: #2d8d99; --cv2a: #13283a; --cv2b: #34607a;
    --cv3a: #5c4720; --cv3b: #9c7f43; --cv4a: #143f41; --cv4b: #2f7466; --cv5a: #57291c; --cv5b: #94543b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1820; --bg-deep: #0c2530; --surface: #10242e; --surface-2: #17303c;
  --ink: #e6f1f4; --ink-soft: #c2d5db; --muted: #93abb5; --gold: #4cc6d6; --gold-bright: #3fc1d2; --gold-soft: #123e49; --on-accent: #032029;
  --sand: #2a2618; --star: #f1c04f;
  --terracotta: #ec8d6c; --line: rgba(230, 241, 244, .11); --line-strong: rgba(230, 241, 244, .24);
  --focus: #8cb8ff; --ok: #7fd1a3; --warn: #e6b062; --bad: #f08d7c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3); --shadow-lg: 0 18px 44px rgba(0,0,0,.45);
  --cv0a: #0b2a38; --cv0b: #0d6f7d; --cv1a: #0a4f5a; --cv1b: #2d8d99; --cv2a: #13283a; --cv2b: #34607a;
  --cv3a: #5c4720; --cv3b: #9c7f43; --cv4a: #143f41; --cv4b: #2f7466; --cv5a: #57291c; --cv5b: #94543b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans);
  background-image: radial-gradient(1100px 520px at 10% -12%, var(--bg-deep), transparent 60%);
  background-repeat: no-repeat;
  min-height: 100vh; padding-bottom: 40px; overflow-x: hidden;
}
body.has-mini { padding-bottom: 110px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; text-wrap: balance; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.012em; }
h1 { font-size: clamp(1.85rem, 4.4vw, 2.9rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.65rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
a:hover { color: var(--gold); }
[hidden] { display: none !important; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.he { font-family: var(--hebrew); direction: rtl; unicode-bidi: isolate; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rule { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.error { color: var(--bad); font-weight: 600; min-height: 1.2em; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2)); background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand:hover { color: inherit; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-en { font-family: var(--serif); font-weight: 700; font-size: 1.22rem; }
.brand-he { font-family: var(--brand-hebrew); font-weight: 600; color: var(--gold); font-size: .95rem; }
.brand img { border-radius: 11px; box-shadow: var(--shadow-sm); }
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; transition: background .15s, color .15s; }
.mainnav a svg { width: 18px; height: 18px; }
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
body:not(.editor) .editor-only { display: none; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 40px; outline: none; }
.view-enter { animation: viewIn .32s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 800; color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: .25em; }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 11px 20px; font: 700 1rem var(--sans);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
  transition: background .15s, filter .15s, transform .15s var(--ease), border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { filter: brightness(1.15); color: var(--bg); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--on-accent); }
.btn.gold:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn.icon-only { padding: 10px; width: 46px; height: 46px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 700 .9rem var(--sans); cursor: pointer; transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .chip-n { font-weight: 600; opacity: .6; font-size: .8em; }
.chip-more { border-style: dashed; }
.small-chip { padding: 5px 11px; font-size: .84rem; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); font-size: .78rem; font-weight: 700; border: 1px solid transparent; }
.tag-btn { font-family: var(--sans); cursor: pointer; padding: 4px 12px; font-size: .82rem; }
.tag-btn:hover { border-color: var(--line-strong); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; letter-spacing: .03em; }
.badge.mashal { background: var(--gold-soft); color: var(--ink); border: 1px dashed var(--gold); }
.badge.published { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.needs_review { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.rejected { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.badge.verified { background: var(--surface-2); color: var(--ink-soft); }

/* Age selector: four large, friendly buttons */
.ages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 6px; background: var(--surface-2); border-radius: 20px; border: 1px solid var(--line); }
.age-btn {
  border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 15px; padding: 10px 6px;
  font: 800 1rem var(--sans); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: background .18s, box-shadow .18s, color .18s;
}
.age-btn:hover:not([disabled]) { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.age-btn small { font-weight: 600; color: var(--muted); font-size: .72rem; }
.age-btn[aria-pressed="true"] { background: var(--surface); border-color: var(--gold); box-shadow: 0 2px 10px rgba(14, 52, 69, .12), inset 0 0 0 1px var(--gold); color: var(--ink); }
.age-btn[aria-pressed="true"] .age-name { color: var(--gold); }
.age-btn[aria-pressed="true"] small { color: var(--ink-soft); }
.age-btn[disabled] { opacity: .4; cursor: not-allowed; }
.age-row { margin: 4px 0 14px; }

/* ---------- Login ---------- */
.login { max-width: 480px; margin: 2vh auto; padding: 22px 26px 20px; text-align: center; box-shadow: var(--shadow-lg); }
/* Owner: the welcome card should fit on one screen, so the logo scales with the window height. */
.login .logo-xl { width: auto; max-width: min(180px, 55%); max-height: 22vh; height: auto; margin: 0 auto 2px; display: block; border-radius: 18px; background: #fff; padding: 4px; }
.login p, .login .small, .login .tagline { text-wrap: balance; }
.login h1 { margin-bottom: 0; }
.login .tagline { color: var(--muted); margin: .4em 0 1em; font-size: 1.05rem; }
.login-points { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 0 0 22px; font-size: .86rem; font-weight: 700; color: var(--ink-soft); }
.login-points li { display: inline-flex; gap: 6px; align-items: center; }
.login-points svg { width: 17px; height: 17px; color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 14px; }
.field label { font-weight: 800; font-size: .92rem; }
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  font: 1rem var(--sans); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: 12px; padding: 11px 14px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); flex-shrink: 0; }
.kid-row { display: grid; grid-template-columns: 1fr 92px 40px; gap: 8px; margin-bottom: 8px; align-items: center; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: stretch; }
.hero-intro { padding: 8px 0; display: flex; flex-direction: column; }
.hero h1 { margin-top: 6px; }
.h1-line { display: block; color: var(--gold); }
.lede { font-size: 1.05rem; max-width: 46ch; }
.who { margin: 6px 0 16px; }
.who .label { display: block; font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.kids { display: flex; gap: 8px; flex-wrap: wrap; }
.kid-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); font: 800 1rem var(--sans); color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.kid-chip:hover { border-color: var(--gold); }
.kid-initial { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-soft); font-size: .9rem; }
.kid-chip[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.kid-chip[aria-pressed="true"] .kid-initial { background: var(--gold); color: var(--on-accent); }
.kid-chip small { color: var(--muted); font-weight: 700; margin-left: 2px; }

.featured { padding: 26px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; border: none; color: #fff;
  background: linear-gradient(140deg, var(--ca, var(--cv0a)), var(--cb, var(--cv0b))); box-shadow: var(--shadow-lg); }
.featured > * { position: relative; z-index: 1; }
.featured .eyebrow { color: rgba(255,255,255,.85); }
.featured h2 { font-size: clamp(1.5rem, 3vw, 2rem); color: #fff; margin: 0; }
.feat-syn { color: rgba(255,255,255,.88); margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.featured .tag { background: rgba(255,255,255,.16); color: #fff; }
.featured .badge.mashal { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.6); }
.feat-art { position: absolute !important; inset: auto -10px -26px auto; z-index: 0 !important; pointer-events: none; text-align: right; }
.feat-art .cover-he { font-family: var(--hebrew); font-size: 7.5rem; line-height: 1; color: rgba(255,255,255,.11); font-weight: 500; white-space: nowrap; }
.feat-art .cover-icon { display: none; }
.feat-play { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.feat-listen { font-weight: 800; font-size: 1.05rem; }
.feat-meta { color: rgba(255,255,255,.85); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.featured .bigplay { background: #fff; color: var(--cv0a); }
.featured .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.featured .btn.ghost:hover { background: rgba(255,255,255,.12); }
.featured .btn.gold { background: #fff; color: #0e3445; border-color: #fff; }
.featured .rating-mini { color: #fff; }
.featured .empty, .featured .empty h3 { color: #fff; }

.bigplay {
  width: 80px; height: 80px; border-radius: 50%; border: none; background: var(--ink); color: var(--bg); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 10px 24px rgba(14, 52, 69, .28); transition: transform .18s var(--ease), box-shadow .18s;
  flex-shrink: 0; position: relative;
}
.bigplay:hover { transform: scale(1.05); }
.bigplay:active { transform: scale(.96); }
.bigplay svg { width: 32px; height: 32px; }
.bigplay.playing::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--gold); opacity: .6; animation: ring 2.2s ease-out infinite; }
@keyframes ring { from { transform: scale(.95); opacity: .7; } to { transform: scale(1.18); opacity: 0; } }

.section-head { display: flex; align-items: flex-end; gap: 12px; margin: 40px 0 14px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 2px 0 0; }
.shelf-sec { min-width: 0; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 280px); gap: 16px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding: 4px 4px 14px; margin: 0 -4px; scrollbar-width: thin; }
.shelf > * { scroll-snap-align: start; }
.theme-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-chip { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
  font: 800 .95rem var(--sans); color: var(--ink); cursor: pointer; transition: transform .15s var(--ease), border-color .15s; }
.theme-chip:hover { transform: translateY(-2px); border-color: var(--gold); }
.theme-chip small { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 0 8px; font-weight: 700; }

/* ---------- Story cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card-wrap { position: relative; display: flex; min-width: 0; }
.story-card { flex: 1; min-width: 0; text-decoration: none; display: flex; flex-direction: column; overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.story-card:hover { color: inherit; }
.card-wrap:hover .story-card { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.cover { height: 104px; position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--ca), var(--cb)); }
.cv-0 { --ca: var(--cv0a); --cb: var(--cv0b); } .cv-1 { --ca: var(--cv1a); --cb: var(--cv1b); } .cv-2 { --ca: var(--cv2a); --cb: var(--cv2b); }
.cv-3 { --ca: var(--cv3a); --cb: var(--cv3b); } .cv-4 { --ca: var(--cv4a); --cb: var(--cv4b); } .cv-5 { --ca: var(--cv5a); --cb: var(--cv5b); }
.cover::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 0%, rgba(255,255,255,.22), transparent 55%); }
.cover-icon { position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; opacity: .9; }
.cover-icon svg { width: 100%; height: 100%; }
.cover-he { position: absolute; left: 16px; bottom: 10px; font-family: var(--hebrew); font-size: 1.5rem; font-weight: 500; letter-spacing: .02em; text-shadow: 0 1px 8px rgba(0,0,0,.18); }
.eq { position: absolute; right: 70px; bottom: 16px; display: none; gap: 3px; align-items: flex-end; height: 18px; }
.eq i { width: 4px; background: #fff; border-radius: 2px; height: 40%; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.35s; } .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.is-playing .eq { display: flex; }
.is-current .story-card { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent), var(--shadow); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.story-card h3 { margin: 0; font-size: 1.1rem; }
.story-card .meta { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .8rem; font-weight: 700; }
.synopsis { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.narrated { color: var(--gold); }
.heard { display: inline-flex; color: var(--ok); }
.heard svg { width: 15px; height: 15px; }
.rating-mini { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-soft); }
.rating-mini svg { width: 14px; height: 14px; fill: var(--star); stroke: none; }
.card-play { position: absolute; top: 80px; right: 14px; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--surface); background: var(--ink); color: var(--bg);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px rgba(14, 52, 69, .3); transition: transform .18s var(--ease), background .15s; z-index: 2; }
.card-play svg { width: 20px; height: 20px; }
.card-play:hover { transform: scale(1.08); background: var(--gold); color: var(--on-accent); }
.is-current .card-play { background: var(--gold); color: var(--on-accent); }
.card-save { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.18); color: #fff;
  display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px); transition: background .15s, transform .15s var(--ease); z-index: 2; }
.card-save svg { width: 18px; height: 18px; }
.card-save:hover { background: rgba(255,255,255,.32); }
.card-save[aria-pressed="true"] { background: #fff; color: var(--cv0a); }
.card-progress { height: 4px; background: var(--surface-2); }
.card-progress span { display: block; height: 100%; background: var(--gold); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- Library ---------- */
.filters { padding: 16px; display: grid; gap: 12px; margin-bottom: 8px; }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.search { position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; pointer-events: none; }
.search-icon svg { width: 18px; height: 18px; }
.search input { padding-left: 42px; border-radius: 999px; }
.selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.select { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.select > span { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.select select { padding: 9px 12px; }
.tagbar { display: flex; flex-wrap: wrap; gap: 8px; }
.results-head { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 6px 0 8px; }
.results-head p { margin: 0; }

/* ---------- Story page ---------- */
.story-head { display: grid; gap: 14px; margin-bottom: 16px; }
.crumbs { font-size: .9rem; }
.crumbs a { font-weight: 700; }
.story-title-row { display: flex; gap: 18px; align-items: center; }
.story-title-row h1 { margin-bottom: .3em; }
.story-badge { width: 92px; height: 92px; border-radius: 22px; flex-shrink: 0; position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--ca), var(--cb)); box-shadow: var(--shadow); }
.story-badge .cover-icon { left: 14px; top: 12px; width: 26px; height: 26px; }
.story-badge .cover-he { left: 12px; bottom: 8px; font-size: 1.15rem; }
.story-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rating-block { display: flex; gap: 6px 18px; flex-wrap: wrap; align-items: center; }
.stars { display: inline-block; font-size: 1.1rem; line-height: 1; letter-spacing: 2px; vertical-align: -1px;
  background: linear-gradient(90deg, var(--star) var(--v), var(--line-strong) var(--v)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars::before { content: "★★★★★"; }
.rate { display: inline-flex; align-items: center; gap: 2px; }
.rate .small { margin-right: 6px; }
.star-btn { width: 34px; height: 34px; border: none; background: transparent; cursor: pointer; padding: 4px; border-radius: 8px; display: grid; place-items: center; transition: transform .15s var(--ease); }
.star-btn svg { width: 24px; height: 24px; fill: transparent; stroke: var(--muted); stroke-width: 1.6; transition: fill .15s, stroke .15s; }
.star-btn[aria-pressed="true"] svg { fill: var(--star); stroke: var(--star); }
.rate:hover .star-btn svg { fill: var(--star); stroke: var(--star); }
.rate .star-btn:hover ~ .star-btn svg { fill: transparent; stroke: var(--muted); }
.star-btn:hover { transform: scale(1.12); }

.player { padding: 18px 20px; display: grid; gap: 8px; margin-top: 16px; }
.player-top { display: flex; gap: 18px; align-items: center; }
.player-info { display: grid; gap: 4px; min-width: 0; }
.player-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.resume-hint { color: var(--gold); font-weight: 700; }
.player-times { display: flex; justify-content: space-between; margin-top: -4px; }
.player-controls { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.transport, .comforts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.player-controls > .btn:last-child { margin-left: auto; }
.progress { width: 100%; accent-color: var(--gold); height: 22px; cursor: pointer; margin: 4px 0 0; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .84rem; font-weight: 600; }
.pill-select { position: relative; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 4px 0 10px; background: var(--surface); color: var(--ink-soft); }
.pill-select svg { width: 16px; height: 16px; flex-shrink: 0; }
.pill-select select { border: none; background: transparent; padding: 8px 6px; width: auto; font-weight: 700; font-size: .88rem; border-radius: 999px; box-shadow: none; }
.pill-select:focus-within { border-color: var(--gold); }
.sleep-left { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.voice-label { font-size: .8rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.voice-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.voice-label.browser .dot { background: var(--warn); }
.upnext { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.upnext-text { display: grid; min-width: 0; }
.upnext-text a { font-weight: 800; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 700; }

.story-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; margin-top: 22px; }
.story-main { display: grid; gap: 18px; align-content: start; min-width: 0; }
.story-text { padding: 30px clamp(18px, 4vw, 44px); font-size: 1.14rem; line-height: 1.8; max-width: 72ch; }
.story-text p:first-of-type::first-letter { font-family: var(--serif); font-size: 2.7em; float: left; line-height: .9; padding: 6px 8px 0 0; color: var(--gold); font-weight: 700; }
.aside { display: grid; gap: 14px; align-content: start; }
.aside .card { padding: 16px 18px; box-shadow: var(--shadow-sm); }
.aside h3 { font-size: 1rem; }
.lesson { margin: .7em 0 0; padding: 10px 12px; background: var(--gold-soft); border-radius: 12px; }
.terms { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.terms dt { font-weight: 800; }
.terms dd { margin: 0; color: var(--ink-soft); }
.note { border-left: 4px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.note.info { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }

.teacher { padding: 0; box-shadow: var(--shadow-sm); }
.teacher summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 14px 18px; }
.teacher summary::-webkit-details-marker { display: none; }
.teacher summary > span:first-child { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--gold); flex-shrink: 0; }
.teacher summary svg { width: 20px; height: 20px; }
.teacher summary::after { content: "+"; margin-left: auto; font: 700 1.4rem var(--sans); color: var(--muted); }
.teacher[open] summary::after { content: "–"; }
.teacher-body { padding: 0 18px 18px 66px; }
.teacher-body h3 { font-size: .98rem; margin-top: 12px; }
.teacher-body ol { padding-left: 20px; margin: 0; }

/* ---------- My list ---------- */
.list-card { padding: 16px 18px; margin-bottom: 14px; }
.list-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-head h2, .list-head h3 { margin: 0; }
.list-rows { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; counter-reset: row; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background .15s; }
.list-row:hover { background: var(--surface-2); }
.row-play { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.row-play svg { width: 17px; height: 17px; }
.row-play:hover { background: var(--gold); color: var(--on-accent); }
.row-main { display: grid; min-width: 0; flex: 1; text-decoration: none; }
.row-main strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.row-tools { display: flex; gap: 4px; }
.new-list-card { padding: 14px 18px; margin-bottom: 14px; display: grid; gap: 8px; }
.new-list-card .row { flex-wrap: nowrap; }
.empty-note { margin: 10px 0 0; }
.inline-icon { width: 16px; height: 16px; vertical-align: -3px; }
.pick-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.pick { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.new-list { flex-wrap: nowrap; }
.rename { flex-wrap: nowrap; gap: 8px; }
.rename input { padding: 7px 12px; }

/* ---------- Sheets (dialogs) ---------- */
dialog.sheet {
  border: none; border-radius: 22px; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
dialog.sheet[open] { animation: sheetIn .25s var(--ease); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.sheet.small { width: min(480px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(6, 20, 28, .5); backdrop-filter: blur(3px); }
.sheet-head { position: sticky; top: 0; background: var(--surface); padding: 18px 22px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: start; z-index: 1; }
.sheet-body { padding: 18px 22px 24px; }
.seg { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.seg .he { font-size: 1.25rem; line-height: 1.9; text-align: right; }
.seg .ref { font-size: .78rem; font-weight: 800; color: var(--gold); text-decoration: none; }
.added { margin: 0; padding-left: 20px; }

/* ---------- Mini player ---------- */
.miniplayer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 30; width: min(680px, calc(100vw - 24px));
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; grid-template-rows: auto 4px; column-gap: 12px; row-gap: 8px; align-items: center;
  padding: 10px 12px 10px 10px; border-radius: 20px; background: #0e3445; color: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.32);
  animation: miniIn .3s var(--ease);
}
:root[data-theme="dark"] .miniplayer { background: #1b3b49; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .miniplayer { background: #1b3b49; } }
@keyframes miniIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.mini-toggle { width: 46px; height: 46px; border-radius: 50%; border: none; background: #3fc1d2; color: #032029; cursor: pointer; display: grid; place-items: center; grid-row: span 2; transition: transform .15s var(--ease); }
.mini-toggle:active { transform: scale(.94); }
.mini-toggle svg { width: 20px; height: 20px; }
.mini-title { display: grid; min-width: 0; text-decoration: none; line-height: 1.25; }
.mini-title:hover { color: #fff; }
.mini-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: .78rem; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miniplayer .icon-btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.22); }
.miniplayer .icon-btn:hover { background: rgba(255,255,255,.1); }
.miniplayer .icon-btn svg { width: 18px; height: 18px; }
.mini-progress { grid-column: 2 / -1; height: 4px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.mini-progress span { display: block; height: 100%; width: 0; background: #3fc1d2; transition: width .25s linear; }

/* ---------- Review & lab ---------- */
.review-item { padding: 16px 18px; margin-bottom: 12px; }
.review-item summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.review-item summary::-webkit-details-marker { display: none; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 800; }
.kv dd { margin: 0; }
.decision { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.decision .chip[data-d="keep"][aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.decision .chip[data-d="reject"][aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.decision .chip[data-d="fix"][aria-pressed="true"] { background: var(--warn); border-color: var(--warn); color: #fff; }
.issue { font-size: .88rem; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); margin: 4px 0; }
table.lab { width: 100%; border-collapse: collapse; }
table.lab th, table.lab td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.lab th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.lab input { padding: 7px 10px; min-width: 120px; }
.term { font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: opacity .2s, transform .2s var(--ease); z-index: 60;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; display: flex; gap: 12px; align-items: center; }
.footer img { border-radius: 8px; opacity: .9; flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero, .story-body, .review-grid { grid-template-columns: 1fr; }

  .story-text { max-width: none; }
}
@media (max-width: 600px) {
  body { font-size: 16px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.has-mini { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
  main { padding-top: 20px; }
  /* No backdrop-filter here: it would make the fixed tab bar below position against the top bar. */
  .topbar { gap: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  /* Main navigation becomes a bottom tab bar on phones. */
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; justify-content: space-around; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .mainnav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .72rem; flex: 1; justify-content: center; border-radius: 12px; min-width: 0; }
  .mainnav a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .mainnav a svg { width: 22px; height: 22px; }
  .mainnav a[aria-current="page"] { background: transparent; color: var(--gold); }
  .mainnav a[aria-current="page"] svg { background: var(--gold-soft); border-radius: 999px; padding: 3px 14px; width: 52px; height: 28px; }
  .topbar-actions { margin-left: auto; }
  body[data-view="login"] { padding-bottom: 24px; }
  .miniplayer { bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); border-radius: 16px; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .ages { gap: 4px; padding: 4px; border-radius: 16px; }
  .age-btn { padding: 9px 2px; font-size: .9rem; border-radius: 12px; }
  .age-btn small { display: none; }
  .player { position: static; padding: 16px; }
  .bigplay { width: 68px; height: 68px; }
  .bigplay svg { width: 28px; height: 28px; }
  .player-controls > .btn:last-child { margin-left: 0; }
  .toolbar { grid-template-columns: 1fr auto; }
  .toolbar .btn { padding: 11px 14px; }
  .selects { grid-template-columns: 1fr 1fr; }
  .selects .select:last-child { grid-column: 1 / -1; }
  .kv { grid-template-columns: 1fr; }
  .featured { padding: 22px 18px; }
  .story-title-row { align-items: flex-start; gap: 14px; }
  .story-badge { width: 64px; height: 64px; border-radius: 16px; }
  .story-badge .cover-icon { left: 10px; top: 8px; width: 20px; height: 20px; }
  .story-badge .cover-he { font-size: .9rem; left: 9px; bottom: 6px; }
  .story-text { padding: 22px 18px; font-size: 1.08rem; }
  .shelf { grid-auto-columns: minmax(240px, 78vw); }
  .teacher-body { padding-left: 18px; }
  .list-row { gap: 8px; padding: 8px 4px; }
  .row-tools { gap: 2px; }
  .row-tools .icon-btn.sm { width: 30px; height: 30px; border-color: transparent; }
  .section-head { margin-top: 32px; }
  table.lab thead { display: none; }
  table.lab tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.lab td { border: none; padding: 2px 0; }
}
@media (max-width: 330px) {
  .brand-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .is-playing .eq i { height: 70%; }
}

/* Age badges: each age group has its own pastel colour and a board-game meeple (matches the Teachers' Resource). */
:root { --ag24: #dff3e4; --ag24-ink: #1d5c34; --ag58: #dcecfb; --ag58-ink: #1b4d7c; --ag912: #ebe3fa; --ag912-ink: #4a3283; --ag12p: #fde6d6; --ag12p-ink: #8a3d15; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ag24: #183a26; --ag24-ink: #a6e3b9; --ag58: #16304a; --ag58-ink: #a9cff5; --ag912: #2c2348; --ag912-ink: #cdbdf5; --ag12p: #43281a; --ag12p-ink: #f7c3a0; } }
:root[data-theme="dark"] { --ag24: #183a26; --ag24-ink: #a6e3b9; --ag58: #16304a; --ag58-ink: #a9cff5; --ag912: #2c2348; --ag912-ink: #cdbdf5; --ag12p: #43281a; --ag12p-ink: #f7c3a0; }
.meeple { width: 1em; height: 1em; fill: currentColor; stroke: none; flex: none; vertical-align: -.12em; }
.age-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; font: 800 .8rem var(--sans); white-space: nowrap; }
.age-badge.a24, .age-btn.a24 .age-name { --bg: var(--ag24); --fg: var(--ag24-ink); }
.age-badge.a58, .age-btn.a58 .age-name { --bg: var(--ag58); --fg: var(--ag58-ink); }
.age-badge.a912, .age-btn.a912 .age-name { --bg: var(--ag912); --fg: var(--ag912-ink); }
.age-badge.a12p, .age-btn.a12p .age-name { --bg: var(--ag12p); --fg: var(--ag12p-ink); }
.age-badge { background: var(--bg); color: var(--fg); }
.age-btn .age-name { display: inline-flex; align-items: center; gap: 5px; }
.age-btn .age-name .meeple { color: var(--fg); }
.age-btn[aria-pressed="true"].a24 { background: var(--ag24); border-color: var(--ag24-ink); box-shadow: inset 0 0 0 1px var(--ag24-ink); }
.age-btn[aria-pressed="true"].a58 { background: var(--ag58); border-color: var(--ag58-ink); box-shadow: inset 0 0 0 1px var(--ag58-ink); }
.age-btn[aria-pressed="true"].a912 { background: var(--ag912); border-color: var(--ag912-ink); box-shadow: inset 0 0 0 1px var(--ag912-ink); }
.age-btn[aria-pressed="true"].a12p { background: var(--ag12p); border-color: var(--ag12p-ink); box-shadow: inset 0 0 0 1px var(--ag12p-ink); }
.age-btn[aria-pressed="true"] .age-name { color: var(--fg); }
@media (max-width: 520px) { .age-btn .age-name { flex-direction: column; gap: 2px; white-space: nowrap; font-size: .86rem; } }

/* ---------- Footer: text and links side by side, stacking cleanly on narrow screens */
.footer { flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; align-items: center; }
.foot-main { display: flex; gap: 12px; align-items: center; flex: 1 1 380px; max-width: 680px; }
.foot-main p { margin: 0; text-wrap: pretty; }
.foot-main strong { color: var(--ink-soft); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-links a { font-weight: 700; text-decoration: none; color: var(--ink-soft); white-space: nowrap; }
.foot-links a:hover { color: var(--gold); text-decoration: underline; }

/* ---------- Button groups and checkbox rows */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0 10px; }
.check-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; cursor: pointer; }
.check-row input[type="checkbox"] { margin: 3px 0 0; }
.check-row > span { display: grid; gap: 2px; }
.sheet-body ul { margin: 6px 0 0; padding-left: 20px; }
.sheet-body > p:first-child { margin-bottom: 4px; }

/* ---------- Teachers' Resource link in the main nav (web app) */
.nav-short { display: none; }
@media (max-width: 1000px) { .nav-long { display: none; } .nav-short { display: inline; } }

/* ---------- Wrapping: headings and short lines balance, running text avoids orphans */
p, li, dd, .synopsis, .feat-syn, .lede { text-wrap: pretty; }
.eyebrow, .tagline, .section-head p, .page-head p, .empty h2, .empty h3, .empty p, .card-body h3, .feat-listen, .upnext-text a, .login-points span { text-wrap: balance; }
.page-head p { max-width: 62ch; }
/* Key terms: the term column never squeezes the meaning; on phones the term sits above its meaning. */
.terms { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
.terms dt { max-width: 22ch; text-wrap: balance; }
@media (max-width: 600px) { .terms { grid-template-columns: 1fr; gap: 2px; } .terms dd { margin-bottom: 8px; } .terms dt { max-width: none; } }
