/* Claude Certs study site — Cert Dojo theme (dark default + light),
   shared design tokens with site/dojo. Same selectors as the original
   warm-light stylesheet, colors remapped to variables. */
:root {
  --sticky-h: 64px; --mini-h: 48px;
  --bg: #0d1117; --panel: #161b27; --panel2: #1d2333; --line: #2a3247;
  --text: #e6e9f2; --muted: #8b93a7; --accent: #d97757; --accent2: #7aa2f7;
  --good: #4ade80; --bad: #f87171; --gold: #fbbf24; --learn: #34d399;
  --prose: #cdd5e6; --soft: #223052; --head-grad: linear-gradient(180deg, #131926, #0d1117);
  --hl-para: #223052; --hl-border: #fbbf24; --hl-sent: #fff3b0;
  color-scheme: dark;
}
body.light {
  --bg: #f4f5f9; --panel: #ffffff; --panel2: #eceef5; --line: #d7dbe7;
  --text: #1d2433; --muted: #5c6579; --accent: #c2542c; --accent2: #3b6fd4;
  --good: #15803d; --bad: #dc2626; --gold: #b45309; --learn: #0e9488;
  --prose: #333c52; --soft: #fdeeda; --head-grad: linear-gradient(180deg, #ffffff, #f4f5f9);
  --hl-para: #fef9c3; --hl-border: #eab308; --hl-sent: #fff3b0;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
}
.ste-note { border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 8px; padding: .45rem .8rem; margin: .3rem 0 .8rem;
  font-size: .8rem; color: var(--muted); background: var(--panel); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px 3rem; }
body.reader .wrap { padding-bottom: 0; }
body.reader.mini-active .wrap { padding-bottom: calc(var(--mini-h) + 8px); }
@media (max-width: 700px) {
  /* mini-player floats 64px above the viewport bottom (over the modenav bar) */
  body.reader.mini-active .wrap { padding-bottom: calc(var(--mini-h) + 24px); }
}
/* keep scrolled-to lines clear of the sticky header (reader) */
html { scroll-padding-top: calc(var(--sticky-h) + 12px); }

/* reader controls stay in one measured sticky row */
.stickyhead { position: sticky; top: 0; z-index: 10; margin: 0 -1rem;
  height: 64px; padding: 0 1rem; background: var(--head-grad);
  border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }

header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .5rem 0; }
h1 { font-size: 1.4rem; margin: .5rem 0; }
h1 .dojo { color: var(--accent); }
a { color: var(--accent); }
.nav-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 0 12px; height: 36px; display: inline-flex; align-items: center;
  border-radius: 8px; cursor: pointer; font-size: 13.5px;
  text-decoration: none; white-space: nowrap; }
.nav-btn:hover { border-color: var(--muted); }
.nav-btn:hover { border-color: var(--muted); }
.theme-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .4rem .8rem; cursor: pointer; font-size: .9rem; }
.theme-btn:hover { border-color: var(--muted); }
.tagline { color: var(--muted); margin-top: 1.4rem; }
.muted { color: var(--muted); }
.hidden { display: none; }

button, select {
  font-size: 1rem; padding: .45rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button:hover { filter: brightness(1.1); }
body.light button:hover { filter: brightness(.97); }
button:disabled { opacity: .35; cursor: default; }
.danger { color: var(--bad); border-color: var(--bad); background: var(--panel); }

/* ---- catalog ---- */
.pack-tools { display: flex; justify-content: flex-end; gap: .45rem;
  color: var(--muted); font-size: .85rem; margin: 0 0 -.8rem; }
.pack-tools a { color: var(--muted); text-decoration: none; }
.pack-tools a:hover { color: var(--accent); }
.pack { margin-top: 1.6rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: .4rem 1rem 1rem; }
.pack-hd { width: 100%; background: transparent;
  border: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  display: flex; gap: 10px; align-items: center; padding: .5rem 0; }
.pack-hd:hover { filter: none; }
.pack-hd:focus-visible, .parts-toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.pack-hd .chev { color: var(--muted); transform: rotate(0deg);
  transition: transform .12s; }
.pack-hd[aria-expanded="true"] .chev { transform: rotate(90deg); }
.pack h2 { font-size: 1.15rem; color: var(--accent); margin: 0; }
.pack .blurb { color: var(--muted); font-size: .9rem; margin: 0 0 .4rem; }
.pack-prog { display: flex; gap: 10px; align-items: center; margin: 0 0 0 auto; }
.pack-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--panel2);
  overflow: hidden; width: 160px; max-width: 160px; }
