/* ============================================================
   eng — Nike-athletic design system
   Deep black · VOLT accent · Barlow Condensed · high contrast
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,500;0,600;0,700;0,800;1,700;1,800&family=Barlow:wght@400;500;600;700&family=Literata:opsz,wght@7..72,400;7..72,500&display=swap');

:root {
  --bg: #0a0a0b;
  --surface: #151517;
  --surface-2: #1e1e21;
  --surface-3: #28282c;
  --line: #2a2a2e;
  --text: #f7f7f8;
  --muted: #9a9aa2;
  --faint: #6a6a72;
  --volt: #d8ff00;          /* Nike volt */
  --volt-dim: #b9db00;
  --on-volt: #0a0a0b;
  --green: #38e08a;
  --red: #ff4d4d;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --sans: 'Barlow', -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans);
  overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

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

/* ---------- display type ---------- */
.display { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.01em; line-height: 0.92; }
.kicker { font-family: var(--cond); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 13px; color: var(--muted); }

/* ---------- screens ---------- */
.screen { display: none; flex-direction: column; min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) 18px calc(var(--nav-h) + 24px + var(--safe-bottom)); }
.screen.active { display: flex; animation: fade .22s ease; }
.screen.immersive { padding-bottom: calc(20px + var(--safe-bottom)); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- top bar ---------- */
.appbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.appbar .icon-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; flex-shrink: 0; transition: transform .12s, background .15s; }
.appbar .icon-btn:active { transform: scale(.9); }
.appbar-title { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 24px; letter-spacing: -0.01em; }
.spacer { flex: 1; }

.icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 30px; height: 30px; }

/* ---------- TODAY hero ---------- */
.greeting { margin-bottom: 4px; }
.greeting .kicker { display: block; margin-bottom: 6px; }
.greeting h1 { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 44px; line-height: 0.9; letter-spacing: -0.02em; }

.streak-row { display: flex; gap: 10px; margin: 20px 0 24px; }
.stat-chip { flex: 1; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px; }
.stat-chip .num { font-family: var(--cond); font-weight: 800; font-size: 34px; line-height: 1;
  color: var(--volt); font-variant-numeric: tabular-nums; }
.stat-chip .lbl { font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* hero CTA card */
.hero-card { position: relative; background: var(--volt); color: var(--on-volt);
  border-radius: var(--r-lg); padding: 22px; overflow: hidden; margin-bottom: 26px;
  transition: transform .12s; }
.hero-card:active { transform: scale(.985); }
.hero-card .kicker { color: rgba(10,10,11,.6); }
.hero-card h2 { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 30px; line-height: 0.95; margin: 8px 0 16px; max-width: 80%; }
.hero-card .go { display: inline-flex; align-items: center; gap: 8px; font-family: var(--cond);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 15px; }
.hero-card .blob { position: absolute; right: -30px; bottom: -40px; width: 150px; height: 150px;
  opacity: .14; }
.hero-stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.hero-stack .hero-card { margin-bottom: 0; }

/* secondary action card (dark "repeat") */
.action-card { display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; text-align: left;
  transition: transform .12s, border-color .15s; }
.action-card:active { transform: scale(.985); border-color: var(--surface-3); }
.action-card:disabled { opacity: .4; }
.action-card .ac-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3);
  display: grid; place-items: center; flex-shrink: 0; color: var(--volt); }
.action-card .ac-text { flex: 1; }
.action-card .ac-text b { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 22px; line-height: 1; display: block; }
.action-card .ac-text span { font-size: 12px; color: var(--muted); }
.action-card .chev { color: var(--faint); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 14px; }
.section-head .kicker { font-size: 14px; color: var(--text); }
.section-head a { font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  font-size: 12px; letter-spacing: 0.06em; color: var(--volt); }

/* ---------- deck cards ---------- */
.decks { display: flex; flex-direction: column; gap: 12px; }
.deck-row { position: relative; overflow: hidden; border-radius: var(--r-md); touch-action: pan-y; }
.deck-del { position: absolute; left: 0; top: 0; bottom: 0; width: 88px; background: var(--red);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  z-index: 1; border-radius: var(--r-md) 0 0 var(--r-md); }
.deck-del span { font-family: var(--cond); font-weight: 700; text-transform: uppercase; font-size: 12px;
  letter-spacing: .04em; }
