/* Read PDF Out Loud. Warm off-white surfaces, near-black ink, raised buttons that press down,
   in the manner of posthog.com. Block appearance comes from /blocks.css, which reads the
   --fg, --muted, --rule, --accent, --hl and --code tokens defined here. */

:root {
  --bg: #EEEFE9; --surface: #FFFFFF; --surface-2: #E5E7E0; --line: #D0D1C9; --line-strong: #BFC1B7;
  --ink: #151515; --ink-2: #4D4F46; --muted-2: #73756B;
  --orange: #F54E00; --yellow: #EB9D2A; --yellow-base: #CD8407; --yellow-edge: #B17816;
  --blue: #1D4AFF; --green: #36A65B; --purple: #B62AD9; --teal: #1FA3A3;
  --word: #FFD65C; --reading: #FFF3C4;
  --fg: var(--ink); --muted: var(--muted-2); --rule: var(--line); --accent: var(--blue);
  --hl: var(--reading); --code: var(--surface-2); --danger: #B42318;
  --ui: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --reading-font: "Literata", Charter, "Iowan Old Style", Georgia, serif;
  --reading-size: 19px;
  --toc-w: 17rem; --settings-w: 9.5rem; --radius: 8px;
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #F3E9D2; --surface: #FBF5E6; --surface-2: #EADDBF; --line: #D8C8A4; --line-strong: #C6B38A;
  --ink: #33291B; --ink-2: #5A4A33; --muted-2: #85745A; --word: #F4C85B; --reading: #F5E3AE;
}
:root[data-theme="dark"] {
  --bg: #1E1F23; --surface: #26272C; --surface-2: #2E3036; --line: #3A3C43; --line-strong: #4A4C54;
  --ink: #EEEFE9; --ink-2: #C9CAC2; --muted-2: #9EA096; --orange: #FF6A2B; --blue: #7C95FF;
  --word: #8A6A12; --reading: #3A3320; --accent: #8FA6FF; --danger: #FF8A7A;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #1E1F23; --surface: #26272C; --surface-2: #2E3036; --line: #3A3C43; --line-strong: #4A4C54;
    --ink: #EEEFE9; --ink-2: #C9CAC2; --muted-2: #9EA096; --orange: #FF6A2B; --blue: #7C95FF;
    --word: #8A6A12; --reading: #3A3320; --accent: #8FA6FF; --danger: #FF8A7A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--ui); -webkit-font-smoothing: antialiased;
}
body.in-reader { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.in-reader main { flex: 1; min-height: 0; }
a { color: var(--ink); }
[hidden] { display: none !important; }
.muted { color: var(--muted-2); }
.error { color: var(--orange); font-weight: 700; }
.show-sm { display: none; }

/* ------------------------------------------------------------ top bar */
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 900; font-size: 1.08rem; text-decoration: none; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; }
.topnav { margin-left: auto; display: flex; gap: .25rem; }
.topnav a { text-decoration: none; font-weight: 700; font-size: .92rem; color: var(--ink-2); padding: .35rem .6rem; border-radius: 6px; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
body.in-reader .topnav, body.in-dashboard .topnav { display: none; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-block; border-radius: var(--radius); cursor: pointer; user-select: none; font: inherit; }
.btn-primary { background: var(--yellow-base); border: 1.5px solid var(--yellow-edge); }
.btn .btn-face {
  display: block; padding: .72rem 1.5rem; border-radius: var(--radius); font-weight: 800; font-size: 1.02rem;
  background: var(--yellow); border: 1.5px solid var(--yellow-edge); color: #151515;
  transform: translateY(-4px); margin: -1.5px; transition: transform .08s ease;
}
.btn:hover .btn-face { transform: translateY(-5px); }
.btn:active .btn-face { transform: translateY(-1px); }
.btn:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
a.btn { text-decoration: none; }
.btn-secondary { background: var(--line-strong); border: 1.5px solid var(--ink-2); }
.btn-secondary .btn-face { background: var(--surface); border-color: var(--ink-2); color: var(--ink); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; font: 700 .86rem/1 var(--ui); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: .45rem .7rem;
  cursor: pointer; text-decoration: none; box-shadow: 0 2px 0 var(--line-strong);
}
.chip:hover { border-color: var(--ink-2); }
.chip:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--line-strong); }
.chip svg { width: 15px; height: 15px; }
.chip[aria-pressed="true"] { background: var(--surface-2); }
.chip-small { padding: .3rem .55rem; font-size: .8rem; }