.pack-bar i { display: block; height: 100%; background: var(--accent); }
.pack-meta { color: var(--muted); font-size: .8rem;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.pack-rows[hidden] { display: none; }
.row { display: flex; gap: .7rem; align-items: baseline; padding: .35rem .5rem;
  border-radius: 6px; text-decoration: none; color: var(--text); }
.row:hover { background: var(--panel2); }
.row.next { background: var(--panel2); }
.next-tag { color: var(--accent); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; }
.row .num { min-width: 1.8em; text-align: right; color: var(--muted);
  font-variant-numeric: tabular-nums; font-size: .9rem; }
.row .ctitle { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .dur { color: var(--muted); font-size: .85rem; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.row.mod .ctitle { font-weight: 600; }
.row.sub { padding-left: 2.6rem; }
.parts-toggle { border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--muted); padding: .12rem .35rem;
  font-size: .75rem; line-height: 1.4; white-space: nowrap; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; align-self: center;
  border: 1.5px solid var(--accent); flex: none; }
.dot.done { background: var(--accent); }
.mode-hint { color: var(--learn); font-size: .85rem; margin-bottom: 1rem; }
#content { max-width: 760px; margin: 0 auto; }

/* ---- D-Day runtime folds ---- */
.dday .unsure-fold summary {
  font-size: .8rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--good); cursor: pointer;
  list-style: none;
}
.dday .unsure-fold summary::-webkit-details-marker { display: none; }
.dday .unsure-fold summary::before { content: "▸"; margin-right: .4rem; }
.dday .unsure-fold[open] summary::before { content: "▾"; }
.dday .unsure-fold summary .n {
  color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums;
  margin-left: .5rem;
}
.dday .unsure-fold > h3.unsure { display: none; }
/* intro paragraph spans the column (the page-local 64ch measure wrapped mid-line on desktop) */
body .dday .intro { max-width: none; }
/* fold as a full-width row: single column, dashed divider, count on the right */
.dday .cols.has-fold { grid-template-columns: 1fr; gap: 0; }
.dday .cols.has-fold > .fold-emptied { display: none; }
.dday .cols.has-fold > .unsure-fold { grid-column: 1 / -1; margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--line); }
.dday .unsure-fold summary { display: flex; align-items: center; gap: .4rem; }
.dday .unsure-fold summary .n { margin-left: auto; }
.dday .unsure-fold[open] > ul.rules { columns: 2; column-gap: 24px; }
.dday .unsure-fold[open] > ul.rules > li { break-inside: avoid; }
@media (max-width: 720px) { .dday .unsure-fold[open] > ul.rules { columns: 1; } }
.dday .unsure-fold[open] > ul.rules { margin-top: 8px; }

@media print {
  .unsure-fold { display: block; }
  .unsure-fold summary { display: none; }
  .unsure-fold > *:not(summary) { display: block; }
  .dday .unsure-fold > h3.unsure { display: block; }
}

/* ---- reader top bar (inside .stickyhead) ---- */
.topbar { display: flex; gap: .5rem; align-items: center; height: 100%;
  min-width: 0; padding: 0 0 3px; white-space: nowrap; }
