/* Hördiktat-Trainer: calm, high-contrast, large type for children with LRS. No web fonts. */
:root {
  --bg: #f8f5ee;
  --surface: #ffffff;
  --surface-2: #f0ebe0;
  --ink: #1b2330;
  --muted: #4d5666;
  --line: #d6cfc0;
  --primary: #0d5f6b;
  --primary-ink: #ffffff;
  --primary-soft: #dcefef;
  --accent: #b45309;
  --mark-bg: #ffe2c7;
  --mark-ink: #7a2e00;
  --mark-line: #c2410c;
  --ok: #2f7d32;
  --ok-soft: #e1f2df;
  --s1: #e1f2df; --s1-ink: #1f5a22;
  --s2: #dfeaf8; --s2-ink: #1d4677;
  --s3: #eee3f6; --s3-ink: #59287a;
  --arc-a: #0d5f6b;
  --arc-b: #b45309;
  --focus: #f59e0b;
  --shadow: 0 1px 2px rgba(27,35,48,.08), 0 4px 14px rgba(27,35,48,.06);
  --radius: 16px;
  --font: Verdana, Tahoma, "Segoe UI", Arial, "Helvetica Neue", Helvetica, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171e;
    --surface: #1b222c;
    --surface-2: #242d39;
    --ink: #eef1f5;
    --muted: #b4bcc8;
    --line: #3a4554;
    --primary: #5cc3cf;
    --primary-ink: #0b1a1d;
    --primary-soft: #183a40;
    --accent: #f0a35a;
    --mark-bg: #5a2a10;
    --mark-ink: #ffe2c7;
    --mark-line: #fb923c;
    --ok: #7bd389;
    --ok-soft: #1d3a22;
    --s1: #1d3a22; --s1-ink: #bfe8c2;
    --s2: #1c3150; --s2-ink: #c7dcf7;
    --s3: #362348; --s3-ink: #e3cdf3;
    --arc-a: #5cc3cf;
    --arc-b: #f0a35a;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.6;
  letter-spacing: .02em;
  word-spacing: .08em;
  overflow-wrap: break-word;
}
@media (min-width: 720px) { body { font-size: 21px; } }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
main { display: block; outline: none; padding-bottom: 32px; }
h1, h2, h3 { line-height: 1.3; letter-spacing: .01em; }
h1 { font-size: 1.55em; margin: .6em 0 .4em; overflow-wrap: anywhere; hyphens: auto; }
h2 { font-size: 1.25em; margin: 1.4em 0 .5em; }
h3 { font-size: 1.08em; margin: 1.2em 0 .4em; }
p { margin: .5em 0 .9em; }
a { color: var(--primary); text-underline-offset: 4px; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
svg.ic { width: 1.25em; height: 1.25em; flex: none; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; background: var(--surface); border-bottom: 2px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: bold; color: var(--ink); text-decoration: none; min-height: 48px; font-size: .95em; }
.brand-lio { width: 34px; height: 42px; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 10px;
  border-radius: 12px; text-decoration: none; font-size: .8em; font-weight: bold; color: var(--primary);
}
.topnav a[aria-current="page"] { background: var(--primary-soft); }
.topbar { flex-wrap: wrap; }
.brand .short { display: none; }
@media (max-width: 400px) { .brand .long { display: none; } .brand .short { display: inline; } }
h1[tabindex="-1"]:focus { outline: none; }
.field input::placeholder { text-transform: none; letter-spacing: .02em; color: var(--muted); opacity: .8; }
@media (max-width: 440px) {
  .topbar { padding: 4px 8px; gap: 2px; }
  .brand { font-size: .8em; gap: 6px; letter-spacing: 0; }
  .brand-lio { width: 26px; height: 34px; }
  .topnav { gap: 0; }
  .topnav a { padding: 0 8px; font-size: .74em; letter-spacing: 0; }
}

.loading { padding: 40px 0; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 20px; border-radius: 14px;
  border: 2px solid var(--primary); background: var(--surface); color: var(--primary);
  font: inherit; font-weight: bold; letter-spacing: .02em; text-decoration: none; text-align: center;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--primary-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 72px; font-size: 1.1em; }
.btn.wide { width: 100%; }
.btn.small { min-height: 48px; padding: 6px 14px; font-size: .88em; }
.btn.quiet { border-color: var(--line); color: var(--ink); }
.btn.danger { border-color: var(--mark-line); color: var(--mark-ink); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.btn-row .btn { flex: 1 1 200px; }

.back { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; margin-top: 8px; font-weight: bold; text-decoration: none; }

/* home */
.hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 16px; margin: 18px 0 8px; }
.hero svg { width: 72px; height: 90px; }
.hero h1 { margin: 0; }
.hero .say { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .hero { grid-template-columns: auto 1fr; grid-template-rows: auto auto; }
  .hero svg { grid-row: 1 / span 2; width: 100px; height: 125px; }
  .hero .say { grid-column: 2; }
}
.say {
  position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin: 0; box-shadow: var(--shadow);
}
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 16px 18px; border-radius: var(--radius); background: var(--surface);
  border: 2px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.card:hover { border-color: var(--primary); }
.card-n { font-size: .8em; font-weight: bold; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; }
.card-t { font-weight: bold; }
.card-p { font-size: .85em; color: var(--muted); }
.bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 6px; }
.home-links { display: grid; gap: 12px; margin: 24px 0 8px; }
@media (min-width: 640px) { .home-links { grid-template-columns: 1fr 1fr; } }

