/* One mobile-first stylesheet for the PWA shell, confirm and admin pages
   (plan assumption 8): the "English with Joyy" design system (warm cream and
   ink, one orange for the key action), Plus Jakarta Sans for display type, Mona
   Sans for the rest (both bundled, ADR 0040),
   CSS variables, light only, 44px touch targets, safe-area insets, one column
   under 768px and a sidebar + content grid above. No framework, no icon
   font, no fixed widths over 320px. */

/* Mona Sans variable, the UI face (OFL-1.1, see LICENSES.md), self-hosted; the
   unicode-range split means a Latin-only page never fetches the Vietnamese subset. */
@font-face {
  font-family: "Mona Sans";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/static/fonts/mona-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Mona Sans";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/static/fonts/mona-sans-vietnamese-wght-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* Plus Jakarta Sans variable, the display face (OFL-1.1, see LICENSES.md). */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-vietnamese-wght-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  color-scheme: light;
  /* Colour: the design's semantic set. Ink and cream carry the page; the one
     brand orange is for the key action on a screen (and the current marker),
     never for body text or links (orange on white is 2.1:1). */
  --fg: #241C14; /* Ink */
  --page: #FCFAF6; /* Backgrounds / Primary: the page */
  --bg: #FFFFFF; /* Backgrounds / Secondary: cards, sheets, bars */
  --surface: #F5F1EA; /* Backgrounds / Tertiary: wells, hints, table heads */
  --fill: rgb(36 28 20 / .07); /* Fills / Primary: a quiet control on cream */
  --muted: #786E63; /* Labels / Secondary */
  --placeholder: #A69B8D; /* Labels / Tertiary: placeholders, disabled */
  --border: #EAE4DA; /* Separators */
  --border-strong: #D9D0C3; /* Separators / Opaque */
  --field-border: #A69B8D; /* An input's outline: 2.7:1, not the 1.5:1 of a divider */
  --accent: #F79F1E; /* Brand */
  --accent-fg: #241C14; /* Labels / On Brand: ink on orange is 7.9:1; white would be 2.1 */
  --accent-soft: #FCECD0; /* Brand Soft */
  --accent-ink: #8F5200; /* Brand as text on Brand Soft or white (5.4:1 or better) */
  --cream: #F9F6D7; /* Cream: highlights */
  --ok: #241C14;
  --danger: #F75C48; /* Coral: fills, icons and outlines */
  --danger-soft: #FFE4DD; /* Coral Soft (the brand's light coral #FFB5A6 gives --danger-ink only 3.3:1, so it is not used) */
  --blue: #1D56BC; /* Brand blue: token only, not used in the UI yet */
  --blue-soft: #CDE2FC; /* Brand blue soft: token only */
  --danger-ink: #C2321F; /* Coral as text (5.6:1 on white; the brand coral is 3.2) */
  /* Radius scale S 8 · M 12 · L 16 · XL 20 · XXL 24 · Full. */
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 20px;
  --r-xxl: 24px;
  --radius: var(--r-m);
  /* Effects: Shadow/Card and Shadow/Floating. */
  --shadow-card: 0 1px 2px rgb(36 28 20 / .04), 0 4px 16px rgb(36 28 20 / .06);
  --shadow-float: 0 2px 6px rgb(36 28 20 / .06), 0 12px 32px rgb(36 28 20 / .12);
  --gap: 1rem;
  /* Type, from the design's text styles (iOS sizes, in rem so they follow the
     user's font size): Large Title 34, Title1 28, Title2 22, Title3 20,
     Headline and Body 17, Callout 16, Subhead 15, Footnote 13, Caption 12.
     Plus Jakarta Sans carries the emotional moments (greeting, lesson and week
     titles, big numbers); everything that works is the UI face. */
  --fs-large: 2.125rem;
  --fs-title: 1.75rem;
  --fs-card-title: 1.375rem;
  --fs-h2: 1.0625rem;
  --fs-stat: 3rem;
  --fs-body: 1.0625rem;
  --fs-sub: .9375rem;
  --fs-foot: .8125rem;
  --fs-cap: .75rem;
  --space-banner: 1rem;
  --space-card: 1.25rem; /* 4pt grid: 20 */
  --tap: 44px;
  --font: "Mona Sans", system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-display: "Plus Jakarta Sans", "Mona Sans", system-ui, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Motion (§16.1): dependency-free tokens. Durations collapse to 0 under
     prefers-reduced-motion (below), which turns every transition off. */
  --dur-fast: .12s;
  --dur-base: .2s;
  --dur-slow: .35s;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.2, 1.2, .3, 1);
  --ease-in: cubic-bezier(.5, 0, .9, .4);
}

/* Reduced motion: no transitions, no shimmer, no view-transition animation.
   The app stays fully usable; only the motion goes. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0s;
    --dur-base: 0s;
    --dur-slow: 0s;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  .skeleton::after,
  .notice {
    animation: none !important; /* after their definitions, so the cascade cannot re-enable them */
  }
}

/* Same-document route changes cross-fade via the native View Transitions API
   (main.js). Scoped to root so nothing else is captured. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--dur-base);
  animation-timing-function: var(--ease-out);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--fg);
  background: var(--page);
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

main {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: calc(var(--gap) + var(--safe-top)) calc(var(--gap) + var(--safe-right)) calc(var(--gap) + var(--safe-bottom)) calc(var(--gap) + var(--safe-left));
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 var(--gap); }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .25rem; }
p { margin: 0 0 var(--gap); }
/* Orange is not a text colour (2.1:1 on white): links are ink, underlined. */
a { color: var(--fg); text-underline-offset: .18em; }
.muted, dt { color: var(--muted); }
dt { font-size: .9rem; }
dd { margin: 0 0 .75rem; word-break: break-word; }
code { font-size: .95em; }
img, audio, video { max-width: 100%; }
audio { width: 100%; min-height: var(--tap); }
/* Elements in the fade list below leave through a transition, so they are
   excluded here and hidden by their own rule at the end of this file. */
[hidden]:not(:is(.notice, .sh-hint, .account-pop, .rec-done, .rec-review)) { display: none !important; }

/* Forms: full width on phones, touch-sized controls. */
form { display: grid; gap: .75rem; margin: 0 0 var(--gap); }
label { display: grid; gap: .25rem; }
input, select, textarea, button, .button {
  font: inherit;
  min-height: 44px;
  border-radius: var(--radius);
}
input, select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--field-border);
}
::placeholder { color: var(--placeholder); opacity: 1; }
textarea { min-height: 6rem; resize: vertical; }
select[multiple] { min-height: 8rem; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0 1.25rem;
  color: var(--accent-fg);
  background: var(--accent);
  border: 1px solid var(--accent);
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary { color: var(--fg); background: var(--fill); border-color: transparent; }
button.danger { color: #fff; background: var(--danger-ink); border-color: var(--danger-ink); }
button:disabled { opacity: .5; cursor: not-allowed; }
/* Ink, not orange: the ring has to read on cream and on the orange button itself. */
:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 var(--gap); }
/* The sign-in password row: the field and its Show/Hide button (Plan E). */
.field-row { display: flex; gap: .5rem; align-items: stretch; }
.field-row input { flex: 1; }
.field-row .reveal { white-space: nowrap; }
/* Loading skeletons (Plan E): a compositor-only shimmer (transform on a
   pseudo-element), switched off under reduced motion. */
.skeletons { display: grid; gap: .5rem; margin: 0 0 var(--gap); }
.skeleton { position: relative; overflow: hidden; height: 1.25rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--bg), transparent); transform: translateX(-100%); animation: skeleton-shimmer calc(var(--dur-slow) * 4) var(--ease-in) infinite; }
.skeleton:first-child { width: 40%; }
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }
/* The quiz (Plan Q). */
.quiz .prompt { font-size: 1.05rem; }
.quiz .option { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .5rem; }
.quiz .option .key { font-weight: 700; color: var(--muted); min-width: 1rem; }
.quiz .option.correct { border-color: var(--ok); }
.quiz .option.wrong { border-color: var(--danger); }
.quiz .notice.ok { border-color: var(--ok); }
.quiz .notice.wrong { border-color: var(--danger); }
.review-list { padding-left: 1.25rem; }
/* The speaking activity (Plan SPK). */
.structure { padding-left: 1.25rem; }
.notes textarea { min-height: 5rem; }
.results-speaking { margin-top: var(--gap); }

/* Lists and cards. */
ul.list { list-style: none; margin: 0 0 var(--gap); padding: 0; display: grid; gap: .5rem; }
ul.list > li > a, .card {
  display: block;
  min-height: 44px;
  padding: 14px 16px;
  background: var(--bg);
  border: 0;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  color: var(--fg);
  text-decoration: none;
}
.badge { display: inline-block; padding: 0 .5rem; border-radius: 999px; font-size: .85rem; background: var(--border); }
.badge.ok { color: var(--bg); background: var(--ok); }
.badges { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.status { min-height: 1.5em; }

/* Admin pages: section nav, role chips, confirmation notice. */
.adminnav { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 var(--gap); border-bottom: 1px solid var(--border); }
.adminnav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 .75rem; text-decoration: none; }
.adminnav a[aria-current="page"] { font-weight: 600; border-bottom: 3px solid var(--accent); }
.adminnav a.back { margin-left: auto; }
.notice { padding: .5rem .75rem; border: 1px solid var(--ok); border-radius: var(--radius); background: var(--surface); animation: notice-in var(--dur-base) var(--ease-out); }
@keyframes notice-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.chips form, td form, li form { display: inline-flex; gap: .25rem; margin: 0; }
.chip { display: inline-flex; align-items: center; }
.addrole, .confirm { display: inline-flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
td .actions { margin: 0; align-items: center; }
.chip-x { min-height: 0; padding: 0 .4rem; margin: 0 .25rem 0 -.25rem; color: var(--danger-ink); background: transparent; border: 0; border-radius: 999px; font-size: 1.1rem; line-height: 1.4; }
.error { color: var(--danger-ink); }
.countdown { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 600; }
.prewrap { white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; margin: 0 0 var(--gap); display: block; overflow-x: auto; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); }
/* Narrow content areas (a phone, or a tablet beside the sidebar): a table.stack reads as one card per row (cells carry data-label). Left
   as a table, the Actions column of People sits off-screen. */
@container content (width < 40rem) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack { overflow-x: visible; }
  table.stack thead { display: none; }
  table.stack tr { padding: .5rem 0; border-bottom: 1px solid var(--border); }
  table.stack td { padding: .25rem .5rem; border: 0; }
  table.stack td:empty { display: none; }
  table.stack td::before { content: attr(data-label); display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
}

/* App shell: nav is a top bar on phones. */
body.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: calc(.5rem + var(--safe-top)) calc(var(--gap) + var(--safe-right)) .5rem calc(var(--gap) + var(--safe-left));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.sidebar a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .75rem; border-radius: var(--radius); }
.sidebar a[aria-current="page"] { background: var(--bg); font-weight: 600; }
.sidebar .who { color: var(--muted); font-size: .9rem; margin-left: auto; }
body.shell:has(.sidebar:not([hidden])) .content { padding-top: var(--gap); }
.build { grid-column: 1 / -1; padding: .5rem calc(var(--gap) + var(--safe-right)) calc(.5rem + var(--safe-bottom)) calc(var(--gap) + var(--safe-left)); color: var(--muted); font-size: .8rem; text-align: right; }

