/* OpenPronounce site.
   Concept: a marked-up exercise sheet. Black text on white paper, a teacher's red pen for what went wrong,
   a highlighter for the word being heard. One reading column, figures allowed to go wider. */
:root {
  --paper: #FCFCFA;
  --sheet: #FFFFFF;
  --tint: #F3F2EE;
  --ink: #161616;
  --soft: #5D5D5B;
  --faint: #767673;
  --rule: #E7E5DF;
  --red: #C8322B;
  --red-soft: #FBEAE8;
  --mark: #FFF0A3;
  --wave: #CFCFCB;
  --button: #161616;
  --button-ink: #FFFFFF;
  --rec-ink: #FFFFFF;
  --code: #F4F4F2;
  --code-ink: #222220;
  --code-dim: #7B7B78;
  --code-key: #1F5F99;
  --code-str: #8A4B0F;

  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --book: "Charis SIL", "Doulos SIL", Georgia, "Times New Roman", serif;
  --pen: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --measure: 680px;
  --wide: 1240px;
  --gutter-l: max(clamp(20px, 4vw, 48px), env(safe-area-inset-left, 0px));
  --gutter-r: max(clamp(20px, 4vw, 48px), env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121212; --sheet: #1A1A19; --tint: #1E1E1D; --ink: #ECECEA; --soft: #A6A6A2; --faint: #85857F;
    --rule: #2C2C2A; --red: #FF6B5F; --red-soft: #3A1E1B; --mark: #5C4F0E; --wave: #3D3D3A;
    --button: #ECECEA; --button-ink: #121212; --rec-ink: #121212; --code: #1E1E1D; --code-ink: #E2E2DF; --code-dim: #8D8D88;
    --code-key: #8CC2F2; --code-str: #E8B37A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121212; --sheet: #1A1A19; --tint: #1E1E1D; --ink: #ECECEA; --soft: #A6A6A2; --faint: #85857F;
  --rule: #2C2C2A; --red: #FF6B5F; --red-soft: #3A1E1B; --mark: #5C4F0E; --wave: #3D3D3A;
  --button: #ECECEA; --button-ink: #121212; --rec-ink: #121212; --code: #1E1E1D; --code-ink: #E2E2DF; --code-dim: #8D8D88;
  --code-key: #8CC2F2; --code-str: #E8B37A; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: var(--mark); color: var(--ink); }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -0.018em; }
h1 { font-size: clamp(2.1rem, 4.8vw, 3.4rem); line-height: 1.08; letter-spacing: -0.028em; }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.1rem); line-height: 1.18; letter-spacing: -0.022em; }
h2.display { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.08; letter-spacing: -0.03em; max-width: 20em; }
h3 { font-size: 1.12rem; line-height: 1.35; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 8px; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { background: var(--tint); padding: 0.1em 0.35em; border-radius: 3px; overflow-wrap: anywhere; }
.ipa { font-family: var(--book); }
.soft { color: var(--soft); }
.small { font-size: 0.9rem; }
.lead { font-size: 1.2rem; line-height: 1.55; color: var(--soft); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--paper); padding: 8px 12px; }