/* chapter list */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 14px;
  min-height: 72px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.row:hover { border-color: var(--primary); }
.row .code { font-weight: bold; color: var(--primary); min-width: 2.4em; }
.row .t { font-weight: bold; }
.row .meta { grid-column: 2 / 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row .tick { grid-row: 1 / span 2; grid-column: 3; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.row .tick.on { background: var(--ok-soft); color: var(--ok); }
.row .tick svg { width: 28px; height: 28px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: bold; }
.badge.s1 { background: var(--s1); color: var(--s1-ink); }
.badge.s2 { background: var(--s2); color: var(--s2-ink); }
.badge.s3 { background: var(--s3); color: var(--s3-ink); }
.done-note { font-size: .78em; color: var(--ok); font-weight: bold; }

/* dictation */
.dict-head { margin-top: 6px; }
.dict-head .code { font-weight: bold; color: var(--primary); }
.dict-head h1 { margin: .15em 0 .3em; }
.achte { background: var(--primary-soft); border-radius: var(--radius); padding: 12px 16px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 20px 0 0; background: var(--surface-2); padding: 6px; border-radius: 18px; }
.tab {
  min-height: 60px; border: 0; border-radius: 14px; background: transparent; color: var(--ink);
  font: inherit; font-size: .85em; font-weight: bold; line-height: 1.2; padding: 6px; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); outline: 2px solid var(--primary); }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-top: 12px; box-shadow: var(--shadow); }
.panel p.help { color: var(--muted); font-size: .9em; margin-top: 0; }
.slow-ctrl { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .slow-ctrl { grid-template-columns: 2fr 1fr; } }
.progress { height: 14px; background: var(--surface-2); border-radius: 8px; overflow: hidden; margin: 16px 0 4px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); }

.counter { font-size: 1.35em; font-weight: bold; text-align: center; margin: 4px 0 8px; }
.hint {
  min-height: 3.2em; display: flex; align-items: center; justify-content: center; text-align: center;
  border-radius: 14px; padding: 8px 12px; margin: 8px 0 12px; font-weight: bold;
}
.hint.on { background: var(--mark-bg); color: var(--mark-ink); border: 2px solid var(--mark-line); font-size: 1.15em; }
.hint.soft { color: var(--muted); font-weight: normal; font-size: .9em; }
.step-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.step-grid .btn { min-height: 72px; flex-direction: column; gap: 4px; font-size: .95em; min-width: 0; padding-left: 8px; padding-right: 8px; }
.step-grid .btn svg { width: 30px; height: 30px; }
.step-grid #btn-play { min-height: 84px; font-size: 1.05em; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0 4px; min-height: 30px; }
.dots span { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); }
.dots-label { text-align: center; color: var(--muted); font-size: .85em; margin: 0 0 6px; }
.endnote { text-align: center; color: var(--ok); font-weight: bold; }
.tip { color: var(--muted); font-size: .9em; }

