@charset "UTF-8";
/* =====================================================================
   Eesti Keel — design system
   Palette: sinimustvalge (blue–black–white), the Estonian flag.
   Light, mobile-first, thumb-driven.
   ===================================================================== */

:root{
  /* ---- flag ---- */
  --blue:        #0072CE;   /* Estonian flag blue */
  --blue-700:    #005BA6;
  --blue-800:    #00447C;
  --blue-100:    #E4F0FB;
  --blue-50:     #F2F8FD;
  --black:       #0A0A0A;
  --white:       #FFFFFF;

  /* ---- neutrals derived from the flag, not grey-from-nowhere ---- */
  --ink:         #0A0A0A;
  --ink-2:       #48566B;
  --ink-3:       #7C8AA0;
  --bg:          #F4F8FC;
  --surface:     var(--white);
  --line:        #DFE8F2;
  --line-strong: #C3D4E6;

  /* ---- semantic. Kept deliberately few: correct/incorrect must be
          unmistakable, everything else stays flag-coloured.
          These are darker than they "look right" at because they carry white
          text on the grade buttons — all pairs verified ≥4.5:1 (WCAG AA).
          The obvious brighter green (#0E8F5D) measures 4.11 and fails. ---- */
  --ok:          #0A7A4E;   /* white on it: 5.38 */
  --ok-soft:     #E3F6EE;
  --no:          #CE2020;   /* white on it: 5.45 */
  --no-soft:     #FCEAEA;
  --warn:        #8F5500;   /* white on it: 6.06 · on warn-soft: 5.52 */
  --warn-soft:   #FFF3E0;
  --gold:        #E8A317;   /* decorative only (ring fill), never text */

  /* ---- type ---- */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* ---- shape ---- */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-pill: 999px;

  /* Shadows tinted blue rather than black — keeps the light theme from
     looking muddy where cards overlap the background. */
  --sh-1: 0 1px 2px rgba(10,50,90,.06), 0 1px 3px rgba(10,50,90,.05);
  --sh-2: 0 2px 8px rgba(10,50,90,.08), 0 1px 3px rgba(10,50,90,.04);
  --sh-3: 0 8px 28px rgba(10,50,90,.12);
  --sh-blue: 0 4px 14px rgba(0,114,206,.28);

  /* ---- motion ---- */
  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t:      220ms cubic-bezier(.4,0,.2,1);
  --t-bounce: 420ms cubic-bezier(.34,1.56,.64,1);

  /* ---- layout ---- */
  --tabbar-h: 60px;
  --header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* =====================================================================
   Reset
   ===================================================================== */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font);
  font-size:16px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  /* stop iOS rubber-banding the whole page during card swipes */
  overscroll-behavior-y:none;
}
img,svg{display:block;max-width:100%}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3,h4{margin:0;line-height:1.2;letter-spacing:-.02em;font-weight:700}
p{margin:0 0 .8em}
a{color:var(--blue-700);text-decoration:none;font-weight:600}
a:hover{text-decoration:underline}
ul,ol{margin:0;padding:0}
:focus-visible{outline:3px solid var(--blue);outline-offset:2px;border-radius:4px}

/* =====================================================================
   The flag itself — a reusable tricolour rule.
   White needs a hairline or it vanishes on white surfaces.
   ===================================================================== */
.flagbar{height:4px;display:flex;flex:none;overflow:hidden}
.flagbar i{flex:1}
.flagbar i:nth-child(1){background:var(--blue)}
.flagbar i:nth-child(2){background:var(--black)}
.flagbar i:nth-child(3){background:var(--white);box-shadow:inset 0 -1px 0 var(--line-strong)}

/* =====================================================================
   App shell
   ===================================================================== */
.app-header{
  position:sticky;top:0;z-index:40;
  background:rgba(255,255,255,.9);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--line);
  padding-top:var(--safe-t);
}
.app-header .bar{
  height:var(--header-h);
  display:flex;align-items:center;gap:.75rem;
  padding:0 1rem;max-width:900px;margin:0 auto;
}
.brand{
  font-weight:800;letter-spacing:-.03em;font-size:1.05rem;color:var(--ink);
  display:flex;align-items:center;gap:.5rem;
}
.brand:hover{text-decoration:none}
.brand .mark{
  width:26px;height:26px;border-radius:7px;overflow:hidden;
  display:flex;flex-direction:column;box-shadow:var(--sh-1);flex:none;
}
.brand .mark i{flex:1}
.brand .mark i:nth-child(1){background:var(--blue)}
.brand .mark i:nth-child(2){background:var(--black)}
.brand .mark i:nth-child(3){background:var(--white)}
.brand em{font-style:normal;color:var(--blue)}

.header-spacer{flex:1}

/* Streak pill — the number people come back for, so it lives in the
   header on every screen. */
.streak-pill{
  display:inline-flex;align-items:center;gap:.3rem;
  background:var(--warn-soft);color:var(--warn);
  border-radius:var(--r-pill);padding:.3rem .7rem;
  font-weight:800;font-size:.9rem;font-variant-numeric:tabular-nums;
}
.streak-pill{text-decoration:none;-webkit-tap-highlight-color:transparent;transition:transform var(--t-fast)}
.streak-pill:active{transform:scale(.94)}
.streak-pill.cold{background:var(--bg);color:var(--ink-3)}

/* Visually hidden but read aloud — the pill is a bare number otherwise. */
.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;
}
.streak-pill .flame{display:inline-block;animation:flicker 2.6s ease-in-out infinite;transform-origin:50% 90%}

/* Top nav is desktop-only; phones get the bottom tab bar instead. */
.top-nav{display:none;gap:.25rem}
.top-nav a{
  color:var(--ink-2);font-weight:600;font-size:.92rem;
  padding:.45rem .75rem;border-radius:var(--r-pill);transition:background var(--t-fast),color var(--t-fast);
}
.top-nav a:hover{background:var(--blue-50);color:var(--blue-700);text-decoration:none}
.top-nav a.active{background:var(--blue-100);color:var(--blue-800)}

/* ---------- main ---------- */
main{
  max-width:900px;margin:0 auto;
  padding:1rem 1rem calc(var(--tabbar-h) + var(--safe-b) + 1.5rem);
}

/* ---------- bottom tab bar (mobile) ----------
   Bottom nav rather than a hamburger: on a 6" phone the top-left corner is
   the hardest place to reach one-handed, and this app is used standing on a
   tram. Five targets, each ≥56px, inside the natural thumb arc. */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:50;
  display:flex;
  background:rgba(255,255,255,.94);
  backdrop-filter:saturate(180%) blur(14px);
  -webkit-backdrop-filter:saturate(180%) blur(14px);
  border-top:1px solid var(--line);
  padding-bottom:var(--safe-b);
}
.tabbar a{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;min-height:var(--tabbar-h);
  color:var(--ink-3);font-size:.68rem;font-weight:700;
  text-decoration:none;position:relative;
  -webkit-tap-highlight-color:transparent;
  transition:color var(--t-fast);
}
.tabbar a svg{width:23px;height:23px;stroke-width:2;transition:transform var(--t-bounce)}
.tabbar a.active{color:var(--blue)}
.tabbar a.active svg{transform:translateY(-2px) scale(1.1)}
.tabbar a.active::before{
  content:"";position:absolute;top:0;left:50%;transform:translateX(-50%);
  width:28px;height:3px;background:var(--blue);border-radius:0 0 3px 3px;
}
.tabbar a:active svg{transform:scale(.9)}
.tabbar .tab-badge{
  position:absolute;top:6px;left:calc(50% + 6px);
  min-width:17px;height:17px;padding:0 4px;
  background:var(--no);color:#fff;border-radius:var(--r-pill);
  font-size:.62rem;line-height:17px;text-align:center;font-weight:800;
  box-shadow:0 0 0 2px var(--white);
}