@media (width >= 48rem) {
  body.shell:has(.sidebar:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
    align-items: start;
  }
  .sidebar {
    position: sticky;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    padding: calc(var(--gap) + var(--safe-top)) var(--gap) var(--gap) calc(var(--gap) + var(--safe-left));
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .sidebar .who { margin-left: 0; margin-top: auto; }
  main { padding-left: 2rem; padding-right: calc(2rem + var(--safe-right)); }
  form.inline { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); align-items: end; }
}

/* The page is cream; cards are white and float on it with Shadow/Card, no outline. */
body { background: var(--page); }
body.page main {
  margin: 1.5rem auto;
  max-width: 56rem;
  background: var(--bg);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}
body.shell .content { background: var(--page); }
.sidebar { background: var(--bg); }
/* Plus Jakarta Sans for page titles. */
h1 { font-family: var(--font-display); font-size: var(--fs-title); font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: var(--fs-h2); font-weight: 600; color: var(--fg); }

button, .button { font-weight: 600; border-radius: 999px; transition: filter var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
button:active, .button:active { transform: translateY(1px); }
@media (hover: hover) { button:hover:not(:disabled), .button:hover { filter: brightness(1.1); } }
button.secondary, .button.secondary { background: var(--fill); border: 1.5px solid transparent; color: var(--fg); }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }

.badge { padding: .05rem .6rem; color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
.who .badge, p.who .badge { margin-left: .15rem; }
p.who { color: var(--muted); }

table { border: 1px solid var(--border); border-radius: var(--radius); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); }
@media (hover: hover) { tbody tr:hover { background: var(--surface); } }
td { vertical-align: top; }
th, td button { white-space: nowrap; }
td button, td select { min-height: 36px; padding-left: .75rem; padding-right: .75rem; }
td select { width: auto; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); }
/* The browser draws the check in white on orange (2.1:1); the ink ring keeps it findable. */
input[type="checkbox"]:checked, input[type="radio"]:checked { outline: 1.5px solid var(--fg); outline-offset: 1px; }
label:has(> input[type="checkbox"], > input[type="radio"]) { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); }
fieldset { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0; padding: .25rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
legend { padding: 0 .4rem; color: var(--muted); font-size: .9rem; }
.adminnav { gap: .5rem; }
.adminnav a { color: var(--muted); }
.adminnav a[aria-current="page"] { color: var(--fg); }
/* The nav brand, spacer and the account menu (Plan I). */
.sidebar .brand { font-weight: 700; }
.sidebar .spacer { flex: 1; }
/* The Lessons timeline (Plan I). */
.week > h2 { margin-top: 1.5rem; }
.activities { list-style: none; padding: 0; display: grid; gap: .25rem; }
.activities .badge { margin-left: .25rem; }
.parts { padding-left: 1.25rem; }
.parts .n { display: inline-block; min-width: 1.5rem; color: var(--muted); }
.notice { background: var(--surface); border-color: transparent; }
@media (hover: hover) { ul.list > li > a:hover { box-shadow: var(--shadow-float); } }

dialog.picker { width: min(40rem, calc(100vw - 2rem)); max-height: 85vh; overflow: auto; color: var(--fg, inherit); background: var(--bg, Canvas); border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-float); padding: 1rem; }
dialog.picker::backdrop { background: rgb(36 28 20 / .45); }

/* Shadowing: a 16:9 player, the sentence with the stress and pause guide
   (thick underline main stress, medium other content words, dotted reduced
   function words; marks between words for breaks) and per-word results. */
.video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 var(--gap); background: #000; border-radius: var(--radius); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
select[name="speed"] { width: auto; }
.sentence { font-size: 1.25rem; line-height: 2.2; }
.word { display: inline-block; text-underline-offset: .3em; }
.word.stressed { text-decoration: underline 3px; font-weight: 600; }
.ipa { display: block; font-size: .8rem; line-height: 1.3; color: var(--muted); }
/* Only the word being said is brand gold (text colour, no highlighter fill); the words already said go back to normal.
   .karaoke-done is still set on them, for anything that wants to style them. */
.karaoke-on { color: var(--accent); }
.caption { font-size: 1rem; line-height: 2; color: var(--muted); }
.caption .word { margin-right: .25rem; }
.translation { margin: .35rem 0 0; color: var(--muted); }
/* Shadowing watch/practice, the Sentences panel and Replay (ADR 0026). */
.sentences { margin: 0 0 var(--gap); }
.sent-list { padding-left: 1.25rem; }
.sent-list li.saved { color: var(--muted); }
.sent-list li[aria-current="true"] { font-weight: 600; }
.sent-list .n { display: inline-block; min-width: 1.5rem; color: var(--muted); }
.replay-list { padding-left: 1.25rem; }
.replay-list .n { display: inline-block; min-width: 1.5rem; color: var(--muted); }
.replay-list audio { display: block; margin-top: .25rem; }
/* The editor's read-only karaoke line: the segment's timed words beside the
   editable text input, spaced like .sentence so the ticker can mark the active
   one. Deliberately its own line, not the input's styling. */
.karaoke { font-size: 1rem; line-height: 2.2; margin: .25rem 0 0; color: var(--muted); }

/* The shadowing student's recorder: Record/Stop beside the sentence and the
   countdown while recording. */
.recorder { margin: 0 0 var(--gap); }
.recorder .actions { margin-bottom: .35rem; }
.recorder .countdown { margin: 0; font-size: 1rem; font-weight: 600; }

/* Shadowing editor (ADR 0038): the student's screen with every part a field.
   The video stays in view above one sentence card; the Sentences column
   beside it switches sentences (below the card on a narrow screen). Import
   thumbnails. */
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--gap); margin: 0 0 var(--gap); }
.editor { display: grid; gap: var(--gap); }
@media (min-width: 48rem) {
  .editor { grid-template-columns: minmax(0, 3fr) minmax(14rem, 1fr); align-items: start; }
}
.editor-main .sh-media { padding-block: 8px; }
.editor-card label { display: block; margin-block: 8px; }
.editor-card input { inline-size: 100%; }
.editor-card .sentence { margin-block: 12px; }
.editor-sentences .editor-list { list-style: none; margin: 8px 0 0; padding: 0; }
/* The generic .sent-list li is a two-column grid (number, text) for the replay list; here one button holds both, so a plain block lets it fill the row. */
.editor-sentences .editor-list li { display: block; margin: 0; padding: 0; }
/* The import wizard's range: a typed time next to the button that takes it from the player. */
.range-controls label { display: inline-flex; align-items: center; gap: 8px; }
.range-controls input.hms { inline-size: 7rem; font-variant-numeric: tabular-nums; }
.sent-pick { display: flex; justify-content: flex-start; align-items: flex-start; gap: 8px; inline-size: 100%; margin: 0 0 4px; padding: 8px 10px; text-align: start; background: transparent; border: 1px solid transparent; border-radius: var(--r-m); color: var(--fg); font-weight: 400; }
.sent-pick.current { background: var(--bg); border-color: var(--accent); font-weight: 600; }
.sent-pick .n { flex: 0 0 1.5rem; color: var(--muted); }
/* The sentence wraps onto as many lines as it needs, left aligned beside its number. */
.sent-pick span:not(.n):not(.warn) { flex: 1 1 auto; min-inline-size: 0; white-space: normal; overflow-wrap: anywhere; text-align: start; }
/* The split picker: the sentence as its words. The left half of a word cuts before it, the right half after it; the cut
   edge shows on hover or focus. The halves reach into the gap, so two words meet at its middle and there is no dead zone. */
.split-picker { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: .5rem 0 1rem; font-size: var(--fs-h2); line-height: 1.5; }
.split-word { position: relative; display: inline-block; }
.split-text { pointer-events: none; }
.split-half { position: absolute; top: -.25em; bottom: -.25em; inline-size: calc(50% + .5rem); min-height: 0; min-inline-size: 0; padding: 0; border: 0; border-radius: var(--r-s); background: transparent; cursor: pointer; }
.split-half.before { inset-inline-start: -.5rem; }
.split-half.after { inset-inline-end: -.5rem; }
.split-half:hover { background: var(--accent-soft); }
.split-half::after { content: ""; position: absolute; top: 0; bottom: 0; inline-size: 3px; border-radius: 2px; background: var(--accent); opacity: 0; }
.split-half.before::after { inset-inline-start: .4rem; }
.split-half.after::after { inset-inline-end: .4rem; }
.split-half:hover::after, .split-half:focus-visible::after { opacity: 1; }
.split-half:focus-visible { outline: 2px solid var(--fg); outline-offset: 0; }
.warn { color: var(--muted); font-style: italic; }
img.thumb { display: block; max-width: min(20rem, 100%); height: auto; border-radius: var(--radius); }

/* ---------------------------------------------------------------------------
   Wireframe layout layer — geometry and the component vocabulary from the
   "English with Joyy" Figma wireframe (page "Wireframe", 0:1). Desktop: a
   ~708px content column inside the shell; phone: a 358px column at 390px.
   Components: section.card, .eyebrow, .chip, .segbar, .card-actions, .btn,
   and the .lw-* Lessons tabs.
   --------------------------------------------------------------------------- */
/* Home: one column, and a rail beside it when the content area has room. The
   66rem column is the wireframe's 708 main + 28 gap + 320 rail, centred. */
.content { container: content / inline-size; --measure-activity: 48rem; }
/* A student activity page (quiz, shadowing, speaking) is one centred column, so its
   back link, title and activity share a left edge: 768px for shadowing and speaking (the
   wireframe's video column), 660px for quiz options. Staff and admin pages are untouched. */
.content:has(.quiz .option) { --measure-activity: 41.25rem; }
.content:has(.quiz .option, .speaking) > * { inline-size: min(100%, var(--measure-activity)); margin-inline: auto; }
h1.page-title { font-size: var(--fs-title); line-height: 1.15; margin: 0 0 18px; }
@media (width >= 48rem) { h1.page-title { font-size: var(--fs-large); } }