.deck-del .icon { width: 22px; height: 22px; }
.deck { position: relative; z-index: 2; width: 100%; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
  text-align: left; transition: transform .18s ease, border-color .15s; will-change: transform; }
.deck:active { border-color: var(--surface-3); }
.deck-thumb { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-3);
  display: grid; place-items: center; flex-shrink: 0; color: var(--volt); }
.deck-main { flex: 1; min-width: 0; }
.deck-name { font-family: var(--cond); font-weight: 700; text-transform: uppercase; font-size: 18px;
  line-height: 1.04; letter-spacing: -0.01em; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.deck-meta { display: flex; gap: 8px; margin-top: 7px; }
.tag { font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  font-size: 11px; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.tag.due { background: rgba(216,255,0,.14); color: var(--volt); }
.tag.new { background: var(--surface-3); color: var(--muted); }
.deck .chev { color: var(--faint); }

.empty { text-align: center; color: var(--muted); margin-top: 50px; line-height: 1.6;
  font-size: 15px; padding: 0 20px; }

/* ---------- buttons ---------- */
.btn { width: 100%; border-radius: 14px; padding: 17px; font-family: var(--cond); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 17px; display: flex;
  align-items: center; justify-content: center; gap: 9px; transition: transform .12s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; }
.btn-volt { background: var(--volt); color: var(--on-volt); }
.btn-dark { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.actions { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.rate-row { display: flex; gap: 10px; }
.rate-row .btn { flex: 1; }
.btn-forgot { background: var(--surface-2); color: var(--red); border: 1.5px solid rgba(255,77,77,.3); }
.btn-remember { background: var(--volt); color: var(--on-volt); }
.hidden { display: none !important; }

/* ---------- inputs ---------- */
.field-label { font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: 12px; color: var(--muted); display: block; margin: 4px 2px 9px; }
.input, .textarea { width: 100%; background: var(--surface); border: 1.5px solid var(--line);
  color: var(--text); border-radius: var(--r-sm); padding: 15px; font-size: 16px; font-family: var(--sans);
  margin-bottom: 14px; transition: border-color .15s; }
.input:focus, .textarea:focus { outline: none; border-color: var(--volt); }
.textarea { resize: vertical; line-height: 1.55; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.status { margin-top: 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.transcript { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; max-height: 32vh; overflow-y: auto; font-size: 15px; line-height: 1.65;
  color: #cdcdd4; margin-bottom: 18px; -webkit-overflow-scrolling: touch; }

/* reader: book-style typography (Kindle / Google Play Books feel) */
.transcript.reader { flex: 1; max-height: none; background: #121211; border-color: #232220;
  padding: 22px 20px 24px; font-family: 'Literata', Georgia, 'Times New Roman', serif;
  font-size: 18.5px; line-height: 1.82; letter-spacing: 0.01em; color: #cbc5b9;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer; }
.reader .para { margin: 0 0 1.15em 0; text-align: left; }
.reader .para:last-child { margin-bottom: 0; }
.reader .w { display: inline; padding: 2px 0.5px; border-radius: 5px;
  transition: background .08s, color .08s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.reader .w.active { background: rgba(216,255,0,.32); color: #fff; }   /* live drag */
.reader .w.sel { background: var(--volt); color: var(--on-volt); }    /* committed */

/* bottom selection bar */
.select-bar { position: sticky; bottom: 0; padding-top: 12px; background: linear-gradient(transparent, var(--bg) 30%); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; max-height: 96px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 8px 7px 13px; font-size: 14px;
  font-weight: 500; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chip .x { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--muted);
  display: grid; place-items: center; flex-shrink: 0; }
.chip .x svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* ---------- generating ---------- */
.center-box { margin: auto; text-align: center; width: 100%; max-width: 340px; }
.center-box h2 { font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 26px; margin: 22px 0 18px; }
.bar { width: 100%; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--volt); border-radius: 999px; transition: width .5s ease; }
.spinner { width: 52px; height: 52px; border: 4px solid var(--surface-2); border-top-color: var(--volt);
  border-radius: 50%; margin: 0 auto; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); } .small { font-size: 13px; } .mt { margin-top: 10px; }

/* ---------- mode pick ---------- */
.mode-card { width: 100%; display: flex; align-items: center; gap: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; margin-bottom: 12px;
  text-align: left; transition: transform .12s, border-color .15s; }
.mode-card:active { transform: scale(.985); }
.mode-card:disabled { opacity: .35; }
.mode-card.accent { background: var(--volt); color: var(--on-volt); border-color: var(--volt); }
.mode-ico { width: 50px; height: 50px; border-radius: 14px; background: var(--surface-3);
  display: grid; place-items: center; flex-shrink: 0; color: var(--volt); }
.mode-card.accent .mode-ico { background: rgba(10,10,11,.12); color: var(--on-volt); }
.mode-card .t { flex: 1; }
.mode-card .t b { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 21px;
  display: block; line-height: 1; }
.mode-card .t span { font-size: 13px; opacity: .7; }

/* ---------- TRAIN ---------- */
.train-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.train-progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.train-progress > i { display: block; height: 100%; background: var(--volt); border-radius: 999px;
  transition: width .35s ease; }
.train-count { font-family: var(--cond); font-weight: 700; font-size: 15px; color: var(--muted);
  font-variant-numeric: tabular-nums; }

.flash { flex: 1; display: flex; flex-direction: column; }
.flash-img { width: 100%; aspect-ratio: 1/1; max-height: 42vh; border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface); }
.flash-img.hidden { display: none; }
.flash-img img { width: 100%; height: 100%; object-fit: cover; }
.flash-body { padding: 22px 4px 4px; text-align: center; }
.flash-word { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 38px;
  line-height: 0.96; letter-spacing: -0.02em; }
.flash-ex { color: var(--muted); font-size: 16px; line-height: 1.45; margin-top: 12px; font-style: italic; }
.audio-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; background: var(--surface-2);
  padding: 11px 20px; border-radius: 999px; font-family: var(--cond); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; font-size: 14px; }
.audio-pill.hidden { display: none; }
.flash-answer { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.flash-answer.hidden { display: none; }
.flash-tr { font-family: var(--cond); font-weight: 700; text-transform: uppercase; font-size: 28px;
  color: var(--volt); line-height: 1; }

/* ---------- DONE ---------- */
.done-wrap { margin: auto; text-align: center; padding: 24px; }
.done-badge { width: 92px; height: 92px; border-radius: 50%; background: var(--volt); color: var(--on-volt);
  display: grid; place-items: center; margin: 0 auto 22px; }
.done-wrap h2 { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 32px;
  line-height: 0.95; }
.done-wrap p { color: var(--muted); margin: 10px 0 28px; font-size: 15px; }
.done-wrap .btn { max-width: 280px; margin: 0 auto; }

/* ---------- STATS ---------- */
.stat-big { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; margin-bottom: 14px; }
.stat-big .num { font-family: var(--cond); font-weight: 800; font-size: 64px; line-height: 0.9;
  color: var(--volt); font-variant-numeric: tabular-nums; }
.stat-big .lbl { font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; font-size: 13px; color: var(--muted); margin-top: 8px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-grid .stat-chip .num { font-size: 30px; }

/* ---------- BOTTOM NAV ---------- */
.bottomnav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%;
  max-width: 540px; height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(12,12,14,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); display: flex; align-items: stretch; z-index: 40; }
.bottomnav.hidden { display: none; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--faint); transition: color .15s; }
.nav-item .nav-lbl { font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: 10px; }
.nav-item.active { color: var(--text); }
.nav-item.add .nav-lbl { color: var(--volt); margin-top: 1px; }
.nav-item.add .nav-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--volt);
  display: grid; place-items: center; margin-top: -24px; box-shadow: 0 8px 22px rgba(216,255,0,.28);
  transition: transform .12s; }
.nav-item.add .nav-ico .icon { width: 26px; height: 26px; stroke: var(--on-volt); stroke-width: 2.6; }
.nav-item.add:active .nav-ico { transform: scale(.9); }

/* ---------- TOAST ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-bottom));
  transform: translateX(-50%); background: var(--surface-3); color: var(--text); padding: 13px 20px;
  border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 34px rgba(0,0,0,.5);
  z-index: 60; max-width: 88%; text-align: center; border: 1px solid var(--line); }
.toast.hidden { display: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