/* =====================================================================
   Cards & surfaces
   ===================================================================== */
.card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r);box-shadow:var(--sh-1);padding:1.1rem;
}
.card.flush{padding:0;overflow:hidden}
.section-title{
  font-size:.75rem;font-weight:800;text-transform:uppercase;letter-spacing:.09em;
  color:var(--ink-3);margin:1.6rem 0 .6rem;
}
.muted{color:var(--ink-2)}
.small{font-size:.85rem}
.mono{font-family:var(--mono)}
.stack>*+*{margin-top:.75rem}

/* ---------- hero: today's goal ---------- */
.hero{
  background:linear-gradient(135deg,var(--blue) 0%,var(--blue-800) 100%);
  color:#fff;border-radius:var(--r-lg);padding:1.3rem;
  box-shadow:var(--sh-blue);position:relative;overflow:hidden;
}
.hero::after{
  content:"";position:absolute;right:-40px;top:-40px;
  width:180px;height:180px;border-radius:50%;
  background:rgba(255,255,255,.08);
}
.hero .row{display:flex;align-items:center;gap:1.1rem;position:relative}
.hero h1{font-size:1.35rem;margin-bottom:.15rem}
.hero p{margin:0;opacity:.85;font-size:.9rem}
.hero .cta{margin-top:1rem;position:relative}

/* Progress ring — a filling circle reads at a glance in a way a number
   never does, and "nearly closed" is what pulls people back in. */
.ring{width:74px;height:74px;flex:none;position:relative}
.ring svg{transform:rotate(-90deg)}
.ring circle{fill:none;stroke-width:8;stroke-linecap:round}
.ring .track{stroke:rgba(255,255,255,.25)}
.ring .fill{stroke:#fff;transition:stroke-dashoffset 900ms cubic-bezier(.4,0,.2,1)}
.ring .label{
  position:absolute;inset:0;display:grid;place-items:center;
  font-weight:800;font-size:.95rem;font-variant-numeric:tabular-nums;
}
.ring.done .fill{stroke:var(--gold)}

/* ---------- stat tiles ---------- */
.tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:.6rem}
.tile{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.85rem;box-shadow:var(--sh-1);
  transition:transform var(--t-fast),box-shadow var(--t-fast);
}
.tile:active{transform:scale(.98)}
.tile b{display:block;font-size:1.6rem;line-height:1.1;font-variant-numeric:tabular-nums}
.tile span{font-size:.72rem;font-weight:700;text-transform:uppercase;
           letter-spacing:.06em;color:var(--ink-3)}
.tile.accent b{color:var(--blue)}
.tile.ok b{color:var(--ok)}
.tile.hot b{color:var(--warn)}

/* =====================================================================
   Buttons — min 48px tall everywhere. Phone-first means no 32px buttons.
   ===================================================================== */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:48px;padding:.7rem 1.3rem;
  background:var(--blue);color:#fff;border:none;border-radius:var(--r-pill);
  font-weight:700;font-size:1rem;cursor:pointer;text-decoration:none;
  box-shadow:var(--sh-blue);
  transition:transform var(--t-fast),box-shadow var(--t-fast),background var(--t-fast);
  -webkit-tap-highlight-color:transparent;
}
.btn:hover{background:var(--blue-700);text-decoration:none}
.btn:active{transform:translateY(1px) scale(.98);box-shadow:0 2px 6px rgba(0,114,206,.3)}
.btn:disabled{opacity:.5;pointer-events:none;box-shadow:none}
.btn.block{display:flex;width:100%}
.btn.ghost{background:transparent;color:var(--blue-700);
           border:2px solid var(--line-strong);box-shadow:none}