section.card { padding: var(--space-card); margin: 0 0 16px; background: var(--bg); border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
section.card > h2 { margin: 0 0 6px; font-size: var(--fs-h2); display: flex; align-items: center; gap: 8px; }
section.card > :last-child { margin-bottom: 0; }
section.card > h2 svg { width: 22px; height: 22px; flex: 0 0 22px; }
h1.page-title { font-weight: 600; }
section.card > h2 { font-weight: 600; }

.eyebrow { margin: 0; font-size: var(--fs-cap); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* Status chips: a quiet tint, not a black outline. Overdue is coral, Submitted is ink. */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); border: 0; color: var(--accent-ink); font-weight: 600; font-size: var(--fs-foot); white-space: nowrap; }
.chip.overdue { background: var(--danger-soft); color: var(--danger-ink); }
.chip.submitted { background: var(--fg); color: var(--page); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; color: var(--muted); font-size: var(--fs-foot); }
.date-today { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: var(--fs-cap); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-actions:not(:last-child) { margin-bottom: 4px; }

/* Buttons: the one orange pill is the key action on the screen; Secondary is a quiet fill; Tertiary is text. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 1.0625rem; text-decoration: none; cursor: pointer; }
.btn.secondary { background: var(--fill); color: var(--fg); }
.btn.tertiary { background: transparent; color: var(--fg); padding: 0 10px; }
.btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.btn-label { font-weight: 600; white-space: nowrap; }

.segbar { display: flex; gap: 8px; }
.segbar-item { flex: 1; height: 10px; border-radius: 999px; background: var(--accent-soft); }
.segbar-item.done, .segbar-item.current { background: var(--accent); }

/* ---- Sign-in: the wireframe's centred white "device" card ---- */
/* The wireframe's sign-in is the whole screen: a 334px form centred in it (28px side
   inset on a phone), on the plain page colour, not a card in a tinted page. */
body.shell:has(.signin-card) .content { display: grid; place-items: center; min-block-size: 100dvh; padding: 1.75rem; background: var(--page); }
.signin-card { inline-size: min(20.875rem, 100%); }
.signin-form { display: grid; gap: 1rem; margin: 0; }
.signin-brand { margin: 0; line-height: 0; }
.signin-brand .brand-logo { inline-size: 120px; }
.signin-title { margin: .25rem 0 0; font-family: var(--font-display); line-height: 1.15; font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; }
.signin-sub { margin: 0 0 .5rem; font-size: var(--fs-sub); color: var(--muted); }
.signin-form label { gap: .25rem; font-weight: 600; line-height: 1.3; }
.signin-form input { min-height: 50px; padding: 0 16px; border: 1.5px solid var(--field-border); border-radius: var(--r-l); background: var(--bg); }
.signin-submit { width: 100%; min-height: 52px; border-radius: 999px; }
/* The password row is the bordered field, with the eye toggle inside it.
   Scoped to the sign-in form: the quiz editor also uses .field-row for its
   option rows and needs the plain flex row. */
.signin-form .field-row { align-items: center; gap: 0; padding-right: 4px; background: var(--bg); border: 1.5px solid var(--field-border); border-radius: var(--r-l); }
.signin-form .field-row input { border: 0; background: transparent; min-height: 46px; }
.signin-form .field-row .reveal { flex: 0 0 auto; min-width: 44px; padding: 0 8px; background: transparent; border: 0; color: var(--fg); }
.signin-form .field-row .reveal svg { width: 22px; height: 22px; }
/* Errors, as drawn in the wireframe: a dashed box above the fields for a failed sign-in,
   and per-field messages with dashed outlines when a field is left empty. */
.signin-alert { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 2px dashed var(--danger); border-radius: var(--r-m); background: var(--danger-soft); color: var(--danger-ink); font-weight: 500; }
.signin-alert svg { flex: 0 0 20px; width: 20px; height: 20px; }
.field-error { display: flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600; color: var(--danger-ink); }
.field-error svg { flex: 0 0 16px; width: 16px; height: 16px; }
.signin-form input[aria-invalid="true"], .signin-form .field-row:has(input[aria-invalid="true"]) { border: 2px dashed var(--danger); }
.signin-form .field-row input[aria-invalid="true"] { border: 0; }

/* ---- Lessons: the Week and All lessons tabs ---- */
.chip svg { width: 15px; height: 15px; }
.chip-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.lw-title, .lw-bar, .lw-offline, .lw-tabpanel { width: min(100%, 45rem); margin-inline: auto; }
.lw-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.lw-tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--fill); border-radius: 999px; }
.lw-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: var(--fs-foot); font-weight: 600; box-shadow: none; }
.lw-tab svg { width: 16px; height: 16px; }
.lw-tab.is-on { background: var(--bg); color: var(--fg); box-shadow: var(--shadow-card); }
.lw-tools { display: flex; gap: 8px; }
.lw-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--bg); color: var(--fg); box-shadow: var(--shadow-card); }
.lw-iconbtn:disabled { opacity: .4; box-shadow: none; }
.lw-iconbtn svg { width: 20px; height: 20px; }
.lw-iconbtn .flip { display: inline-flex; transform: scaleX(-1); }
.lw-offline { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--surface); border-radius: var(--r-l); }
.lw-offline > svg { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; }
.lw-offline p { margin: 0; }
.lw-offline-title { font-weight: 600; }

/* Week head, day strip */
.lw-weekhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lw-weektext { min-width: 0; }
.lw-eyebrow { margin: 0 0 4px; font-size: var(--fs-foot); color: var(--muted); }
.lw-theme { margin: 0; font-family: var(--font-display); font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; }
.lw-weeknav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.lw-todaybtn { min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--fg); font-size: var(--fs-foot); font-weight: 600; box-shadow: none; }
.lw-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 8px; margin-bottom: 20px; background: var(--bg); border-radius: var(--r-l); box-shadow: var(--shadow-card); }
.lw-day { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 64px; padding: 6px 0; border: 2px solid transparent; border-radius: var(--r-m); background: transparent; color: var(--fg); box-shadow: none; }
.lw-day[aria-pressed="true"] { border-color: var(--accent); }
.lw-day-letter { font-size: var(--fs-cap); color: var(--muted); }
.lw-day-num { font-size: 1.0625rem; font-weight: 600; }
.lw-day.is-today .lw-day-letter, .lw-day.is-today .lw-day-num { color: var(--accent-ink); }
.lw-mark { width: 16px; height: 3px; border-radius: 2px; background: transparent; }
.lw-mark.mark-progress { background: var(--accent); }
.lw-mark.mark-overdue { background: var(--danger); }

