/* DTZ Coach – design system
   Idea: the German exam as a journey on a transit line (A1 → B1), with the visual vernacular of
   German public signage: deep "Amt" navy, signal yellow, clear tabular numbers, and a stamp when you pass. */

@font-face { font-family: "DTZ Display"; src: local("DIN Alternate Bold"), local("DINAlternate-Bold"), url("assets/fonts/InterDisplay-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DTZ Display"; src: local("DIN Alternate Bold"), local("DINAlternate-Bold"), url("assets/fonts/InterDisplay-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }

:root {
  --navy: #13233f;
  --navy-2: #24395f;
  --paper: #f3f5f9;
  --card: #ffffff;
  --inset: #e9eef6;
  --line: #d9e0eb;
  --ink: #13233f;
  --ink-2: #4b5b77;
  --ink-3: #5f6b80;
  --go-ink: #0b7a53;
  --mid-ink: #2f6fdb;
  --signal: #ffc800;
  --signal-ink: #2a2000;
  --signal-soft: #fff4c7;
  --go: #0e8a5f;
  --go-soft: #dcf3e9;
  --stop: #d2413a;
  --stop-soft: #fbe5e3;
  --mid: #2f6fdb;
  --mid-soft: #e3ecfc;
  --der: #2f6fdb;
  --die: #c2306b;
  --das: #0e8a5f;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow-1: 0 1px 0 rgba(19, 35, 63, .06), 0 2px 8px rgba(19, 35, 63, .05);
  --shadow-2: 0 10px 30px rgba(19, 35, 63, .12);
  --display: "DTZ Display", "DIN Alternate", -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1528;
    --card: #14223b;
    --inset: #1b2c4a;
    --line: #26385a;
    --ink: #eef3fb;
    --ink-2: #b4c1d8;
    --ink-3: #9aa8c4;
    --go-ink: #45c792;
    --mid-ink: #7fabff;
    --navy: #0f1c33;
    --navy-2: #1c2f52;
    --signal-soft: #3a3110;
    --go-soft: #123828;
    --stop-soft: #3d1b1a;
    --mid-soft: #172b4f;
    --der: #6fa1ff; --die: #ff7aa8; --das: #45c792;
    --shadow-1: none;
    --shadow-2: 0 10px 30px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, a, .opt, .tile, .item { touch-action: manipulation; }
.native button, .native a, .native .item, .native .tile, .native .opt { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* keyboard open: bottom bars stop being fixed so they cannot float over the keyboard or jump */
.kb .tabbar { display: none; }
.kb .player-foot { position: static; transform: none; margin-top: 8px; }
.kb .player-body { padding-bottom: 24px; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 1rem/1.5 var(--text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--mid); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
.ic { flex: none; display: block; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: .9rem; }
.tiny { font-size: .78rem; color: var(--ink-3); }
.de { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: calc(8px + var(--safe-top)) 10px 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar h1 { font-size: 1.05rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--ink); }
.icon-btn:active { background: var(--inset); }
.content { padding: 4px 18px calc(110px + var(--safe-bottom)); }
.content.bare { padding-bottom: calc(40px + var(--safe-bottom)); }
.page-title { padding: calc(18px + var(--safe-top)) 18px 6px; }
.page-title h1 { font-size: 2rem; }
.page-title p { margin-top: 4px; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(19, 35, 63, .05);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 2px; color: var(--ink-3); font-size: .7rem; font-weight: 600; border-radius: 12px; }
.tabbar a.active { color: var(--ink); }
.tabbar a.active .ic { stroke-width: 2.3; }
.tabbar a .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.tabbar a.active .dot { background: var(--signal); }

/* ---------- Surfaces ---------- */
.card { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1); }
.card + .card { margin-top: 12px; }
.card.inset { background: var(--inset); box-shadow: none; }
.card.navy { background: var(--navy); color: #fff; }
.card.navy .muted { color: rgba(255, 255, 255, .72); }
.card.navy .faint { color: rgba(255, 255, 255, .5); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.section-h h2 { font-size: 1.2rem; }

.list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; text-align: start; width: 100%; }
.item + .item { border-top: 1px solid var(--line); }
.item:active { background: var(--inset); }
.item .t { font-weight: 600; }
.item .s { color: var(--ink-2); font-size: .86rem; margin-top: 1px; }
.item .end { color: var(--ink-3); }
[dir="rtl"] .item .end .ic { transform: scaleX(-1); }
.badge-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--inset); color: var(--ink); flex: none; }
.badge-ic.signal { background: var(--signal); color: var(--signal-ink); }
.badge-ic.go { background: var(--go-soft); color: var(--go-ink); }
.badge-ic.mid { background: var(--mid-soft); color: var(--mid-ink); }
.badge-ic.stop { background: var(--stop-soft); color: var(--stop); }
.count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--stop); color: #fff; font-size: .78rem; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; width: 100%; padding: 0 22px; border-radius: 16px;
  font-weight: 700; font-size: 1.02rem; letter-spacing: .005em;
  background: var(--signal); color: var(--signal-ink);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12);
  transition: transform .12s var(--ease), filter .12s;
}
.btn:active { transform: translateY(1px) scale(.99); filter: brightness(.97); }
.btn.dark { background: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
@media (prefers-color-scheme: dark) { .btn.dark { background: #eef3fb; color: var(--navy); } }
.btn.soft { background: var(--inset); color: var(--ink); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; min-height: 46px; font-weight: 600; }
.btn.go { background: var(--go); color: #fff; }
.btn.stop { background: var(--stop); color: #fff; }
.btn.sm { min-height: 40px; width: auto; padding: 0 14px; font-size: .9rem; border-radius: 12px; box-shadow: none; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.round-btn { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--inset); color: var(--ink); }
.round-btn:active { transform: scale(.96); }
.round-btn.sm { width: 42px; height: 42px; }

/* ---------- Chips, bars, rings ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--inset); color: var(--ink-2); }
.chip.A1 { background: var(--go-soft); color: var(--go-ink); }
.chip.A2 { background: var(--mid-soft); color: var(--mid-ink); }
.chip.B1 { background: var(--signal-soft); color: #8a6a00; }
@media (prefers-color-scheme: dark) { .chip.B1 { color: var(--signal); } }
.chip.pro { background: var(--navy); color: var(--signal); }
.band { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 99px; font-weight: 800; font-size: .82rem; font-family: var(--display); }
.band.ok { background: var(--go-soft); color: var(--go-ink); }
.band.warn { background: var(--signal-soft); color: #8a6a00; }
@media (prefers-color-scheme: dark) { .band.warn { color: var(--signal); } }
.band.mid { background: var(--mid-soft); color: var(--mid-ink); }
.band.bad { background: var(--stop-soft); color: var(--stop); }
.band.none { background: var(--inset); color: var(--ink-3); }
.bar { height: 8px; background: var(--inset); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--go); border-radius: 99px; transition: width .5s var(--ease); }
.ring { display: block; }
.ring .track { stroke: rgba(255, 255, 255, .16); }
.ring .val { stroke: var(--signal); transition: stroke-dashoffset .8s var(--ease); }

/* ---------- Home: ticket + line map ---------- */
.ticket { position: relative; background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 18px 18px 16px; overflow: hidden; }

.ticket .perf { border-top: 2px dashed rgba(255, 255, 255, .18); margin: 14px 4px; }
.ticket .big { font-size: 2.6rem; line-height: 1; font-family: var(--display); font-weight: 700; }
.ticket .lbl { font-size: .8rem; color: rgba(255, 255, 255, .65); }
.ticket .secs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ticket .sec { display: flex; flex-direction: column; gap: 6px; }
.ticket .sec b { font-size: .78rem; font-weight: 600; color: rgba(255, 255, 255, .7); }
.pip { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.pip > i { display: block; height: 100%; background: var(--signal); border-radius: 99px; }
.pip.ok > i { background: #3ddc97; }

.daily { display: flex; align-items: center; gap: 16px; }
.continue { display: flex; align-items: center; gap: 14px; background: var(--signal); color: var(--signal-ink); border-radius: var(--r-lg); padding: 16px 16px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .1); }
.continue .play { width: 46px; height: 46px; border-radius: 50%; background: var(--navy); color: var(--signal); display: grid; place-items: center; flex: none; }
.continue .k { font-size: .78rem; font-weight: 700; opacity: .7; }
.continue .t { font-weight: 800; font-size: 1.08rem; font-family: var(--display); }

.line { position: relative; padding: 4px 0 8px; }
.line::before { content: ""; position: absolute; inset-inline-start: 27px; top: 22px; bottom: 30px; width: 6px; border-radius: 6px; background: var(--line); }
.line .done-track { position: absolute; inset-inline-start: 27px; top: 22px; width: 6px; border-radius: 6px; background: var(--navy); }
@media (prefers-color-scheme: dark) { .line .done-track { background: var(--signal); } }
.stop { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.stop .node { position: relative; z-index: 1; width: 60px; flex: none; display: grid; place-items: center; }
.stop .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--card); border: 5px solid var(--line); }
.stop.done .dot { border-color: var(--navy); background: var(--navy); }
@media (prefers-color-scheme: dark) { .stop.done .dot { border-color: var(--signal); background: var(--signal); } }
.stop.done .dot::after { content: ""; display: block; width: 8px; height: 4px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translate(3px, 4px) rotate(-45deg); }
@media (prefers-color-scheme: dark) { .stop.done .dot::after { border-color: var(--navy); } }
.stop.current .dot { width: 34px; height: 34px; border: 6px solid var(--signal); background: var(--navy); box-shadow: 0 0 0 6px color-mix(in srgb, var(--signal) 30%, transparent); }
.stop.final .dot { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--signal); }
.stop .body { flex: 1; min-width: 0; background: var(--card); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow-1); }
.stop.current .body { box-shadow: 0 0 0 2px var(--signal), var(--shadow-2); }
.stop.locked .body .name { color: var(--ink-2); }
.stop.locked .body .sub { color: var(--ink-3); }
.stop .head { display: flex; align-items: center; gap: 10px; }
.stop .name { font-weight: 700; }
.stop .sub { color: var(--ink-2); font-size: .82rem; }
.lessons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.lessons a, .lessons span { min-height: 44px; padding: 5px 4px; border-radius: 10px; background: var(--inset); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); }
.lessons small { font-size: .68rem; font-weight: 600; line-height: 1.1; text-align: center; }
.lessons .ok { background: var(--go-soft); color: var(--go-ink); }
.lessons .next { background: var(--signal); color: var(--signal-ink); }

/* ---------- Lesson player ---------- */
.player { min-height: 100vh; display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-top)) 14px 8px; }
.player-top .bar { flex: 1; height: 12px; }
.player-top .bar > i { background: var(--go); }
.player-body { flex: 1; padding: 10px 20px 160px; display: flex; flex-direction: column; }
.prompt-k { font-size: .9rem; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; }
.prompt { font-size: 1.5rem; font-weight: 700; font-family: var(--display); line-height: 1.25; }
.player-foot { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; padding: 14px 20px calc(16px + var(--safe-bottom)); background: var(--paper); z-index: 40; }

.options { display: grid; gap: 10px; margin-top: 18px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  width: 100%; text-align: start; padding: 15px 16px; border-radius: 16px; font-weight: 600; font-size: 1.04rem;
  background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
  transition: transform .1s, border-color .15s, background .15s;
}
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt.sel { border-color: var(--mid); background: var(--mid-soft); box-shadow: 0 3px 0 var(--mid); }
.opt.right { border-color: var(--go); background: var(--go-soft); box-shadow: 0 3px 0 var(--go); color: var(--go-ink); }
.opt.wrong { border-color: var(--stop); background: var(--stop-soft); box-shadow: 0 3px 0 var(--stop); color: var(--stop); }
.opt.center { text-align: center; }
.opt.art { text-align: center; font-family: var(--display); font-size: 1.3rem; }
.opt.art[data-v="der"].sel { border-color: var(--der); } .opt.art[data-v="die"].sel { border-color: var(--die); } .opt.art[data-v="das"].sel { border-color: var(--das); }

.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-width: 560px; z-index: 50;
  padding: 18px 20px calc(18px + var(--safe-bottom)); border-radius: 24px 24px 0 0;
  transition: transform .28s var(--ease);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet.ok { background: var(--go-soft); color: var(--go-ink); }
.sheet.bad { background: var(--stop-soft); color: var(--stop); }
.sheet h3 { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; }
.sheet .ans { margin: 6px 0 14px; color: var(--ink); font-weight: 600; }
.sheet .ans .muted { font-weight: 400; }

/* word card */
.wordcard { background: var(--card); border-radius: 28px; padding: 28px 22px; box-shadow: var(--shadow-2); text-align: center; position: relative; }
.wordcard .art-bar { position: absolute; top: 0; left: 24px; right: 24px; height: 6px; border-radius: 0 0 6px 6px; }
.wordcard .w { font-family: var(--display); font-size: 2.3rem; font-weight: 700; line-height: 1.15; margin-top: 8px; direction: ltr; }
.wordcard .pl { color: var(--ink-3); font-size: .95rem; margin-top: 4px; direction: ltr; }
.wordcard .tr { font-size: 1.25rem; font-weight: 700; margin-top: 14px; }
.wordcard .ex { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.wordcard .ex .de { font-size: 1.02rem; }
.wordcard .ex .muted { font-size: .92rem; margin-top: 4px; }
.der-c { color: var(--der); } .die-c { color: var(--die); } .das-c { color: var(--das); }
.bg-der { background: var(--der); } .bg-die { background: var(--die); } .bg-das { background: var(--das); } .bg-none { background: var(--line); }
.audio-row { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }

/* flip card (review) */
.flip { perspective: 1400px; }
.flip-inner { position: relative; transition: transform .5s var(--ease); transform-style: preserve-3d; min-height: 330px; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; }
.flip .face.back { transform: rotateY(180deg); }

/* speaking */
.mic {
  width: 92px; height: 92px; border-radius: 50%; margin: 18px auto 8px; display: grid; place-items: center;
  background: var(--navy); color: var(--signal); box-shadow: 0 10px 30px rgba(19, 35, 63, .3);
}
@media (prefers-color-scheme: dark) { .mic { background: var(--signal); color: var(--navy); } }
.mic.on { background: var(--stop); color: #fff; animation: pulse 1.3s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(210, 65, 58, .45); } 70% { box-shadow: 0 0 0 22px rgba(210, 65, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(210, 65, 58, 0); } }
.heard { min-height: 1.6em; text-align: center; color: var(--ink-2); direction: ltr; }
.target { font-size: 1.45rem; font-weight: 700; font-family: var(--display); direction: ltr; line-height: 1.35; }
.w-ok { color: var(--go-ink); } .w-miss { color: var(--stop); text-decoration: underline wavy; text-underline-offset: 5px; }
.score-big { font-family: var(--display); font-size: 3rem; font-weight: 700; line-height: 1; text-align: center; }

/* build sentence */
.slots { min-height: 64px; border-bottom: 2px solid var(--line); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; direction: ltr; }
.tile { padding: 11px 15px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); font-weight: 600; font-size: 1.05rem; }
.tile.ghost { visibility: hidden; }

/* grammar */
.ex-de { direction: ltr; text-align: start; font-size: 1.12rem; font-weight: 600; }
.ex-de mark { background: var(--signal-soft); color: inherit; border-radius: 5px; padding: 0 3px; box-shadow: inset 0 -2px 0 var(--signal); }
.gtable { display: grid; grid-template-columns: auto 1fr; gap: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); direction: ltr; }
.gtable div { padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.gtable div:nth-child(odd) { background: var(--inset); font-weight: 600; }
.gtable.c3 { grid-template-columns: auto 1fr 1fr; }
.gtable.c3 div:nth-child(odd) { background: var(--card); font-weight: 400; }
.gtable.c3 div:nth-child(3n+1) { background: var(--inset); font-weight: 600; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; direction: ltr; text-align: left; line-height: 1.4; }
.msg.them { background: var(--card); align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: var(--shadow-1); }
.msg.me { background: var(--navy); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
@media (prefers-color-scheme: dark) { .msg.me { background: var(--signal); color: var(--navy); } }
.msg .who { display: block; font-size: .7rem; font-weight: 700; opacity: .6; margin-bottom: 2px; }

/* writing */
textarea.letter { width: 100%; min-height: 300px; padding: 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: 1.02rem/1.65 var(--text); direction: ltr; resize: vertical; }
textarea.letter:focus { outline: none; border-color: var(--mid); }
.points { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: p; direction: ltr; }
.points li { counter-increment: p; position: relative; padding: 6px 0 6px 34px; }
.points li::before { content: counter(p); position: absolute; left: 0; top: 6px; width: 24px; height: 24px; border-radius: 8px; background: var(--signal); color: var(--signal-ink); font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
.points li.ok::before { content: "✓"; background: var(--go); color: #fff; }
.points li.no::before { content: "✕"; background: var(--stop); color: #fff; }
.fix { padding: 12px 14px; border-radius: 14px; background: var(--inset); }
.fix + .fix { margin-top: 8px; }
.fix .from { color: var(--stop); text-decoration: line-through; direction: ltr; unicode-bidi: isolate; }
.fix .to { color: var(--go-ink); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.paper { white-space: pre-wrap; direction: ltr; text-align: left; background: var(--card); border: 1px solid var(--line); padding: 16px; border-radius: 16px; font-size: .98rem; line-height: 1.65; }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; }
.crit .bar { grid-column: 1 / -1; margin-top: -4px; }

/* stamp (the one orchestrated moment) */
.stamp {
  width: 168px; height: 168px; margin: 18px auto 6px; border-radius: 50%; display: grid; place-items: center; text-align: center;
  border: 6px double var(--go); color: var(--go-ink); font-family: var(--display); font-weight: 700; letter-spacing: .02em;
  transform: rotate(-12deg); animation: stamp .55s var(--ease) both;
}
.stamp.gold { border-color: #c79a00; color: #c79a00; }
.stamp b { display: block; font-size: 1.5rem; }
.stamp span { font-size: .78rem; }
@keyframes stamp { 0% { transform: rotate(-12deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-12deg) scale(.94); opacity: 1; } 100% { transform: rotate(-12deg) scale(1); } }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 16px; padding: 12px; text-align: center; box-shadow: var(--shadow-1); }
.stat b { display: block; font-family: var(--display); font-size: 1.5rem; }
.stat span { font-size: .78rem; color: var(--ink-2); }

/* onboarding */
.onb { min-height: 100vh; display: flex; flex-direction: column; padding: calc(16px + var(--safe-top)) 22px calc(22px + var(--safe-bottom)); }
.onb .top { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.onb .main { flex: 1; padding-top: 16px; }
.onb h1 { font-size: 2rem; line-height: 1.15; }
.onb .lead { margin-top: 10px; color: var(--ink-2); font-size: 1.05rem; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: start; padding: 16px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); margin-top: 10px; }
.choice.sel { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 70%, transparent); }
@media (prefers-color-scheme: dark) { .choice.sel { border-color: var(--signal); } }
.choice .t { font-weight: 700; }
.choice .s { color: var(--ink-2); font-size: .88rem; }
.lang-list .choice { padding: 14px 16px; }
.lang-list .hello { color: var(--ink-3); font-size: .86rem; }
.hero-line { height: 132px; margin: 6px 0 4px; }
input.field, select.field { width: 100%; min-height: 54px; padding: 0 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }

/* paywall */
.pw-hero { background: var(--navy); color: #fff; padding: calc(56px + var(--safe-top)) 22px 26px; border-radius: 0 0 32px 32px; position: relative; }
.pw-hero h1 { font-size: 2rem; line-height: 1.12; }
.pw-hero .muted { color: rgba(255, 255, 255, .75); margin-top: 10px; }
.pw-close { position: absolute; top: calc(10px + var(--safe-top)); inset-inline-end: 12px; color: rgba(255, 255, 255, .7); }
.cmp { display: grid; grid-template-columns: 1fr 56px 56px; align-items: stretch; }
.cmp > div { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .93rem; display: flex; align-items: center; }
.cmp .h { font-weight: 800; font-size: .78rem; color: var(--ink-3); text-align: center; border-bottom: 0; }
.cmp .c { justify-content: center; }
.cmp .h { justify-content: center; }
.plan { display: flex; align-items: center; gap: 14px; width: 100%; text-align: start; padding: 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); position: relative; }
.plan + .plan { margin-top: 10px; }
.plan.sel { border-color: var(--navy); box-shadow: 0 0 0 3px var(--signal); }
@media (prefers-color-scheme: dark) { .plan.sel { border-color: var(--signal); } }
.plan .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.plan.sel .radio { border: 7px solid var(--navy); }
@media (prefers-color-scheme: dark) { .plan.sel .radio { border-color: var(--signal); } }
.plan .flag { position: absolute; top: -11px; inset-inline-end: 14px; background: var(--signal); color: var(--signal-ink); font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.tl::before { content: ""; position: absolute; inset-inline-start: 13px; top: 26px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .d { width: 28px; height: 28px; border-radius: 50%; background: var(--inset); display: grid; place-items: center; color: var(--ink-2); }
.tl .d.on { background: var(--signal); color: var(--signal-ink); }
.fact { border-inline-start: 4px solid var(--signal); padding: 4px 0 4px 14px; }

/* misc */
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--signal-soft); color: var(--ink); border-radius: 16px; padding: 12px 14px; font-size: .9rem; }
.notice.info { background: var(--mid-soft); }
.empty { text-align: center; padding: 30px 10px; color: var(--ink-2); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@media (prefers-color-scheme: dark) { .spinner { border-top-color: var(--signal); } }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--inset), var(--card), var(--inset)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 16px; height: 72px; }
@keyframes sk { to { background-position: -200% 0; } }
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; opacity: 0; transition: .25s var(--ease); pointer-events: none; z-index: 90; max-width: 88vw; text-align: center; font-weight: 600; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 96px; }
.week div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week i { width: 100%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: var(--inset); min-height: 4px; }
.week i.hit { background: var(--signal); }
.week span { font-size: .7rem; color: var(--ink-3); }
.seg { display: flex; background: var(--inset); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.fade-in { animation: fi .35s var(--ease) both; }
@keyframes fi { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.prompt-k { display: flex; align-items: center; gap: 6px; }
summary .ic, .btn .ic, .chip .ic { display: inline-block; vertical-align: -3px; }
details > summary.small { display: inline-flex; align-items: center; gap: 6px; }

.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch:checked { background: var(--go); }
.switch:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch:checked::after { transform: translateX(-20px); }

/* home: quick actions + single unlock row */
.quick{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.quick a{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 6px;border-radius:14px;background:var(--card);border:1px solid var(--line);color:var(--ink);font-weight:600;font-size:.8rem;text-align:center;text-decoration:none}
.quick a svg{color: var(--mid-ink)}
.unlock-row{display:flex;align-items:center;gap:12px;margin:4px 0 18px 34px;padding:14px;border-radius:16px;background:var(--navy);color:#fff;text-decoration:none}
[dir=rtl] .unlock-row{margin:4px 34px 18px 0}
.unlock-row b{display:block}
.unlock-row .small{opacity:.75}
.unlock-row .badge-ic.signal{background:var(--signal);color:var(--signal-ink)}
.stop.locked .badge-ic{background:color-mix(in srgb,var(--navy) 10%,transparent);color:var(--navy)}

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary > svg:last-child { transition: transform .2s ease; transform: rotate(90deg); }
details[open] > summary > svg:last-child { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { details > summary > svg:last-child { transition: none; } }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stop.locked .badge-ic { background: rgba(255,255,255,.08); color: #9fb0cc; } }
:root[data-theme="dark"] .stop.locked .badge-ic { background: rgba(255,255,255,.08); color: #9fb0cc; }

.crit-bar.lo .bar > i { background: var(--stop); }
.crit-bar.mid .bar > i { background: var(--signal); }
.crit-bar.hi .bar > i { background: var(--go); }
.crit .crit-bar { grid-column: 1 / -1; }
.btn-row > .card { margin-top: 0; }
.wordcard { overflow: hidden; }
.wordcard .art-bar { left: 0; right: 0; top: 0; border-radius: 0; }
.btn-row .btn.ghost.sm { white-space: nowrap; font-size: .82rem; }
.stop .lock-mini { color: var(--ink-3); }

.round-btn.cap { position: relative; margin-bottom: 18px; }
.round-btn.cap::after { content: attr(data-cap); position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .7rem; font-weight: 600; color: var(--ink-3); }

/* modal (AI consent, leave lesson) */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(9, 17, 33, .55); display: grid; place-items: end center; padding: 16px; }
.modal { width: 100%; max-width: 520px; background: var(--card); color: var(--ink); border-radius: 24px; padding: 22px 20px calc(18px + var(--safe-bottom)); box-shadow: var(--shadow-2); }
@media (min-width: 600px) { .modal-wrap { place-items: center; } }
h1[tabindex="-1"]:focus { outline: none; }

/* Dynamic Type on iOS: the base size follows the system text size (all rem sizes scale) */
@supports (font: -apple-system-body) { html { font: -apple-system-body; font-size: max(16px, min(1em, 24px)); } }
/* touch targets at least 44px */
.lessons a, .lessons span { height: 44px; }
.btn.sm { min-height: 44px; }
.seg button { min-height: 44px; }
details > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
a.chip[href] { min-height: 44px; }
.icon-btn { min-width: 44px; min-height: 44px; }
/* RTL logical properties */
[dir=rtl] .switch::after { left: auto; right: 3px; }

/* gap text and matching (DTZ Lesen) */
.gaptext { line-height: 2.2; font-size: 1rem; }
select.gap { font: inherit; font-weight: 700; color: var(--ink); background: var(--mid-soft); border: 2px solid var(--mid); border-radius: 10px; padding: 4px 6px; min-height: 40px; max-width: 100%; }
select.gap.right { border-color: var(--go); background: var(--go-soft); }
select.gap.wrong { border-color: var(--stop); background: var(--stop-soft); }
.ads { display: grid; gap: 8px; }
.ad { font-size: .92rem; }
.ad b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--signal); color: var(--signal-ink); margin-inline-end: 6px; }
.sit { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); min-height: 44px; }
.card h3 + .sp-row, .row-flex + .sp-row { margin-top: 10px; }
.legal-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; }
.legal-row .btn { flex: none; width: auto; padding-inline: 12px; }
.lessons a, .lessons span { min-width: 44px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-color-scheme: dark) { #reset, #reset .t { color: #ff7b73 !important; } }

/* speaking part 2: the exam photo */
.sim-photo { margin: 0; border-radius: 20px; overflow: hidden; background: var(--inset); aspect-ratio: 4 / 3; box-shadow: var(--shadow-1); }
.sim-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sim-thumb { width: 64px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--inset); }

.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring-cap { font-size: .68rem; color: rgba(255, 255, 255, .65); }
.count.soft { background: var(--inset); color: var(--ink-2); }
.steps3 { display: grid; gap: 8px; }
.step3 { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .08); color: #fff; font-weight: 600; }
.step3 .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--signal); color: var(--signal-ink); font-weight: 700; flex: none; }
.step3.done { opacity: .7; }
.step3.done .n { background: var(--go); color: #fff; }
.pl-c { color: var(--ink-3); } .pl-tag { font-size: .55em; font-weight: 700; color: var(--ink-3); vertical-align: middle; border: 1.5px solid var(--line); border-radius: 6px; padding: 1px 5px; font-family: var(--text); }
.xfer-code { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: var(--inset); }
.xfer-code .tiny { width: 100%; }
.xfer-code code { flex: 1; min-width: 0; font-size: .82rem; word-break: break-all; user-select: all; -webkit-user-select: all; }
.waive { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--inset); }
.waive input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--navy); }