.btn.ghost:hover{background:var(--blue-50);border-color:var(--blue)}
.btn.dark{background:var(--black);box-shadow:var(--sh-2)}
.btn.dark:hover{background:#262626}
.btn.small{min-height:38px;padding:.35rem .9rem;font-size:.85rem;box-shadow:none}

.btn-row{display:flex;gap:.6rem;flex-wrap:wrap}
.btn-row .btn{flex:1;min-width:140px}

/* icon button (audio) */
.icon-btn{
  width:44px;height:44px;flex:none;display:grid;place-items:center;
  border-radius:50%;border:2px solid var(--blue-100);background:var(--blue-50);
  color:var(--blue);cursor:pointer;transition:all var(--t-fast);
  -webkit-tap-highlight-color:transparent;
}
.icon-btn:hover{background:var(--blue-100);border-color:var(--blue)}
.icon-btn:active{transform:scale(.9)}
.icon-btn.playing{background:var(--blue);color:#fff;animation:pulse 1s ease-in-out infinite}
.icon-btn.lg{width:64px;height:64px}

/* =====================================================================
   Review — the screen people spend 80% of their time on
   ===================================================================== */
.session{display:flex;flex-direction:column;min-height:calc(100dvh - var(--header-h) - 2rem)}

.session-bar{display:flex;align-items:center;gap:.7rem;margin-bottom:.9rem}
.session-bar .track{flex:1;height:8px;background:var(--line);border-radius:var(--r-pill);overflow:hidden}
.session-bar .track i{
  display:block;height:100%;background:linear-gradient(90deg,var(--blue),var(--blue-700));
  border-radius:var(--r-pill);transition:width var(--t);
}
.session-bar .count{font-size:.8rem;font-weight:800;color:var(--ink-3);
                    font-variant-numeric:tabular-nums;flex:none}

/* 3D flip. The card is the whole interaction: tap to reveal, swipe to grade. */
.flip{perspective:1400px;flex:1;display:flex;margin-bottom:1rem;touch-action:pan-y}
.flip-inner{
  position:relative;width:100%;transform-style:preserve-3d;
  transition:transform 480ms cubic-bezier(.4,0,.2,1);
}
.flip.revealed .flip-inner{transform:rotateY(180deg)}
.face{
  position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  box-shadow:var(--sh-2);padding:1.5rem 1.2rem;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;gap:.7rem;overflow-y:auto;
}
.face.back{transform:rotateY(180deg)}
.face .prompt-label{
  font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.1em;
  color:var(--ink-3);
}
.face .word{font-size:clamp(1.9rem,8vw,2.8rem);font-weight:800;letter-spacing:-.03em;line-height:1.1}
.face .word.et{color:var(--blue-800)}
.face .answer{font-size:clamp(1.4rem,6vw,2rem);font-weight:700}
.face .hint{color:var(--ink-3);font-size:.85rem}

/* Principal parts get their own treatment — they're the point of the app. */
.parts{
  display:inline-flex;gap:.5rem;align-items:center;flex-wrap:wrap;justify-content:center;
  background:var(--blue-50);border:1px dashed var(--blue-100);
  border-radius:var(--r-sm);padding:.5rem .8rem;font-family:var(--mono);font-size:.9rem;
}
.parts b{color:var(--blue-800);font-weight:700}
.parts s{color:var(--line-strong);text-decoration:none}
.note{
  background:var(--warn-soft);border-left:3px solid var(--warn);
  border-radius:6px;padding:.5rem .7rem;font-size:.82rem;color:#6b4500;text-align:left;
}

/* Swipe affordances — appear as you drag, so the gesture teaches itself. */
.swipe-hint{
  position:absolute;top:1rem;padding:.35rem .8rem;border-radius:var(--r-pill);
  font-weight:800;font-size:.8rem;opacity:0;transition:opacity var(--t-fast);pointer-events:none;
}
.swipe-hint.left{left:1rem;background:var(--no-soft);color:var(--no)}
.swipe-hint.right{right:1rem;background:var(--ok-soft);color:var(--ok)}

/* Grade buttons pinned to the thumb zone. */
.grades{
  display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem;
  position:sticky;bottom:0;
}
.grade{
  min-height:60px;border:none;border-radius:var(--r);cursor:pointer;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  font-weight:800;font-size:.85rem;color:#fff;
  box-shadow:var(--sh-2);transition:transform var(--t-fast);
  -webkit-tap-highlight-color:transparent;
}
.grade small{font-size:.62rem;font-weight:600;opacity:.85}
.grade:active{transform:scale(.94)}
.grade.g1{background:var(--no)}
.grade.g2{background:var(--warn)}
.grade.g3{background:var(--ok)}
.grade.g4{background:var(--blue)}

.reveal-btn{margin-top:auto}

/* ---------- celebration ---------- */
.done-screen{text-align:center;padding:2.5rem 1rem}
.done-screen .big{font-size:3.5rem;animation:pop var(--t-bounce)}
.done-screen h2{font-size:1.5rem;margin:.6rem 0 .3rem}
.confetti{position:fixed;inset:0;pointer-events:none;z-index:60;overflow:hidden}
.confetti i{
  position:absolute;width:9px;height:9px;top:-12px;
  animation:fall linear forwards;
}

/* =====================================================================
   Lexeme / phrase lists
   ===================================================================== */
.lex{
  display:flex;align-items:center;gap:.8rem;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.7rem .85rem;box-shadow:var(--sh-1);
  transition:transform var(--t-fast),border-color var(--t-fast);
}
.lex:active{transform:scale(.99);border-color:var(--blue-100)}
.lex .body{flex:1;min-width:0}
.lex .head{font-weight:800;font-size:1.05rem;color:var(--blue-800)}
.lex .gloss{color:var(--ink-2);font-size:.88rem}
.lex .pp{font-family:var(--mono);font-size:.76rem;color:var(--ink-3);margin-top:.15rem}
.chip{
  display:inline-block;border-radius:var(--r-pill);padding:.15rem .55rem;
  font-size:.68rem;font-weight:800;letter-spacing:.02em;
}
.chip.grad{background:var(--warn-soft);color:var(--warn)}
.chip.q3{background:var(--blue-100);color:var(--blue-800)}
.chip.weak{background:var(--no-soft);color:var(--no)}

.phrase{
  display:flex;gap:.75rem;align-items:center;
  padding:.7rem .85rem;background:var(--surface);
  border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--sh-1);
}
.phrase .body{flex:1;min-width:0}
.phrase .et{font-weight:700;color:var(--blue-800)}
.phrase .en{font-size:.88rem;color:var(--ink-2)}
.phrase .lit{font-size:.76rem;color:var(--ink-3);font-style:italic}

/* ---------- day blocks ---------- */
.blocks{list-style:none;display:grid;gap:.5rem}
.block{
  display:flex;align-items:center;gap:.8rem;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.8rem .9rem;box-shadow:var(--sh-1);
}
.block .n{
  width:32px;height:32px;flex:none;border-radius:50%;
  background:var(--blue-50);color:var(--blue);
  display:grid;place-items:center;font-weight:800;font-size:.85rem;
}
.block.done .n{background:var(--ok);color:#fff}
.block .t{flex:1;font-weight:700;font-size:.95rem}
.block .m{font-size:.78rem;color:var(--ink-3);font-weight:700}

.can-do{
  background:var(--ok-soft);border-left:4px solid var(--ok);
  border-radius:var(--r-sm);padding:.8rem 1rem;font-size:.92rem;color:#0a5c3c;
}

/* ---------- forecast ---------- */
.forecast{display:flex;gap:3px;align-items:flex-end;height:96px}
.forecast .bar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;
               align-items:center;height:100%;gap:3px}
.forecast .bar i{
  width:100%;background:var(--blue-100);border-radius:4px 4px 0 0;min-height:3px;
  transition:height 700ms cubic-bezier(.4,0,.2,1);
}
.forecast .bar.today i{background:var(--blue)}
.forecast .bar small{font-size:.58rem;color:var(--ink-3);font-weight:700}

/* ---------- weakness chips ---------- */
.weak-list{display:flex;flex-wrap:wrap;gap:.45rem}
.weak{
  display:inline-flex;align-items:center;gap:.4rem;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-pill);
  padding:.35rem .75rem;font-size:.82rem;font-weight:600;
}
.weak b{font-variant-numeric:tabular-nums}
.weak.bad{border-color:var(--no);background:var(--no-soft);color:var(--no)}
.weak.mid{border-color:var(--warn);background:var(--warn-soft);color:var(--warn)}

/* =====================================================================
   Forms & auth
   ===================================================================== */
.centered{min-height:100dvh;display:grid;place-items:center;padding:1.2rem;background:var(--bg)}
.auth{
  width:100%;max-width:400px;background:var(--surface);
  border-radius:var(--r-lg);box-shadow:var(--sh-3);overflow:hidden;
}
.auth .pad{padding:1.6rem}
.auth h1{font-size:1.5rem;margin-bottom:.3rem;display:flex;align-items:center;gap:.55rem}
.auth label{display:block;margin-top:1rem;font-size:.82rem;font-weight:700;color:var(--ink-2)}
.auth label.row{display:flex;align-items:center;gap:.6rem;font-weight:600}
.auth input{
  width:100%;margin-top:.35rem;padding:.85rem .9rem;min-height:50px;
  background:var(--bg);border:2px solid var(--line);border-radius:var(--r-sm);
  transition:border-color var(--t-fast),background var(--t-fast);
  /* 16px prevents iOS Safari from zooming the viewport on focus */
  font-size:16px;
}
.auth input:focus{outline:none;border-color:var(--blue);background:var(--white)}
.auth input[type=checkbox]{width:22px;height:22px;min-height:0;margin:0;accent-color:var(--blue)}
.auth .btn{margin-top:1.3rem}
.auth small{display:block;margin-top:.3rem;font-size:.76rem;color:var(--ink-3);font-weight:600}
.switch{
  margin:0;padding:1rem;background:var(--blue-50);border-top:1px solid var(--line);
  text-align:center;font-size:.9rem;color:var(--ink-2);font-weight:600;
}
.error-msg{
  margin-top:.9rem;background:var(--no-soft);color:var(--no);
  border-radius:var(--r-sm);padding:.7rem .85rem;font-size:.88rem;font-weight:600;
  animation:shake 400ms;
}

/* ---------- invites ---------- */
.invite-list{list-style:none;display:grid;gap:.4rem;margin-bottom:.9rem}
.invite-list li{
  display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;
  background:var(--blue-50);border-radius:var(--r-sm);padding:.6rem .75rem;
}
.invite-list code{font-family:var(--mono);font-weight:800;color:var(--blue-800);letter-spacing:.08em}
.invite-list button{margin-left:auto}

/* =====================================================================
   Exercise player
   ===================================================================== */
