/* learn-small — A little, every day.
   Brand: royal blue is the signature, jade marks progress, apricot is the
   human touch; warm white dominates and midnight carries the text. */

:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --sand: #f3efe6;
  --ink: #252c40;
  --muted: #5e6578;
  --line: #e8e3d8;
  --blue: #3659c7;
  --blue-ink: #ffffff;
  --blue-tint: #e9eefb;
  --jade: #32a58b;
  --jade-strong: #23876f;
  --jade-tint: #e2f3ee;
  --apricot: #f0a080;
  --apricot-strong: #c8603d;
  --apricot-tint: #fdefe7;
  --danger: #b4452f;
  /* Gender colours, tuned to the palette. Label and article are always printed
     as well, so colour is never the only cue. */
  --g-m: #3659c7;
  --g-f: #d2593e;
  --g-n: #23876f;
  --g-pl: #687086;
  --g-text: #ffffff;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(37 44 64 / 0.05), 0 8px 24px rgb(37 44 64 / 0.06);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #171b26;
    --surface: #212737;
    --sand: #1c2130;
    --ink: #f2f0ea;
    --muted: #a8aec0;
    --line: #333a4e;
    --blue: #7d98f2;
    --blue-ink: #10172e;
    --blue-tint: #26304d;
    --jade: #4cc3a6;
    --jade-strong: #4cc3a6;
    --jade-tint: #1d3a36;
    --apricot: #f4b192;
    --apricot-strong: #f4b192;
    --apricot-tint: #3a2a26;
    --danger: #f19b85;
    --g-m: #7d98f2;
    --g-f: #f08a6f;
    --g-n: #4cc3a6;
    --g-pl: #a3aabb;
    --g-text: #10172e;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:focus-visible, input:focus-visible, a:focus-visible, .card:focus-visible, label:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
a { color: var(--blue); }

h1, h2 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 0.5rem; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
p { margin: 0 0 0.75rem; }
b { font-weight: 700; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Header ───────────────────────────────────────── */

header.site {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 32rem;
  margin: 0 auto;
  padding: 0.85rem 16px 0.25rem;
}
.brand { display: flex; align-items: center; gap: 0.45rem; margin-right: auto; }
.mark { width: 1.9rem; height: auto; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.04em; white-space: nowrap; }
.level { white-space: nowrap; font-size: 0.75rem; font-weight: 650; color: var(--jade-strong); background: var(--jade-tint); border-radius: 99px; padding: 0.1rem 0.5rem; }
@media (max-width: 419px) { .level { display: none; } }
body[data-screen='setup'] .settings-btn, body[data-screen='setup'] .brand { visibility: hidden; }
/* The welcome screen carries its own logo row, so the site header steps aside there. */
body[data-screen='setup'] header.site { display: none; }

main { max-width: 32rem; margin: 0 auto; padding: 0.75rem 16px 3rem; }
.loading { color: var(--muted); text-align: center; margin-top: 30vh; }

/* ── Building blocks ─────────────────────────────── */

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border-radius: 99px;
  background: var(--blue);
  color: var(--blue-ink);
  font-weight: 700;
  cursor: pointer;
}
.pill.wide { display: flex; width: 100%; margin-top: 1.1rem; }
.pill.ghost { background: var(--blue-tint); color: var(--blue); }
.pill:active, .tile:active, .gbtn:active, .rate:active, .chapter:active { transform: scale(0.98); }
.text-btn { display: block; margin: 0.9rem auto 0; padding: 0.5rem 1rem; color: var(--blue); font-weight: 650; }
.text-btn.danger { color: var(--danger); margin: 1rem 0 0; padding-left: 0; }

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow);
}

.kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue); margin-bottom: 0.35rem; }
.kicker.apricot { color: var(--apricot-strong); }
.hint { color: var(--muted); font-size: 0.92rem; margin: 0.9rem 0 0; }
.hint.top { margin: -0.2rem 0 0.9rem; }
.small { font-size: 0.95rem; color: var(--ink); margin: 0.35rem 0 0; }
.small.muted { color: var(--muted); }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.chip { display: inline-grid; place-items: center; min-width: 2.4rem; height: 2.4rem; border-radius: 12px; background: var(--blue-tint); color: var(--blue); font-weight: 800; font-size: 0.85rem; }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--jade); border-radius: 99px; transition: width 0.3s ease; }
.progress.soft { background: var(--sand); margin: 0.9rem 0 0.2rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  z-index: 10;
}

