/* JetLangue — warm cream paper, coral for the brand and for what is happening now,
   ink for text, and a teacher's red pen for corrections. Fredoka for the brand and
   headings (rounded, like the logo), Nunito for reading, Lora for English examples. */
:root {
  --cream: #fbf4ec;
  --cream-2: #f4e6d7;
  --panel: #fffaf5;
  --card: #ffffff;
  --coral: #e56347;
  --coral-dark: #c94d33;
  --coral-soft: #f6d2c5;
  --coral-tint: #fdeee7;
  --ink: #261d16;
  --text: #33271e;
  --muted: #7c6a5d;
  --line: #ecdccb;
  --line-strong: #dcc4ae;
  --red: #c4362b;
  --ok: #2f8a57;
  --ok-tint: #e6f3ea;
  --warn: #b0731c;
  --warn-tint: #fbf0dc;
  --learner: #1e5a8c;
  --shadow: 0 1px 2px rgba(38, 29, 22, 0.06), 0 6px 20px rgba(38, 29, 22, 0.07);
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", "Ubuntu", system-ui, sans-serif;
  --serif: "Lora", "Noto Serif", Georgia, serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --cream: #1c1611;
    --cream-2: #241c16;
    --panel: #221a14;
    --card: #2a211a;
    --coral: #f07a5f;
    --coral-dark: #ff9479;
    --coral-soft: #6b3a2d;
    --coral-tint: #3a2620;
    --ink: #fbf1e7;
    --text: #efe2d5;
    --muted: #b5a291;
    --line: #3a2e25;
    --line-strong: #4d3e32;
    --red: #ff8a7d;
    --ok: #7fd3a0;
    --ok-tint: #1f3227;
    --warn: #f0c060;
    --warn-tint: #3a2f1a;
    --learner: #9cc9f0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 16px/1.55 var(--body); color: var(--text); background: var(--cream); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }
kbd { font: 0.85em var(--body); border: 1px solid currentColor; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
h2, h3, h4 { font-family: var(--display); font-weight: 600; color: var(--ink); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--coral); color: #fff; font: 600 16px/1 var(--display); letter-spacing: 0.02em; flex: none;
}
.wordmark { font: 600 26px/1 var(--display); letter-spacing: -0.01em; }
.wordmark b { color: var(--ink); font-weight: 700; }
.wordmark i { color: var(--coral); font-style: normal; font-weight: 600; }
.brand.big .badge { width: 64px; height: 64px; font-size: 26px; }
.brand.big .wordmark { font-size: 52px; }

/* ---------- boot ---------- */
.boot { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--cream); }
.boot-card { max-width: 520px; width: 100%; }
.boot-sub { color: var(--muted); margin: 14px 0 26px; font-size: 19px; }
.boot-steps { list-style: none; padding: 0; margin: 0 0 18px; }
.boot-steps li { padding: 9px 0 9px 34px; position: relative; color: var(--muted); border-bottom: 1px solid var(--line); }
.boot-steps li::before { content: ""; position: absolute; left: 4px; top: 15px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); }
.boot-steps li.active { color: var(--ink); }
.boot-steps li.active::before { border-color: var(--coral); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.boot-steps li.done { color: var(--ink); }
.boot-steps li.done::before { background: var(--coral); border-color: var(--coral); }
.boot-msg { min-height: 1.5em; color: var(--muted); font-size: 15px; }
.boot-err { background: var(--coral-tint); border-left: 4px solid var(--red); padding: 12px 14px; white-space: pre-wrap; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.rail { background: var(--cream-2); border-right: 1px solid var(--line); padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.modes { display: flex; flex-direction: column; gap: 4px; }
.mode { text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 12px; color: var(--muted); cursor: pointer; font: 500 17px/1.3 var(--display); display: flex; align-items: center; gap: 8px; }
.mode:hover { color: var(--ink); background: rgba(229, 99, 71, 0.08); }
.mode[aria-selected="true"] { color: #fff; background: var(--coral); }
.pill { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--coral); color: #fff; font: 600 13px/22px var(--body); text-align: center; }
.mode[aria-selected="true"] .pill { background: #fff; color: var(--coral); }
.settings summary { cursor: pointer; color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.settings label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0; }
.settings select, .settings input[type="range"] { display: block; width: 100%; margin-top: 4px; }
.settings select { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; color: var(--text); }
.settings input[type="range"] { accent-color: var(--coral); }
.settings .check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
.settings .check input { margin-top: 4px; accent-color: var(--coral); }
.gpu { margin-top: auto; font-size: 12.5px; color: var(--muted); line-height: 1.45; border-top: 1px solid var(--line); padding-top: 12px; }
.gpu strong { color: var(--text); font-weight: 600; }
.gpu .bad { color: var(--red); }
.vram-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); margin: 6px 0; }
.vram-bar span { display: block; height: 100%; }

.main { min-width: 0; height: 100%; overflow: hidden; }
.view { height: 100%; display: flex; flex-direction: column; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 28px 14px; border-bottom: 1px solid var(--line); }
.view-head h2 { font-size: 28px; margin: 0; line-height: 1.2; }
.hint { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; }
.page { flex: 1; overflow-y: auto; padding: 22px 28px 48px; }
.empty { color: var(--muted); font-size: 18px; }
.eyebrow { margin: 0 0 4px; font: 600 12px/1.3 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--coral); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--coral); background: var(--coral); color: #fff; border-radius: 999px; padding: 8px 18px; cursor: pointer; white-space: nowrap; font: 600 15px/1.3 var(--display); }
.btn:hover { background: var(--coral-dark); border-color: var(--coral-dark); }
.btn.ghost { background: transparent; color: var(--coral-dark); }
.btn.ghost:hover { background: var(--coral-tint); }
.btn.small { padding: 5px 13px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; padding: 2px 0; color: var(--muted); cursor: pointer; font-size: 14.5px; display: inline-flex; align-items: center; gap: 5px; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link:hover { color: var(--ink); text-decoration-color: currentColor; }
.link svg { width: 15px; height: 15px; fill: currentColor; }
.link.danger:hover { color: var(--red); }

/* ---------- the lesson with the teacher ---------- */
.class-head { display: grid; grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto; gap: 8px 20px; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--cream); }
.class-title h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.agenda { display: flex; gap: 6px; list-style: none; margin: 0; padding: 4px 0; overflow-x: auto; scrollbar-width: thin; }
.agenda li { flex: none; padding: 3px 11px; border-radius: 999px; font: 500 13px/1.6 var(--display); color: var(--muted); border: 1px solid var(--line-strong); white-space: nowrap; }
.agenda li small { font-size: 11px; opacity: 0.85; }
.agenda li.done { color: var(--coral-dark); border-color: var(--coral-soft); background: var(--coral-tint); }
.agenda li.done::before { content: "✓ "; }
.agenda li.now { color: #fff; background: var(--coral); border-color: var(--coral); }
.class-actions { display: flex; gap: 12px; align-items: center; }
.timer { font: 500 14px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.timer.late { color: var(--red); }

.classroom { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 42%); }
.talk-col { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.thread { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.board { overflow-y: auto; padding: 20px 22px 32px; background: var(--cream-2); }
.system-note { color: var(--muted); font-size: 15px; text-align: center; max-width: 52ch; margin: 18px auto; }

.msg { display: flex; gap: 10px; margin: 0 0 18px; max-width: 760px; }
.msg.me { justify-content: flex-end; margin-left: auto; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font: 600 15px/1 var(--display); margin-top: 2px; }
.bubble { position: relative; min-width: 0; max-width: 100%; background: var(--card); border-radius: 4px var(--radius) var(--radius) var(--radius); padding: 10px 16px 10px; box-shadow: var(--shadow); }
.msg.me .bubble { background: var(--panel); border: 1px solid var(--line); box-shadow: none; border-radius: var(--radius) 4px var(--radius) var(--radius); }
.who { display: block; font: 600 12.5px/1.4 var(--display); color: var(--coral); letter-spacing: 0.02em; }
.msg.me .who { color: var(--learner); }
.say { margin: 2px 0 0; font-size: 18px; line-height: 1.5; color: var(--ink); }
.msg.me .say { color: var(--learner); }
.tr { margin: 4px 0 0; font-size: 14.5px; color: var(--muted); font-style: italic; }
.tr .lbl { font-style: normal; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px; }
.tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; align-items: center; }
.vocab { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vocab span { font-size: 13.5px; border: 1px dashed var(--line-strong); border-radius: 6px; padding: 1px 7px; color: var(--muted); }
.vocab b { color: var(--ink); font-weight: 600; }
.kept { color: var(--muted); font-size: 13.5px; margin: 2px 0 4px; }
.grade { position: absolute; top: 8px; right: 14px; font: 700 17px/1 var(--display); color: var(--coral); }
.grade small { font-size: 11px; font-weight: 400; }
.msg.me .bubble:has(.grade:not([hidden])) .who { padding-right: 60px; }

/* learner words, coloured by pronunciation */
.w { border-radius: 3px; }
.w.scored { cursor: pointer; }
.w.warn { text-decoration: underline dotted var(--warn); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.w.error { text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.w.nonword { font-style: italic; text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.w.scored:hover, .w.scored:focus-visible { background: var(--coral-tint); }

/* red-pen corrections */
.marks { margin-top: 4px; }
.corr { font-size: 16px; line-height: 1.5; color: var(--red); margin: 4px 0; }
.corr del { color: var(--learner); text-decoration: none; background-image: linear-gradient(var(--red), var(--red)); background-repeat: no-repeat; background-position: 0 58%; background-size: 100% 2px; animation: strike 0.5s ease-out both; }
@keyframes strike { from { background-size: 0 2px; } to { background-size: 100% 2px; } }
.corr ins { text-decoration: none; font-weight: 700; margin-left: 6px; }
.corr .why { display: block; font-size: 14px; line-height: 1.45; color: var(--text); margin: 0 0 6px; }
.corr .cat { font-size: 11px; color: var(--red); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 8px; vertical-align: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.corr.small { display: block; font-size: 15px; }
.corr.small .why { display: inline; font-size: 13.5px; }
.fix { font-size: 16px; color: var(--red); margin: 6px 0 0; font-weight: 600; }
.fix .lbl, .note .lbl { font-size: 12px; color: var(--muted); margin-right: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.note { margin: 4px 0; font-size: 14.5px; line-height: 1.5; }
.note.pron { border-left: 3px solid var(--warn); padding: 4px 10px; background: var(--warn-tint); border-radius: 0 8px 8px 0; }
.note.ok { color: var(--ok); font-weight: 600; }
.tnote { margin: 8px 0 4px; padding: 2px 0 2px 12px; border-left: 2px solid var(--coral-soft); }
.tnote p { margin: 3px 0; font-size: 14.5px; line-height: 1.45; }
.tnote .lbl { font: 600 13px var(--display); margin-right: 8px; }
.tnote .good .lbl { color: var(--ok); }
.tnote .watch .lbl { color: var(--red); }
.pending { color: var(--muted); font-style: italic; font-size: 14.5px; }
.pending::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* help card */
.helpbtn[aria-expanded="true"] { color: var(--coral-dark); text-decoration-color: currentColor; }
.helpcard { margin: 10px 0 4px; padding: 10px 14px; background: var(--cream); border: 1px solid var(--line); border-radius: 10px; }
.helpcard h4 { margin: 0 0 6px; font-size: 14px; color: var(--coral-dark); }
.helpcard h4:not(:first-child) { margin-top: 10px; }
.hwords { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.say-it { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.say-it:hover { color: var(--coral-dark); text-decoration: underline; text-underline-offset: 3px; }
.hw { display: inline-flex; gap: 6px; align-items: baseline; }
.hw b { font-weight: 700; color: var(--ink); }
.hw span, .trn { font-size: 13.5px; color: var(--muted); }
.hlist { list-style: none; margin: 0; padding: 0; }
.hlist li { margin: 2px 0; }
.hlist .pat { margin-right: 8px; color: var(--ink); }
.hlist .ex { font-family: var(--serif); font-style: italic; color: var(--learner); margin-right: 8px; }
.hhint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* dock */
.dock { display: flex; gap: 16px; align-items: center; padding: 12px 22px 16px; border-top: 1px solid var(--line); background: var(--cream); }
.dock.idle { opacity: 0.55; pointer-events: none; }
.mic { position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--coral); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(229, 99, 71, 0.35); transition: background 0.15s, transform 0.1s; }
.mic svg { width: 32px; height: 32px; fill: currentColor; position: relative; z-index: 1; }
.mic canvas { position: absolute; inset: -24px; width: 120px; height: 120px; pointer-events: none; }
.mic:active { transform: translateY(1px); }
.mic.rec { background: var(--red); }
.mic.busy { background: var(--muted); cursor: progress; box-shadow: none; }
.dock-side { flex: 1; min-width: 0; }
.mic-state { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.mic-state.live { color: var(--red); }
.typebox { display: flex; gap: 8px; }
.typebox input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 8px 16px; font-size: 16px; }
.typebox.small input { font-size: 15px; padding: 6px 12px; }

/* ---------- cards (board, homework, start) ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin: 0 0 14px; }
.card h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.25; }
.card h4 { margin: 10px 0 6px; font-size: 16px; }
.card p { margin: 6px 0; }
.card.muted { background: transparent; box-shadow: none; border: 1px dashed var(--line-strong); color: var(--muted); }
.card .actions, .actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; }
.start-card { border-top: 4px solid var(--coral); }
.free { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.free select { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px; padding: 4px 8px; }
.status { display: inline-block; font: 600 13px/1.6 var(--display); padding: 1px 10px; border-radius: 999px; background: var(--cream-2); color: var(--muted); }
.status.mastered { background: var(--ok-tint); color: var(--ok); }
.status.review { background: var(--warn-tint); color: var(--warn); }
.status.in_progress { background: var(--coral-tint); color: var(--coral-dark); }
.teacher-says { font-size: 16px; border-left: 3px solid var(--coral); padding-left: 12px; }
.goals { margin: 6px 0; padding-left: 20px; }
.plan { margin: 10px 0 0; padding-left: 22px; color: var(--muted); font-size: 14.5px; }
.plan li.done { color: var(--coral-dark); }
.plan li.done::marker { content: "✓  "; }
.plan li.now { color: var(--ink); font-weight: 700; }
.theory-card h3 { color: var(--coral-dark); }
.ex-card h4 { font-family: var(--body); font-weight: 700; font-size: 15px; color: var(--muted); margin: 2px 0 10px; }
.board-item { padding: 12px 14px; background: var(--cream); border-radius: 10px; }
.board-item .prompt { font-size: 20px; }
.last-answer { margin: 12px 0 0; font-size: 14.5px; padding: 6px 10px; border-radius: 8px; }
.last-answer.ok { background: var(--ok-tint); color: var(--ok); }
.last-answer.bad { background: var(--coral-tint); color: var(--red); }
.phrases { padding-left: 18px; }
.phrases .say-it { font-family: var(--serif); font-style: italic; color: var(--learner); }
.hw-results { padding-left: 22px; font-size: 15px; }
.hw-results li { margin: 5px 0; }
.hw-results .q { display: block; color: var(--muted); }
.hw-results .a { font-family: var(--serif); color: var(--learner); }
.hw-results li.ok .a { color: var(--ok); }
.hw-results li.bad .a { text-decoration: line-through; text-decoration-color: var(--red); }
.hw-results .key { color: var(--ok); font-weight: 700; }
.writing { font-family: var(--serif); background: var(--cream); padding: 8px 12px; border-radius: 8px; }
.hw-instr { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.summary-card { border-top: 4px solid var(--ok); }

/* ---------- course ---------- */
.lib-filters { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; padding: 10px 28px; border-bottom: 1px solid var(--line); }
.level-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.lvl { border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 5px 14px; cursor: pointer; font: 500 15px/1.3 var(--display); display: inline-flex; gap: 8px; align-items: baseline; }
.lvl .cnt { font: 12px var(--body); color: var(--muted); }
.lvl[aria-selected="true"] { background: var(--coral); border-color: var(--coral); color: #fff; }
.lvl[aria-selected="true"] .cnt { color: rgba(255, 255, 255, 0.85); }
.lib-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; color: var(--muted); }
.lib-tools select, .lib-tools input[type="search"] { border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14.5px; }
.lib-tools input[type="search"] { width: 220px; }
.lib-tools .check { display: inline-flex; gap: 6px; align-items: center; }
.lib-tools .check input { accent-color: var(--coral); }
.lib-sec { max-width: 92ch; margin-bottom: 26px; }
.lib-sec > h3 { font-size: 17px; color: var(--muted); font-weight: 500; margin: 0 0 6px; }
.toc { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.toc > li { border-bottom: 1px solid var(--line); }
.toc > li:last-child { border-bottom: 0; }
.toc > li.next { box-shadow: inset 4px 0 0 var(--coral); }
.toc-open { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 16px; cursor: pointer; color: inherit; font: inherit; }
.toc-open:hover { background: var(--coral-tint); }
.toc-open > span { display: block; }
.toc-open > .toc-line { display: flex; }
.toc-line { align-items: baseline; gap: 8px; }
.toc-num { font: 500 15px var(--display); color: var(--muted); min-width: 2.4em; }
.toc-title { font: 600 18px/1.3 var(--display); color: var(--ink); }
.toc-dots { flex: 1; border-bottom: 2px dotted var(--line-strong); transform: translateY(-4px); min-width: 20px; }
.toc-level { font: 500 15px var(--display); color: var(--coral-dark); }
.toc-sub { margin: 2px 0; font-size: 14.5px; color: var(--text); padding-left: calc(2.4em + 8px); }
.toc-meta { font-size: 12.5px; color: var(--muted); padding-left: calc(2.4em + 8px); }
.st-mastered .toc-title { color: var(--muted); }
.tag { font: 600 11.5px/1.6 var(--body); padding: 0 8px; border-radius: 999px; background: var(--cream-2); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tag.next { background: var(--coral); color: #fff; }
.tag.mastered { background: var(--ok-tint); color: var(--ok); }
.tag.review { background: var(--warn-tint); color: var(--warn); }
.tag.in_progress { background: var(--coral-tint); color: var(--coral-dark); }
.kind { display: inline-block; font-size: 11.5px; border-radius: 4px; padding: 0 6px; margin-right: 6px; border: 1px solid currentColor; }
.kind.grammar { color: var(--red); }
.kind.vocabulary { color: var(--ok); }
.kind.situation { color: var(--learner); }
.kind.mixed, .kind.usage { color: var(--warn); }
.kind.functional, .kind.skills { color: var(--muted); }

/* ---------- lesson book ---------- */
.crumbs { margin: 0 0 2px; font-size: 13.5px; color: var(--muted); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; padding: 0 28px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px 9px; cursor: pointer; font: 500 16px/1.3 var(--display); color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--coral-dark); border-bottom-color: var(--coral); }
.tab-score { font: 600 12.5px var(--body); color: var(--coral); margin-left: 4px; }
.lpane > section, .lpane > p, .lpane > table, .lpane > h3 { max-width: 84ch; }
.goals-box { border-left: 3px solid var(--ok); padding: 2px 0 2px 14px; margin-bottom: 22px; }
.goals-box h3 { font-size: 17px; color: var(--ok); margin: 0 0 4px; }
.theory { margin-bottom: 26px; }
.theory h3, .theory-card h3 { font-size: 21px; margin: 0 0 8px; color: var(--coral-dark); }
.theory p, .theory-card p { margin: 6px 0; line-height: 1.6; }
.pts { margin: 4px 0; padding-left: 22px; line-height: 1.6; }
.exs { font-family: var(--serif); font-size: 17.5px; margin: 6px 0 6px 16px; }
.exs .say-it.ex { font-style: italic; color: var(--learner); }
.exnote { display: block; font-family: var(--body); font-size: 13.5px; color: var(--muted); font-style: normal; }
.pitfall { margin: 6px 0 6px 16px; font-family: var(--serif); font-size: 17px; }
.pitfall del { color: var(--red); text-decoration-thickness: 1.5px; }
.pitfall .arrow { color: var(--muted); margin: 0 4px; }
.pitfall .say-it.right { color: var(--ok); font-weight: 600; }
.opening { font-style: italic; color: var(--learner); }
.gloss { display: block; font-family: var(--body); font-style: italic; font-weight: 400; font-size: 13.5px; line-height: 1.4; color: var(--muted); margin-top: 2px; }
.tbl-wrap { overflow-x: auto; margin: 10px 0; }
.ltable { border-collapse: collapse; font-size: 14.5px; min-width: 50%; }
.ltable th, .ltable td { border-bottom: 1px solid var(--line); padding: 5px 14px 5px 0; text-align: left; vertical-align: top; }
.ltable th { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.vocab-table { border-collapse: collapse; width: 100%; margin-bottom: 18px; font-size: 15px; }
.vocab-table td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.vocab-table td.term { width: 34%; }
.vocab-table .term > .say-it { font: 600 17px var(--display); color: var(--ink); }
.vocab-table.compact td { padding: 5px 10px 5px 0; }
.vocab-table tr.used .term > .say-it::after { content: " ✓"; color: var(--ok); }
.pos { font-size: 12px; color: var(--muted); font-style: italic; margin-left: 4px; }
.def { display: block; }
.vex { display: block; margin-top: 2px; }
.vex .say-it { font-family: var(--serif); font-style: italic; color: var(--learner); }
.vnote { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wordcheck { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; font-size: 13.5px; }
.wordcheck .issue { margin: 2px 0; }
.rec-small { border: 0; border-radius: 999px; background: var(--coral); color: #fff; padding: 7px 16px 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--display); }
.rec-small svg { width: 18px; height: 18px; fill: currentColor; }
.rec-small.rec { background: var(--red); }
.rec-small.tiny { padding: 3px 10px 3px 8px; font-size: 12.5px; }
.rec-small.tiny svg { width: 14px; height: 14px; }
.grade-in { font: 700 15px var(--display); color: var(--coral); margin-right: 6px; }
.good { color: var(--ok); font-weight: 700; }
.bad { color: var(--red); font-weight: 700; }
.miss { color: var(--muted); font-style: italic; }

/* exercises */
.exercise { margin-bottom: 26px; padding: 16px 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 84ch; }
.exercise h3 { font: 700 16px/1.4 var(--body); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 0 0 8px; }
.exn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--coral); color: #fff; font: 600 14px var(--display); flex: none; }
.wordbox { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; margin: 4px 0 10px; }
.wordbox span { font-family: var(--serif); font-size: 16px; padding: 0 6px; }
.ex-items { margin: 0; padding-left: 26px; }
.ex-item { margin: 6px 0 12px; padding-left: 4px; }
.ex-item::marker { color: var(--muted); font-weight: 600; }
.ex-item.right::marker { color: var(--ok); }
.ex-item.wrong::marker { color: var(--red); }
.prompt { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.65; color: var(--ink); }
.ans { border: 1px solid var(--line-strong); background: var(--card); border-radius: 8px; padding: 2px 8px; font: 17px/1.4 var(--serif); color: var(--learner); }
.ans.gapin { width: 9em; margin: 0 3px; }
.ans.ok { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.ans.bad { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.ans.wide { width: min(100%, 52ch); }
textarea.ans { resize: vertical; vertical-align: top; }
.ansline { margin: 4px 0 0; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.choices { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 3px; vertical-align: 1px; }
.opt { border: 1px solid var(--line-strong); background: var(--card); border-radius: 8px; padding: 0 9px; cursor: pointer; font: 16px/1.65 var(--serif); }
.opt:hover { border-color: var(--coral); }
.opt.sel { border-color: var(--coral); background: var(--coral-tint); color: var(--coral-dark); font-weight: 600; }
.opt.sel.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-tint); }
.opt.sel.bad { border-color: var(--red); color: var(--red); }
.match-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.match-row .arrow { color: var(--muted); }
.matchsel { font-size: 16px; max-width: 100%; }
.order-words { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.word { font-family: var(--serif); font-size: 16px; }
.mic-mini { border: 0; border-radius: 50%; width: 34px; height: 34px; display: inline-grid; place-items: center; background: var(--coral); color: #fff; cursor: pointer; flex: none; }
.mic-mini svg { width: 18px; height: 18px; fill: currentColor; }
.mic-mini.rec { background: var(--red); }
.fb { font-size: 14.5px; line-height: 1.45; margin-top: 3px; }
.fb .key { font-family: var(--serif); font-size: 16px; color: var(--ok); font-style: italic; }
.fb .why { color: var(--muted); }
.fb .link { margin-left: 6px; font-size: 13.5px; }
.verdict { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--warn); background: var(--warn-tint); border-radius: 0 8px 8px 0; }
.verdict.correct { border-left-color: var(--ok); background: var(--ok-tint); }
.verdict.wrong { border-left-color: var(--red); background: var(--coral-tint); }
.verdict .lbl { color: var(--muted); font-size: 12.5px; }
.verdict .say-it { font-family: var(--serif); font-style: italic; color: var(--learner); }
.ex-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 8px 0 0; }
.ex-score { font: 700 18px var(--display); color: var(--coral); }

/* ---------- drills ---------- */
.drill-controls { padding: 14px 28px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: 14.5px; }
.chip b { font-family: var(--serif); font-weight: 700; color: var(--coral-dark); }
.chip[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: #fff; }
.chip[aria-pressed="true"] b { color: #fff; }
.drill-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.drill-actions .typebox { flex: 1; min-width: 240px; }
.drill { position: relative; max-width: 84ch; padding-left: 52px; }
.drill .num { position: absolute; left: 18px; top: 16px; font: 600 18px var(--display); color: var(--coral); }
.drill .grade { top: 16px; }
.drill .fr { font-family: var(--serif); font-size: 21px; margin: 0; color: var(--ink); padding-right: 60px; }
.drill .ipa { font-family: var(--serif); color: var(--muted); font-size: 16px; margin: 2px 0; }
.drill .meta { color: var(--muted); font-size: 14px; margin: 0; }
.drill .row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; }
.result { margin-top: 6px; }
.result .heard { font-size: 14.5px; color: var(--muted); margin: 4px 0; }
.issue { font-size: 14.5px; line-height: 1.45; margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--red); }
.issue.warn { border-left-color: var(--warn); }
.issue.stress { border-left-color: var(--learner); }

/* ---------- progress ---------- */
.prog-sec { max-width: 84ch; margin-bottom: 28px; }
.prog-sec h3 { font-size: 20px; margin: 0 0 8px; }
.sound-row { display: grid; grid-template-columns: 7.5em 1fr 4em; gap: 12px; align-items: center; margin: 6px 0; }
.sound-row .ph { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--coral); }
.sound-row .pct { text-align: right; color: var(--muted); font-size: 14.5px; }
.sound-ex { grid-column: 2 / 4; margin: -2px 0 6px; font-size: 13.5px; color: var(--muted); }
.spark { width: 100%; max-width: 600px; height: auto; display: block; }
.meta { color: var(--muted); font-size: 14px; }
.sess h4 { margin: 0 0 4px; }

/* ---------- popover, toast, dialog ---------- */
.popover { position: fixed; z-index: 20; max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; font-size: 14.5px; line-height: 1.45; }
.popover h4 { margin: 0 0 4px; font-size: 20px; }
.popover .ipa { font-family: var(--serif); color: var(--muted); }
.popover .issue { margin: 8px 0; }
.popover .row { display: flex; gap: 14px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 10px 18px; border-radius: 999px; z-index: 30; max-width: min(92vw, 600px); box-shadow: var(--shadow); }
.dlg { width: min(640px, 94vw); max-height: 90vh; border: 0; border-radius: var(--radius); padding: 24px 28px 26px; background: var(--cream); color: var(--text); box-shadow: 0 24px 60px rgba(38, 29, 22, 0.35); }
.dlg::backdrop { background: rgba(38, 29, 22, 0.45); }
.dlg-close { position: absolute; top: 14px; right: 20px; }
.dlg h2 { margin: 0 0 12px; font-size: 26px; }
.drop { display: block; position: relative; border: 2px dashed var(--line-strong); border-radius: 12px; padding: 22px 18px; text-align: center; cursor: pointer; color: var(--muted); font-size: 15px; transition: border-color 0.15s, background 0.15s; background: var(--card); }
.drop b { color: var(--coral-dark); }
.drop:hover, .drop.over { border-color: var(--coral); background: var(--coral-tint); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.thumbs li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.thumbs img, .thumbs .pdf { width: 44px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--red); font-size: 12px; }
.thumbs .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field { display: block; margin: 14px 0 4px; font-size: 15px; }
.field textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.maker-note { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.build-steps { list-style: none; padding: 0; margin: 14px 0 0; font-size: 15px; }
.build-steps li { position: relative; padding: 4px 0 4px 26px; color: var(--muted); }
.build-steps li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.build-steps li.active { color: var(--ink); }
.build-steps li.active::before { border-color: var(--coral); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.build-steps li.done::before { background: var(--ok); border-color: var(--ok); }
.build-steps li.failed::before { background: var(--red); border-color: var(--red); }
.build-done { margin-top: 12px; font-size: 15px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .classroom { grid-template-columns: 1fr; grid-template-rows: minmax(160px, 38%) minmax(0, 1fr); }
  .board { order: -1; border-bottom: 1px solid var(--line); }
  .talk-col { border-right: 0; min-height: 0; }
  .class-head { grid-template-columns: 1fr auto; }
  .agenda { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; gap: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .wordmark { font-size: 22px; }
  .rail .badge { width: 32px; height: 32px; font-size: 14px; }
  .modes { flex-direction: row; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .mode { font-size: 15px; padding: 6px 10px; white-space: nowrap; }
  .settings { width: 100%; }
  .settings[open] { max-height: 50vh; overflow: auto; }
  .gpu { display: none; }
  .view-head, .lib-filters, .tabs, .drill-controls { padding-left: 16px; padding-right: 16px; }
  .view-head h2 { font-size: 22px; }
  .view-head .hint { display: none; }
  .page, .thread, .board { padding: 16px; }
  .say { font-size: 17px; }
  .dock { padding: 10px 14px 12px; gap: 12px; }
  .mic { width: 60px; height: 60px; }
  .mic canvas { inset: -18px; width: 96px; height: 96px; }
  .lib-tools input[type="search"] { width: 150px; }
  .vocab-table td.term { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- the website: account and hours ---------- */
.account { font-size: 14px; line-height: 1.4; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.account p { margin: 0 0 4px; }
.account .who { font: 600 15px/1.3 var(--display); color: var(--ink); overflow-wrap: anywhere; }
.account .hours { color: var(--muted); }
.account .hours b { color: var(--coral-dark); }
.account .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.credit-line { color: var(--muted); }
.credit-line b { color: var(--coral-dark); }
.hours-note { display: block; margin-top: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-right: 4px; vertical-align: 1px; }
.dot.ok { background: var(--ok); }
@media (max-width: 860px) {
  .account { border-bottom: 0; padding-bottom: 0; flex-basis: 100%; }
}

/* ---------- log in ---------- */
.auth .boot-card { max-width: 460px; }
.auth .brand.big .wordmark { font-size: 44px; }
.auth-form h2 { margin: 0 0 4px; font-size: 24px; }
.auth-form input { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 10px; padding: 9px 11px; }
.auth-err { color: var(--red); margin: 12px 0 0; }
.auth-note { color: var(--muted); font-size: 14px; margin-top: 18px; }
@media (max-width: 480px) { .auth .brand.big .wordmark { font-size: 36px; } .auth .brand.big .badge { width: 52px; height: 52px; font-size: 21px; } }

/* ---------- admin ---------- */
body.admin { overflow-y: auto; }
.admin-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--cream-2); }
.admin-tag { font: 600 13px/1.6 var(--display); padding: 1px 10px; border-radius: 999px; background: var(--coral-tint); color: var(--coral-dark); }
.admin-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.admin-main { max-width: 1040px; margin: 0 auto; padding: 22px 16px 60px; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font: 600 12px/1.3 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.off td { color: var(--muted); }
.tbl .minus { color: var(--red); }
.tbl .plus { color: var(--ok); }
.link.strong { font-weight: 700; color: var(--ink); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; }
.inline-form h4 { flex-basis: 100%; margin: 0; }
.inline-form input { border: 1px solid var(--line-strong); background: var(--card); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.inline-form input[type=number] { width: 90px; }
.link-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--ok-tint); }
.link-box p { margin: 0 0 8px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--card); border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.big-hours { font-size: 18px; }
.big-hours b { font: 600 30px/1 var(--display); color: var(--coral-dark); }
.bad { color: var(--red); }
@media (max-width: 600px) { .admin-head { padding: 12px 16px; } .tbl { font-size: 13.5px; } }

/* ---------- questions (instead of the browser's confirm boxes) ---------- */
.dlg.ask { width: min(460px, 94vw); }
.dlg.ask p { font-size: 17px; margin: 0 0 6px; }
