/* Dutch App UX mock — calm paper, pine accent. WCAG 2.2 AA. */
:root {
  --bg: #F3EFE6;
  --elev: #FFFBF4;
  --ink: #1A1814;
  --muted: #534E46;
  --line: #E3DDD2;
  --accent: #0F5E56;
  --accent-hover: #0C4F48;
  --on-accent: #FFFFFF;
  --accent-soft: #E4F1EF;
  --accent-ink: #0C4F48;
  --good: #215C45;
  --good-soft: #E6F2EB;
  --warm: #7A4E16;
  --warm-soft: #F6EDE0;
  --danger: #8B3A32;
  --danger-soft: #F8EBE9;
  --shadow: 0 1px 2px rgba(26, 24, 20, 0.06), 0 8px 24px rgba(26, 24, 20, 0.04);
  --radius: 16px;
  --radius-sm: 14px;
  --target: 56px;
  --font-ui: "SF Pro Text", "Segoe UI", "Roboto", "Helvetica Neue", system-ui, sans-serif;
  --font-nl: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --space: 8px;
  --demo-h: 0px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #161411;
  --elev: #22201C;
  --ink: #F2EEE6;
  --muted: #B7B1A6;
  --line: #3A3630;
  --accent: #15756C;
  --accent-hover: #1A8A80;
  --on-accent: #FFFFFF;
  --accent-soft: #1A2E2C;
  --accent-ink: #8ED9D2;
  --good: #8FCBB0;
  --good-soft: #1A2A23;
  --warm: #E0B878;
  --warm-soft: #2A2318;
  --danger: #E0A399;
  --danger-soft: #2A1C1A;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #161411;
    --elev: #22201C;
    --ink: #F2EEE6;
    --muted: #B7B1A6;
    --line: #3A3630;
    --accent: #15756C;
    --accent-hover: #1A8A80;
    --on-accent: #FFFFFF;
    --accent-soft: #1A2E2C;
    --accent-ink: #8ED9D2;
    --good: #8FCBB0;
    --good-soft: #1A2A23;
    --warm: #E0B878;
    --warm-soft: #2A2318;
    --danger: #E0A399;
    --danger-soft: #2A1C1A;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 80;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: 8px;
}
.skip:focus { top: 8px; }

/* Demo bar (hidden in screenshots via html[data-shot]) */
.demo-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--elev);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
html[data-shot] .demo-bar { display: none !important; }
.demo-bar strong { color: var(--ink); font-weight: 600; }
.demo-bar label { display: flex; align-items: center; gap: 6px; }
.demo-bar select, .demo-bar button {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  padding: 0 10px;
}
.demo-bar button { cursor: pointer; }
.demo-bar select:focus-visible,
.demo-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
  min-height: 52px;
}
.topbar h1 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0;
  flex: 1;
  letter-spacing: -0.02em;
}
.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  min-width: var(--target);
  min-height: var(--target);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  padding: 0 12px;
}
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 24px;
}

/* Wider shells */
html[data-profile="laptop"] main,
html[data-profile="fold-open"] main,
html[data-profile="tesla"] main {
  max-width: 1120px;
}
html[data-profile="tesla"] {
  --target: 72px;
  font-size: 18px;
}
html[data-profile="tesla"] .topbar h1 { font-size: 24px; }
html[data-profile="tesla"] main { padding: 12px 32px 32px; }

.muted { color: var(--muted); }
.tiny { font-size: 13px; line-height: 1.4; color: var(--muted); }
.assume { font-size: 13px; color: var(--muted); }
.assume::before { content: ""; }

.hero {
  margin: 8px 0 24px;
}
.hero .greet {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 6px;
}
.hero h2 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  font-weight: 600;
}
.hero p { margin: 0; color: var(--muted); }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: var(--elev);
  border-color: var(--line);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.primary-wrap { margin: 28px 0 20px; }

.parts {
  display: grid;
  gap: 10px;
  margin: 8px 0 24px;
}
html[data-profile="laptop"] .parts,
html[data-profile="fold-open"] .parts,
html[data-profile="tesla"] .parts {
  grid-template-columns: repeat(2, 1fr);
}
html[data-profile="tesla"] .parts { grid-template-columns: repeat(3, 1fr); gap: 14px; }

.part-card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--target);
}
.part-card .name { font-weight: 600; }
.part-card .status { margin-left: auto; font-size: 15px; color: var(--muted); text-align: right; }
.part-card .status.good { color: var(--good); }
.part-card .status.warm { color: var(--warm); }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); flex-shrink: 0;
}
.dot.good { background: var(--good); }
.dot.warm { background: var(--warm); }

/* Quiet progress, no numbers */
.dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 16px;
}
.dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
}
.dots span.on { background: var(--accent); }
.dots span.done { background: var(--accent-ink); opacity: 0.45; }
.bar {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 16px;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 99px;
}

.card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.word {
  font-family: var(--font-nl);
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
  text-align: center;
}
.phrase {
  font-family: var(--font-nl);
  font-size: 20px;
  line-height: 1.45;
  margin: 0;
}
.passage {
  font-family: var(--font-nl);
  font-size: 19px;
  line-height: 1.55;
  margin: 0;
}