.ex-wrap{display:flex;flex-direction:column;gap:.9rem}
.ex-stage{display:flex;flex-direction:column;gap:.8rem}
.ex-footer{position:sticky;bottom:0;padding-top:.4rem;background:linear-gradient(to top,var(--bg) 62%,transparent)}

.ex-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  box-shadow:var(--sh-2);padding:1.1rem;
}
.ex-head{margin-bottom:.9rem}
.ex-kind{
  display:inline-block;font-size:.66rem;font-weight:800;letter-spacing:.1em;
  text-transform:uppercase;color:var(--blue);background:var(--blue-50);
  border-radius:var(--r-pill);padding:.2rem .6rem;
}
.ex-prompt{font-size:1.1rem;font-weight:700;margin:.55rem 0 0;line-height:1.35}
.ex-prompt.et{color:var(--blue-800);font-weight:800}
.ex-hint{font-size:.82rem;color:var(--ink-3);margin:.6rem 0 0}
.ex-audio{display:flex;align-items:center;gap:.6rem;justify-content:center;margin:.9rem 0}

/* options */
.ex-options{display:grid;gap:.5rem}
.ex-opt{
  display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;
  min-height:54px;padding:.75rem .95rem;text-align:left;
  background:var(--surface);border:2px solid var(--line);border-radius:var(--r);
  font-size:1rem;font-weight:600;cursor:pointer;color:var(--ink);
  transition:all var(--t-fast);-webkit-tap-highlight-color:transparent;
}
.ex-opt:hover:not(:disabled){border-color:var(--blue);background:var(--blue-50)}
.ex-opt:active:not(:disabled){transform:scale(.985)}
.ex-opt.sel{border-color:var(--blue);background:var(--blue-100)}
.ex-opt.right{border-color:var(--ok);background:var(--ok-soft);color:#0a5c3c}
.ex-opt.wrong{border-color:var(--no);background:var(--no-soft);color:var(--no)}
.ex-opt:disabled{cursor:default;opacity:1}
.ex-opt.ear{flex-direction:column;align-items:flex-start;gap:.15rem}
.ex-opt.ear b{font-size:1.15rem;color:var(--blue-800)}

/* typed input */
.ex-input{
  width:100%;padding:.85rem .95rem;min-height:54px;
  background:var(--bg);border:2px solid var(--line);border-radius:var(--r-sm);
  font-size:16px;   /* 16px stops iOS Safari zooming the viewport on focus */
  font-weight:600;transition:border-color var(--t-fast),background var(--t-fast);
}
.ex-input:focus{outline:none;border-color:var(--blue);background:var(--white)}
.ex-input:disabled{opacity:1;background:var(--bg)}
.ex-input.right{border-color:var(--ok);background:var(--ok-soft)}
.ex-input.wrong{border-color:var(--no);background:var(--no-soft)}
.ex-input.inline{display:inline-block;width:auto;min-width:130px;min-height:44px;
                 padding:.35rem .6rem;margin:0 .2rem}
textarea.ex-input{min-height:110px;resize:vertical;line-height:1.5}

/* õäöü strip — almost nobody installs an Estonian keyboard, and without this
   every typed answer dies on a missing diacritic. */
.char-strip{display:flex;gap:.35rem;margin-top:.55rem;flex-wrap:wrap}
.char{
  min-width:44px;min-height:44px;border-radius:var(--r-sm);
  background:var(--blue-50);border:1px solid var(--blue-100);color:var(--blue-800);
  font-size:1.15rem;font-weight:700;cursor:pointer;transition:all var(--t-fast);
}
.char:hover{background:var(--blue-100)}
.char:active{transform:scale(.9)}

/* word scramble */
.scramble-answer{
  min-height:60px;padding:.6rem;margin-bottom:.7rem;
  background:var(--blue-50);border:2px dashed var(--blue-100);border-radius:var(--r);
  display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;
}
.scramble-answer[data-show-hint]::before{
  content:attr(data-empty);color:var(--ink-3);font-size:.85rem;font-weight:600;
}
.scramble-pool{display:flex;flex-wrap:wrap;gap:.4rem}
.token{
  min-height:44px;padding:.5rem .85rem;border-radius:var(--r-pill);
  background:var(--blue);color:#fff;border:none;font-weight:700;font-size:.95rem;
  cursor:pointer;transition:transform var(--t-fast);
}
.token.ghost{background:var(--surface);color:var(--blue-800);border:2px solid var(--line-strong)}
.token:active{transform:scale(.93)}
.token:disabled{opacity:.28;pointer-events:none}

.gap-sentence{
  font-size:1.05rem;font-weight:600;line-height:2.2;
  background:var(--blue-50);border-radius:var(--r-sm);padding:.7rem .8rem;
}

/* feedback */
.ex-feedback{
  border-radius:var(--r);padding:.9rem 1rem;animation:slideUp 260ms cubic-bezier(.4,0,.2,1);
  border-left:4px solid;
}
.ex-feedback.ok{background:var(--ok-soft);border-color:var(--ok);color:#0a5c3c}
.ex-feedback.no{background:var(--no-soft);border-color:var(--no);color:#7d1414}
.fb-head{display:flex;align-items:center;gap:.5rem;font-size:1.05rem;margin-bottom:.4rem}
.fb-answer{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.4rem 0}
.fb-answer b{font-size:1.1rem;color:var(--blue-800)}
.fb-why{margin:.45rem 0 0;font-size:.9rem;line-height:1.5}
.fb-explain{margin:.55rem 0 0;font-size:.85rem;opacity:.9;padding-top:.5rem;
            border-top:1px solid rgba(0,0,0,.08)}
.fb-errors{list-style:none;margin:.5rem 0 0;display:grid;gap:.35rem;font-size:.88rem}
.fb-errors li{background:rgba(255,255,255,.6);border-radius:6px;padding:.4rem .55rem}
.fb-errors s{color:var(--no)}
.fb-errors b{color:var(--ok)}

/* =====================================================================
   Lesson blocks
   ===================================================================== */
.back-link{
  background:none;border:none;color:var(--blue-700);font-weight:700;font-size:.92rem;
  padding:.5rem .2rem;margin-bottom:.4rem;cursor:pointer;min-height:44px;
}
.block.tappable{cursor:pointer;-webkit-tap-highlight-color:transparent}
.block.tappable:active{transform:scale(.99);border-color:var(--blue)}
.block .go{color:var(--ink-3);font-size:1.3rem;font-weight:700;line-height:1}
.block-title{font-size:1.2rem;margin-bottom:.5rem}

.step-tabs{display:flex;gap:.35rem;margin:.7rem 0 1rem;flex-wrap:wrap}
.step{
  flex:1;min-width:88px;text-align:center;font-size:.76rem;font-weight:700;
  padding:.45rem .3rem;border-radius:var(--r-pill);
  background:var(--surface);border:1px solid var(--line);color:var(--ink-3);
}
.step.active{background:var(--blue);border-color:var(--blue);color:#fff}
.step.done{background:var(--ok-soft);border-color:var(--ok);color:#0a5c3c}

/* dialogue */
.dialogue{display:grid;gap:.6rem}
.dlg-line{display:flex;gap:.55rem;align-items:flex-start}
.dlg-line.b{flex-direction:row-reverse}
.dlg-line .who{
  font-size:.6rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink-3);width:52px;flex:none;padding-top:.6rem;
}
.dlg-line.b .who{text-align:right}
.dlg-line .bubble{
  flex:1;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r);padding:.65rem .8rem;box-shadow:var(--sh-1);
}
.dlg-line.b .bubble{background:var(--blue-50);border-color:var(--blue-100)}
.dlg-line .et{font-weight:700;color:var(--blue-800);font-size:1rem}
.dlg-line .en{font-size:.87rem;color:var(--ink-2);margin-top:.15rem}
.dlg-line .lit{font-size:.76rem;color:var(--ink-3);font-style:italic;margin-top:.15rem}

.shadow-box{display:grid;gap:.9rem}
.shadow-line{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:1.6rem 1rem;text-align:center;box-shadow:var(--sh-2);
}
.shadow-line .et.big{font-size:clamp(1.3rem,6vw,1.9rem);font-weight:800;color:var(--blue-800);line-height:1.25}
.shadow-line .en{margin-top:.5rem;font-size:.92rem}

/* grammar prose */
.grammar .summary{font-size:1rem;font-weight:600;color:var(--ink-2);
                  border-left:3px solid var(--blue);padding-left:.7rem;margin:.5rem 0 1rem}
.prose{font-size:.94rem;line-height:1.65}
.prose h2,.prose h3,.prose h4,.prose h5{margin:1.1rem 0 .4rem;font-size:1rem}
.prose code{background:var(--blue-50);color:var(--blue-800);border-radius:4px;
            padding:.1rem .3rem;font-family:var(--mono);font-size:.88em}
.prose b{color:var(--blue-800)}
.md-list{padding-left:1.1rem;display:grid;gap:.25rem}
.md-list li{list-style:disc}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:.7rem 0}
.md-table{border-collapse:collapse;width:100%;font-size:.88rem;min-width:280px}
.md-table th,.md-table td{border:1px solid var(--line);padding:.42rem .6rem;text-align:left}
.md-table th{background:var(--blue-50);color:var(--blue-800);font-weight:800;white-space:nowrap}
.md-table tr:nth-child(even) td{background:var(--blue-50)}

/* =====================================================================
   Review ladder — attempts, hints, XP, combo
   ===================================================================== */

/* Three pips = three attempts. Stakes made visible without a hearts system. */
.attempt-pips{display:flex;gap:5px;margin-bottom:.5rem}
.pip{width:9px;height:9px;border-radius:50%;background:var(--blue-100);
     transition:background var(--t),transform var(--t)}
.pip.used{background:var(--no);transform:scale(.8)}

.prompt-sub{display:block;font-size:.78rem;font-weight:700;color:var(--ink-3);
            text-transform:uppercase;letter-spacing:.06em;margin-bottom:.35rem}
.review-prompt{
  font-size:clamp(1.5rem,7vw,2.2rem);font-weight:800;letter-spacing:-.03em;
  line-height:1.15;color:var(--blue-800);word-break:break-word;
}

.combo-chip{
  display:inline-flex;align-items:baseline;gap:.1rem;flex:none;
  background:var(--blue-100);color:var(--blue-800);
  border-radius:var(--r-pill);padding:.15rem .6rem;font-size:.8rem;font-weight:800;
}
.combo-chip.hot{background:var(--warn-soft);color:var(--warn);animation:pop var(--t-bounce)}
.combo-chip small{font-weight:700;font-size:.7rem}

.hint-box{
  display:flex;align-items:center;gap:.55rem;flex-wrap:wrap;margin-top:.8rem;
  background:var(--warn-soft);border-left:4px solid var(--warn);
  border-radius:var(--r-sm);padding:.6rem .8rem;font-size:.88rem;color:#6b4500;
  animation:slideUp 220ms cubic-bezier(.4,0,.2,1);
}
.hint-box.near{background:var(--blue-50);border-color:var(--blue);color:var(--blue-800)}
.hint-label{font-size:.66rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;
            background:rgba(255,255,255,.7);border-radius:var(--r-pill);padding:.1rem .5rem}
.letter-bank{display:flex;gap:.25rem;flex-wrap:wrap;width:100%;margin-top:.3rem}
.letter{
  min-width:30px;height:30px;display:grid;place-items:center;
  background:var(--white);border:1px solid var(--line);border-radius:6px;
  font-family:var(--mono);font-weight:700;font-size:.95rem;
}

/* Options knocked out by a hint, or already tried. */
.ex-opt.dead{opacity:.35;text-decoration:line-through}

.xp-pop{
  margin-left:auto;background:var(--blue);color:#fff;border-radius:var(--r-pill);
  padding:.15rem .6rem;font-size:.82rem;font-weight:800;animation:pop var(--t-bounce);
}
.xp-pop small{font-weight:700;opacity:.85}

.shake{animation:shake 380ms}

/* =====================================================================
   Word introduction (learn)
   ===================================================================== */
.intro-start{
  text-align:center;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-lg);box-shadow:var(--sh-2);padding:2rem 1.2rem;
}
.intro-badge{
  width:64px;height:64px;margin:0 auto .9rem;border-radius:50%;
  background:var(--blue);color:#fff;display:grid;place-items:center;
  font-size:1.6rem;font-weight:800;box-shadow:var(--sh-blue);
}

.deck-bar{display:flex;align-items:center;gap:.7rem;margin-bottom:.8rem}
.dots{display:flex;gap:4px;flex:1;flex-wrap:wrap}
.dot{width:7px;height:7px;border-radius:50%;background:var(--line);transition:all var(--t)}
.dot.done{background:var(--ok)}
.dot.active{background:var(--blue);transform:scale(1.5)}

.deck{position:relative;overflow:hidden}
.word-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  box-shadow:var(--sh-2);padding:1.4rem 1.1rem;min-height:300px;
  display:flex;align-items:center;justify-content:center;
}
.slide-in{animation:slideInRight 300ms cubic-bezier(.4,0,.2,1)}
.slide-out{animation:slideOutLeft 180ms cubic-bezier(.4,0,.2,1) forwards}
@keyframes slideInRight{from{opacity:0;transform:translateX(38px)}to{opacity:1;transform:none}}
@keyframes slideOutLeft{to{opacity:0;transform:translateX(-38px)}}