.topbar .now { flex: 1; min-width: 0; }
.ch-title { font-weight: 600; line-height: 1.35; font-size: .98rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pack { font-size: .78rem; color: var(--muted); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-nav, .more-toggle { flex: none; min-width: 36px; min-height: 36px;
  padding: .35rem .55rem; white-space: nowrap; }
.nav-narrow { display: none; }
/* Listen / Study notes view toggle */
.seg { display: inline-flex; border: 1px solid var(--accent); border-radius: 6px;
  overflow: hidden; flex: none; }
.seg button { border: none; border-radius: 0; padding: .12rem .55rem;
  min-height: 24px; font-size: .78rem; background: var(--panel2); color: var(--text); }
.seg button + button { border-left: 1px solid var(--accent); }
.seg button.active { background: var(--accent); color: #fff; }
.playerbar { flex: none; }
.transport { display: flex; align-items: center; height: 36px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.transport #play-btn { align-self: stretch; min-width: 36px; padding: 0;
  border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.transport .t { min-width: 2.9em; padding: 0 .15rem; color: var(--muted);
  font-size: .82rem; font-variant-numeric: tabular-nums; text-align: center; }
.transport .time-sep { color: var(--muted); font-size: .75rem; }
.reader-more { position: absolute; top: calc(100% + 8px); right: 1rem;
  z-index: 30; width: min(240px, calc(100vw - 24px)); padding: .7rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
.reader-more[hidden] { display: none; }
.more-control { display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .65rem; }
.control-label { color: var(--muted); font-size: .82rem; }
.stepper { display: inline-flex; align-items: center; min-height: 32px;
  overflow: hidden; border: 1px solid var(--accent); border-radius: 7px; }
.stepper button { min-width: 32px; min-height: 32px; padding: 0;
  border: 0; border-radius: 0; }
.stepper > * + * { border-left: 1px solid var(--accent); }
.stepper #speed-label { min-width: 58px; padding: 0 .35rem;
  border-left: 1px solid var(--accent); color: var(--text); font-size: .82rem;
  font-variant-numeric: tabular-nums; text-align: center; }
.reader-more .done-toggle, .reader-more .library-link { width: 100%;
  min-height: 36px; justify-content: center; }
.reader-more .library-link { margin-top: .65rem; }
.kbd-toggle { display: flex; align-items: center; justify-content: center;
  width: 36px; min-height: 36px; margin: 0 0 .65rem auto; padding: 0; }
.kbd-map { position: fixed; top: 50%; left: 50%; z-index: 120;
  width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  overflow-y: auto; padding: 1rem; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .45); transform: translate(-50%, -50%); }
.kbd-map[hidden] { display: none; }
.kbd-map h2 { margin: 0 0 .6rem; color: var(--accent); font-size: 1rem; }
.kbd-map table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.kbd-map th, .kbd-map td { padding: .3rem .2rem; border: 0; text-align: left; }
.kbd-map th { width: 4.5rem; color: var(--text); }
.kbd-map td { color: var(--muted); }
.kbd-map kbd { display: inline-block; min-width: 2rem; padding: .08rem .35rem;
  border: 1px solid var(--line); border-radius: 5px; background: var(--panel2);
  font: inherit; text-align: center; }

/* ---- floating listen controls ---- */
.mini-player { position: fixed; right: 16px; bottom: 16px; z-index: 90;
  display: flex; align-items: stretch; height: var(--mini-h);
  overflow: hidden; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(calc(100% + 20px)); transition: none; }
.mini-player.shown { opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0); transition: opacity .16s ease, transform .16s ease; }
.mini-player #mini-play { width: 42px; min-width: 42px; padding: 0;
  border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.mini-jump { display: flex; align-items: center; gap: .5rem; min-height: 46px;
  padding: 0 .75rem 0 .6rem; border: 0; border-radius: 0;
  background: transparent; }
.mini-progress { display: block; width: 96px; height: 4px; overflow: hidden;
  border-radius: 2px; background: var(--line); }
.mini-progress > span { display: block; width: 0; height: 100%;
  background: var(--accent); }
.mini-time, .mini-speed { color: var(--muted); font-size: .76rem;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
body.mini-active .playerbar { visibility: hidden; }
body.readmode .mini-player { display: none; }

/* ---- chapter typography ---- */
.chapter { min-width: 0; overflow-wrap: anywhere; }
.chapter h1 { font-size: 1.45rem; line-height: 1.4; color: var(--accent);
  margin: 1.2rem 0 .6rem; }
.chapter h2 { font-size: 1.2rem; line-height: 1.4; color: var(--accent);
  margin: 1.6rem 0 .4rem; }
.chapter h3 { font-size: 1.02rem; color: var(--text); margin: 1.2rem 0 .3rem; }
.chapter h4 { font-size: .95rem; color: var(--prose); margin: 1rem 0 .2rem; }
.chapter p { margin: .7rem 0; }
.chapter blockquote { margin: .8rem 0; padding: .1rem 0 .1rem 1rem;
  border-left: 3px solid var(--accent); color: var(--prose); }
.chapter code { background: var(--panel2); padding: .1em .35em; border-radius: 4px;
  font-size: .88em; overflow-wrap: break-word; }
.chapter pre { background: var(--panel); border: 1px solid var(--line);
  padding: .8rem 1rem; border-radius: 8px;
  overflow-x: auto; line-height: 1.55; }
.chapter pre code { background: none; padding: 0; }
.chapter table { display: block; overflow-x: auto; border-collapse: collapse;
  width: 100%; margin: 1rem 0; font-size: .88rem; line-height: 1.55; }
.chapter pre, .chapter table, .chapter .sourceCode { max-width: 100%; }
.chapter .sourceCode { min-width: 0; }
.chapter th, .chapter td { border: 1px solid var(--line); padding: .35rem .55rem;
  text-align: left; vertical-align: top; }
.chapter th { background: var(--panel2); }
.chapter hr { border: none; border-top: 1px solid var(--line); margin: 1.6rem 0; }
.chapter img { max-width: 100%; }
.chapter .error { border: 1px solid var(--bad); border-radius: 8px;
  padding: 1rem 1.2rem; color: var(--bad); }

/* ---- reader progress strip ---- */
#seek { position: absolute; left: 0; bottom: -10px; z-index: 2; width: 100%;
  height: 24px; min-height: 24px; margin: 0; padding: 0; border: 0;
  --seek-progress: 0%; border-radius: 0; background: transparent;
  accent-color: var(--accent); }
#seek::-webkit-slider-runnable-track { height: 3px;
  background: linear-gradient(to right, var(--accent) 0 var(--seek-progress),
    var(--line) var(--seek-progress) 100%); }
#seek::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; }
#seek::-moz-range-track { height: 3px;
  background: linear-gradient(to right, var(--accent) 0 var(--seek-progress),
    var(--line) var(--seek-progress) 100%); }