.select {
  font: 700 .86rem var(--ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: .38rem .45rem; width: 100%; cursor: pointer;
}

/* ------------------------------------------------------------ home */
.home { overflow: visible; }
/* kept short, and shorter on short screens, so the picture of the reader below is in view as the
   page opens */
.hero { max-width: 58rem; margin: 0 auto; padding: clamp(1.25rem, 4.5vh, 2.4rem) 1.25rem 1.4rem; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; padding: .35rem .8rem;
  font-weight: 800; font-size: .82rem; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
}
.dot-live { width: .55rem; height: .55rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.hero h1 { font-size: clamp(2.5rem, min(6vw, 7.5vh), 4rem); line-height: 1.02; font-weight: 900; letter-spacing: -.035em; margin: 0 0 .75rem; }
.hero h1 .underline { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--yellow) 70%, transparent) 62%); padding: 0 .08em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 40rem; margin: 0 auto clamp(1.1rem, 3vh, 1.5rem); }
@media (min-width: 641px) and (max-height: 700px) { .eyebrow { display: none; } }
.drop {
  max-width: 46rem; margin: 0 auto; background: var(--surface); border: 2px dashed var(--line-strong);
  border-radius: 14px; padding: 1.05rem 1.5rem .9rem; transition: border-color .15s, background .15s, transform .15s;
}
.drop.over { border-color: var(--orange); background: color-mix(in srgb, var(--yellow) 10%, var(--surface)); transform: scale(1.01); }
.drop.busy { opacity: .75; pointer-events: none; }
.drop-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .8rem 1.4rem; }
.drop-title { display: flex; align-items: center; gap: .65rem; margin: 0; font-size: 1.2rem; font-weight: 900; }
.drop-icon { flex: none; width: 42px; height: 42px; }
.drop-or { color: var(--muted-2); font-weight: 700; }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.drop .btn .btn-face { padding: .6rem 1.25rem; }
.drop-note { margin: .8rem 0 0; color: var(--muted-2); font-size: .88rem; }
#home-error { max-width: 46rem; margin: 1rem auto 0; }

/* the reader under the hero, a little wider than the text; it opens the sample paper */
.showcase { max-width: 70.5rem; margin: 0 auto; padding: .6rem 1.25rem .5rem; }
.showcase-shot { display: block; border-radius: 14px; }
.showcase-shot img {
  display: block; width: 100%; height: auto; background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: 14px; box-shadow: 0 6px 0 var(--line-strong); transition: transform .15s ease, box-shadow .15s ease;
}
.showcase-shot[href]:hover img { transform: translateY(-3px); box-shadow: 0 9px 0 var(--line-strong); }
.showcase-shot:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.showcase figcaption { max-width: 44rem; margin: 1.1rem auto 0; text-align: center; color: var(--muted-2); font-size: .9rem; font-weight: 700; }