.wc-body{display:flex;flex-direction:column;align-items:center;gap:.75rem;
         text-align:center;width:100%}
.wc-step{font-size:.66rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;
         color:var(--blue);background:var(--blue-50);border-radius:var(--r-pill);padding:.2rem .7rem}
.wc-et{font-size:clamp(1.7rem,8vw,2.6rem);font-weight:800;color:var(--blue-800);
       letter-spacing:-.03em;line-height:1.1;display:flex;align-items:center;gap:.6rem;
       flex-wrap:wrap;justify-content:center}
.wc-et.small-et{font-size:clamp(1.2rem,5vw,1.6rem)}
.wc-en{font-size:1.25rem;font-weight:700}
.reveal-pop{animation:pop var(--t-bounce) backwards}

.part-grid{display:grid;gap:.45rem;width:100%;max-width:340px}
.part-cell{
  display:flex;align-items:center;gap:.6rem;
  background:var(--blue-50);border:1px solid var(--blue-100);border-radius:var(--r-sm);
  padding:.5rem .7rem;
}
.part-cell small{font-size:.64rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;
                 color:var(--ink-3);width:46px;flex:none;text-align:left}
.part-cell b{flex:1;text-align:left;font-size:1.05rem;color:var(--blue-800)}

/* =====================================================================
   Rank, missions, badges
   ===================================================================== */