/* check */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); padding: 6px; border-radius: 18px; margin: 12px 0 16px; }
.seg button { min-height: 60px; border: 0; border-radius: 14px; background: transparent; font: inherit; font-size: .85em; font-weight: bold; color: var(--ink); line-height: 1.2; cursor: pointer; padding: 6px; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--primary); outline: 2px solid var(--primary); box-shadow: var(--shadow); }
.checktext {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 12px; line-height: 2.5; font-size: 1.12em; box-shadow: var(--shadow);
}
.tok {
  font: inherit; color: var(--ink); background: transparent; border: 2px solid transparent; border-radius: 10px;
  padding: 2px 5px; margin: 0 -1px; cursor: pointer; line-height: 1.5; letter-spacing: inherit;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tok:hover { border-color: var(--line); }
.tok.stol { text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 7px; text-decoration-color: var(--muted); }
.tok.wrong { background: var(--mark-bg); color: var(--mark-ink); border-color: var(--mark-line); text-decoration: underline wavy var(--mark-line); text-underline-offset: 7px; }
.wp { white-space: nowrap; }
.pn { margin-left: -6px; margin-right: 2px; }
.legend { font-size: .85em; color: var(--muted); }
.marked-count { font-weight: bold; }
textarea {
  width: 100%; min-height: 9em; font: inherit; font-size: 1.05em; line-height: 1.6; padding: 12px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); resize: vertical;
}
label.lbl { display: block; font-weight: bold; margin: 8px 0 6px; }

/* result */
.lio-box { display: flex; gap: 12px; align-items: center; margin: 16px 0; }
.lio-box svg { width: 70px; height: 88px; flex: none; }
.summary { list-style: none; padding: 0; margin: 8px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.summary li { background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: bold; }
.wcards { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.wcard { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.wcard .strat { margin: 10px 0 6px; }
.wcard .strat b { color: var(--primary); }
.wcard .from { color: var(--muted); font-size: .8em; margin: 4px 0 0; }
.wcard .btn-row { margin: 10px 0 0; gap: 10px; }
.wcard .btn-row .btn { flex: 1 1 220px; }
.syls { font-size: 1.6em; font-weight: bold; letter-spacing: .04em; display: flex; flex-wrap: wrap; gap: 0 2px; line-height: 1.4; }
.syl { display: inline-block; padding: 0 3px 8px; border-bottom: 4px solid var(--arc-a); border-radius: 0 0 50% 50% / 0 0 14px 14px; }
.syl:nth-child(even) { border-bottom-color: var(--arc-b); }
.covered { display: flex; align-items: center; gap: 10px; min-height: 2.6em; color: var(--muted); }
.covered .dots { justify-content: flex-start; margin: 0; }
.covered .dots span { width: 18px; height: 18px; background: var(--line); }
.empty { background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; }

/* parents */
.prose ul { padding-left: 1.2em; }
.prose li { margin: .4em 0; }
.notice { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.confirm { background: var(--mark-bg); color: var(--mark-ink); border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; }

/* lock */
.lock { max-width: 560px; margin: 0 auto; }

.field { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.field input {
  font: inherit; font-size: 1.25em; letter-spacing: .12em; text-transform: uppercase; min-height: 64px;
  padding: 8px 14px; border: 3px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
}
.field input:focus { border-color: var(--primary); outline: none; }
.msg { border-radius: 14px; padding: 12px 16px; font-weight: bold; }
.msg.err { background: var(--mark-bg); color: var(--mark-ink); border: 2px solid var(--mark-line); }
.msg[hidden] { display: none; }

.foot { color: var(--muted); font-size: .8em; padding-top: 16px; padding-bottom: 32px; border-top: 2px solid var(--line); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: bold;
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