/* The day's lesson */
.lw-lesson { margin-bottom: 24px; }
.lw-lesson + .lw-lesson { padding-top: 20px; border-top: 1px solid var(--border); }
.lw-lesson-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.lw-meta { margin: 0; font-size: var(--fs-foot); color: var(--muted); }
.lw-lesson-title { margin: 0 0 14px; font-family: var(--font-display); font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; }
.lw-done { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--cream); border-radius: var(--r-l); }
.lw-done p { margin: 0; }
.lw-done-title { font-weight: 600; }
.lw-done-icon svg { width: 28px; height: 28px; }
.lw-acts { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.lw-act { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; background: var(--bg); border-radius: var(--r-l); box-shadow: var(--shadow-card); color: var(--fg); text-decoration: none; }
.lw-act > svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); }
.lw-act-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.lw-act-icon svg { width: 18px; height: 18px; }
.lw-act-body { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.lw-act-title { font-weight: 600; }
.chip-new { flex: 0 0 auto; background: var(--accent); color: var(--accent-fg); padding: 2px 10px; font-size: .75rem; }
.lw-act.is-submitted .lw-act-icon { background: var(--fill); color: var(--muted); }
.lw-progress { display: flex; gap: 4px; margin: 0 0 14px; }
.lw-progress-seg { flex: 1; height: 6px; border-radius: 999px; background: var(--accent-soft); }
.lw-progress-seg.done { background: var(--accent); }
.btn.lw-cta { width: 100%; }
.lw-empty { padding: 28px 20px; text-align: center; background: var(--surface); border-radius: var(--r-xl); }
.lw-empty h3 { margin: 0 0 4px; font-size: var(--fs-h2); }
.lw-empty p { margin: 0 0 14px; }
.lw-pill { min-height: 44px; padding: 0 16px; font-size: var(--fs-foot); border: 0; border-radius: 999px; background: var(--bg); color: var(--fg); font-weight: 600; box-shadow: var(--shadow-card); }

/* All lessons */
.lw-chips { display: flex; gap: 8px; margin-bottom: 18px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.lw-chip { flex: 0 0 auto; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--bg); color: var(--fg); font-weight: 600; box-shadow: var(--shadow-card); white-space: nowrap; }
.lw-chip.is-on { background: var(--fg); color: var(--page); }
.lw-chip-count { font-weight: 400; opacity: .7; }
.lw-group { margin-bottom: 18px; }
.lw-grouphead { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; margin-bottom: 10px; border: 0; border-radius: 999px; background: var(--fill); color: var(--fg); font-size: var(--fs-foot); font-weight: 600; box-shadow: none; }
.lw-grouphead svg { width: 16px; height: 16px; }
.lw-grouphead.is-overdue { background: var(--danger-soft); color: var(--danger-ink); }
.lw-grouphead.is-todo { background: var(--accent-soft); color: var(--accent-ink); }
.lw-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lw-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; background: var(--bg); border-radius: var(--r-l); box-shadow: var(--shadow-card); color: var(--fg); text-decoration: none; }
.lw-row-body { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.lw-row-title { font-weight: 600; }
.lw-row-icons { display: inline-flex; gap: 6px; color: var(--muted); }
.lw-row-icons svg { width: 16px; height: 16px; }
.lw-todaycard { padding: 16px; background: var(--bg); border-radius: var(--r-xl); box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
.lw-todaycard .lw-lesson-title { margin-bottom: 12px; }
.lw-more { display: inline-block; margin-top: 10px; font-size: var(--fs-foot); }
.lw-none { text-align: center; }

/* The compact bar floats at the top without taking space, so showing it never moves the page. */
.lw-compact-wrap { position: sticky; top: calc(8px + var(--safe-top)); z-index: 6; height: 60px; margin-bottom: -60px; pointer-events: none; }
.lw-compact { box-sizing: border-box; height: 60px; display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--page); border-radius: var(--r-xl); box-shadow: var(--shadow-float); pointer-events: auto; }
.lw-compact[hidden] { display: none; }
.lw-compact-text { display: grid; flex: 1; justify-items: center; min-width: 0; text-align: center; line-height: 1.25; }
.lw-compact-sub { font-size: var(--fs-foot); color: var(--muted); }
.lw-compact-end { display: flex; justify-content: flex-end; min-width: 44px; }
.lw-compact .lw-todaybtn { background: var(--bg); box-shadow: var(--shadow-card); }
.lw-sentinel { height: 1px; margin-top: -1px; }
/* On a phone the filter chips stay pinned under the compact bar. */
@container content (width < 60rem) {
  .lw-allpane .lw-chips { position: sticky; top: calc(68px + var(--safe-top)); z-index: 5; padding-top: 8px; background: var(--page); }
}
.lw-act-icon.t-speaking { background: var(--cream); }
.lw-act-icon.t-quiz { background: var(--fill); color: var(--muted); }

/* Wide content area: two panes, the list on the left and the selected lesson on the right (the
   desktop design). The container is .content, so the sidebar's 240px counts against the width; keep
   60rem in step with WIDE_REM in views/wide.js. */
.lw-agenda, .lw-detail, .lw-only-wide { display: none; }
/* The design's phone screen has no title (the tabs say where you are); keep it for screen readers there. */
.lw-title { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lw-agrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; border: 0; border-radius: var(--r-l); background: var(--bg); color: var(--fg); text-align: left; box-shadow: var(--shadow-card); }
.lw-agrow.is-on, .lw-row[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
.lw-ag-day { display: grid; justify-items: center; flex: 0 0 44px; line-height: 1.15; }
.lw-ag-wd { font-size: var(--fs-cap); color: var(--muted); }
.lw-ag-num { font-size: 1.25rem; font-weight: 600; }
.lw-ag-body { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.lw-ag-title { font-weight: 600; }
@container content (width >= 60rem) {
  .lw-title { position: static; inline-size: auto; block-size: auto; margin: 0 auto 18px; overflow: visible; clip-path: none; white-space: normal; }
  .lw-title, .lw-bar, .lw-offline, .lw-tabpanel { width: min(100%, 64rem); }
  /* .page-title's own margin would win over .lw-title's auto margin and leave the title at the page's left edge while the panes below are centred. */
  .page-title.lw-title { margin-inline: auto; }
  .lw-week, .lw-all { display: grid; grid-template-columns: minmax(19rem, 25rem) minmax(0, 1fr); gap: 2rem; align-items: start; }
  .lw-strip, .lw-only-narrow { display: none; }
  .lw-agenda { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .lw-only-wide { display: block; }
  .lw-detail { display: block; }
  .lw-panel, .lw-detail { position: sticky; top: 1rem; }
  .lw-lesson { margin-bottom: 0; }
  .lw-compact-wrap { display: none; }
  /* The design's desktop panes: a divider between them and a flat, ruled list on the left, with the chosen row as the one card. */
  .lw-week, .lw-all { gap: 0; }
  .lw-weekpane, .lw-allpane { padding-inline-end: 2rem; border-inline-end: 1px solid var(--border); }
  /* The filter chips wrap in the list pane (the design's second row), not scroll out of sight. */
  .lw-allpane .lw-chips { flex-wrap: wrap; overflow: visible; }
  .lw-panel, .lw-detail { padding-inline-start: 2rem; }
  .lw-agenda, .lw-rows { gap: 0; }
  .lw-agrow, .lw-row { border-radius: 0; background: transparent; box-shadow: none; border-bottom: 1px solid var(--border); }
  .lw-agrow.is-on, .lw-row[aria-current="true"] { border-radius: var(--r-l); border-bottom-color: transparent; background: var(--bg); box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
}

/* Choose a week, Before you start */
.lw-sheet-list { padding-bottom: calc(20px + var(--safe-bottom)); }
.lw-month-name { margin: 18px 0 8px; font-size: var(--fs-foot); font-weight: 600; color: var(--muted); }
.lw-weeklist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lw-weekrow { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; justify-items: start; gap: 2px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; border-radius: var(--r-m); background: var(--bg); color: var(--fg); text-align: left; box-shadow: var(--shadow-card); }
.lw-weekrow[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
.lw-weekrow-label { font-size: var(--fs-foot); color: var(--muted); }
.lw-weekrow-theme { font-weight: 600; }
/* Weeks (staff name the calendar weeks) */
.wk-month h2 { margin: 18px 0 8px; font-size: var(--fs-foot); font-weight: 600; color: var(--muted); font-family: var(--font); }
.wk-list { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.wk-row { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-m); background: var(--bg); box-shadow: var(--shadow-card); }
.wk-row.is-current { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
.wk-label { font-size: var(--fs-foot); color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-row .error { color: var(--danger-ink); }
@media (min-width: 48rem) {
  .wk-row { grid-template-columns: 14rem minmax(0, 1fr) 6rem; align-items: center; }
}
.lw-tips { display: grid; gap: 14px; margin: 18px 0 8px; padding: 0; list-style: none; }
.lw-tips li { display: flex; align-items: flex-start; gap: 12px; }
.lw-tips svg { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; color: var(--muted); }

/* ---- Lesson details: a card of numbered parts ---- */
.lesson-back { margin: 0 0 12px; }
/* Shadowing is a focus view in the wireframe: no navigation while you practise, and a header
   (close, title, activity) in place of the lesson page's own back link and title. */
body.shell:has(.focus-head) .sidebar, body.shell:has(.focus-head) .topbar { display: none; }
body.shell:has(.focus-head):has(.sidebar:not([hidden])) { display: block; }
body.shell:has(.focus-head):has(.sidebar:not([hidden])) .content { padding: 0 1rem calc(1.5rem + var(--safe-bottom)); }
.content:has(.focus-head) .lesson-back, .content:has(.focus-head) .lesson-title, .content:has(.focus-head) .lesson-body { display: none; }
.focus-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: calc(8px + var(--safe-top)) 0 8px; }
/* The close button is a white circle that floats on the cream. */
.focus-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; margin-left: -10px; border-radius: 50%; background: var(--bg); box-shadow: var(--shadow-card); color: var(--fg); }
.focus-close svg { width: 22px; height: 22px; }
.focus-titles { display: grid; min-width: 0; line-height: 1.25; }
.focus-titles h2 { margin: 0; font-size: var(--fs-body); font-weight: 600; }
.focus-titles .muted { font-size: var(--fs-foot); }
.lesson-back a { color: var(--muted); font-weight: 600; text-decoration: none; }
.parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.part { display: flex; align-items: center; gap: 12px; }
/* The part number is a Brand Soft disc, like the saved-sentence chips. */
.part .n { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px; min-width: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: .85rem; }
.part-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.part-title { font-weight: 600; }
/* The lesson details dialog (wireframe): a bottom sheet on a phone, a centred modal from 48rem. */
dialog.sheet { padding: 0; border: 0; border-radius: var(--r-xxl); background: var(--page); color: var(--fg); inline-size: min(27rem, calc(100% - 2rem)); max-block-size: min(90dvh, 40rem); overflow: auto; box-shadow: var(--shadow-float); }
dialog.sheet::backdrop { background: rgb(36 28 20 / .5); }
.sheet-body { display: grid; gap: 12px; padding: 20px 20px 8px; }
.sheet-body > p { margin: 0; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; }
.sheet-close { flex: 0 0 44px; width: 44px; height: 44px; margin: -6px -8px 0 0; padding: 0; background: var(--bg); border: 0; box-shadow: var(--shadow-card); color: var(--fg); }
.sheet-close svg { width: 22px; height: 22px; }
.sheet-body .part { padding: 10px 12px; border: 0; border-radius: var(--r-l); background: var(--bg); box-shadow: var(--shadow-card); }
.sheet-body .part-body { gap: 0; line-height: 1.3; }
.sheet-body .part-body .muted { font-size: var(--fs-foot); }
.sheet-foot { position: sticky; inset-block-end: 0; margin-top: 8px; padding: 12px 20px calc(20px + var(--safe-bottom)); background: var(--page); }
.sheet-start { width: 100%; }
@media (width < 48rem) {
  dialog.sheet { margin: auto 0 0; inline-size: 100%; max-inline-size: none; border-radius: var(--r-xxl) var(--r-xxl) 0 0; }
}
section.card .card-actions { margin-top: 16px; }

/* ---- Assignment screens in the wireframe language ----
   Quiz (p34-49): lettered option cards and a full-width Check. Speaking
   (p50-63) and Shadowing (p3-33): prompt/guidance/notes/player as white cards
   on the grey page, black pill actions. */
.quiz { display: grid; gap: 12px; max-width: 44rem; }
.quiz h3 { margin: 0; font-size: var(--fs-cap); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.quiz .prompt { margin: 0; font-size: var(--fs-card-title); font-weight: 600; line-height: 1.3; }
.quiz .option { display: flex; align-items: center; gap: 14px; padding: 16px; margin: 0; border: 0; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-card); }
.quiz .option .key { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 30px; min-width: 0; border-radius: var(--r-s); border: 0; background: var(--surface); color: var(--fg); font-weight: 600; font-size: .9rem; }
.quiz .option input[type="radio"] { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
/* The chosen option takes the brand outline; the key turns Brand Soft. */
.quiz .option:has(input:checked), .quiz .option.correct { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-card); }
.quiz .option:has(input:checked) .key { background: var(--accent-soft); color: var(--accent-ink); }
.quiz .option:has(input:focus-visible) { outline: 3px solid var(--fg); outline-offset: 2px; }
.quiz .option.correct .key { background: var(--accent); color: var(--accent-fg); }
.quiz .option.wrong { border: 2px dashed var(--danger); background: var(--danger-soft); box-shadow: none; }
.quiz .option.wrong .key { background: var(--danger-ink); border-color: var(--danger-ink); color: #fff; }
.quiz .opt-body { display: grid; gap: 6px; min-width: 0; }
.quiz .opt-tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-foot); font-weight: 600; }
.quiz .opt-tag svg { width: 14px; height: 14px; }
/* Feedback: a tinted panel under the options, with a dashed rule above it. Right is Brand Soft, wrong is Coral Soft. */
.quiz .notice.ok { border: 0; border-top: 2px dashed var(--accent); border-radius: 0; background: var(--accent-soft); }
.quiz .notice.wrong { border: 0; border-top: 2px dashed var(--danger); border-radius: 0; background: var(--danger-soft); }
.quiz .segbar { margin: 0 0 4px; }
/* The quiz fills the screen so Check can sit at the bottom even when the question is short. */
.placement:has(.quiz-body) { display: flex; flex-direction: column; min-block-size: calc(100dvh - 1.5rem - var(--safe-bottom)); }
.quiz-body { flex: 1; display: flex; flex-direction: column; }
.quiz-body > .quiz { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.quiz-body .quiz .actions { margin-top: auto; }
/* Check / Continue: a full-width bar pinned along the bottom of the column. */
.quiz .actions { position: sticky; inset-block-end: 0; z-index: 2; margin: 8px 0 0; padding: 12px 0 calc(12px + var(--safe-bottom)); background: var(--page); box-shadow: 0 -12px 16px -8px var(--page); }
.quiz .actions button, .quiz .actions .btn { width: 100%; }
/* Lesson complete: Back to home / View lessons side by side, not pinned. */
.quiz .done-exits { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0; border-top: 0; }
.quiz-body .quiz .done-exits, .quiz-body .quiz .done-secondary { margin-top: 0; }
.quiz-body .quiz .done-secondary { position: static; padding: 0; border-top: 0; display: grid; gap: 8px; }
.done-head { display: grid; justify-items: center; gap: 8px; margin-top: 8px; text-align: center; }
.done-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-card); }
.done-mark svg { width: 32px; height: 32px; stroke-width: 2.4; }
.quiz-result { display: grid; gap: 12px; margin: 0 0 12px; }
.filter-row { display: flex; gap: 8px; margin: 0 0 12px; }
/* Filter chips: a quiet fill; the chosen one is Ink. */
.filter-chip { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--fill); color: var(--fg); border: 0; box-shadow: none; font-weight: 600; }
.filter-chip[aria-pressed="true"] { background: var(--fg); color: var(--page); }
.done-head h3 { margin: 0; }
.done-title { margin: 0; font-family: var(--font-display); font-size: var(--fs-title); font-weight: 600; line-height: 1.2; }

.guidance, .notes, .speaking, .results-speaking { max-width: 44rem; }
.guidance, .notes, .speaking, .results-speaking { padding: 20px; margin: 0 0 16px; border: 0; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-card); }
.guidance h4, .notes h3, .speaking h3, .results-speaking h3 { margin: 0 0 8px; font-size: var(--fs-cap); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.guidance h4 { margin-top: 16px; }
.guidance h4:first-child { margin-top: 0; }
.speaking .countdown, .recorder .countdown { font-size: 1.1rem; }
.results-speaking audio, .speaking audio { margin-top: 8px; }
/* The speaking prompt and its guidance (wireframe S01): a bold prompt card, collapsible help. */
.prompt-card { margin: 0 0 16px; padding: 16px; border: 0; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-card); }
.prompt-card p { margin: 0; }
.prompt-card .prompt-text { margin-bottom: 8px; font-size: var(--fs-card-title); font-weight: 600; line-height: 1.3; }
.guidance { display: grid; gap: 8px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.acc { border: 0; border-radius: var(--r-l); background: var(--bg); box-shadow: var(--shadow-card); }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 14px; font-weight: 600; list-style: none; cursor: pointer; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary svg { flex: 0 0 20px; width: 20px; height: 20px; transition: transform var(--dur-fast) var(--ease-out); }
.acc[open] > summary svg { transform: rotate(180deg); }
.acc > :not(summary) { margin: 0; padding: 0 14px 14px; }
.acc ol, .acc ul { padding-left: 2.2rem; }
.placement.is-complete > :not(.focus-head):not(.speaking):not(.results-speaking) { display: none; }
.rec-done { display: grid; gap: 12px; margin: 0 0 16px; }
.rec-done[hidden] { display: none; }
.rec-done .done-exits { position: static; padding: 0; border: 0; margin: 0; }
.rec-bar[hidden] { display: none; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notes-head h3 { margin: 0; }
.notes-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0; background: transparent; border: 0; box-shadow: none; color: var(--fg); font-weight: 700; }
.notes-toggle svg { width: 20px; height: 20px; }
/* Speaking record section: flat, with the bar pinned along the bottom of the column. */
.placement:has(.rec-bar) { display: flex; flex-direction: column; min-block-size: calc(100dvh - 1.5rem - var(--safe-bottom)); }
.placement:has(.rec-bar) > .speaking { margin-top: auto; padding: 0; border: 0; background: transparent; }
.rec-review { display: grid; gap: 8px; margin: 0 0 16px; padding: 12px; border: 0; border-radius: var(--r-l); background: var(--bg); box-shadow: var(--shadow-card); }
.rec-review[hidden] { display: none; }
.rec-review-title { margin: 0; font-weight: 700; }
/* The recording player (wireframe): round play, title, progress, time; the audio element is hidden. */
.audio-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-card); background: var(--bg); }
.audio-card audio { display: none; }
.audio-play { flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--accent-fg); border: 0; box-shadow: none; }
.audio-play svg { width: 20px; height: 20px; }
.audio-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.audio-title { font-weight: 600; }
.audio-bar { height: 6px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.audio-fill { display: block; height: 100%; width: 0; background: var(--accent); }
.audio-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.rec-review audio { width: 100%; }
.speaking .caption { margin: 0; padding: 12px; background: var(--surface); border-radius: var(--r-m); }
/* The dock: a white card pinned along the bottom with Shadow/Floating. */
.rec-bar { position: sticky; inset-block-end: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 16px calc(12px + var(--safe-bottom)); background: var(--bg); border-radius: var(--r-xxl) var(--r-xxl) 0 0; box-shadow: var(--shadow-float); }
.rec-bar .countdown { flex: 1; margin: 0; font-size: 1rem; }
.rec-bar .countdown:empty { display: none; }
.rec-bar button { flex: 1; min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.rec-bar button[hidden] { display: none; }
.rec-bar button svg { width: 20px; height: 20px; }
.rec-bar button { border-radius: 999px; }
.rec-bar button.secondary { border: 0; }
/* Stop keeps the brand orange: it is the one key action while recording, and the timer carries the coral recording dot. */
.rec-bar button.danger { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.rec-bar .countdown::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; background: var(--danger); vertical-align: -1px; }
/* Errors on a student activity are a dashed box, not red text (the wireframe's error language). */
/* The wireframe's state notice: a dark dashed box, the icon beside the title, a small outlined retry. */
.notice.state { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: start; margin: 0 0 12px; padding: 14px; border: 2px dashed var(--danger); border-radius: var(--r-l); background: var(--danger-soft); }
.notice.state .state-icon { grid-row: 1; grid-column: 1; display: inline-flex; color: var(--danger-ink); }
.notice.state .state-icon svg { width: 20px; height: 20px; }
.notice.state > p { grid-column: 2; margin: 0; }
.notice.state { position: relative; }
.state-close { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0; background: transparent; border: 0; box-shadow: none; color: var(--fg); }
.notice.state .state-close { justify-content: center; gap: 0; padding: 0; min-height: 36px; }
.notice.state .state-close svg { width: 18px; height: 18px; flex: 0 0 18px; }
.notice.state .state-title { margin-bottom: 4px; }
.notice.state .actions { grid-column: 2; margin: 10px 0 0; }
.notice.state button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 12px; }
.notice.state button svg { width: 18px; height: 18px; }
.notice.state .secondary { border: 0; background: var(--bg); }
/* The lesson list failing to load is not an inline notice: centred, no box, a dark retry. */
.notice.state-lessons { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 3rem 1rem; border: 0; text-align: center; }
.notice.state-lessons .state-icon svg { width: 32px; height: 32px; }
.notice.state-lessons .actions { margin-top: 12px; }
.notice.state-lessons .btn { min-height: 44px; padding: 0 20px; }
.content:has(.focus-head) .status.error { padding: 12px 14px; border: 2px dashed var(--danger); border-radius: var(--r-m); background: var(--danger-soft); color: var(--danger-ink); }
.speaking button:not(.secondary):not(.danger) { border-radius: 999px; }

.video { position: relative; border-radius: var(--r-xl); }
/* The editor's player and its media controls stay in view while the sentence scrolls. */
.sh-stage { position: sticky; inset-block-start: var(--safe-top, 0px); z-index: 3; padding-block-start: 8px; background: var(--page); }
/* The video is at most 40% of the screen height (16:9), so the sticky stage never takes the whole screen; scroll-padding keeps a focused or scrolled-to control from landing under it. */
.sh-stage .video { margin-block: 0; margin-inline: auto; inline-size: min(100%, 71dvh); }
html:has(.sh-stage) { scroll-padding-block-start: calc(40dvh + 5rem); }
.sh-media { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding-block-end: 4px; }
.sh-media .sh-transport { padding: 8px 0; margin-inline-start: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sentence { font-size: var(--fs-card-title); }
.sh-where { margin: 0 0 10px; font-weight: 600; color: var(--muted); }
.sh-sentence-card { position: relative; padding: 16px 20px; margin: 0 0 16px; border: 0; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-card); }
/* Visually hidden labels of the icon buttons (the unit harness and the accessible name read them). */
.sh-btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* While a take is recorded the ring pulses with the voice (its size is --level, 0 to 1, set from the microphone's level in shadowing.js); with nothing heard for a few seconds a warning shows. */
.sh-ring { display: block; inline-size: 64px; block-size: 64px; margin: 0 auto 6px; border-radius: 50%; background: var(--accent); opacity: 0; transform: scale(.5); pointer-events: none; }
.sh-ring.on { opacity: .3; transform: scale(calc(.6 + var(--level, 0) * .5)); transition: transform .1s linear, opacity .2s; }
@media (prefers-reduced-motion: reduce) { .sh-ring.on { transition: none; } }
.sh-hear { margin: 4px 0 0; text-align: center; font-weight: 600; }

/* ---- Error states (wireframe "Errors/states") ---- */

/* ---- Results and review (wireframe "Results/review") ---- */
.result-card { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.result-check { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); }
.result-check svg { width: 22px; height: 22px; }
.result-body { flex: 1; min-width: 0; }
.result-title { margin: 0; font-weight: 600; font-size: 1.125rem; }
.result-meta { margin: 0; }
.result-card .secondary { margin-left: auto; }
.result-question { display: block; }
.result-answer { display: flex; align-items: center; gap: 14px; }

.review-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }
.review-q-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.review-q-top .q-prompt { margin: 0; font-size: 1.15rem; }
.review-answer { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
.review-x, .review-ok { display: inline-flex; align-items: center; color: var(--muted); }
.review-ok svg { width: 16px; height: 16px; }
.takeaways { margin-top: 16px; }
.takeaways ul { margin: 0; padding-left: 1.1rem; }
.takeaways li { margin: 6px 0; }

/* ---- Wireframe shell: 240px sidebar (desktop) / top bar + bottom tabs (phone) ---- */
body.shell, body.shell:has(.sidebar:not([hidden])) { display: block; }
body.shell { background: var(--page); }
body.shell:has(.sidebar:not([hidden])) { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start; }

.sidebar { position: sticky; top: 0; align-self: start; height: 100dvh; display: flex; flex-direction: column; gap: 0; padding: 16px; background: var(--bg); box-shadow: var(--shadow-card); border: 0; }
.sidebar .brand-text { margin: 8px 0 20px; line-height: 0; }
.brand-logo { display: block; block-size: auto; }
.sidebar .brand-logo { inline-size: 132px; }
ul.side-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
ul.side-nav a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: var(--r-m); color: var(--fg); text-decoration: none; }
ul.side-nav a svg { width: 22px; height: 22px; flex: 0 0 22px; }
ul.side-nav .nav-label { white-space: nowrap; }
ul.side-nav a { border: 0; border-radius: var(--r-l); }
/* The current destination is a filled pill, as in the design's tab bar. */
ul.side-nav a[aria-current="page"] { background: var(--fill); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 6px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); border: 0; font-size: var(--fs-cap); font-weight: 600; }
.sidebar .who { color: var(--muted); font-size: .9rem; margin: 0; }
/* The account control (wireframe): an avatar button in the phone top bar; avatar, name and
   chevron in the desktop sidebar foot. Both open the same small menu. */