#seek::-moz-range-progress { height: 3px; background: var(--accent); }
#seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; }
.done-toggle { display: flex; align-items: center; gap: .35rem;
  cursor: pointer; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 8px; padding: .4rem .65rem; background: var(--panel2);
  font-size: .95rem; white-space: nowrap; }
.done-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.note { margin: .3rem 0; font-size: .8rem; color: var(--accent2); line-height: 1.4; }

/* ---- karaoke highlight (Listen view) ---- */
.chapter.scriptview .s.seekable { cursor: pointer; }
.chapter .speaking { background: var(--hl-para); border-left: 3px solid var(--hl-border);
  padding-left: .45rem; border-radius: 4px; }
/* sentence-level highlight: inline, no border, clean wrap across lines */
.chapter span.s.speaking { border-left: none; padding-left: 0;
  background: var(--hl-sent); color: #111;
  border-radius: 3px; box-decoration-break: clone;
  -webkit-box-decoration-break: clone; }

/* ---- progress page ---- */
.summary { text-align: center; margin: 1rem 0 1.5rem; line-height: 1.7; }
.bigpct { font-size: 2.4rem; font-weight: 700; color: var(--accent); }
.sumlabel { font-size: .85rem; color: var(--muted); margin-top: -0.3rem; }
.pbar { display: block; height: .55rem; background: var(--panel2);
  border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.pfill { display: block; height: 100%; background: var(--accent);
  border-radius: 4px; }
.prow { padding: .5rem 0 .7rem; font-size: .95rem; }
.prow .phead { display: flex; gap: .7rem; align-items: baseline;
  justify-content: space-between; }
.prow .pname { font-weight: 600; color: var(--text); }
.prow .pstat { color: var(--muted); font-variant-numeric: tabular-nums;
  font-size: .85rem; white-space: nowrap; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr));
  gap: 4px; margin-top: .35rem; }