.illust {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}
.illust svg { width: 160px; height: 120px; }

.answers {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
html[data-profile="tesla"] .answers {
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
/* Phone: answers sit in the lower third — spacer pushes them down in session view */
.session-body { display: flex; flex-direction: column; min-height: calc(100dvh - 200px); }
html[data-profile="phone"] .session-body,
html[data-profile="fold-closed"] .session-body,
html[data-profile="auto"] .session-body {
  min-height: calc(100dvh - 220px);
}
.session-lower { margin-top: auto; padding-top: 16px; }

.choice {
  min-height: var(--target);
  text-align: left;
  justify-content: flex-start;
  font-weight: 500;
  padding: 12px 16px;
}
.choice kbd {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  margin-right: 8px;
  min-width: 22px;
  text-align: center;
}
html:not([data-profile="laptop"]) .choice kbd { display: none; }
.choice[aria-pressed="true"], .choice.picked {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.choice.correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}
.choice.wrong {
  border-color: var(--line);
  opacity: 0.7;
}

.dontknow {
  margin-top: 8px;
  width: 100%;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
}
.dontknow:hover { background: var(--elev); color: var(--ink); }

.review {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--good-soft);
  border: 1px solid var(--line);
}
.review.neutral { background: var(--accent-soft); }
.review h3 { margin: 0 0 6px; font-size: 16px; }
.review p { margin: 0; }

.audio {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 12px 0 8px;
}
.audio .btn { min-width: var(--target); }
.wave {
  width: 80px; height: 28px;
  display: flex; align-items: flex-end; gap: 3px;
}
.wave i {
  flex: 1; background: var(--accent);
  border-radius: 2px; height: 30%;
  opacity: 0.5;
}
html[data-playing] .wave i { animation: eq 0.8s ease-in-out infinite alternate; }
html[data-playing] .wave i:nth-child(2) { animation-delay: .1s; }
html[data-playing] .wave i:nth-child(3) { animation-delay: .2s; }
html[data-playing] .wave i:nth-child(4) { animation-delay: .15s; }
html[data-playing] .wave i:nth-child(5) { animation-delay: .05s; }
@keyframes eq {
  from { height: 25%; }
  to { height: 100%; }
}

.input-row { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.input-row input, .input-row textarea, .field {
  font: inherit;
  font-size: 18px;
  color: var(--ink);
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: var(--target);
  padding: 12px 16px;
  width: 100%;
}
.input-row textarea, textarea.field {
  min-height: 220px;
  resize: vertical;
  font-size: 17px;
  line-height: 1.5;
}
.input-row input:focus-visible,
.input-row textarea:focus-visible,
.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.digit-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.digit-pad button {
  min-height: var(--target);
  font-size: 22px;
  font-weight: 600;
}

/* Two-pane Lezen */
.panes { display: flex; flex-direction: column; gap: 16px; }
html[data-profile="fold-open"] .panes.lezen,
html[data-profile="laptop"] .panes.lezen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
html[data-profile="fold-open"] .panes.lezen .passage-card,
html[data-profile="laptop"] .panes.lezen .passage-card {
  position: sticky;
  top: 12px;
  max-height: calc(100dvh - 180px);
  overflow: auto;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
}
.timer.warn { color: var(--warm); }

.mic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.mic-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mic-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mic-btn.rec { background: var(--danger); }

.note {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  margin: 12px 0;
}
.banner-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}
.empty h2 { color: var(--ink); font-size: 22px; margin: 0 0 8px; }

.skel {
  height: 16px;
  background: var(--line);
  border-radius: 8px;
  margin: 10px 0;
  width: 70%;
}

.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--target);
  padding: 10px 14px;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row .meta { margin-left: auto; color: var(--muted); font-size: 15px; text-align: right; }
.row[disabled], .row.is-disabled {
  opacity: 0.7;
  cursor: default;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--target);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.switch label { flex: 1; }
.toggle {
  appearance: none;
  width: 88px;
  height: 56px;
  border-radius: 99px;
  background: var(--line);
  border: 0;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--elev);
  box-shadow: var(--shadow);
}
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { left: 38px; }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Bottom nav */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--elev);
  border-top: 1px solid var(--line);
  padding: 4px 8px env(safe-area-inset-bottom, 8px);
}
.nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: var(--target);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
}
.nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav button[aria-current="page"] { color: var(--accent-ink); }
.nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-profile="tesla"] .nav button { font-size: 16px; }

/* First-run overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overlay .card { max-width: 440px; width: 100%; }
.overlay h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.03em; }
.overlay p { color: var(--muted); margin: 0 0 20px; }
.overlay .stack { display: flex; flex-direction: column; gap: 10px; }

.done-mark {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  display: flex; align-items: center; justify-content: center;
  margin: 12px auto 16px;
  font-size: 28px;
}

.kbd-hint { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; }
html:not([data-profile="laptop"]) .kbd-hint { display: none; }

.setting-block { margin: 8px 0 28px; }
.setting-block h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 0 0 8px; text-transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html[data-playing] .wave i { animation: none !important; height: 60%; opacity: 1; }
}

@media (max-width: 420px) {
  .hero h2 { font-size: 26px; }
  .word { font-size: 32px; }
}