.account-menu { position: relative; }
.account-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 10px; background: var(--fill); border: 0; border-radius: var(--r-l); box-shadow: none; color: var(--fg); font-weight: 600; text-align: left; }
.account-menu[data-variant="top"] .account-btn { width: auto; min-height: 44px; padding: 0; background: transparent; border: 0; border-radius: 50%; }
.sidebar .account-btn .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-size: 1rem; }
.account-btn > svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); transform: rotate(90deg); }
.avatar { position: relative; }
.avatar[data-unread="true"]::after { content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.account-pop { position: absolute; z-index: 30; min-width: 15rem; max-width: calc(100vw - 2rem); padding: 6px; background: var(--bg); border: 0; border-radius: var(--r-l); box-shadow: var(--shadow-float); }
.account-menu[data-variant="top"] .account-pop { top: calc(100% + 8px); right: 0; }
.account-menu[data-variant="foot"] .account-pop { bottom: calc(100% + 8px); left: 0; right: 0; }
.account-head { display: grid; gap: 2px; margin-bottom: 4px; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); }
.account-head .muted { font-size: .9rem; }
.account-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; background: transparent; border: 0; border-radius: var(--r-m); box-shadow: none; color: var(--fg); font-weight: 600; text-align: left; text-decoration: none; }
@media (hover: hover) { .account-item:hover { background: var(--surface); filter: none; } }
.account-item svg { flex: 0 0 20px; width: 20px; height: 20px; }

body.shell:has(.sidebar:not([hidden])) .content { padding: 2rem 1.5rem 1.5rem; }
.content { max-width: none; }