/* ── Welcome and chapter picker ──────────────────── */

.welcome { text-align: center; padding: 1.5rem 0 1.25rem; }
.welcome-mark .mark { width: 4.5rem; }
.wordmark-big { font-size: 2.6rem; letter-spacing: -0.05em; margin: 0.4rem 0 0.2rem; }
.tagline { text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.8rem; font-weight: 650; color: var(--ink); }
.lead { color: var(--muted); max-width: 22rem; margin: 0.8rem auto 0; }

.chapters { display: grid; gap: 0.5rem; }
.chapter {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.25rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--sand);
  text-align: left;
}
.chapter-n { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: var(--surface); color: var(--blue); font-weight: 800; flex: none; }
.chapter.on { background: var(--blue-tint); box-shadow: inset 0 0 0 2px var(--blue); font-weight: 650; }
.chapter.on .chapter-n { background: var(--blue); color: var(--blue-ink); }
.chapter-check { margin-left: auto; color: var(--blue); }
.picking { margin-left: auto; color: var(--blue); font-size: 0.85rem; font-weight: 600; }
.chapter:disabled { cursor: default; color: inherit; }

.segmented { display: flex; gap: 0.5rem; }
.segmented button { flex: 1; min-height: 2.9rem; border-radius: var(--radius-sm); background: var(--sand); font-weight: 650; }
.segmented .on { background: var(--blue); color: var(--blue-ink); }
.toggle { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.1rem; cursor: pointer; }
.toggle input { width: 1.3rem; height: 1.3rem; accent-color: var(--jade); flex: none; }

/* ── Welcome steps ─────────────────────────────── */