.cell { display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border-radius: 4px; font-size: .72rem; text-decoration: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-variant-numeric: tabular-nums; }
.cell:hover { outline: 2px solid var(--accent); }
.cell.done { background: var(--accent); border-color: var(--accent); color: #fff; }

footer { margin-top: 2rem; font-size: .85rem; color: var(--muted); }

/* ---- landing page (index) ---- */
.landing h1 { font-size: 1.6rem; margin: 1.2rem 0 .2rem; }
.landing .sub { color: var(--muted); font-size: .95rem; }
.resume { display: flex; flex-direction: row; align-items: center;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 14px;
  padding: 14px 18px; gap: 12px; margin: 1.6rem 0 0;
  text-decoration: none; color: var(--text); }
.resume.hidden { display: none; }
.resume .k { color: var(--accent); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; }
.resume .t { font-weight: 600; }
.resume .s { color: var(--muted); font-size: .85rem; }
.resume .go { margin-left: auto; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 6px 12px; white-space: nowrap; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px; margin: 1.6rem 0; }
.lcard { display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; text-decoration: none; color: var(--text);
  transition: transform .12s, border-color .12s; }
.lcard:hover { transform: translateY(-3px); }
.lcard.study:hover { border-color: var(--accent2); }
.lcard.listen:hover { border-color: var(--gold); }
.lcard.train:hover { border-color: var(--accent); }
.lcard.dday:hover { border-color: var(--good); }
.lcard.hidden { display: none; } /* language-gated cards */
.lcard .icon { font-size: 28px; }
.lcard h2 { margin: 10px 0 6px; font-size: 1.05rem; }
.lcard p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.lcard .who { margin-top: 10px; font-size: .78rem; color: var(--learn);
  letter-spacing: .3px; text-transform: uppercase; font-weight: 700; }
.lcard .prog { margin-top: 8px; font-size: .8rem; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.lcard .prog.active { color: var(--text); }
.lnote { font-size: .85rem; color: var(--muted); line-height: 1.6;
  background: var(--panel); border: 1px dashed var(--line); border-radius: 12px;
  padding: 12px 16px; }

@media (max-width: 560px) {
  .pack-hd .pack-bar { display: none; }
  .pack-hd h2 { min-width: 0; overflow-wrap: anywhere; }
  .pack-hd .pack-prog { min-width: 0; }
  .pack-hd .pack-meta { white-space: normal; line-height: 1.35; text-align: right; }
  .resume { flex-wrap: wrap; }
  .resume .go { flex: 1 0 100%; margin-left: 0; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pack-hd .chev { transition: none; }
  .mini-player, .mini-player.shown { transform: none; transition: none; }
}

/* ---- reading mode (?view=notes entry): text only, no audio controls ---- */
body.readmode .playerbar, body.readmode .speed-control, body.readmode #note,
body.readmode .view-switch { display: none; }
body.readmode #seek { display: block; pointer-events: none; }

@media (max-width: 699px) {
  .ch-pack { display: none; }
  .transport #t-tot, .transport .time-sep { display: none; }
}

@media (max-width: 700px) {
  .mini-player { right: auto; bottom: calc(64px + env(safe-area-inset-bottom));
    left: 50%; transform: translate(-50%, calc(100% + 20px)); }
  .mini-player.shown { transform: translate(-50%, 0); }
}


/* standardized site header (training-page style) ---- */
/* display:block neutralizes the legacy `header{display:flex}` rule; the row is
   classed head-row so the chapter-list .row:hover highlight can never paint it */
.sitehead {
  display: block; width: 100%; background: var(--head-grad);
  border-bottom: 1px solid var(--line);
  padding: 12px 0 11px;
}
.sitehead .head-row {
  max-width: 860px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: nowrap; min-width: 0;
}
.sitehead h1 { font-size: 22px; margin: 0; letter-spacing: .5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sitehead .controls {
  margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none;
}
.brand-link { text-decoration: none; color: inherit; cursor: pointer; }

/* ---- shared mode navigation ---- */
.modenav {
  width: 100%; max-width: 860px; height: 40px; margin: 0 auto;
  padding: 4px 20px; display: flex; align-items: center; justify-content: center;
  gap: 4px;
}
.modenav a {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 32px; padding: 0 10px; border-radius: 8px; color: var(--muted);
  font-size: 13px; line-height: 1; text-decoration: none; white-space: nowrap;
}
.modenav a:hover { color: var(--text); background: var(--panel2); }
.modenav a[aria-current="page"] { color: var(--accent); background: var(--panel2); }
.modenav svg { width: 16px; height: 16px; flex: none; }
body.landing .modenav { display: none; }

@media (max-width: 700px) {
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .modenav, body.landing .modenav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    display: flex; width: 100%; max-width: none;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .modenav a {
    flex: 1; height: 48px; padding: 3px 0; border-radius: 6px;
    flex-direction: column; gap: 2px; color: var(--muted); font-size: 11px;
  }
  .modenav a:hover, .modenav a[aria-current="page"] {
    color: var(--accent); background: transparent;
  }
  .modenav svg { width: 20px; height: 20px; }
  .modenav-label { line-height: 1.1; }
}

/* reader chrome at the narrowest supported phone width */
@media (max-width: 560px) {
  .stickyhead { height: 56px; margin: 0 -20px; padding: 0 4px; }
  .topbar { gap: 3px; }
  .chapter-nav, .more-toggle { width: 28px; min-width: 28px;
    min-height: 32px; padding: 0; }
  .nav-wide { display: none; }
  .nav-narrow { display: inline; font-size: 1.15rem; line-height: 1; }
  .ch-title { font-size: .76rem; }
  .view-switch button { min-height: 28px; padding: 0 3px; font-size: .65rem; }
  .transport { height: 32px; }
  .transport #play-btn { min-width: 28px; width: 28px; }
  .transport .t { min-width: 28px; padding: 0 2px; font-size: .69rem; }
  .transport #t-tot, .transport .time-sep { display: none; }
  .reader-more { position: fixed; top: auto; right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom)); left: 8px; z-index: 110;
    width: auto; max-height: calc(100vh - 76px - env(safe-area-inset-bottom));
    overflow-y: auto; border-radius: 14px; }
}

/* ---- icon buttons (top-right controls) ---- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; cursor: pointer; text-decoration: none;
  transition: border-color .12s, transform .12s;
}
.icon-btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .flag { font-size: 17px; line-height: 1; }
.lang-wrap { position: relative; }
.lang-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; min-width: 150px; z-index: 40;
  box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.lang-wrap.open .lang-menu { display: block; }
.lang-menu a { display: block; padding: 8px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text); font-size: 14px; line-height: 1.4; }
.lang-menu a:hover { background: var(--panel2); }
.lang-menu a.on { color: var(--accent); font-weight: 700; }
.icon-btn.lang { width: auto; padding: 0 10px; font-size: 13px; font-weight: 600; gap: 5px; }

/* headline suffix + chapter checkboxes */
.hsub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: .35rem; letter-spacing: 0; }
.chk { width: 19px; height: 19px; border: 1.5px solid var(--accent); border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  cursor: pointer; align-self: center; transition: box-shadow .1s; }
.chk:hover { box-shadow: 0 0 0 3px rgba(217,119,87,.25); }
.chk.done { background: var(--accent); border-color: var(--accent); }
.chk.done::after { content: "\2713"; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