.topbar { display: none; }
@media (width < 48rem) {
  body.shell:has(.sidebar:not([hidden])) { display: block; }
  .sidebar {
    /* The tab bar floats: a white pill inset from the edges, with Shadow/Floating. */
    position: fixed; top: auto; z-index: 20;
    left: calc(16px + var(--safe-left)); right: calc(16px + var(--safe-right)); bottom: calc(8px + var(--safe-bottom));
    height: auto; flex-direction: row; align-items: stretch; gap: 0;
    padding: 6px; border: 0; border-radius: 28px; box-shadow: var(--shadow-float);
  }
  .sidebar .brand-text, .sidebar .side-foot, .sidebar .who, .sidebar .spacer { display: none; }
  ul.side-nav { display: flex; flex: 1; gap: 0; }
  /* Equal slots (at most five), so the active item changes nothing's width; nothing scrolls sideways. */
  ul.side-nav > li { flex: 1 1 0; min-width: 0; }
  ul.side-nav a, ul.side-nav .nav-more-btn { justify-content: center; min-height: 56px; border-radius: 22px; padding: 0 2px; }
  ul.side-nav .nav-label { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  ul.side-nav > li.nav-overflow { display: none; }
  .nav-more-wrap { position: relative; height: 100%; }
  .nav-more-btn { width: 100%; height: 100%; flex-direction: column; gap: 2px; font-size: .75rem; color: var(--muted); background: transparent; border: 0; box-shadow: none; display: flex; align-items: center; }
  .nav-more-btn svg { width: 22px; height: 22px; }
  .nav-more-btn[aria-current="page"] { background: var(--fill); border-radius: 22px; color: var(--fg); }
  .nav-more-pop { position: absolute; z-index: 30; right: 8px; bottom: calc(100% + 8px); min-width: 12rem; padding: 6px; background: var(--bg); border: 0; border-radius: var(--r-l); box-shadow: var(--shadow-float); }
  .nav-more-pop[hidden] { display: none; }
  .nav-more-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: var(--r-m); color: var(--fg); text-decoration: none; font-weight: 600; }
  .nav-more-item svg { flex: 0 0 22px; width: 22px; height: 22px; }
  .nav-more-item[aria-current="page"] { background: var(--fill); }
  /* The floating bar is 68px tall and sits 8px up: leave 92px so the last card clears it. */
  body.shell:has(.sidebar:not([hidden])) .content { padding: 16px 16px calc(92px + var(--safe-bottom)); }
  /* The build line is the last thing in the page. Leave the bar's height below it so it reads above the bar, never in the strip under or behind it. */
  .build { padding-bottom: calc(.5rem + 76px + var(--safe-bottom)); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(14px + var(--safe-top)) calc(16px + var(--safe-right)) 14px calc(16px + var(--safe-left));
    background: var(--page);
  }
  .topbar .brand-text { margin: 0; line-height: 0; }
  .topbar .brand-logo { inline-size: 96px; }
  .topbar .account { display: inline-flex; }
  .topbar .avatar { width: 44px; height: 44px; flex: 0 0 44px; font-size: .8rem; }
  /* Phone bottom tabs: the current one is a filled pill inside the floating bar. */
  ul.side-nav a { flex-direction: column; gap: 2px; font-size: .75rem; color: var(--muted); }
  ul.side-nav a[aria-current="page"] { background: var(--fill); border: 0; border-radius: 22px; color: var(--fg); }
  ul.side-nav a svg { width: 22px; height: 22px; }
  ul.side-nav a { transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
}
/* "More" exists only for the phone bar. */
.nav-more { display: none; }
@media (width < 48rem) { ul.side-nav > li.nav-more { display: block; } }

/* ---------------------------------------------------------------------------
   Layout and motion polish. Kept last so it wins ties with the rules above.
   --------------------------------------------------------------------------- */


/* Long text wraps instead of clipping or pushing the column wider. Grid and
   flex children need min-width: 0 or they refuse to shrink below their text. */
.placement > *, .focus-head > * { min-width: 0; }
.sentence, .caption, .translation, .karaoke, .word, .sent-list li, .replay-list li, .sh-hint p, .focus-head > div { overflow-wrap: anywhere; }
.word { max-width: 100%; }
.focus-head > div { flex: 1 1 auto; }
.sh-sentence-card { overflow: hidden; }
.sh-sentence-card .sentence { margin: 0; }

/* Sentence and replay lists number themselves with .n; drop the native marker. */
.sent-list, .replay-list { list-style: none; padding-left: 0; }
.sent-list li, .replay-list li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); column-gap: .25rem; margin: 0 0 .5rem; padding: .35rem .5rem; border-radius: var(--r-m); transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out); }
.sent-list li > .n, .replay-list li > .n { min-width: 0; }
.replay-list li > :not(.n) { grid-column: 2; }
.sent-list li[aria-current="true"] { background: var(--accent-soft); }

/* Motion: every control answers a press; the sentence card's own entrance lives in shadowing.js (Web Animations). */
.btn, .shx-mic, .shx-tr, .shx-tr-play, .shx-side, .shx-chip, .shx-cta, .filter-chip, .account-item, .tl-toggle {
  transition: filter var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.btn:active, .shx-mic:active:not(:disabled), .shx-tr:active:not(:disabled), .shx-tr-play:active:not(:disabled), .shx-cta:active:not(:disabled), .rec-bar button:active { transform: translateY(2px) scale(.97); }
@media (hover: hover) {
  .btn:hover:not(:disabled):not(:active) { transform: translateY(-1px); }
  .shx-chip:hover:not(:disabled):not(.current) { border-color: var(--fg); }
}
.karaoke-on, .karaoke-done { transition: color var(--dur-fast) linear; }
.sent-bar-item.current { transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }

/* Disclosure opens by growing instead of snapping (Chromium; elsewhere it just opens). */
@supports (interpolate-size: allow-keywords) {
  .acc { interpolate-size: allow-keywords; }
  .acc::details-content { block-size: 0; overflow: clip; transition: block-size var(--dur-base) var(--ease-out), content-visibility var(--dur-base) allow-discrete; }
  .acc[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .btn:active, .shx-mic:active, .shx-tr:active, .shx-tr-play:active, .shx-cta:active, .rec-bar button:active, .btn:hover { transform: none; }
}
.sh-where { margin-block-start: 16px; }
.placement > .notice { margin-block-end: 12px; }

/* ---------------------------------------------------------------------------
   Global motion: nothing pops in or out. State changes ease; things that
   appear fade in; things toggled with [hidden] fade (and the notices and hints
   collapse) before they go; dialogs fade and, on a phone, slide. All durations
   are the --dur-* tokens, which are 0 under prefers-reduced-motion.
   --------------------------------------------------------------------------- */
:root { interpolate-size: allow-keywords; }
html { -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
dialog.sheet, dialog.picker, .account-pop, .sentences { overscroll-behavior: contain; }

/* Controls that are not buttons ease their state changes too. */
:where(a, input, select, textarea, summary, label) {
  transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
:where(a, button, input, select, textarea, summary, [role="button"]):focus-visible { transition: outline-offset var(--dur-fast) var(--ease-out); }
.segbar-item { transition: background-color var(--dur-base) var(--ease-out); }

/* Fresh content (data arriving after a skeleton, results, a replay list) fades in. */
@keyframes appear { from { opacity: 0; } }
:is(.lw-tabpanel, .replay-list, .status:not(:empty)) { animation: appear var(--dur-base) var(--ease-out); }
/* Blocks a view inserts once its data arrives (a list replacing "Loading…", a card, a form) fade in instead of popping (opacity only, so measured layout never shifts mid-animation). Headings, back links, skeletons and the status line are excluded so the title does not flash when a view re-renders. */
@keyframes fade-in { from { opacity: 0; } }
#app > div > :not(h1, .page-title, .skeletons, .status, [role="status"], .lesson-back, p:has(> a:only-child)) { animation: fade-in var(--dur-slow) var(--ease-out) both; }

/* Toggled with [hidden]: fade, and for blocks that take space, collapse. */
:is(.notice, .sh-hint, .account-pop, .rec-done, .rec-review) {
  transition: opacity var(--dur-base) var(--ease-out), display var(--dur-base) allow-discrete;
}
:is(.notice, .sh-hint) {
  transition: opacity var(--dur-base) var(--ease-out), block-size var(--dur-base) var(--ease-out), margin-block var(--dur-base) var(--ease-out), padding-block var(--dur-base) var(--ease-out), border-width var(--dur-base) var(--ease-out), display var(--dur-base) allow-discrete;
}
:is(.notice, .sh-hint, .account-pop, .rec-done, .rec-review)[hidden] { display: none; opacity: 0; pointer-events: none; }
:is(.notice, .sh-hint)[hidden] { block-size: 0; margin-block: 0; padding-block: 0; border-width: 0; overflow: clip; }
@starting-style {
  :is(.notice, .sh-hint, .account-pop, .rec-done, .rec-review):not([hidden]) { opacity: 0; }
  :is(.notice, .sh-hint):not([hidden]) { block-size: 0; margin-block: 0; padding-block: 0; border-width: 0; }
}

/* Dialogs and the sheet: fade and settle in, fade and settle out; the backdrop fades. */
dialog.sheet, dialog.picker {
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), overlay var(--dur-base) allow-discrete, display var(--dur-base) allow-discrete;
}
dialog.sheet[open], dialog.picker[open] { opacity: 1; transform: none; }
dialog.sheet::backdrop, dialog.picker::backdrop {
  background-color: transparent;
  transition: background-color var(--dur-base) var(--ease-out), overlay var(--dur-base) allow-discrete, display var(--dur-base) allow-discrete;
}
dialog.sheet[open]::backdrop { background-color: rgb(36 28 20 / .5); }
dialog.picker[open]::backdrop { background-color: rgb(36 28 20 / .45); }
@starting-style {
  dialog.sheet[open], dialog.picker[open] { opacity: 0; transform: translateY(8px) scale(.98); }
  dialog.sheet[open]::backdrop, dialog.picker[open]::backdrop { background-color: transparent; }
}
@media (width < 48rem) {
  dialog.sheet { transform: translateY(100%); }
  dialog.sheet[open] { transform: none; }
  @starting-style { dialog.sheet[open] { transform: translateY(100%); } }
}

/* Phone polish, from looking at the app at 320, 390 and 430 wide. */
/* Display type: Plus Jakarta Sans at 700. */
h1, h1.page-title, .signin-title, .lw-theme, .lw-lesson-title, .sheet-head h2, .done-title { font-weight: 700; }

/* The tab bar's labels: five slots at 320 wide cannot carry "Assignments" at 12px. */
@media (width < 48rem) {
  ul.side-nav a, ul.side-nav .nav-more-btn { font-size: .6875rem; letter-spacing: -.005em; }
  ul.side-nav .nav-label { overflow: visible; text-overflow: clip; }
  ul.side-nav a { padding-inline: 0; }
  /* The rail and its marker take 52px of a 358px column; on a phone the marker shrinks and the card gets the room. */
  .tl-node { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
  .tl-list::before { left: 12px; }
  .tl-marker { width: 26px; height: 26px; border-width: 2px; }
  .tl-marker svg { width: 14px; height: 14px; }
  .marker-current .dot { width: 8px; height: 8px; }
  .tl-card { padding: 14px; }
  .tl-node-title { font-size: 1.0625rem; }
  /* Docks run edge to edge of the screen, with the content column's 16px inside them, so the key button is still the column's width. */
  .rec-bar, .quiz .actions { margin-inline: -16px; padding-inline: 16px; }
  .quiz .done-exits, .quiz-body .quiz .done-secondary, .rec-done .done-exits { margin-inline: 0; padding-inline: 0; }
  /* Solid cream up to the bar's top edge (8px up + 68px tall = 76px), then a 36px fade, so nothing shows in the gaps beside or below the floating bar. Not in focus views, which hide the bar. */
  body.shell:has(.sidebar:not([hidden])):not(:has(.focus-head))::after { content: ""; position: fixed; inset: auto 0 0 0; z-index: 19; height: calc(112px + var(--safe-bottom)); background: linear-gradient(to top, var(--page) calc(76px + var(--safe-bottom)), rgb(252 250 246 / 0)); pointer-events: none; }
}
/* Sign-in: a short landscape phone has to fit without scrolling past the button. */
.signin-sub { margin-bottom: .25rem; }
@media (height < 30rem) {
  body.shell:has(.signin-card) .content { padding-block: 1rem; }
  .signin-form { gap: .625rem; }
}

/* Route change: the page area rises slightly while the navigation stays put. */
body.shell .content { view-transition-name: page; }
/* The nav is not given its own transition name: on a phone it is position: fixed, and a fixed element lifted into the transition overlay can render offset from the bottom edge (iOS). It is identical across routes, so it needs no morph. */
/* One after the other: the old page fades out (--dur-fast), then the new one fades in and rises (--dur-base). Normal blending, not the default plus-lighter, so the gap between them is the plain page background (.content is var(--page)) rather than a flash. */
::view-transition-group(page) { animation-duration: calc(var(--dur-fast) + var(--dur-base)); animation-timing-function: var(--ease-out); }
::view-transition-old(page), ::view-transition-new(page) { mix-blend-mode: normal; animation-fill-mode: both; }
::view-transition-old(page) { animation: page-out var(--dur-fast) linear both; }
::view-transition-new(page) { animation: page-in var(--dur-base) var(--ease-out) var(--dur-fast) both; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

/* Counters and day numbers keep fixed-width digits. */
.lw-chip-count, .lw-day-num, .lw-ag-num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   Shadowing, student (the Nov 25 design, ADR 0043). A phone-width column on
   every screen: the design is 390 wide, and a wide screen shows the same
   layout centred. Header, video, transport, sentence strip, card and a dock.
   No gradients; the one orange is the key action and the current marker.
   --------------------------------------------------------------------------- */
.shx { display: flex; flex-direction: column; inline-size: 100%; max-inline-size: 430px; min-block-size: 100dvh; margin-inline: auto; }
/* The page is the column: the dock is the last thing, so the build line and the content's own bottom padding step aside. */
body.shell:has(.shx) .build { display: none; }
body.shell:has(.shx):has(.sidebar:not([hidden])) .content, body.shell:has(.shx) .content { padding-block-end: 0; }
.shx > *, .shx-main > * { min-width: 0; }
.shx-head { order: 0; margin: 0 0 12px; padding: calc(4px + var(--safe-top)) 0 4px; }
.shx-head .focus-close { margin-left: 0; }
.shx-head .focus-titles { flex: 1 1 auto; min-width: 0; }
.shx-head h2 { overflow: hidden; margin: 0; font-size: var(--fs-body); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.shx-sub { font-size: var(--fs-foot); font-variant-numeric: tabular-nums; }
.shx-iconbtn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; inline-size: 44px; block-size: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--bg); box-shadow: var(--shadow-card); color: var(--fg); }
.shx-iconbtn svg { inline-size: 22px; block-size: 22px; }
.shx-iconbtn.flat { flex-basis: 36px; inline-size: 36px; block-size: 36px; min-height: 36px; }
.shx-iconbtn.flat svg { inline-size: 20px; block-size: 20px; }
.shx-iconbtn[hidden] { display: none; }

.shx-main { display: flex; flex-direction: column; gap: 12px; }
.shx-main[hidden] { display: none; }
.shx-video { margin: 0; border-radius: var(--r-xl); }
.shx-video-play { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; display: inline-flex; align-items: center; justify-content: center; inline-size: 56px; block-size: 44px; min-height: 44px; padding: 0; border: 0; border-radius: var(--r-m); background: rgb(36 28 20 / .72); color: #fff; transform: translate(-50%, -50%); }
.shx-video-play svg { inline-size: 24px; block-size: 24px; fill: currentColor; stroke: none; }
.shx-video-play[hidden] { display: none; }

/* The video's transport: previous, replay, play or pause, next and the speed (ADR 0043). */
.shx-strip[hidden], .shx-card[hidden], .shx-transport[hidden] { display: none; }
.shx-transport { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--bg); box-shadow: var(--shadow-card); }
.shx-tr { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; inline-size: 44px; block-size: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--fg); }
.shx-tr svg { inline-size: 22px; block-size: 22px; }
.shx-tr:disabled { opacity: .35; }
.shx-tr-play { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 52px; inline-size: 52px; block-size: 52px; min-height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--fg); color: var(--page); }
.shx-tr-play svg { inline-size: 24px; block-size: 24px; fill: currentColor; stroke: none; }
.shx-tr-play svg:has(path[d^="M9 5"]) { fill: none; stroke: currentColor; }
.shx-tr-play:disabled { opacity: .5; }
.shx-speed { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 48px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--fill); color: var(--fg); font-size: var(--fs-foot); font-weight: 600; font-variant-numeric: tabular-nums; }

.shx-strip { display: flex; align-items: center; gap: 8px; padding-block: 2px; }
.shx-strip-scroll { position: relative; display: flex; align-items: center; justify-content: safe center; gap: 8px; flex: 1 1 auto; min-inline-size: 0; padding-block: 2px; overflow-x: auto; scrollbar-width: none; }
.shx-strip-scroll::-webkit-scrollbar { display: none; }
.shx-chip { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; inline-size: 40px; block-size: 40px; min-height: 40px; padding: 0; border: 1.5px solid transparent; border-radius: 50%; background: var(--bg); color: var(--fg); font-size: var(--fs-sub); font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-card); }
.shx-chip svg { inline-size: 20px; block-size: 20px; }
.shx-chip.saved { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.shx-chip.current { border-color: var(--accent); background: var(--bg); }
.shx-chip.current.saved { background: var(--accent-soft); }
.shx-chip.locked { color: var(--placeholder); box-shadow: none; opacity: .7; }
.shx-chip.unsaved { border-style: dashed; background: var(--accent-soft); }
.shx-chip.unsaved::after { content: ""; position: absolute; inset-block-start: -2px; inset-inline-end: -2px; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--accent); }
.shx-chip.list { color: var(--fg); }
.shx-chip.scroll { flex-basis: 32px; inline-size: 32px; background: var(--bg); }

