/* Layout concept: one calm column, large touch targets, one strong teal accent.
   Everything the child taps is at least 64px tall. */
:root {
  --bg: #f2f7f9;
  --surface: #ffffff;
  --ink: #12303f;
  --muted: #53707e;
  --line: #d3e1e8;
  --accent: #0b8f84;
  --accent-ink: #ffffff;
  --accent-soft: #d8f1ee;
  --sun: #f2b632;
  --good: #1f8a4c;
  --good-soft: #dcf3e5;
  --bad: #b8431f;
  --bad-soft: #fbe3da;
  --focus: #1b5fd1;
  --font-ui: "Avenir Next", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-letter: ui-rounded, "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1d25; --surface: #162a35; --ink: #e8f2f6; --muted: #9ab4c0; --line: #29414e;
    --accent: #38c2b4; --accent-ink: #062521; --accent-soft: #15403d; --sun: #f2c14e;
    --good: #5ccf8a; --good-soft: #17382a; --bad: #f08a66; --bad-soft: #43241a; --focus: #7fb0ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1d25; --surface: #162a35; --ink: #e8f2f6; --muted: #9ab4c0; --line: #29414e;
  --accent: #38c2b4; --accent-ink: #062521; --accent-soft: #15403d; --sun: #f2c14e;
  --good: #5ccf8a; --good-soft: #17382a; --bad: #f08a66; --bad-soft: #43241a; --focus: #7fb0ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.125rem;
  line-height: 1.45;
  padding-block: 12px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 36rem; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 700; font-size: 1rem; letter-spacing: 0.01em; min-width: 0; }
.lang {
  min-height: 44px; min-width: 56px; padding: 0 14px; border-radius: 22px;
  border: 2px solid var(--line); background: var(--surface); font-weight: 700;
}
.notice {
  background: var(--accent-soft); border-radius: 12px; padding: 10px 14px;
  font-size: 0.9rem; color: var(--ink);
}

.card { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.title { font-size: 1.6rem; font-weight: 800; }
.can { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: var(--font-letter); font-weight: 800; font-size: 1.6rem;
  min-width: 64px; padding: 8px 14px; text-align: center; border-radius: 14px;
  background: var(--accent-soft); color: var(--ink);
}
.pill { align-self: flex-start; font-size: 0.9rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); }
.pill.progress { border-color: var(--sun); }
.pill.mastered { border-color: var(--good); background: var(--good-soft); }

.btn {
  min-height: 64px; padding: 0 22px; border-radius: 16px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 1.15rem; width: 100%;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { min-height: 48px; font-size: 1rem; width: auto; }

.dots { display: flex; gap: 8px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: transparent; }
.dot.done { background: var(--accent); border-color: var(--accent); }
.dot.now { border-color: var(--accent); }

.q { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.prompt { font-size: 1.25rem; font-weight: 700; }
.stim { font-family: var(--font-letter); font-weight: 800; font-size: 4.5rem; line-height: 1.05; }
.stim.word { font-size: 3.4rem; letter-spacing: 0.04em; }
.stim.pic { font-size: 5rem; }
.fallback { font-size: 0.95rem; color: var(--muted); }

.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.opt {
  min-height: 84px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface);
  font-family: var(--font-letter); font-weight: 800; font-size: 2.6rem; position: relative;
}
.opt.pic { font-size: 3rem; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt .mark { position: absolute; top: 4px; right: 8px; font-size: 1rem; font-family: var(--font-ui); }
.opt[disabled] { cursor: default; }
.feedback { min-height: 1.6em; font-weight: 700; }
.feedback.right { color: var(--good); }
.feedback.wrong { color: var(--bad); }

.score { font-size: 2.4rem; font-weight: 800; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 12rem; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 1rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.tag { font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--accent-soft); }
.tag.later { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.obj { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.obj span:first-child { min-width: 0; }
.small { font-size: 0.95rem; color: var(--muted); }
.tools { border-style: dashed; }

@media (max-width: 380px) {
  .stim { font-size: 3.6rem; }
  .opt { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .opt, .btn { transition: background-color 0.12s, border-color 0.12s; }
}

/* the three steps of a unit: Learn, Practice, Check */
.step .stephead { display: flex; gap: 14px; align-items: flex-start; }
.stepnum { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; background: var(--accent); color: var(--accent-ink); }
.step.done .stepnum { background: var(--good); color: var(--accent-ink); }
.step.locked .stepnum { background: var(--line); color: var(--muted); }
.steptitle { font-size: 1.25rem; font-weight: 800; }

/* Learn screens */
.lesson { display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.bigletter { font-family: var(--font-letter); font-weight: 800; font-size: 6rem; line-height: 1; color: var(--accent); }
.exs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
.ex { min-height: 120px; border-radius: 16px; border: 3px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; }
.expic { font-size: 3rem; line-height: 1.1; }
.exword { font-family: var(--font-letter); font-size: 1.8rem; font-weight: 600; }
.exword b { color: var(--accent); font-weight: 800; }
.pairs { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pair { display: flex; gap: 8px; align-items: center; font-family: var(--font-letter); font-weight: 800; font-size: 2rem; padding: 8px 14px; border-radius: 14px; background: var(--accent-soft); }
.pair .big { color: var(--accent); }
.blend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-letter); font-weight: 800; }
.tile { font-size: 2.4rem; min-width: 56px; padding: 4px 10px; border-radius: 12px; border: 3px solid var(--accent); }
.arrow { font-size: 2rem; color: var(--muted); }
.blendword { font-size: 2.8rem; color: var(--accent); }

/* sign-in */
.acct { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acct .sync { flex-basis: 100%; }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: transparent; font-weight: 700; }
.tab.on { border-color: var(--accent); background: var(--accent-soft); }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 1rem; }
.field input {
  font: inherit; font-weight: 400; min-height: 52px; padding: 0 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; min-width: 0;
  direction: ltr; text-align: left;
}
.pwrow { display: flex; gap: 8px; align-items: stretch; }
.showpw { min-width: 72px; border-radius: 12px; border: 2px solid var(--line); background: transparent; font-weight: 700; }
.msg { min-height: 1.4em; font-weight: 600; font-size: 0.95rem; }
.msg.right { color: var(--good); }
.msg.wrong { color: var(--bad); }
.link { align-self: flex-start; background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--accent); font-weight: 700; text-decoration: underline; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.9rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn[disabled] { opacity: 0.6; cursor: default; }