.rank-card{
  background:linear-gradient(135deg,var(--blue) 0%,var(--blue-800) 100%);
  color:#fff;border-radius:var(--r-lg);padding:1.1rem 1.2rem;
  box-shadow:var(--sh-blue);margin-bottom:.4rem;
}
.rank-top{display:flex;align-items:flex-end;justify-content:space-between;gap:.8rem}
.rank-et{font-size:1.35rem;font-weight:800;letter-spacing:-.02em;line-height:1.1}
.rank-en{font-size:.8rem;opacity:.8;font-weight:600}
.rank-xp{font-size:1rem;font-weight:800;font-variant-numeric:tabular-nums}
.rank-track{height:8px;background:rgba(255,255,255,.25);border-radius:var(--r-pill);
            overflow:hidden;margin:.7rem 0 .4rem}
.rank-track i{display:block;height:100%;background:#fff;border-radius:var(--r-pill);
              transition:width 900ms cubic-bezier(.4,0,.2,1)}
.rank-next{font-size:.8rem;opacity:.85;font-weight:600}

.mission-list{display:grid;gap:.5rem}
.mission{
  display:flex;align-items:center;gap:.75rem;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.75rem .85rem;box-shadow:var(--sh-1);cursor:pointer;
  transition:transform var(--t-fast),border-color var(--t-fast);
  -webkit-tap-highlight-color:transparent;
}
.mission:active{transform:scale(.99)}
.mission.done{background:var(--ok-soft);border-color:var(--ok)}
.mission.locked{opacity:.55;cursor:default}
.m-check{
  width:28px;height:28px;flex:none;border-radius:50%;display:grid;place-items:center;
  background:var(--blue-50);color:var(--blue);font-weight:800;font-size:.9rem;
}
.mission.done .m-check{background:var(--ok);color:#fff}
.m-body{flex:1;min-width:0}
.m-title{font-weight:700;font-size:.95rem;line-height:1.3}
.m-sub{font-size:.76rem;color:var(--ink-3);text-transform:capitalize}
.m-xp{font-size:.8rem;font-weight:800;color:var(--blue);flex:none}
.m-meta{display:flex;gap:.4rem;flex-wrap:wrap;margin:.7rem 0}

/* bottom sheet — reachable, dismissible, doesn't cover the whole screen */
.sheet-backdrop{
  position:fixed;inset:0;z-index:80;background:rgba(10,30,60,.45);
  display:flex;align-items:flex-end;justify-content:center;
  animation:fadeIn 180ms;
}
.sheet{
  width:100%;max-width:520px;background:var(--surface);
  border-radius:var(--r-lg) var(--r-lg) 0 0;padding:1rem 1.2rem;
  padding-bottom:calc(1.2rem + var(--safe-b));
  box-shadow:var(--sh-3);animation:sheetUp 260ms cubic-bezier(.4,0,.2,1);
  max-height:86vh;overflow-y:auto;
}
.sheet-grab{width:38px;height:4px;border-radius:2px;background:var(--line-strong);
            margin:0 auto .9rem}
.sheet h2{font-size:1.2rem;margin-bottom:.2rem}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}

.badge-shelf{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:.5rem}
.badge{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.75rem .4rem;text-align:center;opacity:.5;
}
.badge.earned{opacity:1;border-color:var(--gold);background:#FFFBF0}
.b-icon{display:block;font-size:1.6rem;line-height:1.2}
.b-title{display:block;font-size:.74rem;font-weight:800;margin-top:.25rem}
.b-sub{display:block;font-size:.66rem;color:var(--ink-3)}

@media (min-width:600px){
  .sheet{border-radius:var(--r-lg);margin-bottom:2rem}
  .sheet-backdrop{align-items:center}
}

/* =====================================================================
   Tutor & roleplay
   ===================================================================== */
.scenario-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.55rem}
.scenario{
  display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.85rem;text-align:left;cursor:pointer;box-shadow:var(--sh-1);
  transition:transform var(--t-fast),border-color var(--t-fast);
  -webkit-tap-highlight-color:transparent;
}
.scenario:hover:not(:disabled){border-color:var(--blue)}
.scenario:active:not(:disabled){transform:scale(.98)}
.scenario.locked{opacity:.5;cursor:default}
.s-icon{font-size:1.5rem;line-height:1.2}
.s-title{font-weight:800;font-size:.92rem}
.s-goal{font-size:.75rem;color:var(--ink-3);line-height:1.35}

.thread-row{
  display:flex;align-items:center;gap:.6rem;width:100%;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:.65rem .8rem;cursor:pointer;text-align:left;
}
.t-mode{font-size:1.1rem;flex:none}
.t-title{flex:1;font-weight:700;font-size:.9rem;overflow:hidden;
         text-overflow:ellipsis;white-space:nowrap}

/* ---- chat ---- */
.chat-wrap{display:flex;flex-direction:column;
           min-height:calc(100dvh - var(--header-h) - var(--tabbar-h) - 3rem)}
.chat-head{display:flex;align-items:center;gap:.6rem;margin-bottom:.5rem;flex-wrap:wrap}
.chat-title{font-weight:800;flex:1}
.chat-goal{
  background:var(--blue-50);border-left:3px solid var(--blue);
  border-radius:var(--r-sm);padding:.55rem .8rem;font-size:.85rem;margin-bottom:.7rem;
}
.chat-log{flex:1;display:flex;flex-direction:column;gap:.5rem;overflow-y:auto;
          padding:.3rem 0 .6rem}

.bubble-row{display:flex}
.bubble-row.me{justify-content:flex-end}
.bubble{
  max-width:86%;border-radius:var(--r);padding:.6rem .8rem;
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--sh-1);
  animation:slideUp 200ms cubic-bezier(.4,0,.2,1);
}
.bubble-row.me .bubble{background:var(--blue);color:#fff;border-color:var(--blue)}
.b-text{white-space:pre-wrap;line-height:1.5;font-size:.95rem}
.bubble-row.them .b-text{color:var(--blue-800);font-weight:600}
.b-tools{display:flex;gap:.3rem;margin-top:.35rem}

.typing{display:flex;gap:4px;padding:.8rem 1rem}
.typing i{width:7px;height:7px;border-radius:50%;background:var(--ink-3);
          animation:blink 1.2s infinite}
.typing i:nth-child(2){animation-delay:.2s}
.typing i:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,60%,100%{opacity:.25}30%{opacity:1}}

.chat-bar{
  display:flex;gap:.5rem;align-items:flex-end;position:sticky;bottom:0;
  background:var(--bg);padding:.5rem 0;
}
.chat-input{
  flex:1;border:2px solid var(--line);border-radius:var(--r);
  padding:.7rem .85rem;font-size:16px;resize:none;background:var(--surface);
  font-family:inherit;line-height:1.4;max-height:120px;
}
.chat-input:focus{outline:none;border-color:var(--blue)}
.chat-send{
  width:48px;height:48px;flex:none;border:none;border-radius:50%;
  background:var(--blue);color:#fff;font-size:1.3rem;font-weight:800;cursor:pointer;
  box-shadow:var(--sh-blue);
}
.chat-send:disabled{opacity:.5}

.chat-help{display:flex;gap:.4rem;flex-wrap:wrap;padding-bottom:.4rem}
.chip-btn{
  background:var(--surface);border:1px solid var(--line-strong);border-radius:var(--r-pill);
  padding:.35rem .8rem;font-size:.8rem;font-weight:700;color:var(--ink-2);cursor:pointer;
  min-height:38px;
}
.chip-btn:hover{border-color:var(--blue);color:var(--blue-700)}