.library-section, .features, .how, .faq { max-width: 58rem; margin: 0 auto; padding: 1.5rem 1.25rem; }
.features, .how, .uses, .faq { scroll-margin-top: 2rem; } /* clear of the sticky top bar */
.section-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.25rem; font-weight: 900; margin: 0 0 .75rem; }
.session-note { color: var(--muted-2); font-size: .85rem; margin: 0; }
.library { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
.card {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1rem;
  box-shadow: 0 3px 0 var(--line); transition: transform .08s, box-shadow .08s, border-color .15s;
}
.card:hover { border-color: var(--ink-2); transform: translateY(-1px); box-shadow: 0 4px 0 var(--line-strong); }
.card-icon { flex: none; width: 38px; height: 46px; border-radius: 6px; background: var(--orange); position: relative; }
.card-icon::after { content: ""; position: absolute; left: 9px; right: 9px; top: 14px; height: 3px; border-radius: 2px; background: #fff; box-shadow: 0 7px 0 #fff, 0 14px 0 rgba(255,255,255,.6); }
.card .text { min-width: 0; flex: 1; }
.card .name { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { display: block; color: var(--muted-2); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--muted-2); font-size: .82rem; text-align: right; white-space: nowrap; }
.badge { display: inline-block; font-size: .74rem; font-weight: 800; border-radius: 999px; padding: .15rem .55rem; background: var(--surface-2); color: var(--ink-2); }
.badge.working { background: color-mix(in srgb, var(--yellow) 30%, var(--surface)); color: var(--ink); }
.badge.ready { background: color-mix(in srgb, var(--green) 22%, var(--surface)); color: var(--ink); }
.badge.failed { background: color-mix(in srgb, var(--orange) 22%, var(--surface)); color: var(--ink); }

.section-title { font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 900; letter-spacing: -.02em; margin: 1.5rem 0 .4rem; text-align: center; }
.section-lede { text-align: center; color: var(--ink-2); max-width: 34rem; margin: 0 auto 1.8rem; font-size: 1.05rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem 1.2rem; box-shadow: 0 3px 0 var(--line); }
.feature h3 { margin: .8rem 0 .35rem; font-size: 1.08rem; font-weight: 900; }
.feature p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.feature-icon {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: #151515;
  background: var(--tint); border: 1.5px solid #151515; box-shadow: 0 3px 0 #151515;
}
.feature-icon svg { width: 24px; height: 24px; fill: none; }
.steps { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.steps h3 { margin: .7rem 0 .3rem; font-weight: 900; }
.steps p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.step-no { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; background: var(--ink); color: var(--bg); }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; margin: .6rem auto 0; max-width: 44rem; }
.faq summary { font-weight: 800; cursor: pointer; }
.faq details p { margin: .6rem 0 0; color: var(--ink-2); }
.site-footer { max-width: 58rem; margin: 2rem auto 0; padding: 1.5rem 1.25rem 3rem; display: flex; gap: 1rem; justify-content: space-between; font-weight: 800; border-top: 1px solid var(--line); }

.drag-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.drag-overlay > div { border: 3px dashed var(--orange); border-radius: 18px; padding: 3rem 4rem; background: var(--surface); }
.drag-overlay p { margin: 0; font-size: 1.5rem; font-weight: 900; }

/* ------------------------------------------------------------ reader */
.reader { display: flex; flex-direction: column; height: 100%; }
.reader-bar {
  display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.reader-bar h1 {
  font-size: 1rem; font-weight: 900; margin: 0 .3rem; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.views { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.views button {
  font: 800 .84rem var(--ui); color: var(--ink-2); background: transparent; border: 0; border-radius: 6px;
  padding: .38rem .7rem; cursor: pointer;
}
.views button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--line-strong), 0 0 0 1px var(--line); }
.reader-body { flex: 1; display: flex; min-height: 0; position: relative; }

.toc {
  width: var(--toc-w); flex: none; border-right: 1px solid var(--line); background: var(--bg);
  overflow: auto; padding: .8rem .55rem 2rem;
}
.toc.hidden { display: none; }
.toc a {
  display: block; color: var(--ink-2); text-decoration: none; font-size: .88rem; font-weight: 700; line-height: 1.3;
  padding: .38rem .55rem; border-radius: 6px;
}
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.current { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--orange); }
.toc a .page-no { color: var(--muted-2); font-size: .75rem; float: right; margin-left: .5rem; font-weight: 700; }
.toc a.level-2 { padding-left: 1.25rem; font-weight: 600; }
.toc a.level-3 { padding-left: 2rem; font-weight: 600; color: var(--muted-2); }
.toc a.toc-title { font-weight: 900; color: var(--ink); margin-bottom: .35rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.toc .empty { color: var(--muted-2); font-size: .88rem; padding: .5rem; }

.panes { flex: 1; display: flex; min-width: 0; background: var(--bg); }
.page {
  flex: 1; min-width: 0; overflow: auto; padding: 2.2rem max(1.5rem, calc((100% - 44rem) / 2)) 5rem;
  font-family: var(--reading-font); font-size: var(--reading-size); line-height: 1.68; background: var(--surface);
}
.page > :first-child { margin-top: 0; }
.page .blk img { max-height: min(70vh, 42rem); width: auto; max-width: 100%; }
.page h1, .page h2, .page h3, .page h4, .page h5, .page h6 { font-family: var(--ui); font-weight: 900; letter-spacing: -.01em; }
.page .hint { color: var(--muted-2); font-family: var(--ui); }
.page .waiting { font-family: var(--ui); text-align: center; padding: 3rem 1rem; }
.page .waiting .spinner { width: 1.6rem; height: 1.6rem; border-width: 3px; margin-bottom: 1rem; }
.original { flex: 1; min-width: 0; overflow: auto; background: var(--surface-2); padding: 1rem; display: none; }
.page-shot { position: relative; margin: 0 auto; width: fit-content; }
.page-shot img { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.box { position: absolute; border: 2px solid var(--orange); background: color-mix(in srgb, var(--yellow) 18%, transparent); border-radius: 3px; pointer-events: none; }
.panes[data-view="original"] .page { display: none; }
.panes[data-view="original"] .original, .panes[data-view="both"] .original { display: block; }
.panes[data-view="both"] .page { border-right: 1px solid var(--line); padding-left: 1.5rem; padding-right: 1.5rem; }
.blk.picked { background: var(--hl); box-shadow: 0 0 0 .3rem var(--hl); }

/* settings: a narrow panel, half the contents' width */
.settings {
  width: var(--settings-w); flex: none; border-left: 1px solid var(--line); background: var(--bg);
  overflow: auto; padding: .8rem .65rem 2rem; display: flex; flex-direction: column; gap: 1.1rem;
}
.settings.hidden { display: none; }
.set-group { display: flex; flex-direction: column; gap: .45rem; }
.set-group h2 { font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin: 0 0 .1rem; }
.set-label { font-size: .78rem; font-weight: 800; color: var(--ink-2); margin-top: .15rem; }
.switch {
  display: flex; align-items: center; gap: .45rem; width: 100%; text-align: left; cursor: pointer;
  font: 700 .8rem/1.2 var(--ui); color: var(--ink); background: transparent; border: 0; padding: .2rem 0;
}
.switch .knob {
  flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s;
}
.switch .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.switch[aria-checked="true"] .knob { background: var(--orange); }
.switch[aria-checked="true"] .knob::after { transform: translateX(12px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; }
.stepper button { font: 900 .82rem var(--ui); color: var(--ink); background: transparent; border: 0; padding: .35rem .5rem; cursor: pointer; }
.stepper span { font-weight: 800; font-size: .8rem; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.swatch { padding: 2px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: transparent; cursor: pointer; aspect-ratio: 1; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.swatch span.auto { background: linear-gradient(135deg, #EEEFE9 50%, #1E1F23 50%); }
.swatch[aria-checked="true"] { border-color: var(--orange); box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 35%, transparent); }
.set-link { font-weight: 800; font-size: .82rem; color: var(--ink); }
.keys p { margin: 0; font-size: .76rem; color: var(--muted-2); font-weight: 700; }
kbd { font: 800 .7rem var(--ui); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: .05rem .3rem; margin-right: .15rem; background: var(--surface); color: var(--ink); }

/* ------------------------------------------------------------ player */
.player {
  border-top: 1px solid var(--line-strong); background: var(--surface); padding: .45rem 1rem .75rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06); z-index: 5;
}
.player-status { display: flex; align-items: center; gap: .6rem; min-height: 1.4rem; font-size: .82rem; font-weight: 700; color: var(--muted-2); }
.job { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job.failed { color: var(--orange); }
.player-note { margin-left: auto; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-main { display: flex; align-items: center; gap: 1.2rem; }
.transport { display: flex; align-items: center; gap: .6rem; }
.round-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-strong); box-shadow: 0 2px 0 var(--line-strong);
}
.round-btn:hover { border-color: var(--ink-2); }
.round-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--line-strong); }
.round-btn:disabled { opacity: .4; cursor: not-allowed; }
.round-btn svg { width: 18px; height: 18px; }
.round-btn.small { width: 32px; height: 32px; }
.round-btn.small svg { width: 14px; height: 14px; }
.play { width: 60px; height: 60px; border-radius: 50%; padding: 0; cursor: pointer; background: var(--yellow-base); border: 1.5px solid var(--yellow-edge); }
.play-face {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; margin: -1.5px;
  background: var(--yellow); border: 1.5px solid var(--yellow-edge); color: #151515; transform: translateY(-4px); transition: transform .08s;
}
.play:hover .play-face { transform: translateY(-5px); }
.play:active .play-face { transform: translateY(-1px); }
.play:disabled { opacity: .45; cursor: not-allowed; }
.play:disabled .play-face { transform: translateY(-2px); }
.play .icon { display: inline-flex; width: 24px; height: 24px; }
.play .icon svg { width: 100%; height: 100%; }
.play .spinner { width: 22px; height: 22px; margin: 0; border-width: 3px; }
.timeline { flex: 1; display: flex; align-items: center; gap: .7rem; min-width: 0; }
.time { font: 800 .82rem var(--ui); font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 2.6rem; text-align: center; }
.seek { flex: 1; position: relative; height: 26px; cursor: pointer; touch-action: none; }
.seek-track { position: absolute; left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.seek-fill { height: 100%; width: 0; background: var(--orange); border-radius: 999px; }
.seek-knob {
  position: absolute; top: 50%; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); transition: transform .1s;
}
.seek:hover .seek-knob, .seek.dragging .seek-knob { transform: scale(1.15); }
.seek:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; border-radius: 8px; }
.player-tools { display: flex; align-items: center; gap: .8rem; }
.speed { width: auto; }
.pager { display: flex; align-items: center; gap: .35rem; }
.count { display: inline-flex; align-items: center; gap: .3rem; font-weight: 800; font-size: .85rem; color: var(--ink-2); }
#page-number { width: 3.2rem; font: 800 .85rem var(--ui); padding: .3rem .35rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); text-align: center; }

/* reading along: the paragraph and the word being spoken */
.page.listenable .blk { cursor: pointer; }
.page.listenable .w:hover { text-decoration: underline dotted var(--muted-2); text-underline-offset: .2em; }
.page .reading { background: var(--reading); box-shadow: 0 0 0 .4rem var(--reading); border-radius: 4px; }
.page .w.speaking { background: var(--word); box-shadow: 0 0 0 .12rem var(--word); border-radius: 3px; }

/* a box set beside the main text (vocabulary, a question), read after the paragraph it interrupts */
.page .sidebar { font-family: var(--ui); background: var(--surface-2); border-color: var(--line); border-left-color: var(--teal); }
.page.boxes-off .sidebar { color: var(--muted-2); }

/* summaries stay hidden on the page and open only while they are read aloud */
.page .explanation {
  max-height: 0; opacity: 0; visibility: hidden; overflow: hidden;
  margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0;
  font-family: var(--ui); background: var(--surface-2); border-left-color: var(--orange);
  transition: max-height .35s ease, opacity .2s ease, margin .35s ease, padding .35s ease, visibility 0s linear .35s;
}
.page .explanation.open {
  max-height: 40rem; opacity: 1; visibility: visible;
  margin-top: .25rem; margin-bottom: 1.25rem; padding-top: .7rem; padding-bottom: .7rem;
  transition: max-height .45s ease, opacity .3s ease .1s, margin .35s ease, padding .35s ease, visibility 0s;
}

.spinner {
  display: inline-block; width: .85rem; height: .85rem; margin-right: .4rem; vertical-align: -2px;
  border: 2px solid var(--line-strong); border-top-color: var(--orange); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (hover: none) {
  .set-group.keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 1.5s !important; }
}

/* ------------------------------------------------------------ accounts */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.account-area { margin-left: .75rem; display: flex; align-items: center; }
.topnav + .account-area { margin-left: .5rem; }
.topnav[hidden] + .account-area, body.in-reader .account-area, body.in-dashboard .account-area { margin-left: auto; }
.account { position: relative; }
.avatar-button { display: inline-flex; align-items: center; gap: .3rem; padding: 2px 8px 2px 2px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--ink-2); cursor: pointer; color: var(--ink); font: inherit; }
.avatar-button svg { width: 14px; height: 14px; }
.avatar-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--teal); color: #fff; font: 800 .74rem var(--ui); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 38px; height: 38px; font-size: .9rem; flex: none; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 20; width: min(18.5rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: .8rem; box-shadow: 0 4px 0 var(--line-strong);
}
.menu-head { display: flex; align-items: center; gap: .65rem; }
.menu-who { min-width: 0; display: grid; }
.menu-who strong { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-who span { color: var(--muted-2); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-usage { margin: .8rem 0 .5rem; padding: .6rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.account-menu [role="menuitem"] { display: block; width: 100%; text-align: left; font: 800 .92rem var(--ui); color: var(--ink); background: none; border: 0; border-radius: 6px; padding: .45rem .5rem; cursor: pointer; text-decoration: none; }
.account-menu [role="menuitem"]:hover, .account-menu [role="menuitem"]:focus-visible { background: var(--surface-2); }
.account-menu .danger { color: var(--danger); font-size: .85rem; margin-top: .25rem; }
.usage-row { display: flex; justify-content: space-between; gap: 1rem; font: 700 .82rem var(--ui); color: var(--ink-2); }
.bar { height: 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin-top: .4rem; }
.bar b { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 999px; transition: width .3s; }
.bar.full b { background: var(--danger); }
.usage-note { margin: .35rem 0 0; color: var(--muted-2); font-size: .8rem; }

/* the library */
.dashboard { max-width: 62rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; width: 100%; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dash-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 900; letter-spacing: -.02em; margin: 0; }
.dash-sub { margin: .2rem 0 0; color: var(--muted-2); font-weight: 700; font-size: .92rem; }
.usage-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin: 1.1rem 0 0; max-width: 26rem; }
.dash-busy { margin: 1rem 0 0; font-weight: 700; color: var(--ink-2); }
#dash-error { margin: 1rem 0 0; }
.doc-grid { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: .9rem; }
.doc { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 0 var(--line); transition: transform .08s, box-shadow .08s, border-color .15s; }
.doc:hover { border-color: var(--ink-2); transform: translateY(-1px); box-shadow: 0 4px 0 var(--line-strong); }
.doc-open { display: flex; gap: .75rem; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: .9rem 2.6rem .75rem .9rem; cursor: pointer; border-radius: 12px; }
.doc-open .card-icon { width: 30px; height: 38px; }
.doc-open .card-icon::after { left: 7px; right: 7px; top: 11px; box-shadow: 0 6px 0 #fff, 0 12px 0 rgba(255,255,255,.6); }
.doc-open .card-icon.muted { background: var(--line-strong); }
.doc-text { min-width: 0; flex: 1; }
.doc-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 800; line-height: 1.3; }
.doc-sub { display: block; margin-top: .2rem; color: var(--muted-2); font-size: .82rem; }
.doc-foot { padding: 0 .9rem .85rem; }
.doc-foot .bar { margin: 0 0 .4rem; height: 6px; }
.doc-foot .bar.done b { background: var(--green); }
.doc-foot .bar.working b { background: var(--teal); }
.doc-state { display: flex; justify-content: space-between; gap: .5rem; font: 700 .8rem var(--ui); color: var(--ink-2); }
.doc-state .failed { color: var(--danger); }
.doc-menu-button { position: absolute; top: .55rem; right: .5rem; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.doc-menu-button:hover, .doc-menu-button[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.doc-menu-button svg { width: 18px; height: 18px; }
.doc-menu { position: absolute; top: 2.4rem; right: .5rem; z-index: 10; min-width: 11rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .35rem; box-shadow: 0 4px 0 var(--line-strong); }
.doc-menu [role="menuitem"] { display: block; width: 100%; text-align: left; font: 700 .9rem var(--ui); color: var(--ink); background: none; border: 0; border-radius: 6px; padding: .45rem .55rem; cursor: pointer; text-decoration: none; }
.doc-menu [role="menuitem"]:hover { background: var(--surface-2); }
.doc-menu .danger { color: var(--danger); }
.dash-empty { margin: 2rem 0 0; text-align: center; background: var(--surface); border: 2px dashed var(--line-strong); border-radius: 14px; padding: 2rem 1.25rem; }
.dash-empty h2 { margin: 0 0 .4rem; font-weight: 900; }
.dash-empty p { color: var(--ink-2); max-width: 32rem; margin: .4rem auto; }
.footer-links a { color: inherit; }

/* dialogs */
.dialog { border: 1px solid var(--line-strong); border-radius: 14px; padding: 1.4rem 1.4rem 1.1rem; width: min(24rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 6px 0 var(--line-strong); font-family: var(--ui); }
.dialog::backdrop { background: rgba(21, 21, 21, .45); }
.dialog h2 { margin: 0 0 .5rem; font-size: 1.3rem; font-weight: 900; padding-right: 1.5rem; }
.dialog p { color: var(--ink-2); margin: .5rem 0; }
.dialog-x { position: absolute; right: .7rem; top: .7rem; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; }
.dialog-x:hover { background: var(--surface-2); }
.dialog-x svg { width: 16px; height: 16px; }
.dialog-file { display: flex; align-items: center; gap: .4rem; background: var(--surface-2); border-radius: 8px; padding: .45rem .6rem; font-weight: 700; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-lede { font-size: .92rem; }
.dialog-icon { width: 34px; height: 34px; color: var(--orange); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; margin-top: .8rem; padding: .7rem 1rem; font: 800 .98rem var(--ui); color: #151515; background: #fff; border: 1.5px solid var(--ink-2); border-bottom-width: 4px; border-radius: 8px; cursor: pointer; }
.btn-google:hover { background: #F2F2EE; }
.btn-google svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: .6rem; margin: .9rem 0; color: var(--muted-2); font-weight: 700; font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dialog input[type="email"], .dialog input[type="text"] { width: 100%; box-sizing: border-box; font: 600 1rem var(--ui); padding: .65rem .75rem; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.dialog input:focus { outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent); border-color: var(--blue); }
.btn.block { display: block; width: 100%; margin-top: .6rem; text-align: center; }
.btn.block .btn-face { text-align: center; }
button.btn { padding: 0; }
.fine { font-size: .8rem !important; color: var(--muted-2) !important; text-align: center; margin-top: .9rem !important; }
.fine a { color: inherit; }
.link-button { background: none; border: 0; padding: 0; font: 800 .92rem var(--ui); color: var(--blue); cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.chip.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.danger-fill { background: #B42318; color: #fff; border-color: #B42318; }
#confirm-input { margin-top: .5rem; }

/* privacy and terms */
.legal-page { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; font-family: var(--ui); line-height: 1.6; }
.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 900; margin: 0; }
.legal-page h2 { font-size: 1.15rem; font-weight: 900; margin: 1.8rem 0 .4rem; }
.legal-page p, .legal-page li { color: var(--ink-2); }
.legal-page li { margin: .35rem 0; }
.legal-date { color: var(--muted-2) !important; font-weight: 700; margin-top: .3rem; }

/* the home page's uses */
.uses { max-width: 58rem; margin: 0 auto; padding: 1.5rem 1.25rem; }
.use-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.use { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; box-shadow: 0 3px 0 var(--line); }
.use h3 { margin: 0 0 .35rem; font-size: 1.05rem; font-weight: 900; }
.use p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.how-more { text-align: center; margin: 1.3rem 0 0; font-weight: 800; }

/* tutorial */
.open-app { flex: none; margin-left: auto; }
.topnav + .open-app { margin-left: .5rem; }
.topnav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.guide { max-width: 50rem; margin: 0 auto; padding: 1.6rem 1.25rem 3rem; line-height: 1.6; }
.crumbs { display: flex; gap: .45rem; margin-bottom: 1rem; font-size: .85rem; font-weight: 700; color: var(--muted-2); }
.crumbs a { color: inherit; }
.guide h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; font-weight: 900; letter-spacing: -.03em; margin: 0 0 .8rem; }
.guide-lede { font-size: 1.15rem; margin: 0 0 1.5rem; }
.guide h2 { display: flex; align-items: center; gap: .6rem; font-size: clamp(1.35rem, 3vw, 1.6rem); line-height: 1.2; font-weight: 900; letter-spacing: -.015em; margin: 2.8rem 0 .5rem; scroll-margin-top: 5rem; }
.guide .step { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; font-size: 1rem; background: var(--ink); color: var(--bg); }
.guide p, .guide li { color: var(--ink-2); }
.guide li { margin: .35rem 0; }
.guide strong { color: var(--ink); }
.guide kbd { font-size: .8rem; }
.guide-toc { margin: 1.5rem 0 0; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 0 var(--line); }
.guide-toc-title { margin: 0 0 .3rem; font-weight: 900; color: var(--ink) !important; }
.guide-toc ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.guide-toc li { margin: .2rem 0; break-inside: avoid; }
.guide-toc a { color: var(--ink); font-weight: 700; }
.shot { margin: 1.4rem 0 1.6rem; }
.shot img { display: block; width: 100%; height: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 4px 0 var(--line-strong); }
.shot.phone img { width: min(100%, 19rem); margin: 0 auto; border-radius: 22px; }
.shot figcaption { margin-top: .8rem; text-align: center; color: var(--muted-2); font-size: .9rem; font-weight: 700; }
.keys-table { width: 100%; margin: 1.2rem 0 .5rem; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.keys-table caption { text-align: left; font-weight: 900; color: var(--ink); margin-bottom: .45rem; }
.keys-table th, .keys-table td { text-align: left; padding: .5rem .8rem; border-top: 1px solid var(--line); color: var(--ink-2); }
.keys-table thead th { border-top: 0; font-size: .82rem; color: var(--muted-2); }
.guide-end { margin-top: 3rem; padding: 1.8rem 1.5rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--line); }
.guide-end h2 { justify-content: center; margin-top: 0; }
.guide-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem 1rem; margin: 1.2rem 0 .4rem; }
.guide-more { margin-bottom: 0; font-size: .92rem; }
.guide a:not(.btn), .guide-more a { color: var(--ink); }

/* ------------------------------------------------------------ smaller screens */
@media (max-width: 1100px) {
  .settings { position: absolute; right: 0; top: 0; bottom: 0; z-index: 6; box-shadow: -4px 0 16px rgba(0,0,0,.15); }
}
@media (max-width: 900px) {
  .toc { position: absolute; left: 0; top: 0; bottom: 0; z-index: 6; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .panes[data-view="both"] { flex-direction: column; }
  .panes[data-view="both"] .page { border-right: 0; border-bottom: 1px solid var(--line); }
  .player-main { flex-wrap: wrap; justify-content: space-between; gap: .35rem .6rem; }
  .timeline { order: -1; flex-basis: 100%; }
  .player-tools { gap: .5rem; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .topnav { display: none; }
  .topbar .open-app { margin-left: auto; }
  .site-footer { flex-wrap: wrap; }
  .hero { padding-top: 1.6rem; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.5rem); } /* the name on one line */
  .lede { font-size: 1.05rem; margin-bottom: 1.2rem; }
  /* nothing to drag on a phone: just the buttons */
  .drop { border: 0; background: none; padding: 0; }
  .drop-title { display: none; }
  .drop .btn .btn-face { padding: .6rem 1rem; font-size: .98rem; }
  .drop-note { margin-top: .7rem; }
  .page { padding: 1.4rem 1.1rem 4rem; }
  .reader-bar { padding: .5rem .6rem; gap: .4rem; }
  .views button { padding: .35rem .5rem; }
  .play { width: 54px; height: 54px; }
  .card .meta { display: none; }
  body.in-reader .topbar { display: none; }
  .reader-bar #doc-title { visibility: hidden; }
  .player { padding: .35rem .75rem calc(.6rem + env(safe-area-inset-bottom)); }
  .transport { gap: .45rem; }
  .round-btn { width: 36px; height: 36px; }
  .round-btn.small { width: 30px; height: 30px; }
  .player-main { gap: .35rem .4rem; }
  .player-tools { gap: .35rem; }
  .speed { width: 3.4rem; padding: .38rem .15rem .38rem .3rem; }
  .pager { gap: .25rem; }
  #page-number { width: 2.3rem; }
}