/* Frame */
.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.col { max-width: var(--measure); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--paper); }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo svg { width: 22px; height: 22px; flex: none; }
.nav { display: flex; gap: 26px; margin: 0 12px 0 auto; align-items: center; font-size: 0.95rem; }
.nav .nav-install { display: none; }
.head-install { padding: 8px 14px; font-size: 0.93rem; }
.nav a { text-decoration: none; color: var(--soft); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 6px; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: 3px; padding: 6px 12px; font: 500 0.9rem var(--sans); cursor: pointer; }
@media (max-width: 820px) {
  .menu-btn { display: inline-block; margin-left: 0; }
  .site-header .star-btn { margin-left: auto; }
  .site-header .head-install { display: none; }
  .nav .nav-install { display: inline-flex; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 4px var(--gutter-r) 16px var(--gutter-l); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .nav .btn { margin-top: 14px; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 3px; font: 500 0.98rem/1.1 var(--sans); text-decoration: none; border: 1px solid var(--button); background: var(--button); color: var(--button-ink); cursor: pointer; }
.btn:hover { color: var(--button-ink); opacity: 0.88; }
.btn-line { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-line:hover { color: var(--ink); border-color: var(--ink); opacity: 1; }
.nav .btn { color: var(--button-ink); padding: 8px 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Page rhythm */
.page-head { padding-block: clamp(48px, 8vw, 88px) clamp(28px, 4vw, 40px); display: flex; flex-direction: column; gap: 20px; }
.page-head .lead { max-width: 36em; }
.block { padding-block: clamp(48px, 7vw, 80px); border-top: 1px solid var(--rule); }
.block > .wrap { display: flex; flex-direction: column; gap: 22px; }
.block h2 + p, .block h2 + .lead { margin-top: -6px; }
.prose { max-width: var(--measure); display: flex; flex-direction: column; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.install-line { font: 400 0.95rem var(--mono); color: var(--soft); }
.install-line b { color: var(--ink); font-weight: 400; }

/* The exercise sheet (demo) */
.sheet { margin: 8px 0 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 0 var(--rule), 0 18px 40px -28px rgba(0, 0, 0, 0.25); }
.sheet-head { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: baseline; justify-content: space-between; padding: 14px clamp(16px, 3vw, 28px); border-bottom: 1px solid var(--rule); }
.seg { display: flex; gap: 20px; }
.seg button { background: none; border: 0; padding: 4px 0; font: 500 0.95rem var(--sans); color: var(--soft); cursor: pointer; border-bottom: 2px solid transparent; }
.seg button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.stage-label { font: 400 0.82rem var(--mono); color: var(--faint); }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr) 230px; }
@media (max-width: 720px) { .sheet-body { grid-template-columns: minmax(0, 1fr); } .sheet-body .margin { flex-direction: row; align-items: center; gap: 24px; } .sheet-body .dims { flex: 1 1 auto; } .margin { border-left: 0 !important; border-top: 1px dashed var(--rule); } }
.reading { padding: clamp(18px, 3vw, 34px); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.player { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.play:hover { background: var(--ink); color: var(--paper); }
.play svg { width: 16px; height: 16px; }
.wave { height: 64px; cursor: pointer; min-width: 0; }
.wave canvas { width: 100%; height: 100%; display: block; }
.said-row { font: 400 clamp(1.25rem, 2.6vw, 1.95rem)/2.25 var(--book); margin: 0; padding-top: 6px; }
.said-row .word { position: relative; padding: 1px 2px; border-radius: 2px; }
.said-row .word.now { background: var(--mark); }
.said-row .word.bad { text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 7px; }
.said-row .word.missing { color: var(--faint); }
.said-row .word .pen { position: absolute; left: 50%; bottom: 72%; transform: translateX(-50%) rotate(-3deg); font: 500 1.15rem/1 var(--pen); color: var(--red); white-space: nowrap; pointer-events: none; }
.said-row .word .pen.ipa { font: italic 400 0.9rem/1 var(--book); bottom: 78%; }
.said-row .seg-mark { color: var(--faint); padding: 0 4px; }
.notes { display: flex; flex-direction: column; gap: 6px; font-size: 0.93rem; color: var(--soft); border-top: 1px dashed var(--rule); padding-top: 14px; }
.notes .ipa { color: var(--ink); }
.notes .red { color: var(--red); }
.margin { border-left: 1px dashed var(--rule); padding: clamp(18px, 3.4vw, 40px) 24px; display: flex; flex-direction: column; gap: 18px; }
.grade { position: relative; width: 116px; height: 86px; display: grid; place-items: center; color: var(--red); }
.grade svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.grade .big-score { font: 600 2.7rem/1 var(--pen); transform: rotate(-4deg); }
.grade .big-score small { font-size: 1.1rem; margin-left: 2px; }
.dims { display: grid; gap: 6px; font-size: 0.9rem; }
.dim { display: flex; justify-content: space-between; gap: 12px; color: var(--soft); border-bottom: 1px dotted var(--rule); padding-bottom: 4px; }
.dim b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.stage-foot { padding: 12px clamp(16px, 3vw, 28px); border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--faint); }

/* Data */
.figure { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.bars { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px 18px; align-items: center; }
@media (max-width: 600px) { .bars { grid-template-columns: 1fr; gap: 6px; } .bars .who { margin-top: 10px; } }
.bars .who { font-size: 0.95rem; }
.bars .who small { display: block; color: var(--faint); font-size: 0.82rem; }
.pair-bars { display: grid; gap: 5px; }
.hb { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.hb span { height: 12px; background: var(--tint); position: relative; }
.hb span i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0); background: var(--ink); }
.hb.free span i { background: var(--faint); }
.key { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--soft); }
.key span::before { content: ""; display: inline-block; width: 12px; height: 10px; background: var(--ink); margin-right: 7px; }
.key span.free::before { background: var(--faint); }

.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 11px 14px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; font-size: 0.88rem; color: var(--soft); border-bottom-color: var(--ink); }
td code, th code { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }

dl.defs { margin: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px 24px; }
dl.defs dt { font-weight: 600; }
dl.defs dd { margin: 0; color: var(--soft); }
@media (max-width: 600px) { dl.defs { grid-template-columns: 1fr; gap: 4px; } dl.defs dd { margin-bottom: 12px; } }

/* Code */
.code { position: relative; background: var(--code); color: var(--code-ink); border-radius: 4px; min-width: 0; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 0.84rem; line-height: 1.7; }
.code .c { color: var(--code-dim); }
.code .k { color: var(--code-key); }
.code .s { color: var(--code-str); }
.code .p { color: var(--code-dim); user-select: none; }
.copy { position: absolute; top: 8px; right: 8px; background: var(--sheet); color: var(--soft); border: 1px solid var(--rule); border-radius: 3px; padding: 3px 9px; font: 500 0.75rem var(--sans); cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 600px) { .code:not(.install):has(.copy) pre { padding-top: 44px; } }

/* Tabs */
.tabs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tablist { display: flex; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.tablist button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 6px 0; color: var(--soft); font: 500 0.92rem var(--sans); cursor: pointer; }
.tablist button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 18px; padding: 30px 0; border-top: 1px solid var(--rule); }
.step .n { font: 500 0.95rem var(--mono); color: var(--faint); padding-top: 3px; }
.step-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.step-body > p { color: var(--soft); }

/* Notes */
.note { border-left: 3px solid var(--ink); padding: 4px 0 4px 16px; color: var(--soft); }
.note strong { color: var(--ink); }
.note.red { border-left-color: var(--red); }

/* Plans */
.plans { border-top: 1px solid var(--ink); }
.plan { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px 28px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.plan.pick { background: linear-gradient(90deg, var(--mark), transparent 70%); }
.plan h3 { font-size: 1.15rem; }
.plan p { color: var(--soft); font-size: 0.94rem; }
.price { font: 600 1.5rem/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.price small { font-weight: 400; font-size: 0.88rem; color: var(--soft); letter-spacing: 0; }
@media (max-width: 720px) { .plan { grid-template-columns: 1fr; } }

/* Forms */
.form { display: grid; gap: 18px; max-width: 560px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; font-size: 0.95rem; }
.hint { font-size: 0.85rem; color: var(--soft); }
input[type="text"], input[type="email"], input[type="number"], select, textarea { font: 400 1rem var(--sans); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-bottom-color: var(--soft); border-radius: 3px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; }
textarea { min-height: 130px; resize: vertical; }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radios label, .check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 0.97rem; cursor: pointer; }
.radios input, .check input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.answer { border-left: 3px solid var(--red); padding: 6px 0 6px 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.answer .code { align-self: stretch; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { color: var(--red); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.side { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--tint); border-radius: 4px; }

/* Calculator */

/* FAQ */
.faq { border-top: 1px solid var(--rule); max-width: var(--measure); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-weight: 500; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 13px; font-size: 1.3rem; color: var(--faint); }
.faq details[open] summary::after { content: "\2212"; }
.faq .a { padding: 0 0 18px; color: var(--soft); display: flex; flex-direction: column; gap: 10px; }

/* Docs */
.docs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 56px; padding-block: 44px 88px; }
@media (max-width: 880px) { .docs { grid-template-columns: 1fr; gap: 24px; } }
.docs-nav { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 20px; font-size: 0.93rem; max-height: calc(100vh - 100px); overflow-y: auto; }
@media (max-width: 880px) { .docs-nav { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 18px; } }
.docs-nav h4 { margin: 0 0 6px; font-size: 0.8rem; font-weight: 600; color: var(--faint); }
.docs-nav ul { list-style: none; padding: 0; gap: 0; }
.docs-nav a { display: block; padding: 4px 0 4px 12px; text-decoration: none; color: var(--soft); border-left: 2px solid transparent; }
.docs-nav a:hover { color: var(--ink); }
.docs-nav a[aria-current="page"] { color: var(--ink); border-left-color: var(--red); }
.doc { display: flex; flex-direction: column; gap: 18px; max-width: var(--measure); min-width: 0; }
.doc h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); }
.doc h2 { font-size: 1.4rem; margin-top: 26px; }
.doc .lead { font-size: 1.12rem; }
.doc table { font-size: 0.9rem; }
.doc td:first-child { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; border-top: 1px solid var(--rule); padding-top: 18px; font-size: 0.95rem; }
.pager a { display: flex; flex-direction: column; text-decoration: none; }
.pager a.next { text-align: right; margin-left: auto; }
.pager small { color: var(--faint); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding-block: 44px 36px; font-size: 0.92rem; color: var(--soft); }
.foot { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 760px) { .foot { grid-template-columns: 1fr 1fr; } .foot > :first-child { grid-column: 1 / -1; } }
.foot h4 { margin: 0 0 10px; font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.foot ul { list-style: none; padding: 0; gap: 6px; }
.foot a { text-decoration: none; color: var(--soft); }
.foot a:hover { color: var(--ink); }
.foot p { max-width: 28em; margin-top: 10px; }
.foot-base { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 0.84rem; color: var(--faint); }

/* Star button (header, hero, footer, closing). site.js fills [data-stars]. */
.star-btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 3px; font: 500 0.88rem/1 var(--sans); color: var(--ink); text-decoration: none; white-space: nowrap; }
.star-btn:hover { color: var(--ink); border-color: var(--ink); }
.star-btn svg { width: 16px; height: 16px; flex: none; }
.stars { font-variant-numeric: tabular-nums; }
.star-btn .stars { border-left: 1px solid var(--rule); padding-left: 8px; margin-left: 1px; color: var(--soft); }
.star-cta .stars { margin-left: 4px; padding: 2px 7px; border-radius: 10px; background: var(--tint); color: var(--ink); font-size: 0.86rem; }
.btn.star-cta:not(.btn-line) .stars { background: rgba(127, 127, 127, 0.28); color: inherit; }
@media (max-width: 480px) { .site-header .star-btn > span:not(.stars) { display: none; } }
.text-link { font-weight: 500; text-decoration-color: var(--rule); }
.text-link:hover { text-decoration-color: var(--red); }

/* Home: hero */
.hero { padding-block: clamp(32px, 4.5vw, 60px) clamp(48px, 7vw, 88px); }
.hero-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px clamp(28px, 5vw, 72px); align-items: end; margin-bottom: clamp(24px, 3vw, 36px); }
@media (max-width: 960px) { .hero-top { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: clamp(2.3rem, 5vw, 4.1rem); line-height: 1.02; letter-spacing: -0.035em; }
.hl { background: linear-gradient(transparent 0 60%, var(--mark) 60% 94%, transparent 94%) no-repeat 0 0 / 100% 100%; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hero-side { display: flex; flex-direction: column; gap: 18px; }
.hero .lead { font-size: clamp(1.08rem, 1.5vw, 1.22rem); }
.code.install pre { padding: 13px 92px 13px 16px; font-size: 0.95rem; }
.code.install .copy { top: 50%; transform: translateY(-50%); right: 10px; }
@media (max-width: 480px) { .code.install pre { font-size: 0.86rem; padding-right: 66px; } }

/* Demo: the code under the sheet */
.sheet { border-color: var(--ink); box-shadow: 6px 6px 0 var(--tint), 0 30px 60px -40px rgba(0, 0, 0, 0.35); }
.sheet-code { background: var(--paper); color: var(--ink); border-radius: 0 0 3px 3px; padding: 6px clamp(10px, 2.4vw, 22px) 14px; }
.sheet-code .code { background: transparent; }
.sheet-code .code pre { padding-inline: 4px 64px; }
.sheet-code figcaption { padding: 0 4px; font-size: 0.84rem; color: var(--faint); }
@media (prefers-reduced-motion: no-preference) {
  .grade.draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pen-draw 0.7s ease-out 0.15s forwards; }
  .grade.draw .big-score { animation: pen-in 0.4s ease-out both; }
}
@keyframes pen-draw { to { stroke-dashoffset: 0; } }
@keyframes pen-in { from { opacity: 0; transform: rotate(-4deg) scale(0.92); } }

/* Dark band: tokens redefined locally so code, tabs and buttons follow. */
.night, .sheet-code {
  --paper: #141413; --sheet: #1C1C1B; --tint: #232322; --ink: #EDEDEA; --soft: #A9A9A4; --faint: #8A8A85;
  --rule: #31312F; --red: #FF6B5F; --mark: #5C4F0E; --button: #EDEDEA; --button-ink: #141413;
  --code: #1C1C1B; --code-ink: #E4E4E0; --code-dim: #8D8D88; --code-key: #8CC2F2; --code-str: #E8B37A; color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .night, :root:not([data-theme="light"]) .sheet-code { --paper: #0A0A0A; --sheet: #151514; --code: #151514; } }
:root[data-theme="dark"] .night, :root[data-theme="dark"] .sheet-code { --paper: #0A0A0A; --sheet: #151514; --code: #151514; }
.night { background: var(--paper); color: var(--ink); border-top: 0; }
.night .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
@media (max-width: 960px) { .night .split { grid-template-columns: 1fr; } }
.night dl.defs { grid-template-columns: 150px minmax(0, 1fr); font-size: 0.95rem; }
@media (max-width: 600px) { .night dl.defs { grid-template-columns: 1fr; } }
.code-stack { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.code-stack .code pre { font-size: 0.86rem; padding: 20px 22px; }
.eval { display: flex; flex-direction: column; gap: 12px; }

/* Why it matters */
.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px clamp(24px, 4vw, 56px); margin-top: 14px; }
@media (max-width: 860px) { .why-grid { grid-template-columns: 1fr; } }
.why-grid > div { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 2px solid var(--ink); }
.why-grid p { color: var(--soft); }
.why-note { max-width: 52em; }

/* Agreement */
@media (min-width: 821px) { .agree { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.agree .figure { padding-top: 6px; }
.limits-line { border-left: 3px solid var(--red); padding-left: 14px; }

/* Cases: the question in the speaker's voice, the answer in prose, the recipe in red pen. */
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(28px, 5vw, 72px); }
.case { display: flex; flex-direction: column; gap: 10px; padding: 28px 0 30px; border-top: 1px solid var(--rule); }
.case .ask { font: italic 400 clamp(1.3rem, 2.2vw, 1.6rem)/1.3 var(--book); text-wrap: balance; margin: 0 0 4px; }
.case h3 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.case p { margin: 0; color: var(--soft); }
.case .ask { color: var(--ink); }
.pen { font: 500 1.4rem/1.2 var(--pen); color: var(--red); transform: rotate(-1.5deg); transform-origin: left center; }
.case .pen { margin-top: 2px; }
@media (max-width: 760px) { .cases { grid-template-columns: 1fr; } }

/* Licence */
.licence-card { position: relative; border: 1px solid var(--ink); border-radius: 4px; padding: clamp(24px, 5vw, 56px); background: var(--sheet); box-shadow: 6px 6px 0 var(--mark); }
.licence-card .prose { max-width: 760px; }
.licence-pen { position: absolute; right: clamp(16px, 4vw, 48px); top: clamp(14px, 3vw, 32px); font-size: 1.7rem; transform: rotate(-6deg); }
@media (max-width: 760px) { .licence-pen { position: static; transform: rotate(-2deg); margin-top: 18px; } }

/* Closing */
.closing .wrap { align-items: center; text-align: center; }
.closing .lead { max-width: 36em; }
.closing .actions { justify-content: center; }

/* Footer star */
.foot-star { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.foot-star span:not(.stars) { font-size: 0.86rem; }
.foot .star-btn { color: var(--ink); }

/* Motion: sections rise once into view; bars and highlighter draw. Nothing moves with reduced motion or without JS. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .reveal .hb span i { width: 0; transition: width 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s; }
  .js .reveal.in .hb span i { width: var(--w); }
  .hl { animation: sweep 0.9s cubic-bezier(0.3, 0.6, 0.2, 1) 0.35s both; }
  .btn, .star-btn, .copy { transition: opacity 0.15s, border-color 0.15s, color 0.15s; }
}
@keyframes sweep { from { background-size: 0 100%; } }
.answer:focus { outline: none; }

/* Try it: the sentence is the exercise, the margin holds the pen. One button, the score lands where it was. */
.try { padding-block: clamp(28px, 5vw, 64px) clamp(48px, 7vw, 88px); display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 28px); }
.try-title { font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.15; letter-spacing: -0.022em; max-width: 26em; }
.try-sheet { margin: 0; }
.try-head { align-items: center; flex-wrap: nowrap; padding-block: 8px; }
.try-nav { display: flex; align-items: center; gap: 6px; margin-left: -8px; }
.try-arrow { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--soft); cursor: pointer; }
.try-arrow:hover { color: var(--ink); background: var(--tint); }
.try-arrow svg { width: 20px; height: 20px; }
.try-nav .stage-label { min-width: 8.5em; text-align: center; white-space: nowrap; }
.try-own { white-space: nowrap; }
.try-own { background: none; border: 0; padding: 8px 0; font: 500 0.92rem var(--sans); color: var(--soft); cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.try-own:hover { color: var(--ink); text-decoration-color: var(--red); }
.try-body { grid-template-columns: minmax(0, 1fr) 270px; }
.try .reading { justify-content: center; gap: 16px; padding: clamp(22px, 4.5vw, 56px) clamp(18px, 4vw, 48px); min-height: clamp(220px, 26vw, 300px); overflow-x: clip; }
.try-text, .try-input { font: 400 clamp(1.7rem, 4.4vw, 2.7rem)/1.9 var(--book); letter-spacing: -0.005em; color: var(--ink); text-wrap: pretty; overflow-wrap: anywhere; }
.try-text { margin: 0; padding-top: 0.2em; }
[data-state="result"] .try-text { line-height: 2.15; }
.try-input { display: block; width: 100%; resize: none; border: 0; border-bottom: 1.5px dashed var(--soft); border-radius: 0; background: transparent; padding: 0.15em 0; field-sizing: content; min-height: 2.2em; }
.try-input:focus { outline: none; border-bottom-color: var(--red); }
.try-input::placeholder { color: var(--faint); }
.try .notes { margin-top: 4px; }
.try-text .word .pen { font-size: 1.35rem; bottom: 74%; }
.try-text .word .pen.ipa { font-size: 1.05rem; bottom: 80%; }

.try-margin { align-items: stretch; justify-content: center; padding: clamp(22px, 3.4vw, 40px) 24px; }
.try-act { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.try-status { font-size: 0.98rem; color: var(--ink); min-height: 1.6em; max-width: 17em; font-variant-numeric: tabular-nums; }
.try-size, .try-file { font-size: 0.84rem; color: var(--faint); max-width: 18em; }
.try-file { position: relative; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; cursor: pointer; padding: 4px 0; }
.try-file:hover { color: var(--ink); text-decoration-color: var(--red); }
.try-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; width: 100%; }
.try-file:focus-within { outline: 2px solid var(--red); outline-offset: 3px; }
[data-state="recording"] .try-file, [data-state="analysing"] .try-file, [data-state="analysing"] .try-size { display: none; }
.try-bar { width: 100%; max-width: 200px; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.try-bar > div { height: 100%; width: 0; background: var(--red); transition: width 0.2s; }
.try-ask { display: flex; flex-direction: column; gap: 10px; font-size: 0.9rem; color: var(--soft); }
.try-ask-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.try-ask .btn { padding: 8px 12px; font-size: 0.88rem; }

/* The Record button: a red disc in a ring. Recording: square icon, the ring fills over 20 s, the halo follows the voice. */
.rec { --size: 96px; --level: 0; --elapsed: 0; position: relative; width: var(--size); height: var(--size); border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--red); color: var(--rec-ink); display: grid; place-items: center; touch-action: manipulation;
  box-shadow: 0 0 0 calc(4px + var(--level) * 18px) var(--red-soft), 0 10px 24px -14px var(--red); transition: transform 0.15s, box-shadow 0.08s linear; }
.rec:hover { transform: scale(1.03); }
.rec:active { transform: scale(0.97); }
.rec:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.rec-icon { width: 34px; height: 34px; background: currentColor; mask: var(--mic) center / contain no-repeat; -webkit-mask: var(--mic) center / contain no-repeat;
  --mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8.5' y='2.5' width='7' height='12' rx='3.5'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
[data-state="recording"] .rec-icon { width: 28px; height: 28px; mask: none; -webkit-mask: none; border-radius: 4px; }
.rec-ring { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; overflow: visible; }
.rec-ring circle { fill: none; stroke-width: 2.5; }
.rec-track { stroke: transparent; }
.rec-prog { stroke: var(--red); stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--elapsed)); stroke-linecap: round; }
[data-state="recording"] .rec-track { stroke: var(--rule); }
.rec[disabled] { cursor: progress; opacity: 1; }
[data-state="analysing"] .rec { background: var(--red-soft); color: var(--red); box-shadow: none; transform: none; }
[data-state="analysing"] .rec-icon { mask: none; -webkit-mask: none; width: 12px; height: 12px; border-radius: 50%; }
[data-state="analysing"] .rec-prog { stroke-dasharray: 0.22 0.78; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  [data-state="analysing"] .rec-ring { animation: rec-spin 1.1s linear infinite; }
  [data-state="result"] .try-text .word.bad { animation: mark-in 0.35s ease-out both; animation-delay: calc(0.35s + var(--i, 0) * 0.12s); }
  [data-state="result"] .try-text .pen { animation: pen-in 0.4s ease-out both; animation-delay: calc(0.5s + var(--i, 0) * 0.12s); }
  .try-grade:not([hidden]) .dims { animation: fade-in 0.4s ease-out 0.5s both; }
  .try .player:not([hidden]), .try .notes:not([hidden]) { animation: fade-in 0.35s ease-out both; }
}
@keyframes rec-spin { to { transform: rotate(270deg); } }
@keyframes mark-in { from { text-decoration-color: transparent; } }
@keyframes fade-in { from { opacity: 0; } }

.try-grade { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.try-grade .dims, .try-grade .try-again { align-self: stretch; }
.try-again { gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.btn.try-again .rec-dot { box-shadow: 0 0 0 2px var(--button-ink); }
.try-foot { color: var(--soft); }

@media (max-width: 720px) {
  .try-body { grid-template-columns: minmax(0, 1fr); }
  .try .reading { min-height: 0; padding-block: 26px 22px; }
  .try-nav .stage-label { min-width: 0; }
  .try-head { gap: 8px; padding-inline: 12px 16px; }
  .try-nav { margin-left: 0; gap: 0; }
  .try-arrow { width: 36px; height: 36px; }
  .try-own { font-size: 0.86rem; }
  .try-text, .try-input { font-size: clamp(1.6rem, 7.4vw, 2.1rem); }
  .sheet-body .try-margin { flex-direction: column; align-items: stretch; padding-block: 26px 30px; }
  .try-grade { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
  .try-grade .dims { flex: 1 1 140px; }
  .try-grade .try-again { flex: 1 1 100%; padding-block: 14px; }
}

/* How it fits: three boxes, two arrows, vertical on a phone */
.distil { display: flex; align-items: stretch; gap: 10px; max-width: 900px; margin-block: 8px; }
.distil-box { flex: 1 1 0; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--ink); border-radius: 4px; background: var(--sheet); font-size: 0.92rem; color: var(--soft); }
.distil-box b { color: var(--ink); font-weight: 600; font-size: 1rem; margin-bottom: 2px; }
.distil-page { border-color: var(--red); box-shadow: 4px 4px 0 var(--red-soft); }
.distil-page b { color: var(--red); }
.distil-arrow { flex: 0 0 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--soft); text-align: center; }
.distil-arrow svg { width: 60px; height: 24px; }
.distil-arrow span { font: 500 1.08rem/1.1 var(--pen); color: var(--red); }
@media (max-width: 720px) {
  .distil { flex-direction: column; }
  .distil-arrow { flex: none; flex-direction: row; gap: 10px; padding-left: 18px; justify-content: flex-start; }
  .distil-arrow svg { transform: rotate(90deg); width: 32px; }
}
.distil-table { max-width: 900px; }
.try-fine { padding-block: 28px 48px; border-top: 1px solid var(--rule); }
.try-fine p { max-width: var(--measure); font-size: 0.86rem; color: var(--faint); }
.device .wrap { display: flex; flex-direction: column; gap: 22px; }
.device .lead { max-width: var(--measure); }
.device .prose { max-width: var(--measure); }
/* Before the model is ready, the button fetches it: a down arrow, the ring fills with the download. */
[data-model="none"] .rec-icon, [data-model="loading"] .rec-icon { --mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3.5v12M6.5 10.5 12 16l5.5-5.5M5 20.5h14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
[data-model="loading"] .rec { background: var(--red-soft); color: var(--red); box-shadow: none; cursor: progress; }
[data-model="loading"] .rec:hover, [data-model="loading"] .rec:active { transform: none; }
[data-model="loading"] .rec-track { stroke: var(--rule); }
[data-state="recording"] .try-size, [data-model="loading"] .try-file { display: none; }
@media (prefers-reduced-motion: no-preference) {
  [data-model="ready"][data-state="idle"] .rec { animation: rec-ready 0.6s ease-out 1; }
  @keyframes rec-ready { 0% { box-shadow: 0 0 0 0 var(--red-soft); } 60% { box-shadow: 0 0 0 16px var(--red-soft); } 100% { box-shadow: 0 0 0 4px var(--red-soft); } }
}

/* Refresh, 2026-11: rounded frame, glass header, alternating backgrounds, maintainer block */
body { font-size: 1.0625rem; }
h1, h2 { letter-spacing: -0.04em; }

/* Header: glass, pill links */
.site-header { background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px); border-bottom-color: transparent; box-shadow: 0 1px 0 var(--rule); }
.nav { gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 9px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--tint); }
.nav a[aria-current="page"] { text-decoration: none; background: var(--tint); }
.hf-btn { display: inline-grid; place-items: center; width: 36px; height: 34px; border-radius: 9px; border: 1px solid var(--rule); }
.hf-btn:hover { border-color: var(--ink); }
.hf-btn svg { width: 19px; height: 19px; }
.site-header .wrap { gap: 8px; }
.star-btn { border-radius: 9px; height: 34px; }
@media (max-width: 820px) { .site-header .hf-btn { margin-left: auto; } .site-header .star-btn { margin-left: 0; } }

/* Buttons */
.btn { border-radius: 11px; padding: 13px 20px; font-weight: 600; letter-spacing: -0.01em; transition: transform .15s, box-shadow .15s; }
.btn:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .45); }
.btn-line:hover { box-shadow: none; }
.code { border-radius: 11px; }

/* Hero: centred, bigger, one idea */
.hero { padding-top: clamp(56px, 8vw, 104px); }
.hero-top { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 22px; margin-bottom: clamp(40px, 5vw, 64px); }
.hero h1 { font-size: clamp(2.6rem, 6.8vw, 5.2rem); line-height: .98; max-width: 12.5em; }
.hero-side { display: flex; flex-direction: column; align-items: center; gap: 22px; max-width: 40em; }
.hero-side .install { order: 3; }
.hero-side .actions { justify-content: center; }

/* The sheet: a real sheet of paper */
.sheet { border: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 1px var(--rule), 0 2px 4px rgba(0,0,0,.03), 0 40px 90px -40px rgba(0, 0, 0, .35); }
.sheet-code { border-radius: 0; }
.seg button { border-radius: 8px; }

/* Rhythm: alternate backgrounds instead of rules */
.block { border-top: 0; padding-block: clamp(72px, 10vw, 120px); }
.block.why, .block#cases, .block.closing { background: var(--tint); }
h2.display { font-size: clamp(2.1rem, 4.8vw, 3.5rem); }
.why-grid > div { border-top: 0; padding: 26px; border-radius: 16px; background: var(--paper); box-shadow: 0 0 0 1px var(--rule); }
.distil-box { border-radius: 14px; }
.case { border-radius: 16px; background: var(--paper); box-shadow: 0 0 0 1px var(--rule); padding: 26px; transition: transform .2s, box-shadow .2s; }
.case:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--rule), 0 24px 50px -30px rgba(0,0,0,.3); }
.hb span, .hb span i { border-radius: 6px; }
.licence-card { border-radius: 22px; }

/* Maintainer */
.maker { position: relative; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center; max-width: 880px; }
.maker img { width: 160px; height: 160px; object-fit: cover; border-radius: 20px; transform: rotate(-2deg); box-shadow: 0 0 0 6px var(--paper), 0 0 0 7px var(--rule), 0 24px 50px -24px rgba(0,0,0,.4); }
.maker-quote { font-size: clamp(1.25rem, 2.2vw, 1.55rem); line-height: 1.4; letter-spacing: -0.02em; font-weight: 500; margin-bottom: 14px; }
.maker b { color: var(--ink); }
.maker-pen { position: absolute; left: 118px; top: -14px; transform: rotate(-8deg); font-size: 1.5rem; }
@media (max-width: 640px) { .maker { grid-template-columns: 1fr; } .maker img { width: 120px; height: 120px; } .maker-pen { left: 96px; } }
