:root {
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --ink: #102c24;
  --muted: #626961;
  --line: #d9d9ce;
  --accent: #153f2e;
  --accent-ink: #ffffff;
  --accent-soft: #e9ece1;
  --good: #257047;
  --good-soft: #dcf5e8;
  --bad: #d94848;
  --bad-soft: #fde2e2;
  --shadow: 0 3px 18px rgba(35, 45, 31, 0.045);
  --radius: 16px;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15171c; --surface: #1f222a; --ink: #f1f2f5; --muted: #9aa0ad; --line: #2e323c;
  --accent: #68d5b5; --accent-ink: #1a1a1a; --accent-soft: #203a34; --good: #3ccf8e; --good-soft: #17352a;
  --bad: #ff6b6b; --bad-soft: #3d1f22; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; gap: 12px;
  max-width: 720px; margin: 0 auto; padding: 14px 16px;
}
.brand {
  background: none; border: 0; padding: 0;
  font-size: 22px; font-weight: 900; letter-spacing: -0.5px;
}
.brand span { color: var(--accent); }
.brand { color: var(--ink); text-decoration: none; white-space: nowrap; }
.catalog-link { font-size: 13px; font-weight: 800; color: var(--accent); text-underline-offset: 4px; }
.course-group { margin: 18px 0; padding: 0; border: 0; min-width: 0; }
.course-group legend { font-size: 15px; font-weight: 900; margin-bottom: 10px; }
.intro .jobs { display: grid; gap: 10px; margin: 22px 0; }
.intro .jobs .category-entry { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; border-radius: 14px; padding: 16px; font-size: 16px; }
.category-entry b { grid-column: 1; }
.category-entry small { grid-column: 1; color: var(--muted); font-size: 13px; line-height: 1.5; font-weight: 600; }
.category-entry span { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 24px; color: var(--accent); }
.catalogue .top, .catalogue main { max-width: 1100px; }
.catalogue .top { justify-content: space-between; padding-top: 24px; }
.language-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.language-nav a { color: var(--muted); font-size: 13px; text-underline-offset: 5px; }
.language-nav a[aria-current] { color: var(--accent); font-weight: 800; }
.catalogue-hero { padding: 52px 0 28px; max-width: 770px; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-size: 12px; font-weight: 900; letter-spacing: 2px; }
.catalogue .catalogue-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.08; letter-spacing: -1.5px; margin-bottom: 20px; }
.catalogue .lead { max-width: 630px; font-size: 19px; line-height: 1.6; }
.category-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 28px; }
.category-nav a { color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 99px; padding: 10px 16px; background: var(--surface); font-size: 14px; font-weight: 800; }
.category-nav a:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.catalogue-search { max-width: 560px; }
.catalogue-search label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.catalogue-search input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; font: inherit; color: var(--ink); background: var(--surface); }
.course-note { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 720px; }
.catalogue-group { margin: 44px 0; scroll-margin-top: 24px; }
.catalogue-group h2 { margin-bottom: 6px; font-size: 26px; }
.group-description { color: var(--muted); margin-top: 0; }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; position: relative; }
.course-card:hover, .course-card:focus-within { border-color: var(--accent); }
.course-card h3 { font-size: 20px; margin: 0 0 8px; letter-spacing: -.4px; }
.course-card h3 a { color: var(--ink); text-decoration: none; }
.course-card p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.course-card .course-meta { font-size: 12px; padding-top: 6px; }
.course-open { margin-top: auto; color: var(--accent); font-weight: 800; text-decoration: none; font-size: 14px; }
.course-open span { margin-left: 8px; }
.catalogue-footer { padding: 26px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.catalogue-footer a { color: var(--accent); }
@media (max-width: 760px) { .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .catalogue .top { align-items: flex-start; flex-direction: column; } }
@media (max-width: 480px) { .course-grid { grid-template-columns: 1fr; } .catalogue-hero { padding-top: 30px; } .top { flex-wrap: wrap; } .catalog-link { margin-left: auto; } .course-card { padding: 20px; } }
.score { margin-left: auto; display: flex; align-items: baseline; gap: 6px; position: relative; }
.score-num { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.score-label { color: var(--muted); font-size: 14px; }
.score-delta {
  position: absolute; right: 0; top: -14px; font-weight: 900; font-size: 15px; opacity: 0;
}
.score-delta.up { color: var(--good); animation: pop 1s ease-out; }
.score-delta.down { color: var(--bad); animation: pop 1s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.nav { display: flex; gap: 4px; }
.score[hidden] + .nav { margin-left: auto; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  width: 42px; height: 42px; font-size: 18px;
}

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 48px; }

/* ---------- Setup ---------- */
.setup h1 { font-size: 30px; font-weight: 900; margin: 12px 0 4px; letter-spacing: -0.5px; }
.setup .lead { color: var(--muted); margin: 0 0 24px; }
.step { margin: 0 0 22px; }
.step h2 { font-size: 16px; font-weight: 800; margin: 0 0 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice {
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 14px; text-align: left; box-shadow: var(--shadow);
}
.choice b { display: block; font-weight: 800; }
.choice small { color: var(--muted); font-weight: 600; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 14px;
  padding: 14px 22px; font-weight: 900; font-size: 18px; box-shadow: var(--shadow);
}
.primary:disabled { opacity: 0.4; cursor: default; }
.secondary {
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 16px; font-weight: 800;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toggle { display: flex; gap: 8px; align-items: center; color: var(--muted); }

/* ---------- Play ---------- */
.meta { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }

.prompt {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 16px; text-align: center; position: relative; margin-bottom: 16px;
  min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.badge {
  position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent); padding: 4px 10px; border-radius: 99px;
}
.prompt .w { font-size: clamp(34px, 9vw, 52px); font-weight: 900; letter-spacing: -0.5px; overflow-wrap: anywhere; }
.prompt .sub { color: var(--muted); font-size: 20px; }
.speak {
  position: absolute; top: 10px; right: 10px; background: none; border: 0; font-size: 24px;
  width: 44px; height: 44px; border-radius: 12px;
}
.speak:hover { background: var(--accent-soft); }
.task-q { text-align: center; color: var(--muted); margin: 0 0 12px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-height: 92px; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform 0.08s;
}
.opt:active { transform: scale(0.98); }
.opt .w { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.opt .key { font-size: 11px; color: var(--muted); }
.opt.good { border-color: var(--good); background: var(--good-soft); }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.dim { opacity: 0.45; }
.opt:disabled { cursor: default; }

.feedback { text-align: center; margin-top: 16px; min-height: 56px; }
.feedback .msg { font-weight: 800; margin-bottom: 10px; }
.feedback .msg.good { color: var(--good); }
.feedback .msg.bad { color: var(--bad); }

.prompt .w.long, .opt .w.long { font-size: clamp(20px, 4.6vw, 28px); letter-spacing: 0; line-height: 1.25; }
.opt .w.long { font-size: 18px; font-weight: 700; }
.options.wide { grid-template-columns: 1fr; }
.options.wide .opt { min-height: 60px; flex-direction: row; justify-content: flex-start; text-align: left; gap: 10px; }
.options.wide .opt .key { margin-left: auto; }
.row.center { justify-content: center; }
.offer .prompt { padding: 36px 20px; gap: 12px; }
.offer .sub { font-size: 17px; max-width: 520px; line-height: 1.45; }

/* Setup: emner */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface); border: 2px solid var(--line); border-radius: 99px;
  padding: 7px 12px; font-weight: 700; font-size: 14px;
}
.chip small { color: var(--muted); font-weight: 700; margin-left: 2px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chip[aria-pressed="false"] { opacity: 0.6; }

/* Byg / stav */
.build {
  min-height: 64px; background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-bottom: 14px;
}
.build.good { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.build.bad { border-style: solid; border-color: var(--bad); background: var(--bad-soft); }
.build .prefix { color: var(--muted); font-weight: 800; font-size: 20px; margin-right: 4px; }
.built { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px;
  padding: 8px 12px; font-weight: 800; font-size: 18px; min-width: 42px;
}
.tile:disabled { opacity: 0.25; cursor: default; }
.tile.in { background: var(--accent-soft); border-color: var(--accent); }
.tile.in:disabled { opacity: 1; }

/* ---------- Stats ---------- */
td.wrap { white-space: normal; min-width: 120px; }
.stats h1 { font-size: 26px; font-weight: 900; margin: 12px 0 6px; }
.explain { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.explain code { background: var(--accent-soft); color: var(--ink); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td.num { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--line); }
.dot.ok { background: var(--good); }
.dot.no { background: var(--bad); }
.bar { width: 70px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; }
.bar > div { height: 100%; background: var(--accent); }
.bar.due > div { background: var(--bad); }

@media (max-width: 420px) {
  .options { gap: 10px; }
  .opt { min-height: 80px; }
  .score-label { display: none; }
}

/* Ikoner og billeder */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.speak { color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.speak svg { width: 24px; height: 24px; }
.speak:hover { color: var(--accent); }
.pic { width: 150px; height: 150px; object-fit: contain; border-radius: 16px; user-select: none; }
.opt .pic { width: 104px; height: 104px; }
.pic-sm { width: 40px; height: 40px; object-fit: contain; vertical-align: middle; border-radius: 8px; }
.choice:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
@media (max-width: 420px) { .pic { width: 120px; height: 120px; } .opt .pic { width: 84px; height: 84px; } }

/* Introduktion (første besøg) */
.intro { max-width: 720px; margin: 0 auto; padding: 8px 16px 0; }
.intro h1 { font-size: clamp(26px, 6vw, 34px); font-weight: 900; letter-spacing: -0.5px; margin: 8px 0 6px; line-height: 1.15; }
.intro .lead { color: var(--muted); margin: 0 0 14px; font-size: 17px; }
.intro .how { margin: 0 0 10px; padding-left: 22px; line-height: 1.5; }
.intro .how li { margin-bottom: 6px; }
.intro .tagline { color: var(--accent); font-weight: 800; font-size: 14px; margin: 0 0 8px; }
a.brand { text-decoration: none; color: var(--ink); }

/* Kontekstlinje i øvelsen */
.ctxbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.pill {
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  padding: 5px 11px; font-size: 13px; font-weight: 800; color: var(--ink);
}
.pill:hover { border-color: var(--accent); }
.pill.toggle { color: var(--accent); }

/* Lyd slået fra */
#soundBtn .mute { display: none; }
#soundBtn.off .mute { display: inline; }
#soundBtn.off .waves { display: none; }
#soundBtn.off { color: var(--muted); }

.row.actions { margin-top: 6px; }
.explain p { margin: 6px 0 0; }
.explain details { margin-top: 8px; }
.explain summary { cursor: pointer; font-weight: 800; color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Links til jobsider på forsiden */
.intro .jobs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.intro .jobs a, .page .links a {
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px;
  font-size: 13px; font-weight: 800; color: var(--ink); text-decoration: none;
}
.intro .jobs a:hover, .page .links a:hover { border-color: var(--accent); }

/* Statiske jobsider */
.page main { max-width: 760px; }
.page h1 { font-size: clamp(28px, 6vw, 38px); font-weight: 900; margin: 8px 0 4px; letter-spacing: -0.5px; }
.page h2 { font-size: 20px; font-weight: 900; margin: 28px 0 10px; }
.page .lead { color: var(--muted); font-size: 18px; margin: 0 0 12px; }
.page p { line-height: 1.55; }
.page .cta { display: inline-block; text-decoration: none; }
.page .tagline { color: var(--accent); font-weight: 800; font-size: 14px; }
.page .how { padding-left: 22px; line-height: 1.55; }
.page .topics { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.page .topics li { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 14px; font-weight: 700; }
.page .topics small { color: var(--muted); }
.page .links { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.page td { white-space: normal; }
.page td.da { font-weight: 800; }
.page .langs a { color: var(--accent); font-weight: 800; }

/* ---------- Billed-mode ---------- */
.prompt.pics .pic { width: 190px; height: 190px; }
.options.pics .opt { min-height: 140px; padding: 8px; }
.options.pics .opt .pic { width: 124px; height: 124px; }
@media (max-width: 420px) {
  .prompt.pics .pic { width: 150px; height: 150px; }
  .options.pics .opt { min-height: 118px; }
  .options.pics .opt .pic { width: 100px; height: 100px; }
}

/* ---------- Skriv ordet: pladser til bogstaver og bogstav-tastatur ---------- */
.slots {
  --slot: min(46px, calc((min(100vw, 720px) - 32px) / var(--n, 6) - 5px));
  display: flex; justify-content: center; align-items: flex-end; gap: 6px; flex-wrap: nowrap;
  margin: 0 0 18px; min-height: 60px;
}
.slots .prefix { color: var(--muted); font-weight: 800; font-size: calc(var(--slot) * 0.6); margin-right: calc(var(--slot) * 0.3); padding-bottom: 6px; }
.slot {
  width: var(--slot); height: calc(var(--slot) * 1.25); border-bottom: 4px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--slot) * 0.75); font-weight: 900; line-height: 1;
}
.slot.cur { border-color: var(--accent); animation: blink 1.1s ease-in-out infinite; }
.slot.filled { border-color: var(--ink); }
.slot.just { animation: drop 0.18s ease-out; }
.slot.fixed { border-color: transparent; }
.slots.good .slot { color: var(--good); border-color: var(--good); animation: none; }
.slots.almost .slot { color: var(--accent); border-color: var(--accent); animation: none; }
@keyframes blink { 50% { border-color: var(--line); } }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }

.keys {
  display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 10px;
  max-width: calc(var(--cols, 3) * 96px); margin: 0 auto;
}
.kb {
  aspect-ratio: 1; background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px; box-shadow: var(--shadow);
  font-size: clamp(26px, 8vw, 38px); font-weight: 900; line-height: 1; padding: 0;
  touch-action: manipulation; user-select: none; transition: transform 0.06s;
}
.kb:active { transform: translateY(2px); border-bottom-width: 3px; }
.kb.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.kb.shake { animation: shake 0.35s; }
.kb.hint { background: var(--accent-soft); border-color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.kb:disabled { cursor: default; opacity: 0.5; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
.feedback .msg.almost { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .slot.cur, .slot.just, .kb.shake, .kb.hint { animation: none; }
}
.prompt.write { min-height: 0; padding: 22px 16px 16px; margin-bottom: 12px; }
.prompt.write.pics .pic { width: 150px; height: 150px; }
.prompt.write .w { font-size: clamp(26px, 7vw, 40px); }
@media (max-width: 420px) {
  .prompt.write.pics .pic { width: 118px; height: 118px; }
  .keys { gap: 8px; max-width: calc(var(--cols, 3) * 80px); }
  .slots { gap: 4px; margin-bottom: 14px; }
}

/* Catalogue overrides follow the legacy page rules. */
.page.catalogue main, .page.catalogue .top { max-width: 1100px; }
.intro nav.jobs { display: grid; }
.course-picker summary { cursor: pointer; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 800; }
.setup-ready { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; margin: 20px 0 28px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; }
.setup-ready > div { min-width: 0; overflow-wrap: anywhere; }
.setup-ready b, .setup-ready span { display: block; }
.setup-ready span { margin-top: 6px; font-size: 13px; color: var(--muted); }
.setup-ready button { flex-shrink: 0; min-height: 44px; font-size: 15px; }
@media (max-width: 380px) { .setup-ready { flex-wrap: wrap; } }

/* Feedback stays readable while the next task is already interactive. */
.answer-receipt { min-height: 26px; padding: 2px 0; color: var(--good); font-size: 13px; line-height: 1.5; font-weight: 800; overflow-wrap: anywhere; }
.answer-receipt > div { flex: 1; min-width: min(160px, 100%); }
.answer-receipt .secondary { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.answer-receipt #previousFavoriteBtn { width: 44px; flex-shrink: 0; font-size: 22px; }
.answer-receipt [aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.answer-receipt #receiptSaveStatus:empty { display: none; }
.resume-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 24px 0 12px; }
.resume-panel > div { min-width: 0; overflow-wrap: anywhere; }
.resume-panel h2 { margin: 6px 0; font-size: 24px; }
.resume-panel p { margin: 0; }
.resume-panel .cta { flex-shrink: 0; margin: 0; }
.catalogue-personal a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 800; text-underline-offset: 4px; }
@media (max-width: 600px) { .resume-panel { align-items: flex-start; flex-direction: column; padding: 18px; } }
.score-delta.up, .score-delta.down, .slot.cur, .slot.just, .kb.shake, .kb.hint { animation: none; }
.progress > div { transition: none; }
.level-notice { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 14px; line-height: 1.5; }
button, .category-nav a, .course-open { touch-action: manipulation; }

/* Personal vocabulary: compact on desktop, comfortable touch targets on small screens. */
.word-save { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0; }
.word-save .secondary { min-height: 44px; padding: 9px 14px; font-size: 13px; }
.word-save [aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.word-save [role="status"] { flex-basis: 100%; text-align: center; font-size: 13px; }
.library h1 { font-size: 32px; margin-bottom: 6px; }
.library input, .library select, dialog input, dialog select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-width: 100%; min-width: 0; }
.library label, dialog label { display: block; font-size: 13px; font-weight: 800; margin: 12px 0 6px; }
.library input[type="search"] { width: 100%; }
.library-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.library-pair select { width: 100%; }
.library-audio { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.library-audio svg { width: 20px; height: 20px; }
.list-management { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 12px 0; }
.library-transfer { margin: 28px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.library-transfer summary { cursor: pointer; font-weight: 800; min-height: 44px; }
.library .secondary, .library .chip, dialog button { min-height: 44px; }
.library .secondary { padding: 9px 12px; font-size: 13px; }
.list-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.new-list-form .row { display: flex; gap: 8px; }
.new-list-form input { flex: 1; }
.library-title { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-top: 26px; }
.library-title h2 { font-size: 22px; overflow-wrap: anywhere; margin: 0; }
.library-title small { color: var(--muted); font-size: 14px; }
.library-title button { font-size: 14px; }
.library-words { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.library-word { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.library-word > div:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.library-word b, .library-word span { display: block; }
.library-word span { color: var(--muted); font-size: 14px; margin-top: 4px; }
.library-row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.empty-list { padding: 24px; border: 1px dashed var(--line); border-radius: 12px; line-height: 1.6; color: var(--muted); }
.dictionary-search { margin: 32px 0; }
.dictionary-search h2 { font-size: 20px; }
.custom-word { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 18px; margin: 20px 0; }
.custom-word summary { cursor: pointer; font-weight: 800; }
.custom-word input, .custom-word select { width: 100%; margin-bottom: 8px; }
.custom-word button { margin-top: 12px; }
.word-choices { display: grid; gap: 8px; }
.word-choices:empty { display: none; }
.word-choices button { text-align: left; margin: 0; overflow-wrap: anywhere; }
.word-choices b, .word-choices span { display: block; }
.word-choices span { color: var(--muted); margin-top: 4px; }
.own-word-actions { flex-wrap: wrap; gap: 10px; }
.library-backup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.library-return { display: flex; flex-wrap: wrap; gap: 10px; }
.library .import-label { display: inline-flex; align-items: center; margin: 0; font-size: 13px; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; position: relative; }
.import-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.import-label:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.text-button { border: 0; background: none; padding: 10px 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: min(450px, calc(100vw - 28px)); width: 100%; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog input, dialog select { width: 100%; }
dialog h2 { font-size: 24px; margin: 0 0 18px; }
@media (max-width: 760px) { .top { flex-wrap: wrap; } .top .nav { margin-left: auto; } }
@media (max-width: 480px) {
  .library-title { align-items: flex-start; flex-direction: column; }
  .library-word { flex-wrap: wrap; gap: 10px; }
  .library-word > div:first-child { flex-basis: 100%; }
  .library-row-actions { justify-content: flex-start; }
  .new-list-form .row { flex-wrap: wrap; }
  .new-list-form input { flex-basis: 100%; }
}

.icon-btn { width: 44px; height: 44px; }
.opt, .kb { transition: none; }
.opt:active { transform: none; }
@media (max-width: 960px) { .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .course-grid { grid-template-columns: 1fr; } }

/* The exercise header keeps its two essential controls on one row. */
body:not(.catalogue) > .top { flex-wrap: nowrap; gap: 8px; padding: 10px 16px; }
body:not(.catalogue) > .top .nav { margin-left: auto; flex-shrink: 0; }
body:has(dialog[open]) { overflow: hidden; }
dialog { max-height: calc(100dvh - 28px); overflow-y: auto; }
.menu-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.menu-heading h2 { margin: 0; }
.menu-items { display: grid; gap: 6px; }
.menu-items a, .menu-items button { display: flex; align-items: center; text-align: left; text-decoration: none; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; font-weight: 800; min-height: 48px; }
.menu-items a:hover, .menu-items button:hover { border-color: var(--accent); }
#appMenu .score { margin: 6px 0 0; }
#appMenu .score-label { display: inline; }
.mode-fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.mode-fieldset legend { font-weight: 900; }
.mode-fieldset .course-note { margin: 8px 0 12px; }
label.repeat-option { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; margin: 0 0 16px; font-size: 15px; cursor: pointer; }
.repeat-option input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; padding: 0; accent-color: var(--accent); }
.repeat-option small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; font-weight: 600; }
.prompt-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }
.prompt-actions .speak { position: static; }
.word-heart { width: 44px; height: 44px; font-size: 28px; line-height: 1; background: none; border: 0; border-radius: 12px; }
.word-heart:hover, .word-heart[data-saved="true"] { color: var(--accent); background: var(--accent-soft); }
.favorite-choice { width: 100%; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); border-radius: 12px; padding: 12px; text-align: left; font-weight: 800; }
.prompt, .prompt.write { padding-top: 52px; }
.meta { margin-bottom: 6px; }
.progress { margin-bottom: 6px; }
@media (max-width: 480px) {
  body:not(.catalogue) > .top .brand { font-size: 20px; }
  main { padding-top: 4px; padding-bottom: 20px; }
  .prompt { min-height: 140px; margin-bottom: 12px; padding-bottom: 18px; }
  .prompt .w { font-size: clamp(28px, 8vw, 38px); }
  .opt { min-height: 84px; }
  .opt .w { font-size: clamp(18px, 5vw, 20px); }
  .keys { max-width: calc(var(--cols, 3) * 66px); gap: 8px; }
  .feedback { min-height: 44px; }
  .setup-ready > div { flex-basis: 100%; }
  dialog { padding: 20px; }
}

/* Editorial identity: warm paper, quiet rules and forest green. */
.brand { font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -1.4px; }
.brand span { color: inherit; }
h1, h2, dialog h2 { font-family: var(--serif); font-weight: 500; }
.setup h1, .page h1, .page h2, .catalogue .catalogue-hero h1 { font-weight: 500; }
.choice, .opt { box-shadow: none; }
.choice { border-width: 1px; }
.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.primary, .secondary { min-height: 48px; font-size: 16px; padding: 12px 20px; border-radius: 999px; font-weight: 600; box-shadow: none; line-height: 1.4; }
.primary { border: 1px solid var(--accent); }
.secondary { border-width: 1px; color: var(--ink); }
.icon-btn { background: transparent; border-radius: 10px; }
.prompt { border: 1px solid var(--line); }
.prompt .w { font-weight: 600; letter-spacing: -.8px; }
.offer .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.offer .row button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; padding: 12px 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.topic-picker { position: relative; }
.topic-picker > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; background: var(--surface); min-height: 48px; font-weight: 500; }
.topic-picker > summary::-webkit-details-marker { display: none; }
.topic-picker[open] > summary { border-color: var(--accent); }
.topic-picker > summary::after { content: ''; width: 8px; height: 8px; flex: 0 0 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -4px 2px 0 0; }
.topic-picker[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.topic-panel { position: absolute; inset: calc(100% + 6px) 0 auto; z-index: 5; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; box-shadow: 0 12px 35px rgb(16 44 36 / .14); max-height: min(420px, 60dvh); overflow-y: auto; }
.topic-panel .course-note { margin: 0 0 10px; }
.topic-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.topic-tools .secondary { min-height: 44px; font-size: 13px; padding: 8px 14px; }
.topic-checks { border: 0; margin: 0 0 12px; padding: 0; }
.topic-checks label { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.topic-checks input { width: 20px; height: 20px; margin: 0; flex: 0 0 20px; accent-color: var(--accent); }
.topic-checks small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-panel > .primary { width: 100%; position: sticky; bottom: 0; }
.landing-nav { display: none; }
.landing > header.top { max-width: 1248px; min-height: 88px; padding: 20px 56px; border-bottom: 1px solid var(--line); }
.landing > .top .brand { font-size: 28px; }
.landing > .top .landing-nav { display: flex; gap: 32px; align-items: center; margin: 0 auto; padding-left: 30px; font-size: 14px; }
.landing-nav a { text-decoration: none; color: var(--ink); white-space: nowrap; }
.landing-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.landing > .top .nav { margin-left: 0; gap: 10px; }
.intro { max-width: 1248px; padding: 0; }
.home-hero { min-height: 400px; padding: 46px 56px 36px; background: linear-gradient(90deg, var(--bg) 0%, rgb(247 244 238 / .97) 30%, rgb(247 244 238 / .78) 52%, transparent 75%), url('images/site/study-corner.jpg') center right / cover no-repeat; }
.hero-copy { max-width: 700px; }
.home-hero .eyebrow { color: var(--ink); font-size: 11px; font-weight: 500; letter-spacing: 2.4px; display: flex; gap: 22px; align-items: center; margin: 0 0 26px; }
.home-hero .eyebrow::after { content: ''; display: block; width: 64px; height: 1px; background: var(--muted); opacity: .6; }
.intro .home-hero h1 { max-width: 720px; font-size: clamp(44px, 5vw, 65px); font-weight: 500; line-height: 1.09; letter-spacing: -2.8px; margin: 0 0 22px; text-wrap: balance; }
.intro .home-hero .lead { max-width: 610px; font-family: var(--serif); font-size: 20px; font-style: italic; color: var(--ink); line-height: 1.5; margin-bottom: 26px; text-wrap: pretty; }
.hero-benefits { display: flex; flex-wrap: wrap; gap: 0; list-style: none; padding: 0; margin: 26px 0 0; font-size: 13px; }
.hero-benefits li { display: flex; align-items: center; gap: 8px; }
.hero-benefits li + li::before { content: '/'; color: #8b9185; margin: 0 24px; }
.hero-benefits svg { width: 19px; height: 19px; }
.intro .jobs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 30px 32px; margin: 0; }
.intro .jobs .category-entry { display: flex; align-items: flex-start; gap: 18px; padding: 8px 24px; background: transparent; border: 0; border-radius: 0; color: var(--ink); font-size: 16px; }
.intro .category-entry + .category-entry { border-left: 1px solid var(--line); }
.intro .category-entry b { display: block; font-family: var(--serif); font-weight: 600; font-size: 20px; margin-bottom: 7px; letter-spacing: -.7px; }
.intro .category-entry small { display: block; font-size: 13px; line-height: 1.55; color: var(--ink); font-weight: 400; }
.category-icon { width: 32px; height: 32px; flex: 0 0 32px; }
.intro .category-entry:hover b { text-decoration: underline; text-underline-offset: 4px; }
.home-how { display: flex; align-items: center; gap: 32px; padding: 24px 32px; margin: 8px 32px 0; border-radius: 20px; background: var(--accent-soft); scroll-margin-top: 24px; }
.home-how h2 { font-size: 28px; font-weight: 400; letter-spacing: -1px; margin: 0; white-space: nowrap; }
.intro .home-how .how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 0; margin: 0; counter-reset: steps; list-style: none; }
.intro .home-how .how li { counter-increment: steps; display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.5; margin: 0; }
.home-how li::before { content: counter(steps); display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 27px; height: 27px; flex: 0 0 27px; font-family: var(--serif); font-size: 15px; }
.landing > main { max-width: 1248px; padding: 42px 32px 70px; scroll-margin-top: 24px; background: url('images/site/landscape.svg') center bottom / 100% auto no-repeat; }
.landing .setup { text-align: center; padding: 0 24px; }
.setup-kicker { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; margin: 0 0 16px; }
.setup-kicker::before, .setup-kicker::after { content: ''; width: 42px; height: 1px; background: #a2a99a; }
.landing .setup .step h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -1px; margin-bottom: 24px; }
.landing .setup .choices { max-width: 590px; margin: 0 auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.landing .setup .choice { border-radius: 999px; text-align: center; min-height: 50px; background: transparent; border-color: #9da697; }
.landing .setup .choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.page .top { padding-top: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.page main { padding-top: 28px; }
.page .catalogue-hero { padding-top: 28px; }
.course-card { background: transparent; border-radius: 4px; box-shadow: none; padding: 0; }
.course-card-link { display: flex; flex-direction: column; align-items: flex-start; flex: 1; width: 100%; padding: 24px 20px; color: var(--ink); text-decoration: none; border-radius: inherit; }
.course-card-link:hover .course-open { text-decoration: underline; text-underline-offset: 4px; }
.course-card h3 { font-family: var(--serif); font-weight: 500; font-size: 23px; }
.category-nav a { background: transparent; }
.catalogue-search input { background: var(--surface); }
@media (max-width: 1100px) {
  .landing > header.top .landing-nav { display: none; }
  .landing > header.top .nav { margin-left: auto; }
}
@media (max-width: 1000px) {
  .landing > header.top { padding-left: 32px; padding-right: 32px; }
  .landing > .top .landing-nav { gap: 18px; padding-left: 12px; font-size: 12px; }
  .home-hero { padding: 38px 32px; }
  .hero-copy { max-width: 600px; }
  .intro .home-hero h1 { max-width: 590px; }
  .intro .jobs { padding: 24px 12px; }
  .intro .jobs .category-entry { padding: 8px 16px; gap: 12px; }
  .intro .category-entry b { font-size: 18px; }
  .home-how { flex-direction: column; align-items: flex-start; gap: 18px; }
}
@media (max-width: 760px) {
  .landing > header.top { min-height: 76px; padding: 14px 24px; }
  .landing > .top .landing-nav { display: none; }
  .landing > .top .nav { margin-left: auto; }
  .landing > .top .brand { font-size: 25px; }
  .home-hero { min-height: 0; padding: 32px 24px 26px; background: none; }
  .home-hero .eyebrow { font-size: 9px; letter-spacing: 1.6px; gap: 12px; margin-bottom: 20px; }
  .home-hero .eyebrow::after { width: 30px; }
  .intro .home-hero h1 { font-size: clamp(34px, 7.3vw, 48px); letter-spacing: -1.6px; line-height: 1.13; margin-bottom: 18px; }
  .intro .home-hero .lead { font-size: 17px; font-style: normal; line-height: 1.45; margin-bottom: 22px; }
  .hero-benefits { justify-content: space-between; flex-wrap: nowrap; gap: 6px; font-size: 11px; margin-top: 22px; }
  .hero-benefits li { gap: 6px; }
  .hero-benefits li + li::before { margin: 0 8px 0 0; }
  .hero-benefits svg { width: 17px; height: 17px; flex: 0 0 17px; }
  .intro .jobs { grid-template-columns: 1fr; padding: 0 24px; }
  .intro .jobs .category-entry { padding: 18px 0; align-items: center; gap: 20px; }
  .intro .category-entry + .category-entry { border-left: 0; border-top: 1px solid var(--line); }
  .intro .category-entry b { font-size: 18px; margin-bottom: 4px; }
  .intro .category-entry small { font-size: 12px; }
  .category-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .home-how { display: flex; margin: 22px 16px 0; padding: 22px; }
  .home-how h2 { font-size: 24px; }
  .intro .home-how .how { grid-template-columns: 1fr; gap: 14px; }
  .landing > main { padding: 30px 16px 40px; background: none; }
  .landing .setup { background: var(--accent-soft); padding: 26px 16px; border-radius: 20px; }
  .landing .setup .step { margin-bottom: 0; }
  .landing .setup .step h2 { font-size: 26px; line-height: 1.2; }
  .landing .setup .choices { gap: 8px; }
  .landing .setup .choice { padding: 10px 5px; font-size: 13px; min-height: 46px; }
  body:not(.catalogue) > .top .brand { font-size: 22px; }
}
@media (max-width: 359px) {
  .landing > header.top { padding-left: 16px; padding-right: 16px; }
  .hero-benefits { font-size: 10px; }
  .hero-benefits li + li::before { display: none; }
  .home-hero, .intro .jobs { padding-left: 20px; padding-right: 20px; }
  .intro .home-hero h1 { font-size: 33px; }
}