.shx-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-card); overflow: hidden; }
.shx-card-head { display: flex; align-items: center; gap: 8px; min-block-size: 28px; }
.shx-card-head .shx-grow { flex: 1 1 auto; }
.shx-card-head .sh-where { margin: 0; font-size: var(--fs-foot); font-weight: 600; color: var(--muted); }
.shx-note { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-foot); font-weight: 500; }
.shx-note[hidden] { display: none; }
/* The learning aids under the sentence: three chips and an info button. */
.shx-aids { display: grid; gap: 8px; padding-block-start: 10px; border-top: 1px solid var(--border); }
.shx-aids[hidden] { display: none; }
.shx-aid-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.shx-aid { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--fill); color: var(--muted); font-size: var(--fs-sub); font-weight: 500; }
.shx-aid.on { background: var(--fg); color: var(--page); }
.shx-info { display: inline-flex; align-items: center; justify-content: center; inline-size: 36px; block-size: 36px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.shx-info svg { inline-size: 20px; block-size: 20px; }
/* What Joyy heard, in place of the aids while a take waits to be saved (frame 8). */
.shx-heard { display: flex; align-items: baseline; gap: 10px; }
.shx-heard-label { flex: 0 0 auto; color: var(--muted); font-size: var(--fs-sub); }
.shx-heard-text { min-width: 0; font-size: var(--fs-body); line-height: 1.4; overflow-wrap: anywhere; }
.shx-heard-text.muted { color: var(--muted); }
/* Three dots that rise in turn after "Catching your words": the take is being read, not stuck. */
.shx-dots { display: inline-flex; gap: 3px; margin-inline-start: 4px; vertical-align: baseline; }
.shx-dots i { inline-size: 4px; block-size: 4px; border-radius: 50%; background: currentColor; opacity: .35; animation: shx-dot 1.2s ease-in-out infinite; }
.shx-dots i:nth-child(2) { animation-delay: .2s; }
.shx-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes shx-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .shx-dots i { animation: none; opacity: .6; } }
/* The one quiet line while the speech model downloads: no box, no colour, gone when done. */
.shx-model-note { margin: 0; color: var(--muted); font-size: var(--fs-foot); text-align: center; }
.shx-model-note[hidden] { display: none; }
.shx-aids-note { margin: 0; color: var(--muted); font-size: var(--fs-foot); line-height: 1.4; }
.shx-card .sentence { margin: 0; font-size: var(--fs-h2); font-weight: 500; line-height: 1.45; }
.shx-card .sentence .word { margin-inline-end: .1em; }
.shx-card .sentence .ipa { font-size: .75rem; }
.shx-card .sentence .pause { margin-inline-end: .1em; color: var(--accent-ink); font-weight: 600; }
.shx-card .translation { margin: .5rem 0 0; font-size: var(--fs-sub); }
/* A take waiting to be saved: the recording, in the dock (frame 8). */
.shx-take { display: flex; align-items: center; gap: 10px; inline-size: 100%; min-height: 48px; padding: 0 16px 0 8px; border: 0; border-radius: 999px; background: var(--fill); color: var(--fg); font-size: var(--fs-sub); font-weight: 600; text-align: start; }
.shx-take-label { flex: 1 1 auto; }
.shx-take-disc { display: inline-flex; align-items: center; justify-content: center; inline-size: 32px; block-size: 32px; border-radius: 50%; background: var(--fg); color: var(--page); }
.shx-take-disc svg { inline-size: 16px; block-size: 16px; fill: currentColor; stroke: none; }
.shx-take.on .shx-take-disc svg { fill: none; stroke: currentColor; }
.shx-take-time { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* The bottom: what is above the dock, and the dock itself. It stays at the bottom of the screen. */
.shx-bottom { position: sticky; inset-block-end: 0; z-index: 4; margin-block-start: auto; padding-block: 12px calc(8px + var(--safe-bottom)); }
.shx-bottom[hidden] { display: none; }
.shx-float { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-block-end: 8px; }
.shx-float > .sh-hear[hidden], .shx-float > .status:empty { display: none; }
.shx-float .status { inline-size: 100%; margin: 0; }
.shx-rec-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--danger); }
.shx-rec-time { font-variant-numeric: tabular-nums; }
/* An error sits under the dock's row, in coral text and not in a box (frames 12 and 14). */
.shx-notice { display: flex; align-items: flex-start; gap: 8px; inline-size: 100%; margin-block-start: 8px; color: var(--danger-ink); font-size: var(--fs-foot); }
.shx-notice svg { flex: 0 0 18px; inline-size: 18px; block-size: 18px; margin-top: 1px; }
.shx-notice p { margin: 0; color: var(--muted); }
.shx-notice strong { color: var(--danger-ink); font-weight: 600; }
.shx-link { display: inline-block; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--fg); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: .18em; }
.shx .sh-hear { inline-size: 100%; margin: 0; padding: 8px 12px; border-radius: var(--r-m); background: var(--danger-soft); color: var(--danger-ink); font-size: var(--fs-foot); font-weight: 600; text-align: center; }
.shx .status.error { padding: 10px 14px; border: 0; border-radius: var(--r-m); background: var(--danger-soft); color: var(--danger-ink); font-size: var(--fs-foot); }
.shx .status.error:empty { display: none; }

.shx-dock { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--r-xxl); background: var(--bg); box-shadow: var(--shadow-float); }
.shx-dock-line { margin: 0; color: var(--muted); font-size: var(--fs-sub); text-align: center; font-variant-numeric: tabular-nums; }
.shx-dock-line.strong { color: var(--muted); }
.shx-dock-line.strong strong { color: var(--fg); font-weight: 600; }
.shx-dock-line.rec { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--fg); font-weight: 600; }
.shx-dock.done { gap: 8px; }
.shx-dock-row { display: flex; align-items: flex-start; justify-content: space-between; min-block-size: 72px; padding-inline: 8px; }
.shx-dock-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
/* Listen, Pause and My take: a round grey button with its name under it. */
.shx-side { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 76px; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--fg); font-size: var(--fs-foot); font-weight: 500; }
.shx-side-disc { display: inline-flex; align-items: center; justify-content: center; inline-size: 48px; block-size: 48px; border-radius: 50%; background: var(--fill); }
.shx-side-disc svg { inline-size: 22px; block-size: 22px; }
.shx-side:disabled { color: var(--placeholder); opacity: .7; }
.shx-side:disabled .shx-side-disc { background: transparent; }
.shx-side[name="listen"] .shx-side-disc svg:not(:has(path[d^="M9 5"])) { fill: currentColor; stroke: none; }
.shx-micwrap { position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 72px; block-size: 72px; }
.shx-micwrap .sh-ring { position: absolute; inset: 0; inline-size: auto; block-size: auto; margin: 0; }
.shx-mic { position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 64px; block-size: 64px; min-height: 64px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-fg); box-shadow: 0 6px 18px rgb(247 159 30 / .35); }
.shx-mic svg { inline-size: 26px; block-size: 26px; }
.shx-mic:disabled { background: var(--fill); color: var(--placeholder); box-shadow: none; opacity: 1; }
.shx-mic.stop { border: 3px solid var(--accent); background: var(--fg); color: #fff; box-shadow: none; }
.shx-mic.stop svg { fill: currentColor; }
.shx-turn-ring { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; transform: rotate(-90deg); pointer-events: none; }
.shx-turn-ring circle { fill: none; stroke-width: 3; }
.shx-turn-ring .track { stroke: var(--accent-soft); }
.shx-turn-ring .fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 207.3; stroke-dashoffset: 207.3; animation: shx-turn 2s linear forwards; }
@keyframes shx-turn { to { stroke-dashoffset: 0; } }
.shx-cta { display: flex; align-items: center; justify-content: center; gap: 6px; inline-size: 100%; min-height: 52px; padding: 0 20px; border: 0; border-radius: 999px; font-size: var(--fs-body); font-weight: 600; text-decoration: none; }
.shx-cta svg { inline-size: 18px; block-size: 18px; }
.shx-cta.orange { background: var(--accent); color: var(--accent-fg); }
.shx-cta.dark { background: var(--fg); color: var(--page); }
.shx-cta.quiet, .shx-cta.grey { background: var(--fill); color: var(--fg); }
.shx-cta.text-danger { background: transparent; color: var(--danger-ink); }
.shx-cta:disabled { opacity: .5; }