.steps { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.step { display: flex; gap: 0.85rem; align-items: flex-start; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.95rem 1rem; }
.step h2 { font-size: 1.08rem; margin: 0.15rem 0 0.3rem; }
.step p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.step-icon { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 14px; flex: none; }
.step-icon.blue { background: var(--blue-tint); color: var(--blue); }
.step-icon.jade { background: var(--jade-tint); color: var(--jade-strong); }
.step-icon.apricot { background: var(--apricot-tint); color: var(--apricot-strong); }
.mini { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; align-items: center; }
.mini-rate { font-size: 0.78rem; font-weight: 700; padding: 0.25rem 0.55rem; border-radius: 9px; box-shadow: inset 0 0 0 1.5px var(--line); }
.mini-rate.on { background: var(--jade-strong); color: #fff; box-shadow: none; }
.mini-verb { font-size: 0.85rem; background: var(--sand); border-radius: 9px; padding: 0.25rem 0.6rem; margin-right: 0.2rem; }
.mini-verb b { color: var(--blue); }
.mini .gchip { min-width: 2rem; height: 1.5rem; font-size: 0.75rem; }
.mini-chapter { font-size: 0.85rem; background: var(--blue-tint); color: var(--ink); border-radius: 9px; padding: 0.3rem 0.65rem; }
.mini-chapter b { color: var(--blue); }
.welcome-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0 0.9rem; }
.welcome-row .mark { width: 2.6rem; }
.wordmark-row { font-size: 1.9rem; letter-spacing: -0.05em; margin: 0; }
.welcome-row .tagline { margin: 0.1rem 0 0; font-size: 0.72rem; letter-spacing: 0.18em; }
.welcome.compact { padding: 0.25rem 0 0.9rem; }
.welcome.compact .mark { width: 3rem; }
.welcome.compact .wordmark-big { font-size: 2.1rem; margin-top: 0.25rem; }
.sticky-cta { position: sticky; bottom: 0; padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sticky-cta .pill.wide { margin-top: 0; }
.fine { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 0.9rem; }
.text-btn.left { margin: 0 0 0.75rem; padding-left: 0; display: inline-flex; align-items: center; gap: 0.35rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .mini-rate.on { color: #0f1a17; }
}

/* ── Home ────────────────────────────────────────── */

.hello { margin: 0.9rem 0 1rem; }
.hello h1 { font-size: 2rem; margin-bottom: 0.15rem; }
.tagline-sm { color: var(--muted); }

.chapter-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}
.chapter-row .change { margin-left: auto; flex: none; padding: 0.35rem 0.8rem; border-radius: 99px; background: var(--blue-tint); color: var(--blue); font-weight: 700; font-size: 0.85rem; }
.chapter-row.flat { box-shadow: none; background: var(--sand); margin-bottom: 0; }
.nudge { background: var(--apricot-tint); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.nudge p { margin-bottom: 0.7rem; }
.nudge .pill { min-height: 2.6rem; padding: 0.5rem 1.1rem; }
.nudge .pill.ghost { background: var(--surface); }
.chapter-row-text small { display: block; color: var(--muted); font-size: 0.85rem; }

.today {
  position: relative;
  overflow: hidden;
  background: var(--blue-tint);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem 1.3rem;
  margin-bottom: 1rem;
}
.today::after {
  content: '';
  position: absolute;
  right: -2.5rem;
  bottom: -2.5rem;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: var(--jade);
  opacity: 0.18;
  pointer-events: none;
}
.today h2 { font-size: 1.5rem; margin-bottom: 0.2rem; }
.today .meta { color: var(--muted); margin: 0; }
.today .pill { margin-top: 1rem; position: relative; z-index: 1; }
.today .pill.ghost { background: var(--surface); }

.practice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}
.tile-icon { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 14px; margin-bottom: 0.45rem; }
.tile-icon.blue { background: var(--blue-tint); color: var(--blue); }
.tile-icon.jade { background: var(--jade-tint); color: var(--jade-strong); }
.tile-name { font-weight: 750; font-size: 1.05rem; }
.tile-meta { color: var(--muted); font-size: 0.88rem; }
.so-far { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 1.4rem; }

/* ── Mode screens ────────────────────────────────── */

.modebar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.85rem; margin: 0.25rem 0 1rem; }
.modebar-title { font-size: 1.1rem; margin: 0; text-align: center; }
.modebar-meta { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; min-width: 2.5rem; text-align: right; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem 1.4rem;
  min-height: 16rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.card:not(.revealed)[role='button'] { cursor: pointer; }
.card .de, .panel .de { font-size: clamp(1.9rem, 8.5vw, 2.5rem); font-weight: 800; margin: 0.35rem 0 0.6rem; overflow-wrap: anywhere; }
.panel .de { text-align: left; margin: 0; }
.card .en, .panel .en { font-size: 1.15rem; color: var(--muted); }
.side-b { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1.2rem; }
.side-b .en { color: var(--ink); font-size: 1.3rem; font-weight: 600; }
.tap { margin-top: 1.25rem; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.speak {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--blue);
}
.speak .icon { width: 1.35rem; height: 1.35rem; }

.gender-line { display: flex; justify-content: center; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.dot { color: var(--muted); }
.plural, .fem { font-weight: 650; }
.tip, .rule { display: inline-block; background: var(--apricot-tint); color: var(--ink); border-radius: 10px; padding: 0.35rem 0.75rem; font-size: 0.92rem; margin: 0.5rem 0 0; }
.report { display: block; margin-top: 1rem; font-size: 0.82rem; color: var(--muted); }

.gchip {
  display: inline-grid;
  place-items: center;
  min-width: 2.3rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 8px;
  color: var(--g-text);
  font-weight: 800;
  font-size: 0.85rem;
}
.g-m.gchip, .gbtn.g-m { background: var(--g-m); }
.g-f.gchip, .gbtn.g-f { background: var(--g-f); }
.g-n.gchip, .gbtn.g-n { background: var(--g-n); }
.g-pl.gchip, .gbtn.g-pl { background: var(--g-pl); }

.forms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin: 1rem 0 0.25rem; }
.form { padding: 0.5rem 0.3rem; border-radius: 12px; background: var(--sand); font-weight: 700; font-size: 0.98rem; }
.form span { display: block; font-weight: 500; font-size: 0.75rem; color: var(--muted); }
.form.irr { background: var(--blue-tint); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }

.ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 1rem; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-height: 3.6rem; padding: 0.55rem 0.2rem; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); }
.rate span { font-size: 0.78rem; color: var(--muted); }
.rate { transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }
/* Whichever button is tapped flashes jade: every answer is a step forward. */
.rate.pressed { background: var(--jade-strong); box-shadow: none; color: #fff; }
.rate.pressed span { color: rgb(255 255 255 / 0.85); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .rate.pressed { color: #0f1a17; }
  :root:not([data-theme='light']) .rate.pressed span { color: rgb(15 26 23 / 0.75); }
}

/* ── Verdicts: the words carry it ("Richtig!", "Not quite."), colour supports. */

.verdict { margin-top: 1.2rem; padding: 1rem; border-radius: var(--radius-sm); text-align: center; }
.verdict.right { background: var(--jade-tint); }
.verdict.wrong { background: var(--apricot-tint); }
.verdict-title { display: flex; justify-content: center; align-items: center; gap: 0.35rem; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; margin: 0 0 0.3rem; }
.right .verdict-title { color: var(--jade-strong); }
.wrong .verdict-title { color: var(--apricot-strong); }
.answer { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 1.35rem; color: var(--ink); padding: 0.2rem 0.4rem; }
.answer .icon { color: var(--blue); }

/* ── Verb drill ──────────────────────────────────── */

.plus { color: var(--muted); font-weight: 500; }
.person { color: var(--blue); }
#answer { margin-top: 1.1rem; }
#typed {
  width: 100%;
  font-size: 1.45rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
}
#typed:focus { border-color: var(--blue); outline: none; }
.umlauts { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.7rem; }
.umlauts button { min-width: 3.2rem; min-height: 2.9rem; font-size: 1.25rem; font-weight: 650; border-radius: 12px; background: var(--sand); }

h2.spaced { margin-top: 1.4rem; }
.choose { margin: 0.6rem 0 0.2rem; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.8rem; }
.option {
  position: relative;
  min-height: 3.6rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--sand);
  font-size: 1.25rem;
  font-weight: 700;
}
.option .key { position: absolute; top: 0.35rem; left: 0.55rem; font-size: 0.7rem; font-weight: 600; color: var(--muted); }
.option.right { background: var(--jade-tint); color: var(--jade-strong); box-shadow: inset 0 0 0 2px var(--jade); }
.option.wrong { background: var(--apricot-tint); color: var(--apricot-strong); box-shadow: inset 0 0 0 2px var(--apricot); text-decoration: line-through; }
.option.faded { opacity: 0.45; }
.option:disabled { cursor: default; }
@media (hover: none) { .option .key { display: none; } }