/* ---- debrief ---- */
.debrief{
  background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--blue);
  border-radius:var(--r);padding:1rem;margin-top:.6rem;box-shadow:var(--sh-2);
}
.debrief h3{font-size:1.05rem;margin-bottom:.4rem}
.debrief ul{padding-left:1.1rem;display:grid;gap:.45rem;margin:.35rem 0 0}
.debrief li{list-style:disc;font-size:.88rem}
.db-good{background:var(--ok-soft);border-radius:var(--r-sm);padding:.6rem .8rem;margin:.6rem 0;
         color:#0a5c3c}
.db-fix{background:var(--warn-soft);border-radius:var(--r-sm);padding:.6rem .8rem;margin:.6rem 0;
        color:#6b4500}
.db-fix s{color:var(--no)}
.db-fix b{color:var(--ok)}

/* ---------- toast ---------- */
.toast{
  position:fixed;left:50%;transform:translateX(-50%) translateY(20px);
  bottom:calc(var(--tabbar-h) + var(--safe-b) + 14px);z-index:70;
  background:var(--black);color:#fff;border-radius:var(--r-pill);
  padding:.7rem 1.2rem;font-size:.88rem;font-weight:600;
  max-width:min(92vw,460px);box-shadow:var(--sh-3);
  opacity:0;transition:opacity var(--t),transform var(--t);
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast.warn{background:var(--warn)}
.toast.ok{background:var(--ok)}

.loading{display:grid;place-items:center;padding:3rem 1rem;color:var(--ink-3);font-weight:600}
.spinner{
  width:30px;height:30px;border:3px solid var(--line);border-top-color:var(--blue);
  border-radius:50%;animation:spin .8s linear infinite;margin-bottom:.7rem;
}
.empty{text-align:center;padding:2.5rem 1rem;color:var(--ink-2)}
.empty .big{font-size:3rem;margin-bottom:.5rem}

/* =====================================================================
   Animations
   ===================================================================== */
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.12)}}
@keyframes pop{0%{transform:scale(0)}70%{transform:scale(1.18)}100%{transform:scale(1)}}
@keyframes shake{0%,100%{transform:translateX(0)}20%,60%{transform:translateX(-7px)}40%,80%{transform:translateX(7px)}}
@keyframes flicker{0%,100%{transform:scale(1) rotate(-2deg)}50%{transform:scale(1.14) rotate(2deg)}}
@keyframes fall{to{transform:translateY(105vh) rotate(680deg)}}
@keyframes slideUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.animate-in{animation:slideUp 320ms cubic-bezier(.4,0,.2,1) backwards}
.animate-in:nth-child(2){animation-delay:40ms}
.animate-in:nth-child(3){animation-delay:80ms}
.animate-in:nth-child(4){animation-delay:120ms}

/* =====================================================================
   Responsive — mobile is the base; these are the additions for bigger screens
   ===================================================================== */
@media (min-width:600px){
  .tiles{grid-template-columns:repeat(4,1fr)}
  main{padding-left:1.5rem;padding-right:1.5rem}
}

@media (min-width:860px){
  .tabbar{display:none}
  .top-nav{display:flex}
  main{padding-bottom:3rem}
  .toast{bottom:24px}
  .hero{padding:1.8rem}
  .hero h1{font-size:1.7rem}
  .session{min-height:auto}
  .flip{min-height:340px}
}

/* Short landscape phones: don't let the card push the grades off-screen. */
@media (max-height:520px){
  .flip{min-height:180px}
  .grade{min-height:48px}
  .face .word{font-size:1.7rem}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
  .flip-inner{transition:none}
}

/* Honour a system dark preference without going back to a dark app:
   nudge the canvas slightly, keep the flag palette intact. */