/* Done */
.shx-done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-block: 8px; text-align: center; }
.shx-done[hidden] { display: none; }
.shx-done-icon { display: inline-flex; align-items: center; justify-content: center; inline-size: 56px; block-size: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.shx-done-icon svg { inline-size: 28px; block-size: 28px; }
.shx-done .done-title { margin: 4px 0 0; font-size: var(--fs-title); line-height: 1.2; }
.shx-done-line { margin: 0; color: var(--muted); }
.shx-replay { inline-size: 100%; max-inline-size: 430px; margin: 16px auto 0; }

/* ---- Desktop (the Nov 25 draft in "Screens · Lessons (desktop)", ADR 0044) ----
   Wide screens: the sidebar folds to a 72px icon rail, the header is a back link and the title, and the page is two
   columns: the video, transport and sentence on the left, the dock as a "Your turn" panel on the right. A phone and
   a narrow window keep the single phone-width column above. */
.shx-back, .shx-pagetitle, .shx-panel-title, .shx-keys { display: none; }
@media (width >= 60rem) {
  body.shell:has(.focus-head):has(.sidebar:not([hidden])) { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: start; }
  body.shell:has(.focus-head) .sidebar { display: flex; align-items: center; padding: 16px 10px; }
  body.shell:has(.focus-head) .sidebar .brand-text, body.shell:has(.focus-head) .sidebar .nav-label, body.shell:has(.focus-head) .sidebar .account-btn .who, body.shell:has(.focus-head) .sidebar .account-btn > svg { display: none; }
  body.shell:has(.focus-head) ul.side-nav a { justify-content: center; min-inline-size: 52px; padding: 0; }
  body.shell:has(.focus-head) .sidebar .account-btn { justify-content: center; padding: 0; background: transparent; }
}
@container content (width >= 50rem) {
  .shx { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; column-gap: 2rem; align-items: start; max-inline-size: 72rem; min-block-size: 0; }
  .shx-head { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 0 0 8px; }
  .shx-head .focus-close { display: none; }
  .shx-head .focus-titles { justify-items: center; text-align: center; }
  .shx-head .shx-iconbtn { justify-self: end; }
  .shx-back { display: inline-flex; align-items: center; gap: 6px; justify-self: start; white-space: nowrap; min-height: 44px; color: var(--muted); font-weight: 500; text-decoration: none; }
  .shx-back svg { inline-size: 18px; block-size: 18px; }
  .shx-pagetitle { display: block; grid-column: 1 / -1; margin: 0 0 16px; font-size: var(--fs-title); line-height: 1.2; }
  .shx-main { grid-column: 1; grid-row: 3; }
  .shx-bottom { grid-column: 2; grid-row: 3; position: sticky; inset-block: 1rem auto; margin: 0; padding: 20px; border-radius: var(--r-xxl); background: var(--bg); box-shadow: var(--shadow-card); }
  .shx-panel-title { display: block; margin: 0 0 12px; color: var(--muted); text-align: center; }
  .shx-panel-title:empty { display: none; }
  .shx-dock { padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .shx-keys { display: block; margin: 16px 0 0; color: var(--muted); font-size: var(--fs-foot); text-align: center; }
  .shx-keys[hidden] { display: none; }
  .shx-keys kbd { padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font: inherit; font-size: .85em; }
  .shx-replay { max-inline-size: none; }
}

/* Sheets */
.shx-sheet-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; padding: 16px 16px 0; }
.shx-sheet-head h2 { margin: 0; font-family: var(--font); font-size: var(--fs-body); font-weight: 600; text-align: center; grid-column: 2; grid-row: 1; }
.shx-sheet-x { grid-column: 1; grid-row: 1; margin: 0; }
.shx-sheet-head.plain { display: grid; justify-items: center; gap: 12px; padding-top: 24px; }
.shx-sheet-head.plain h2 { grid-column: auto; grid-row: auto; font-family: var(--font-display); font-size: var(--fs-card-title); font-weight: 600; }
dialog.shx-sheet { max-block-size: min(92dvh, 48rem); }
.shx-card-head .sh-where { text-transform: none; letter-spacing: 0; }
.shx-sheet-body { padding: 12px 16px calc(16px + var(--safe-bottom)); }
dialog.shx-sheet { background: var(--page); }
.shx-card-group { display: grid; gap: 0; padding: 4px 0; border-radius: var(--r-l); background: var(--bg); box-shadow: var(--shadow-card); overflow: hidden; }
.shx-group-title { margin: 0; padding: 12px 16px 0; font-size: var(--fs-foot); font-weight: 600; color: var(--muted); }
.shx-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; color: var(--fg); }
.shx-row-stack { padding-bottom: 6px; }
.shx-row-text { display: grid; gap: 2px; min-width: 0; }
.shx-row-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.shx-row-title svg { inline-size: 18px; block-size: 18px; color: var(--muted); }
.shx-row-line { color: var(--muted); font-size: var(--fs-foot); line-height: 1.35; }
.shx-pad { margin: 0; padding: 0 16px 8px; }
.shx-row-btn { inline-size: 100%; min-height: 0; border: 0; border-radius: 0; background: transparent; text-align: start; font-weight: 400; }
.shx-row-btn > svg { flex: 0 0 18px; inline-size: 18px; block-size: 18px; color: var(--muted); }
.shx-switch { position: relative; flex: 0 0 auto; display: inline-block; inline-size: 51px; block-size: 31px; }
.shx-switch-input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.shx-switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background-color var(--dur-base) var(--ease-out); pointer-events: none; }
.shx-switch-track::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; inline-size: 27px; block-size: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(36 28 20 / .3); transition: transform var(--dur-base) var(--ease-out); }
.shx-switch-input:checked + .shx-switch-track { background: var(--fg); }
.shx-switch-input:checked + .shx-switch-track::after { transform: translateX(20px); }
.shx-switch-input:focus-visible + .shx-switch-track { outline: 3px solid var(--fg); outline-offset: 2px; }
.shx-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; margin: 0 16px 12px; padding: 2px; border-radius: var(--r-s); background: var(--fill); }
.shx-seg-btn { min-height: 34px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--fg); font-size: var(--fs-foot); font-weight: 500; font-variant-numeric: tabular-nums; }
.shx-seg-btn[aria-pressed="true"] { background: var(--bg); box-shadow: 0 1px 3px rgb(36 28 20 / .15); font-weight: 600; }
.shx-wide-btn { display: flex; align-items: center; justify-content: center; gap: 8px; inline-size: 100%; min-height: 48px; border: 0; border-radius: var(--r-l); background: var(--fill); color: var(--fg); font-weight: 600; }
.shx-wide-btn svg { inline-size: 20px; block-size: 20px; }
.shx-wide-btn:disabled { opacity: .5; }

.shx-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.shx-list-item { display: flex; align-items: flex-start; gap: 12px; inline-size: 100%; min-height: 0; padding: 12px; border: 1.5px solid transparent; border-radius: var(--r-m); background: var(--bg); color: var(--fg); font-weight: 400; text-align: start; box-shadow: var(--shadow-card); }
.shx-list-item.current { border-color: var(--accent); }
.shx-list-item.locked { color: var(--placeholder); box-shadow: none; background: var(--surface); }
.shx-list-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; inline-size: 24px; block-size: 24px; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: var(--fs-cap); font-weight: 600; }
.shx-list-mark.done { background: var(--accent-soft); color: var(--accent-ink); }
.shx-list-mark svg { inline-size: 14px; block-size: 14px; }
.shx-list-text { flex: 1; min-width: 0; font-size: var(--fs-sub); line-height: 1.35; }
.shx-sheet-tall { max-block-size: min(88dvh, 44rem); }

.shx-ask-icon { display: inline-flex; align-items: center; justify-content: center; justify-self: center; inline-size: 44px; block-size: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.shx-ask-icon svg { inline-size: 22px; block-size: 22px; }
.shx-ask-text { margin: 0; color: var(--muted); font-size: var(--fs-sub); line-height: 1.45; }
.shx-sheet-ask .shx-ask-text { text-align: center; }
.shx-sheet-ask .shx-sheet-body { gap: 8px; }
.shx-guide { padding: 10px 14px; border-radius: var(--r-m); background: var(--bg); box-shadow: var(--shadow-card); }
.shx-guide summary { font-weight: 600; cursor: pointer; }
.shx-guide ol { margin: 8px 0 0; padding-inline-start: 1.25rem; color: var(--muted); font-size: var(--fs-sub); }
.shx-guide li { margin-block: 4px; }

.shx-input-name { color: var(--muted); font-size: var(--fs-sub); text-align: end; }
.shx-meter { position: relative; block-size: 6px; margin: 4px 16px 0; border-radius: 999px; background: var(--fill); overflow: hidden; }
.shx-meter-fill { position: absolute; inset: 0; border-radius: inherit; background: var(--accent); transform-origin: left center; transform: scaleX(var(--fill, 0)); transition: transform .1s linear; }
.shx-meter-cap { margin: 4px 16px 8px; color: var(--muted); font-size: var(--fs-cap); text-align: end; }
.shx-test { display: flex; align-items: center; gap: 10px; inline-size: calc(100% - 32px); min-height: 48px; margin: 0 16px 8px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--fg); font-weight: 600; text-align: start; }
.shx-test-disc { display: inline-flex; align-items: center; justify-content: center; inline-size: 32px; block-size: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); }
.shx-test-disc svg { inline-size: 16px; block-size: 16px; fill: currentColor; stroke: none; }
.shx-test-label { flex: 1; }
.shx-test-time { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.shx-test:disabled { opacity: 1; }
.shx-verdict { margin: 0 16px 8px; font-size: var(--fs-sub); font-weight: 600; }
.shx-verdict:empty { display: none; }
.shx-verdict.bad { color: var(--danger-ink); }
.shx-tips { display: grid; gap: 10px; margin: 4px 0 8px; padding: 0 4px; list-style: none; color: var(--muted); font-size: var(--fs-foot); }
.shx-tips li { display: flex; align-items: flex-start; gap: 10px; }
.shx-tips svg { flex: 0 0 18px; inline-size: 18px; block-size: 18px; }
.shx-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shx-pair [hidden] { display: none; }
.shx-pair > :only-child, .shx-pair > .shx-cta.dark:first-child:not(:only-child) { grid-column: auto; }
.shx-pair:has(> [hidden]) { grid-template-columns: 1fr; }