/* ── Gender drill ────────────────────────────────── */

.card.noun { min-height: 12rem; display: flex; flex-direction: column; justify-content: center; }
.gbuttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-top: 1rem; }
.gbtn { min-height: 5rem; color: var(--g-text); display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius); }
.gbtn b { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.gbtn span { font-size: 0.9rem; opacity: 0.9; }
.gbtn:disabled { opacity: 0.5; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.9rem 0 0.25rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* ── Endings ─────────────────────────────────────── */

.finale { text-align: center; padding: 1rem 0.5rem 0; }
.shapes { width: 10rem; height: auto; margin: 0.5rem auto 1rem; display: block; }
.finale h1 { font-size: 2rem; }
.finale p { color: var(--muted); }
.review-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin: 1.2rem 0 0; text-align: left; }
.review-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 2.8rem; padding: 0.35rem 0.25rem; border-bottom: 1px solid var(--line); text-align: left; }
.review-item:last-child { border-bottom: 0; }
.review-item b { margin-left: auto; }
.review-word { display: flex; flex-direction: column; margin-right: auto; }
.review-word b { margin-left: 0; }
.review-word small { color: var(--muted); font-size: 0.8rem; }
.review-list + .review-list { margin-top: 0.75rem; }
.kicker.jade { color: var(--jade-strong); }
.knew { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.knew-word { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.65rem 0.3rem 0.3rem; border-radius: 99px; background: var(--sand); font-weight: 600; font-size: 0.95rem; }
.knew-word .gchip { min-width: 2rem; height: 1.4rem; font-size: 0.75rem; }
.review-item .icon { color: var(--blue); }

.about p { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .pill:active, .tile:active, .gbtn:active, .rate:active, .chapter:active { transform: none; }
}