@media (prefers-color-scheme:dark){
  :root{--bg:#EDF3F9}
}

/* =====================================================================
   Welcome + streak
   ===================================================================== */
.welcome{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:var(--sh-1);padding:1.2rem 1.1rem;margin-bottom:1rem;
}
.welcome-top{display:flex;align-items:flex-start;gap:1rem;justify-content:space-between}
.welcome-hi h1{font-size:1.5rem;line-height:1.15;letter-spacing:-.02em;margin:0}
.welcome-hi p{margin:.15rem 0 0;font-size:.85rem}

.streak-badge{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-width:74px;padding:.5rem .6rem;border-radius:14px;flex:none;
  background:var(--bg);border:1px solid var(--line);
}
.streak-badge .flame{font-size:1.15rem;line-height:1}
.streak-badge b{font-size:1.5rem;line-height:1.05;font-variant-numeric:tabular-nums}
.streak-badge .lbl{font-size:.62rem;font-weight:700;color:var(--ink-3);text-transform:uppercase;letter-spacing:.04em}
.streak-badge.hot{background:#FFF6E6;border-color:#F2D7A0}
.streak-badge.hot b{color:var(--warn)}
/* Alive but not yet counted today. Nudge, not alarm. */
.streak-badge.at-risk{background:var(--warn-soft);border-color:#E9C68A;animation:sb-breathe 2.6s ease-in-out infinite}
@keyframes sb-breathe{0%,100%{opacity:1}50%{opacity:.78}}

/* The chain — seven days, honest about the gaps. */
.chain{display:flex;gap:.3rem;margin:.9rem 0 .2rem}
.chain-day{flex:1;display:flex;flex-direction:column;align-items:center;gap:.25rem;min-width:0}
.chain-day i{
  display:block;width:100%;height:26px;border-radius:7px;
  background:var(--line);border:1px solid transparent;
  transition:background var(--t-fast),transform var(--t-bounce);
}
.chain-day.done i{background:var(--warn);}
.chain-day.goal i{background:var(--ok);}
.chain-day.today i{outline:2px solid var(--blue);outline-offset:2px}
.chain-day.today:not(.done) i{background:repeating-linear-gradient(
  45deg,var(--line),var(--line) 4px,#fff 4px,#fff 8px)}
.chain-day b{font-size:.6rem;font-weight:800;color:var(--ink-3)}

.streak-note{margin:.55rem 0 0;font-size:.84rem;line-height:1.45}
.streak-note.warn{color:var(--warn);font-weight:600}
.streak-note.ok{color:var(--ok);font-weight:600}

.welcome-cta{display:flex;align-items:center;gap:1rem;margin-top:1rem}
.welcome-cta .cta-body{flex:1;min-width:0}
.welcome-cta .cta-body p{margin:.3rem 0 0}

/* Header pill mirrors the badge state. */
.streak-pill.at-risk{background:var(--warn-soft);color:var(--warn)}

/* Milestone card. Deliberately dismissible and self-clearing — a celebration
   that blocks the app becomes an obstacle the second time you see it. */
.milestone{
  position:fixed;left:50%;top:22%;transform:translateX(-50%);z-index:120;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:0 12px 40px rgba(10,50,90,.22);padding:1.5rem 1.8rem;text-align:center;
  max-width:min(90vw,340px);animation:ms-in var(--t-bounce);
}
.milestone .big{font-size:2.6rem;line-height:1}
.milestone h2{margin:.4rem 0 .1rem;font-size:1.3rem}
.milestone .btn{margin-top:.9rem}
@keyframes ms-in{from{opacity:0;transform:translateX(-50%) scale(.86)}to{opacity:1;transform:translateX(-50%) scale(1)}}

@media (max-width:380px){
  .welcome-hi h1{font-size:1.3rem}
  .streak-badge{min-width:64px}
  .chain-day i{height:22px}
}

/* =====================================================================
   Speaking practice
   ===================================================================== */
.speak-wrap{display:flex;flex-direction:column;gap:1rem;align-items:stretch}

.speak-target{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:var(--sh-1);padding:1.4rem 1.1rem;text-align:center;
}
.speak-word{font-size:2rem;font-weight:800;letter-spacing:-.02em;line-height:1.15}
.speak-listen{display:flex;gap:.5rem;align-items:center;justify-content:center;margin-top:.8rem}

/* Level meter. Sits directly above the button so the eye reads
   "sound is arriving" without leaving the control. */
.mic-meter{
  height:6px;border-radius:var(--r-pill);background:var(--line);
  overflow:hidden;
}
.mic-meter i{
  display:block;height:100%;width:100%;background:var(--blue);
  transform-origin:left center;transform:scaleX(0);
  transition:transform 60ms linear;
}

.mic-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.35rem;
  width:100%;min-height:88px;padding:1rem;
  border:2px solid var(--blue);border-radius:var(--r);
  background:var(--surface);color:var(--blue);
  font-weight:800;font-size:1rem;cursor:pointer;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
  transition:background var(--t-fast),color var(--t-fast),transform var(--t-fast);
}
.mic-btn:active{transform:scale(.98)}
.mic-btn .mic-icon{font-size:1.5rem;line-height:1}
.mic-btn.recording{
  background:var(--no);border-color:var(--no);color:#fff;
  animation:mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse{
  0%,100%{box-shadow:0 0 0 0 rgba(206,32,32,.42)}
  50%    {box-shadow:0 0 0 12px rgba(206,32,32,0)}
}

.speak-result{
  border:1px solid var(--line);border-left-width:4px;
  border-radius:var(--r);padding:1rem;background:var(--surface);
}
.speak-result.ok  {border-left-color:var(--ok);  background:var(--ok-soft)}
.speak-result.warn{border-left-color:var(--warn);background:var(--warn-soft)}
.speak-result.no  {border-left-color:var(--no);  background:var(--no-soft)}
.speak-result.muted{border-left-color:var(--ink-3)}

/* What you said vs what the word is — the two facts that matter, side by
   side, before any verdict or advice. */
.speak-heard{
  display:grid;grid-template-columns:1fr 1fr;gap:.6rem;
  margin:.7rem 0;padding:.7rem;border-radius:12px;
  background:rgba(255,255,255,.7);
}
.speak-heard > div{display:flex;flex-direction:column;gap:.15rem;min-width:0}
.speak-heard b{font-size:1.15rem;word-break:break-word}
.speak-heard .heard-text{color:var(--no)}
.speak-heard .target-text{color:var(--ok)}
.speak-result.ok .speak-heard .heard-text{color:var(--ok)}

.speak-chips{display:flex;flex-wrap:wrap;gap:.35rem;margin:.5rem 0}

/* The coaching sentence is already useful when it appears — this only marks
   that a better one may replace it. Deliberately subtle: a spinner here would
   imply the result is incomplete, and it isn't. */
.fb-why.thinking{opacity:.62}
.fb-why.thinking::after{
  content:"";display:inline-block;width:.5em;height:.5em;margin-left:.4em;
  border-radius:50%;background:currentColor;vertical-align:middle;
  animation:fb-pulse 1s ease-in-out infinite;
}
@keyframes fb-pulse{0%,100%{opacity:.25}50%{opacity:.9}}

.speak-actions{
  display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-top:.9rem;
}
.model-audio{display:inline-flex;align-items:center;gap:.3rem}

/* Two-way choice (used by the production block) */
.choice-screen{text-align:center;padding:1.2rem .2rem}
.choice-grid{display:grid;gap:.8rem;margin-top:1.2rem}
@media (min-width:520px){ .choice-grid{grid-template-columns:1fr 1fr} }
.choice-card{
  display:flex;flex-direction:column;align-items:center;gap:.4rem;
  padding:1.4rem 1rem;text-align:center;cursor:pointer;
  background:var(--surface);border:2px solid var(--line);border-radius:var(--r);
  box-shadow:var(--sh-1);color:inherit;font:inherit;
  transition:border-color var(--t-fast),transform var(--t-fast);
}
.choice-card:hover,.choice-card:focus-visible{border-color:var(--blue)}
.choice-card:active{transform:scale(.98)}
.choice-card .big{font-size:2rem;line-height:1}
.choice-card b{font-size:1.05rem}

.centre{text-align:center}
.card.soft{background:var(--surface);opacity:.96;margin-bottom:1rem}

@media (max-width:380px){
  .speak-word{font-size:1.6rem}
  .speak-heard{grid-template-columns:1fr}
}

@media print{
  .tabbar,.app-header,.toast{display:none}
}

/* =====================================================================
   Install banner
   ---------------------------------------------------------------------
   Sits above the tab bar rather than over it. Covering the navigation with
   a promotional banner is the fastest way to make someone dismiss it
   without reading it.
   ===================================================================== */
.pwa-banner{
  position:fixed;left:12px;right:12px;
  bottom:calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index:60;display:flex;align-items:center;gap:14px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:var(--sh-3);padding:14px 16px;
  transform:translateY(140%);opacity:0;
  transition:transform var(--t-bounce),opacity var(--t);
}
.pwa-banner.is-in{transform:translateY(0);opacity:1}
.pwa-banner img{border-radius:11px;flex:none}
.pwa-copy{flex:1;min-width:0}
.pwa-copy b{display:block;font-size:15px;font-weight:800;letter-spacing:-.01em;line-height:1.3}
.pwa-copy span{display:block;font-size:13px;color:var(--ink-2);line-height:1.45;margin-top:2px}
.pwa-actions{display:flex;align-items:center;gap:8px;flex:none}
.pwa-banner button{
  font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;
  padding:10px 14px;border-radius:var(--r-pill);border:0;
}
.pwa-no{background:transparent;color:var(--ink-3)}
.pwa-no:hover{background:var(--bg);color:var(--ink-2)}
.pwa-yes{background:var(--blue);color:var(--white);box-shadow:var(--sh-blue)}
.pwa-yes:hover{background:var(--blue-700)}
.pwa-banner.is-strong{border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-100),var(--sh-3)}
.pwa-banner.is-help{flex-direction:column;align-items:flex-start;gap:10px}
.pwa-banner.is-help .pwa-actions{align-self:flex-end}

@media (min-width:720px){
  .pwa-banner{left:auto;right:20px;bottom:20px;max-width:26rem}
}
@media (prefers-reduced-motion:reduce){
  .pwa-banner{transition:opacity var(--t)}
  .pwa-banner.is-in{transform:none}
}

/* ---- Download for offline, on the day screen ---- */
.day-offline{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px}
.day-offline button{
  display:inline-flex;align-items:center;gap:8px;font-family:inherit;font-size:14px;
  font-weight:700;cursor:pointer;padding:10px 16px;border-radius:var(--r-pill);
  border:1.5px solid var(--line-strong);background:var(--surface);color:var(--ink-2);
}
.day-offline button:hover{border-color:var(--blue);color:var(--blue-700)}
.day-offline button[disabled]{opacity:.6;cursor:default}
.day-offline .is-saved{border-color:var(--ok);color:var(--ok);background:var(--ok-soft)}
.day-offline .note{font-size:13px;color:var(--ink-3)}
.day-offline .note.warn{color:var(--warn)}
