/* ============================================================
   TOEFL Lab — stylesheet
   Direction: a near-future study lab. Glass panels floating over a
   slow-drifting nebula, glowing accents, and the highlighter stroke
   kept as the one signature gesture from the original design.
   ============================================================ */

:root {
  --navy:       #16182B;   /* fixed brand navy — sidebar, exam bar, toast; stays dark in both themes */
  --ink:        #16182B;
  --ink-2:      #363B57;
  --muted:      #6B7189;
  --muted-2:    #9AA0B4;
  --paper:      #EEF0F7;
  --surface:    #FFFFFF;
  --surface-2:  #F6F7FA;
  --line:       #DCE0EA;
  --line-2:     #C6CCDB;

  --accent:     #4B3FD4;
  --accent-ink: #2E259C;
  --accent-soft:#ECEAFF;
  --accent-2:   #0EA5B7;   /* secondary futuristic accent — cyan, used sparingly for glow highlights */

  --hl:         #FFE45C;   /* the highlighter */
  --hl-deep:    #F5C518;

  --ok:         #0F7A62;
  --ok-soft:    #E3F4EF;
  --alert:      #C2453D;
  --alert-soft: #FBEAE8;

  --r-sm: 4px;
  --r:    8px;
  --r-lg: 14px;

  --shadow: 0 1px 2px rgba(22,24,43,.05), 0 6px 20px rgba(22,24,43,.06);
  --shadow-lg: 0 2px 6px rgba(22,24,43,.08), 0 18px 48px rgba(22,24,43,.12);

  /* glass panels + ambient background — the "futuristic lab" layer */
  --glass-bg:     rgba(255,255,255,.55);
  --glass-border: rgba(255,255,255,.75);
  --glass-blur:   18px;
  --glow-accent:  rgba(75,63,212,.35);
  --glow-accent-2: rgba(14,165,183,.30);
  --blob1: rgba(140,127,255,.30);
  --blob2: rgba(14,165,183,.26);
  --blob3: rgba(199,125,255,.24);

  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --nav-w: 236px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- dark theme ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:        #E7E8F3;
    --ink-2:      #C7CADD;
    --muted:      #9195B0;
    --muted-2:    #6D7191;
    --paper:      #0A0B16;
    --surface:    #1B1D30;
    --surface-2:  #242745;
    --line:       #333756;
    --line-2:     #454A72;
    --accent:     #8C7FFF;
    --accent-ink: #C3BAFF;
    --accent-soft:#262247;
    --accent-2:   #22D3EE;
    --ok:         #3FCB9E;
    --ok-soft:    #123328;
    --alert:      #FF7A70;
    --alert-soft: #3A1F1F;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 18px 48px rgba(0,0,0,.5);
    --glass-bg:     rgba(27,29,48,.55);
    --glass-border: rgba(255,255,255,.09);
    --glow-accent:  rgba(140,127,255,.5);
    --glow-accent-2: rgba(34,211,238,.4);
    --blob1: rgba(140,127,255,.4);
    --blob2: rgba(34,211,238,.3);
    --blob3: rgba(199,125,255,.28);
  }
}
:root[data-theme="dark"] {
  --ink:        #E7E8F3;
  --ink-2:      #C7CADD;
  --muted:      #9195B0;
  --muted-2:    #6D7191;
  --paper:      #0A0B16;
  --surface:    #1B1D30;
  --surface-2:  #242745;
  --line:       #333756;
  --line-2:     #454A72;
  --accent:     #8C7FFF;
  --accent-ink: #C3BAFF;
  --accent-soft:#262247;
  --accent-2:   #22D3EE;
  --ok:         #3FCB9E;
  --ok-soft:    #123328;
  --alert:      #FF7A70;
  --alert-soft: #3A1F1F;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 18px 48px rgba(0,0,0,.5);
  --glass-bg:     rgba(27,29,48,.55);
  --glass-border: rgba(255,255,255,.09);
  --glow-accent:  rgba(140,127,255,.5);
  --glow-accent-2: rgba(34,211,238,.4);
  --blob1: rgba(140,127,255,.4);
  --blob2: rgba(34,211,238,.3);
  --blob3: rgba(199,125,255,.28);
}
/* the highlighter is always a light-yellow stroke, so text sitting on it
   must stay dark even when body text elsewhere has flipped to light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hl,
  :root:not([data-theme="light"]) .task.done .body { color: #1A1A2E; }
}
:root[data-theme="dark"] .hl,
:root[data-theme="dark"] .task.done .body { color: #1A1A2E; }

/* .prose hardcodes a light-mode navy — without this it goes nearly
   invisible (near-black on near-black) in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prose { color: var(--ink); }
}
:root[data-theme="dark"] .prose { color: var(--ink); }

* { box-sizing: border-box; }

html { color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0 0 .85em 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- the signature: highlighter stroke ---------- */
.hl {
  position: relative;
  display: inline;
  background-image: linear-gradient(100deg,
      rgba(255,228,92,0) 0%,
      rgba(255,228,92,.85) 3%,
      rgba(255,228,92,.85) 97%,
      rgba(255,228,92,0) 100%);
  background-repeat: no-repeat;
  background-size: 100% 58%;
  background-position: 0 78%;
  padding: 0 .12em;
}
.hl-grow { background-size: 0% 58%; transition: background-size .5s cubic-bezier(.22,1,.36,1); }
.hl-grow.on { background-size: 100% 58%; }

/* ---------- ambient background: a slow-drifting nebula behind the glass UI ---------- */
.bg-fx {
  position: fixed; inset: -10%; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle, var(--blob1), transparent 60%),
    radial-gradient(circle, var(--blob2), transparent 60%),
    radial-gradient(circle, var(--blob3), transparent 60%);
  background-repeat: no-repeat;
  background-size: 55% 55%, 50% 50%, 60% 60%;
  background-position: 10% 15%, 85% 10%, 45% 95%;
  filter: blur(60px);
  animation: bgDrift 45s ease-in-out infinite alternate;
  will-change: background-position;
}
@keyframes bgDrift {
  0%   { background-position: 10% 15%, 85% 10%, 45% 95%; }
  50%  { background-position: 22% 28%, 72% 22%, 60% 82%; }
  100% { background-position: 14% 8%,  80% 30%, 40% 90%; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-fx { animation: none; }
}

/* ============================================================
   Shell
   ============================================================ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; position: relative; z-index: 1; }

/* ---------- sidebar (desktop) ---------- */
.nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--navy);
  color: #C9CDDD;
  padding: 22px 14px calc(18px + var(--safe-b));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { padding: 0 8px 18px; }
.brand .mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--hl);
  display: block;
  margin-bottom: 5px;
}
.brand .name { font-size: 19px; color: #fff; font-weight: 600; letter-spacing: -.02em; }
.brand .sub { color: #838AA5; font-size: 11.5px; margin-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: #C9CDDD;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background .14s, color .14s;
}
.nav-item[hidden] { display: none; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 4px 18px -2px var(--glow-accent); }
.nav-item .ico { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.8; }
.nav-item .badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  background: rgba(255,255,255,.12);
  padding: 1px 6px;
  border-radius: 20px;
}
.nav-item.active .badge { background: rgba(0,0,0,.22); }

.nav-progress { margin: 14px 8px 6px; }
.nav-progress .lbl {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: #838AA5; margin-bottom: 7px;
}
.nav-progress .track { height: 5px; background: rgba(255,255,255,.12); border-radius: 20px; overflow: hidden; }
.nav-progress .fill { height: 100%; background: var(--hl); border-radius: 20px; transition: width .6s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 10px 1px rgba(255,228,92,.6); }
.nav-account { margin-top: auto; position: relative; padding: 0 8px; }
.nav-foot {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer;
  padding: 12px 0 0; font-size: 11px; color: #6E7691; font-family: inherit;
}
.nav-foot:hover { color: #9AA0B4; }
.nav-foot-label { margin-left: 8px; vertical-align: middle; }
.nav-foot-ico { display: none; }
.nav-account-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  background: #20233D; border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .16s, transform .16s;
}
.nav-account-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.nav-account-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: var(--r); background: transparent; color: #C9CDDD;
  font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; font-family: inherit;
}
.nav-account-menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-account-menu-item .ico { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.8; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { padding: 30px 34px 90px; max-width: 1040px; width: 100%; margin: 0 auto; }
.view[hidden] { display: none; }
.view.view-enter { animation: viewEnter .38s cubic-bezier(.22,1,.36,1); }
@keyframes viewEnter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .view.view-enter { animation: none; }
}

.page-head { margin-bottom: 22px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.page-head h1 { font-size: 30px; }
.page-head .lede { color: var(--muted); font-size: 14.5px; margin: 8px 0 0; max-width: 62ch; }

/* ---------- auth gate: an immersive, theme-independent "welcome" scene ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow: hidden;
  background:
    radial-gradient(1200px circle at 20% 15%, rgba(140,127,255,.22), transparent 55%),
    radial-gradient(1000px circle at 85% 85%, rgba(34,211,238,.18), transparent 55%),
    radial-gradient(900px circle at 75% 10%, rgba(199,125,255,.16), transparent 55%),
    linear-gradient(160deg, #0A0B16 0%, #14152A 55%, #0A0B16 100%);
}
.auth-gate[hidden] { display: none; }

.auth-aura {
  position: absolute; top: 50%; left: 50%; width: 640px; height: 640px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(140,127,255,.35), rgba(34,211,238,.12) 45%, transparent 70%);
  filter: blur(50px);
  animation: authAuraPulse 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes authAuraPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .8; }
  50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* floating embers drifting up through the scene */
.auth-particles { position: absolute; inset: 0; pointer-events: none; }
.auth-particles span {
  position: absolute; bottom: -5%; left: 0;
  width: var(--size, 3px); height: var(--size, 3px); border-radius: 50%;
  background: #B9B2FF; box-shadow: 0 0 6px 1px rgba(140,127,255,.8);
  opacity: 0;
  animation: authEmberRise var(--dur, 18s) linear var(--delay, 0s) infinite;
}
.auth-particles span:nth-child(3n)   { background: #7EEAF0; box-shadow: 0 0 6px 1px rgba(34,211,238,.8); }
.auth-particles span:nth-child(5n)   { background: #E3B8FF; box-shadow: 0 0 6px 1px rgba(199,125,255,.8); }
@keyframes authEmberRise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: .9; }
  90%  { opacity: .5; }
  100% { transform: translateY(-105vh) translateX(20px); opacity: 0; }
}

/* rotating gradient ring around the card — the oversized conic-gradient is
   clipped by the wrapper's rounded rect, leaving only a thin glowing edge */
.auth-card-wrap {
  position: relative; z-index: 1;
  max-width: 380px; width: 100%;
  padding: 2px; border-radius: calc(var(--r-lg) + 2px);
  overflow: hidden;
  box-shadow: 0 0 90px -8px rgba(140,127,255,.55), 0 0 40px -4px rgba(34,211,238,.35);
  animation: authFloat 6s ease-in-out infinite;
}
.auth-card-wrap::before {
  content: ""; position: absolute; inset: -60%;
  background: conic-gradient(from 0deg, #8C7FFF, #22D3EE, #C77DFF, #FFE45C, #8C7FFF);
  animation: authRingSpin 5s linear infinite;
}
@keyframes authRingSpin { to { transform: rotate(360deg); } }
@keyframes authFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.auth-card {
  /* the auth scene is always dark regardless of the app's light/dark setting
     (theme choice happens after login) — so every themed variable a child
     rule might reference is pinned locally here, not left to inherit
     whatever the outer, possibly-light, theme currently resolves to */
  --ink: #E7E8F3; --ink-2: #C7CADD; --muted: #9195B0; --muted-2: #6D7191;
  --line: #333756; --line-2: #454A72; --surface: rgba(255,255,255,.05); --surface-2: rgba(255,255,255,.09);
  --accent-soft: rgba(140,127,255,.28); --alert: #FF7A70; --alert-soft: rgba(255,122,112,.15); --ok: #3FCB9E;
  background: rgba(20,21,38,.72); border: none; border-radius: var(--r-lg);
  padding: 32px 28px; width: 100%;
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  position: relative; z-index: 1; overflow: hidden;
  color: var(--ink);
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
}
.auth-card label.field > span {
  color: #9FA3C6; font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
}
.auth-card .field-input { position: relative; }
.auth-card .field-input .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #767BA3; pointer-events: none;
  transition: color .18s;
}
.auth-card .field-input:focus-within .ico { color: #A79BFF; }
.auth-card input[type=email], .auth-card input[type=password] {
  padding: 11px 14px 11px 40px;
  border-radius: 13px; border: 1px solid transparent;
  background:
    linear-gradient(rgba(15,16,30,.65), rgba(15,16,30,.65)) padding-box,
    linear-gradient(135deg, rgba(140,127,255,.45), rgba(34,211,238,.22)) border-box;
  color: #E7E8F3;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.3);
  transition: box-shadow .18s, background .18s;
}
.auth-card input[type=email]::placeholder, .auth-card input[type=password]::placeholder { color: #5F6389; }
.auth-card input[type=email]:focus, .auth-card input[type=password]:focus {
  background:
    linear-gradient(rgba(20,21,38,.78), rgba(20,21,38,.78)) padding-box,
    linear-gradient(135deg, #8C7FFF, #22D3EE) border-box;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.25), 0 0 0 4px rgba(140,127,255,.2), 0 0 22px -4px rgba(140,127,255,.65);
}
.auth-card a { color: #A9E8F5; }
.auth-card .expl { color: #E7E8F3; background: rgba(255,255,255,.06); border-left-color: var(--accent-2); }

.auth-card .btn-primary {
  position: relative; overflow: hidden; background: linear-gradient(100deg, #6C5CE7, #8C7FFF 50%, #22D3EE 150%);
  border: none; box-shadow: 0 6px 26px -6px rgba(140,127,255,.65);
}
.auth-card .btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.45) 48%, transparent 66%);
  background-size: 220% 100%; background-position: 130% 0;
  animation: authShimmer 3.2s ease-in-out infinite;
}
@keyframes authShimmer {
  0%, 55% { background-position: 130% 0; }
  100%    { background-position: -30% 0; }
}

.auth-brand { margin-bottom: 22px; }
.auth-brand .mark {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--hl); display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.auth-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hl); display: inline-block;
  box-shadow: 0 0 8px 1px rgba(255,228,92,.8);
  animation: authDotPulse 1.8s ease-in-out infinite;
}
@keyframes authDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.auth-brand .name {
  font-size: 28px; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(90deg, #fff 0%, #C3BAFF 30%, #7EEAF0 55%, #fff 80%);
  background-size: 250% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: authTextShine 6s linear infinite;
}
@keyframes authTextShine { to { background-position: -250% center; } }

@media (prefers-reduced-motion: reduce) {
  .auth-aura, .auth-particles span, .auth-card-wrap, .auth-card-wrap::before,
  .auth-dot, .auth-brand .name, .auth-card .btn-primary::after { animation: none; }
}

/* ---------- cards ---------- */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  opacity: .6;
}
.card > h2 { font-size: 17px; margin-bottom: 4px; }
.card > .card-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.card-flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- stat tiles ---------- */
.stat {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  transition: box-shadow .2s, transform .2s;
}
.stat:hover, .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), 0 0 40px -18px var(--glow-accent); }
@media (prefers-reduced-motion: reduce) {
  .stat, .card { transition: none; }
  .stat:hover, .card:hover { transform: none; }
}
.stat .k {
  font-family: var(--mono); font-size: 10px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.stat .v { font-family: var(--mono); font-size: 27px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.stat .v small { font-size: 14px; color: var(--muted-2); font-weight: 400; }
.stat .note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* clickable stat tiles (Today) */
.stat-link { cursor: pointer; }
.stat-link .go-arrow { opacity: 0; transform: translateX(-3px); transition: opacity .18s, transform .18s; color: var(--accent-ink); font-size: 12px; }
.stat-link:hover .go-arrow { opacity: 1; transform: translateX(0); }
.stat-link:active { transform: translateY(0) scale(.98); }
.stat.stat-ok .v { color: var(--ok); }
.stat.stat-alert .v { color: var(--alert); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px; font-weight: 500;
  transition: background .14s, border-color .14s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 18px -4px var(--glow-accent); transition: background .14s, border-color .14s, transform .06s, box-shadow .2s; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); box-shadow: 0 6px 26px -4px var(--glow-accent); }
.btn-danger { color: var(--alert); border-color: #E9C4C0; }
.btn-danger:hover { background: var(--alert-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }
.qnav-controls { justify-content: space-between; margin-top: 14px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12px; font-weight: 500; color: var(--ink-2);
  margin-bottom: 5px;
}
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- task checklist ---------- */
.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.box {
  flex: 0 0 19px; width: 19px; height: 19px; margin-top: 2px;
  border: 1.8px solid var(--line-2); border-radius: 5px;
  background: var(--surface);
  display: grid; place-items: center;
  transition: background .16s, border-color .16s;
}
.box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.5); transition: opacity .16s, transform .16s; }
.task.done .box { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 12px -1px var(--ok); }
.task.done .box svg { opacity: 1; transform: scale(1); }
@keyframes taskPop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
.task.just-done .box { animation: taskPop .4s cubic-bezier(.34,1.56,.64,1); }
@media (prefers-reduced-motion: reduce) {
  .task.just-done .box { animation: none; }
}

/* ---------- courses: course card → chapters → lessons, unlocked in order ---------- */
.course { margin-bottom: 26px; }
.course-card {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.course-ico { flex: none; width: 60px; height: 60px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.course-ico svg { width: 30px; height: 30px; }
.course-txt { flex: 1; min-width: 0; }
.course-title { font-size: 18px; font-weight: 600; margin: 0; }
.course-count { font-size: 13px; color: var(--accent-2); font-weight: 600; margin-top: 4px; }
.course-bar { height: 5px; max-width: 220px; background: var(--line); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.course-bar span { display: block; height: 100%; background: var(--accent-2); border-radius: 9px; transition: width .4s ease; }
/* the timeline down the left, with a dot at each chapter */
.course-track { position: relative; margin-left: 46px; padding: 16px 0 0 32px; border-left: 2px solid var(--line); }
.chapter { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 12px; }
.chapter::before { content: ""; position: absolute; left: -38px; top: 25px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px var(--paper); }
.chapter-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 15.5px; font-weight: 600; border-radius: var(--r-lg); }
.chapter-head:hover { background: var(--surface-2); }
.ch-chev { flex: none; width: 18px; height: 18px; color: var(--muted); transition: transform .2s ease; }
.chapter.open .ch-chev { transform: rotate(90deg); }
.ch-title { flex: 1; min-width: 0; }
.ch-no { white-space: nowrap; }
.ch-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); font-family: var(--mono); }
.ch-badge svg { width: 15px; height: 15px; }
.ch-badge.ok { color: var(--ok); }
.ch-badge.attn { color: #fff; background: #F0932B; border-radius: 20px; padding: 2px 8px 2px 5px; }
.ch-badge.locked { color: var(--muted-2); }
.chapter-body { display: none; margin: 0 18px; padding: 8px 0 12px; border-top: 1px solid var(--line); }
.chapter.open .chapter-body { display: block; }
.lesson {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 2px 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); text-align: left; font-size: 14.5px;
}
.lesson:hover { background: var(--surface-2); }
.ls-ico { flex: none; width: 20px; height: 20px; color: var(--muted-2); }
.ls-ico svg { width: 20px; height: 20px; display: block; }
.ls-title { flex: 1; min-width: 0; }
.ls-sub { flex: none; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.lesson.is-done .ls-ico { color: #22A06B; }
.lesson.is-done .ls-title { color: var(--muted); }
.lesson.is-attn .ls-ico { color: #F0932B; }
.lesson.is-current { background: var(--accent-soft); font-weight: 600; }
.lesson.is-next .ls-ico { color: var(--accent); }
.lesson.is-locked { cursor: not-allowed; }
.lesson.is-locked .ls-title, .lesson.is-locked .ls-sub { color: var(--muted-2); }
.lesson.is-locked:hover { background: transparent; }
@media (max-width: 560px) {
  .course-card { padding: 14px 16px; gap: 14px; }
  .course-ico { width: 48px; height: 48px; }
  .course-ico svg { width: 24px; height: 24px; }
  .course-track { margin-left: 22px; padding-left: 18px; }
  .chapter::before { left: -24px; }
  .chapter-head { padding: 14px 14px; font-size: 15px; }
  .chapter-body { margin: 0 12px; }
  .ls-sub { display: none; }
}

/* the bar at the bottom of an open lesson: one step per lesson, and Next */
/* lesson header: Outline button, where the lesson sits, course progress */
.lesson-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.lt-outline { display: inline-flex; align-items: center; gap: 6px; }
.lt-outline svg { width: 16px; height: 16px; }
.lt-crumb { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-pct { flex: none; }

/* slide-out course outline */
.outline-wrap { position: fixed; inset: 0; z-index: 300; }
.outline-backdrop { position: absolute; inset: 0; background: rgba(12,14,32,.45); opacity: 0; transition: opacity .2s; }
.outline-panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(380px, 88vw);
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .22s cubic-bezier(.22,1,.36,1);
}
.outline-wrap.open .outline-backdrop { opacity: 1; }
.outline-wrap.open .outline-panel { transform: translateX(0); }
.outline-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.outline-title { font-size: 18px; margin: 2px 0 4px; }
.outline-count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.outline-body { flex: 1; overflow-y: auto; padding: 8px 10px calc(16px + var(--safe-b)); }
.outline-ch { padding: 8px 0; }
.outline-ch-title { display: flex; gap: 8px; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 8px; }
.outline-ch-n { font-family: var(--mono); font-weight: 500; flex: none; }
.outline-lesson {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-radius: var(--r);
  background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.outline-lesson:hover { background: var(--accent-soft); }
.outline-lesson.is-here { background: var(--accent-soft); font-weight: 600; }
.outline-lesson.is-done .ls-ico { color: #22A06B; }
.outline-lesson.is-attn .ls-ico { color: #F0932B; }
.outline-lesson.is-next .ls-ico { color: var(--accent); }
.outline-lesson.is-locked { cursor: not-allowed; color: var(--muted-2); }
.outline-lesson.is-locked:hover { background: transparent; }
.ol-title { flex: 1; min-width: 0; }
.lb-back[disabled] { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .outline-panel, .outline-backdrop { transition: none; } }

.lesson-bar {
  position: sticky; bottom: 12px; z-index: 40; margin-top: 20px;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.lb-steps { flex: 1; min-width: 0; display: flex; gap: 5px; }
.lb-back { flex: none; }
.ls-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: 1px; background: var(--hl); color: #16182B; }
.lb-step { flex: 1; max-width: 70px; height: 6px; padding: 0; border: 0; border-radius: 6px; background: var(--accent); opacity: .3; }
.lb-step.done { opacity: 1; }
.lb-step.here { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.lb-step.locked { background: var(--line-2); opacity: 1; cursor: not-allowed; }
.lb-msg { flex: 0 1 260px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.lb-msg:empty { display: none; }
.lb-next { flex: none; }
.gc-done-note { margin-top: 14px; font-size: 13.5px; color: var(--ok); font-weight: 600; }
.linkish { border: 0; background: none; padding: 0 0 0 8px; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
body:has(.lesson-bar) .tutor-launcher { bottom: 96px; }
@media (max-width: 768px) {
  /* fixed just above the tab bar, so it never floats mid-screen on a short
     lesson and Ask Momo can always sit above it */
  .lesson-bar { position: fixed; left: 8px; right: 8px; margin: 0; bottom: calc(70px + var(--safe-b)); flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; }
  body:has(.lesson-bar) .view { padding-bottom: calc(240px + var(--safe-b)); }
  .lb-steps { flex-basis: 100%; order: -1; }
  .lb-msg { flex: 1 1 0; }
  .lb-next { margin-left: auto; }
  body:has(.lesson-bar) .tutor-launcher { bottom: calc(196px + var(--safe-b)); }
}

/* ---------- celebrations: fireworks and the pass banner ---------- */
.fireworks { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1000; pointer-events: none; }
.pass-banner {
  position: fixed; left: 50%; top: 20%; z-index: 1001; cursor: pointer;
  transform: translate(-50%, 0) scale(.85); opacity: 0;
  transition: opacity .25s ease, transform .35s cubic-bezier(.22,1.4,.36,1);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px 30px; text-align: center; width: max-content; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 70px -12px rgba(20,16,60,.45);
}
.pass-banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.pass-banner .pb-emoji { font-size: 38px; line-height: 1.1; }
.pass-banner .pb-title { font-size: 26px; font-weight: 800; margin-top: 4px; }
.pass-banner .pb-sub { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .pass-banner { transition: none; } }

/* ---------- celebration confetti (day completed) ---------- */
.confetti-piece {
  position: fixed; top: 30%; left: 50%; width: 8px; height: 8px; border-radius: 2px;
  z-index: 1000; pointer-events: none;
  animation: confettiFly 1.3s ease-out forwards;
}
@keyframes confettiFly {
  0%   { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 320px)) rotate(var(--rot)); opacity: 0; }
}
.task .txt { flex: 1; font-size: 14.5px; min-width: 0; }
.task .txt .tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); font-weight: 500;
  display: block; margin-bottom: 2px;
}
.task.done .txt > .body { color: var(--muted); }
.task .body {
  background-image: linear-gradient(100deg, rgba(255,228,92,0) 0%, rgba(255,228,92,.8) 3%, rgba(255,228,92,.8) 97%, rgba(255,228,92,0) 100%);
  background-repeat: no-repeat;
  background-size: 0% 55%;
  background-position: 0 80%;
  transition: background-size .45s cubic-bezier(.22,1,.36,1);
}
.task.done .body { background-size: 100% 55%; }
.tasklink {
  display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
/* strict mode locks ticking a task off, not reading it — keep the text at
   full contrast and only mute the checkbox */
.task.locked { cursor: default; }
.task.locked:hover { background: transparent; }
.task.locked .box { border-style: dashed; border-color: var(--line-2); opacity: .7; }
.lock-ico { flex: 0 0 auto; font-size: 13px; margin-top: 2px; opacity: .6; }

/* ---------- mission card (Today) ---------- */
.mission-card { margin-bottom: 18px; position: relative; overflow: hidden; }
.mission-card::before {
  content: ""; position: absolute; inset: -40%; z-index: 0; pointer-events: none;
  background: radial-gradient(circle at 15% 20%, var(--glow-accent), transparent 55%),
              radial-gradient(circle at 85% 80%, var(--glow-accent-2), transparent 55%);
  opacity: .55; animation: missionGlowDrift 14s ease-in-out infinite alternate;
}
.mission-head, .mission-bar, .mission-note { position: relative; z-index: 1; }
.mission-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mission-band { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.03em; }
.mission-band-max { font-size: 15px; color: var(--muted-2); font-weight: 400; margin-right: 10px; }
.mission-band-empty { color: var(--muted-2); font-size: 15px; font-weight: 500; letter-spacing: 0; animation: missionPulse 2.4s ease-in-out infinite; }
.mission-band-empty small { display: block; font-family: var(--sans, inherit); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.mission-target { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mission-days { text-align: right; }
.mission-days .v { font-family: var(--mono); font-size: 22px; font-weight: 600; transition: color .3s; }
.mission-days .k { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.mission-bar { margin: 16px 0 4px; }
.mission-bar .track { position: relative; height: 8px; border-radius: 20px; background: var(--line); overflow: visible; box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
.mission-bar .fill {
  height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%; transition: width 1s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 12px -1px var(--glow-accent);
  position: relative; overflow: hidden;
}
.mission-bar .fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 48%, transparent 66%);
  background-size: 200% 100%; animation: missionShimmer 2.6s ease-in-out infinite;
}
.mission-bar.is-empty .track { background: repeating-linear-gradient(135deg, var(--line) 0 8px, var(--surface-2) 8px 16px); }
.mission-bar.is-empty .fill { display: none; }
.mission-bar .goal-mark {
  position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px;
  background: var(--ok); border-radius: 3px; transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 0 3px var(--paper), 0 0 10px 1px var(--ok); z-index: 2;
}
.mission-bar .goal-mark::after {
  content: "target"; position: absolute; top: -20px; left: 50%; transform: translateX(-50%) rotate(-45deg);
  font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap;
}
.mission-note { font-size: 14px; margin-top: 10px; color: var(--ink-2); }
.mission-footer { padding: 10px 20px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
@keyframes missionGlowDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4%, -3%) scale(1.08); }
}
@keyframes missionPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes missionShimmer {
  0%   { background-position: 140% 0; }
  100% { background-position: -60% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mission-card::before { animation: none; }
  .mission-band-empty { animation: none; }
  .mission-bar .fill::after { animation: none; }
  .mission-bar .fill { transition: none; }
}

/* ---------- task row: skill icon, duration estimate, why-note ---------- */
.skill-ico { margin-right: 4px; }
.est-pill { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 8px; font-weight: 400; }
.why-note { font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; padding: 4px 8px; margin-top: 6px; display: inline-block; }

/* ---------- profile avatar (photo or initials) ---------- */
.avatar-img { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.avatar-fallback { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; font-family: var(--mono); vertical-align: middle; flex: 0 0 auto; }

/* ---------- daily study-minutes log (Today's Time blocks card) ---------- */
.time-log-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.time-log-input { width: 56px !important; padding: 4px 6px !important; text-align: center; font-family: var(--mono); font-size: 13px; }
.time-log-unit { font-size: 11.5px; color: var(--muted); }
.time-fb { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.time-fb-pending { color: var(--muted); background: var(--surface-2); }
.time-fb-under { color: var(--alert); background: var(--alert-soft); }
.time-fb-ok { color: var(--ok); background: var(--ok-soft); }
.time-fb-over { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- Complete the Words ---------- */
input.blank {
  display: inline-block; width: auto; min-width: 68px;
  padding: 2px 7px; margin: 0 2px; border-radius: 5px;
  border: 1.5px solid var(--line-2); background: var(--surface);
  font-family: var(--mono); font-size: 15px; text-align: center;
}
input.blank:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.blank.blank-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
input.blank.blank-bad { border-color: var(--alert); background: var(--alert-soft); color: var(--alert); }

/* ---------- Build a Sentence ---------- */
.sentence-strip, .sentence-pool {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  min-height: 44px; padding: 10px 12px; border-radius: var(--r);
  margin-bottom: 12px;
}
.sentence-strip { background: var(--surface-2); border: 1px dashed var(--line-2); }
.sentence-pool { background: var(--surface); border: 1px solid var(--line); }
.chip-word {
  display: inline-block; padding: 6px 12px; border-radius: 20px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1.5px solid var(--line-2); background: var(--surface);
  transition: border-color .14s, background .14s;
}
.chip-word:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip-word.built { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-word.built:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

/* ---------- day accordion ---------- */
.day {
  border: 1px solid var(--glass-border); border-radius: var(--r-lg); background: var(--glass-bg);
  margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}
.day-head {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 14px 16px; border: 0; background: transparent; text-align: left;
}
.day-head:hover { background: var(--surface-2); }
.day-n {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.day.complete .day-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.day.today .day-n { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-t { flex: 1; min-width: 0; }
.day-t .ttl { font-size: 14.5px; font-weight: 600; }
.day-t .meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.day-count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.chev { width: 16px; height: 16px; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.day.open .chev { transform: rotate(180deg); }
.day-body { display: none; border-top: 1px solid var(--line); }
.day.open .day-body { display: block; }
/* ---------- Pro: trial bar and upgrade screen ---------- */
.access-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13.5px; text-align: center;
  background: var(--accent-soft); color: var(--accent-ink); border-bottom: 1px solid var(--line);
}
.access-bar[hidden] { display: none; }
.access-bar.urgent { background: var(--alert-soft); color: var(--alert); }
.access-bar .btn { padding: 5px 12px; font-size: 13px; }
body.no-access .nav-item, body.no-access .nav-account-menu-item:not([data-view="pro"]) { opacity: .45; }
.pro-price { font-size: 34px; font-weight: 700; color: var(--ink); margin: 6px 0 2px; }
.pro-price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.pro-list { margin: 12px 0 18px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; line-height: 1.75; }

.day-note { padding: 12px 16px; font-size: 13px; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--line); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px;
  border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 500;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 10px -3px var(--ok); }
.pill-warn { background: #FFF6D6; color: #8A6A00; }
.pill-alert { background: var(--alert-soft); color: var(--alert); }

/* ---------- prose / study content ---------- */
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.72; color: #23263C; }
.prose h3 { font-family: var(--sans); font-size: 16px; margin: 26px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 7px; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose .callout {
  font-family: var(--sans); font-size: 14px; line-height: 1.6;
  background: var(--surface-2); border-left: 3px solid var(--accent);
  padding: 13px 16px; border-radius: 0 var(--r) var(--r) 0; margin: 16px 0;
}

.tmpl {
  font-family: var(--mono); font-size: 13px; line-height: 1.85;
  background: var(--surface-2); border: 1px dashed var(--line-2);
  border-radius: var(--r); padding: 14px 16px; margin: 10px 0 4px;
  white-space: pre-wrap;
}
.tmpl b { color: var(--accent-ink); font-weight: 600; }

.tmpl-check { display: flex; flex-direction: column; gap: 2px; }
.tchk {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 6px; border-radius: var(--r); cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
}
.tchk:hover { background: var(--surface); }
.tchk input { margin-top: 3px; flex: 0 0 auto; width: auto; }
.tchk.done span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted-2); }
.tchk b { color: var(--accent-ink); }

input.tfill {
  display: inline-block; width: auto; min-width: 60px; max-width: 100%;
  padding: 2px 8px; margin: 1px 2px; border-radius: 5px;
  border: 1.5px dashed var(--line-2); background: var(--surface);
  font-family: var(--mono); font-size: 13px; color: var(--accent-ink);
}
input.tfill:focus { outline: none; border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.tfill:placeholder-shown { border-color: var(--line-2); }
input.tfill:not(:placeholder-shown) { border-style: solid; border-color: var(--ok); }

/* ---------- accordion (generic) ---------- */
.acc { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow); }
.acc-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 17px; border: 0; background: transparent; text-align: left; font-size: 15px; font-weight: 600; }
.acc-head:hover { background: var(--surface-2); }
.acc-head .chev { margin-left: auto; }
.acc.open .chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 4px 20px 20px; border-top: 1px solid var(--line); }
.acc.open .acc-body { display: block; }

/* ---------- exam realism: the in-progress practice header ---------- */
.exam-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #C9CDDD;
  padding: 10px 16px; border-radius: var(--r); margin-bottom: 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: var(--shadow);
}
.exam-bar .exam-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.exam-bar .exam-name { color: var(--hl); font-weight: 600; }
.exam-bar .exam-meta { color: #C9CDDD; font-weight: 500; white-space: nowrap; }
.exam-exit {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  background: transparent; border: 1px solid rgba(255,255,255,.35); color: #C9CDDD;
  padding: 4px 9px; border-radius: 6px; cursor: pointer; flex: none;
}
.exam-exit:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ---------- practice ---------- */
.passage {
  font-family: var(--serif); font-size: 17px; line-height: 1.78;
  max-height: 60vh; overflow-y: auto; padding: 18px 20px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
}
.passage p { margin-bottom: 1em; }
.passage .pno { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-right: 8px; }

.q { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 17px 19px; margin-bottom: 12px; }
.q .qn { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.q .qt { font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 10px 13px; border: 1.5px solid var(--line); border-radius: var(--r);
  margin-bottom: 8px; cursor: pointer; font-size: 14.5px;
  transition: border-color .14s, background .14s;
}
.opt:hover { border-color: var(--muted-2); background: var(--surface-2); }
.opt .ol { font-family: var(--mono); font-weight: 600; color: var(--muted); flex: 0 0 auto; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--alert); background: var(--alert-soft); }
.opt.locked { cursor: default; }
.expl {
  font-size: 13.5px; line-height: 1.65; margin-top: 10px; padding: 12px 14px;
  background: var(--surface-2); border-left: 3px solid var(--ok); border-radius: 0 var(--r) var(--r) 0;
}
.expl b { color: var(--ok); }

/* ---------- timer ---------- */
.timer {
  font-family: var(--mono); font-size: 46px; font-weight: 600;
  letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.timer.prep { color: var(--accent); }
.timer.run  { color: var(--ok); }
.timer.low  { color: var(--alert); }
.timer-wrap { text-align: center; padding: 22px 0 6px; }
.timer-lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.ring { height: 4px; background: var(--line); border-radius: 20px; overflow: hidden; margin: 16px auto 0; max-width: 380px; }
.ring i { display: block; height: 100%; background: var(--ok); border-radius: 20px; transition: width .25s linear; }
.timer.prep ~ .ring i { background: var(--accent); }

.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--alert); display: inline-block; margin-right: 7px; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- flashcard ---------- */
.fc {
  perspective: 1400px; height: 260px; margin-bottom: 16px;
}
.fc-in {
  position: relative; width: 100%; height: 100%;
  transition: transform .55s cubic-bezier(.4,.15,.2,1); transform-style: preserve-3d; cursor: pointer;
}
.fc.flip .fc-in { transform: rotateY(180deg); }
.fc-f, .fc-b {
  position: absolute; inset: 0; backface-visibility: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.fc-b { transform: rotateY(180deg); background: var(--surface-2); justify-content: flex-start; overflow-y: auto; }
.fc-word { font-size: 33px; font-weight: 600; letter-spacing: -.03em; }
.fc-pos { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 9px; }
.fc-hint { font-size: 12.5px; color: var(--muted-2); margin-top: 20px; }
.fc-def { font-family: var(--serif); font-size: 18px; line-height: 1.6; margin-bottom: 14px; }
.fc-ex { font-family: var(--serif); font-size: 15px; font-style: italic; color: var(--muted); line-height: 1.6; }

/* ---------- Grammar Course: lesson storyboard preview ---------- */
.gc-board { background: var(--surface); }
.gc-seg { font-size: 15.5px; line-height: 1.7; padding: 9px 0; border-bottom: 1px solid var(--line); }
/* scoped to a wrapper, not a bare :last-of-type — .gc-video-note is also
   a div and sits right after the segments, so a bare :last-of-type on
   .gc-seg never matched anything (the last div-type sibling is the
   note, which isn't a .gc-seg) and every row kept its border. */
.gc-seg-list .gc-seg:last-child { border-bottom: none; }
.gc-seg-rule { color: var(--ink); font-weight: 500; }
.gc-seg-example { font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.gc-seg-wrong { color: var(--alert); font-weight: 500; }
.gc-seg-right { color: var(--ok); font-weight: 500; }
.gc-video-note { margin-top: 16px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); color: var(--muted); font-size: 13px; }
/* The pre-rendered videos have a permanent light "whiteboard" background
   baked into every frame — on the light theme that blends right into
   the surrounding card, but on the dark theme it read as a jarring raw
   white rectangle. Frame it deliberately in a light mat instead, so it
   reads as "a whiteboard sitting in a dark room" rather than "broken." */
.gc-video-frame { background: #EEF0F7; border-radius: 12px; padding: 10px; }
.gc-video { display: block; width: 100%; border-radius: 8px; background: #000; }

/* ---------- table ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; padding: 10px 13px; background: var(--surface-2);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 220px; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart .tg { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
.chart .goal { stroke: var(--hl-deep); stroke-width: 1.5; stroke-dasharray: 5 4; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 42ch; margin: 0 auto 16px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 30px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 200;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- break / games ---------- */
.memory-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.mm-card {
  position: relative; aspect-ratio: 1; border: 0; border-radius: var(--r);
  background: transparent; padding: 0; cursor: pointer; perspective: 900px;
}
.mm-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r); backface-visibility: hidden; padding: 6px;
  font-size: 12.5px; line-height: 1.25; text-align: center; overflow: hidden;
  transition: transform .45s cubic-bezier(.4,.15,.2,1);
}
.mm-back { background: var(--accent); color: #fff; font-size: 20px; font-weight: 600; transform: rotateY(0deg); }
.mm-front { background: var(--surface); border: 1.5px solid var(--line-2); transform: rotateY(-180deg); }
.mm-front.mm-word { font-family: var(--sans); font-weight: 600; font-size: 14px; }
.mm-front.mm-def { font-family: var(--serif); }
.mm-card.flip .mm-back { transform: rotateY(180deg); }
.mm-card.flip .mm-front { transform: rotateY(0deg); }
.mm-card.matched .mm-front { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

.breath-wrap { position: relative; height: 220px; display: flex; align-items: center; justify-content: center; }
.breath-circle {
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent-soft), var(--accent) 78%);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 20px 50px rgba(75,63,212,.25);
}
.breath-label {
  position: absolute; font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: #fff; mix-blend-mode: difference;
}

/* ---------- admin ---------- */
.task code, .card code {
  font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; font-size: 12.5px;
}

/* ---------- filter chips ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 13px; border: 1px solid var(--line-2); border-radius: 30px;
  background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.chip:hover { border-color: var(--muted-2); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.topbar { display: none; }

/* Exam mode: hide all navigation during a live mock test, like a real proctored interface */
.exam-mode .nav { display: none; }
.exam-mode .topbar { display: none; }

/* ============================================================
   Responsive — iPad
   ============================================================ */
@media (max-width: 1000px) {
  .view { padding: 26px 24px 90px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Responsive — phone: sidebar becomes a bottom tab bar
   ============================================================ */
@media (max-width: 768px) {
  .app { flex-direction: column; }

  .topbar {
    display: flex; align-items: center; gap: 10px;
    background: var(--navy); color: #fff; padding: 12px 16px;
    position: sticky; top: 0; z-index: 60;
  }
  .topbar .mark { font-family: var(--mono); font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--hl); }
  .topbar .nm { font-size: 15px; font-weight: 600; }
  .topbar .tp { margin-left: auto; font-family: var(--mono); font-size: 11px; color: #A9B0C7; }

  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; flex: none; height: auto;
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 7px 8px calc(7px + var(--safe-b));
    gap: 2px; z-index: 100;
    border-top: 1px solid rgba(255,255,255,.1);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .brand, .nav-progress { display: none; }

  .nav-item {
    flex-direction: column; gap: 3px; min-width: 62px; padding: 7px 6px;
    font-size: 10px; font-weight: 500; text-align: center; border-radius: 9px;
  }
  .nav-item .ico { width: 19px; height: 19px; flex: none; }
  .nav-item .badge { display: none; }
  .nav-item .lb { white-space: nowrap; }

  /* the account button moves to the top bar (app.js re-homes it there on
     phones): at the end of the scrolling tab row it sat off-screen, and its
     menu was clipped by the row's overflow, so taps seemed to do nothing on
     iPhone. The menu drops down from the top-right corner instead. */
  .topbar .nav-account { margin: 0 0 0 4px; flex: 0 0 auto; padding: 0; position: static; }
  .topbar .nav-foot {
    display: flex; align-items: center; justify-content: center;
    min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%;
  }
  .topbar .nav-foot-label { display: none; }
  .topbar .nav-foot .avatar-img, .topbar .nav-foot .avatar-fallback { width: 32px !important; height: 32px !important; font-size: 14px !important; }
  .topbar .nav-foot-ico { display: block; width: 22px; height: 22px; color: #C9CDDD; }
  .topbar .nav-account-menu {
    position: fixed; left: auto; right: 10px; bottom: auto; top: calc(58px + env(safe-area-inset-top, 0px));
    min-width: 180px; transform: translateY(-8px);
  }
  .topbar .nav-account-menu.open { transform: translateY(0); }

  /* clear the bottom tab bar — it previously sat under whatever nav item
     scrolled to the far right (Settings/Admin), now more visibly under
     the account button, so lift it above the bar instead. */
  .tutor-launcher { bottom: calc(70px + var(--safe-b)); }

  .view { padding: 20px 16px 108px; }
  .exam-mode .view { padding-bottom: 20px; }
  .page-head h1 { font-size: 24px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* stat rows stay 2-up so the content below stays above the fold */
  .grid-4, .grid-3.stats { grid-template-columns: repeat(2, 1fr); }
  .grid { gap: 12px; }
  .stat { padding: 12px 13px; }
  .stat .k { font-size: 9px; margin-bottom: 5px; }
  .stat .v { font-size: 22px; }
  .stat .note { font-size: 11px; margin-top: 4px; }
  .card { padding: 16px; border-radius: 11px; }
  .prose { font-size: 16px; }
  .passage { font-size: 16px; max-height: 48vh; }
  .timer { font-size: 40px; }
  .fc { height: 290px; }
  .btn { padding: 10px 15px; }        /* bigger touch targets */
  .task { padding: 14px 13px; }
  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 9px 8px; }

  .memory-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mm-face { font-size: 11px; }
  .breath-wrap { height: 180px; }
  .breath-circle { width: 108px; height: 108px; }
  .sentence-strip, .sentence-pool { padding: 8px 10px; }
  .chip-word { padding: 5px 10px; font-size: 13px; }
  input.blank { min-width: 62px; }

  /* iOS Safari auto-zooms the whole page in when a focused text input's
     font-size computes below 16px, and the zoom sticks after the field
     loses focus — this is almost certainly what reads as "zoomed in on
     the phone". Force every text-entry control to 16px on phone widths
     only, so desktop/iPad (outside this media query) render unchanged. */
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=date], input[type=search], input.blank, select, textarea {
    font-size: 16px !important;
  }
  .time-log-input { width: 62px !important; }
}

@media (max-width: 380px) {
  .fc-word { font-size: 27px; }
  .stat .v { font-size: 23px; }
}

/* ---------- AI tutor chat ---------- */
/* while a lesson is open, sit above its bar so Next is never covered (phones: see the 768px rules) */
@media (min-width: 769px) { body:has(.lesson-bar) .tutor-launcher { bottom: 100px; } }
.tutor-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6C5CE7, #22D3EE);
  color: #fff; box-shadow: 0 6px 24px -4px var(--glow-accent), 0 0 0 1px rgba(255,255,255,.15) inset;
  transition: transform .16s;
}
.tutor-launcher:hover { transform: scale(1.07); }
.tutor-launcher[hidden] { display: none; }

.tutor-panel {
  position: fixed; right: 20px; bottom: 86px; z-index: 200;
  width: 340px; max-width: calc(100vw - 40px); height: 460px; max-height: calc(100vh - 130px);
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--r-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow: var(--shadow-lg), 0 0 50px -12px var(--glow-accent);
  display: flex; flex-direction: column; overflow: hidden;
}
.tutor-panel[hidden] { display: none; }
.tutor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--line);
  background: var(--navy); color: #fff;
}
.tutor-head-mark { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; color: var(--accent-2); margin-bottom: 2px; }
.tutor-head-name { font-size: 13.5px; font-weight: 600; }
.tutor-close { background: transparent; border: none; color: #C9CDDD; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.tutor-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.tutor-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.tutor-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.tutor-msg-bot { align-self: flex-start; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.tutor-msg-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.tutor-msg-loading { align-self: flex-start; color: var(--muted); font-size: 12.5px; font-style: italic; }
.tutor-msg-bot p { margin: 0 0 8px; }
.tutor-msg-bot p:last-child { margin-bottom: 0; }
.tutor-msg-bot ul, .tutor-msg-bot ol { margin: 0 0 8px; padding-left: 1.1em; }
.tutor-msg-bot ul:last-child, .tutor-msg-bot ol:last-child { margin-bottom: 0; }
.tutor-msg-bot li { margin: 3px 0; }
.tutor-msg-bot li::marker { color: var(--accent-2); }
.tutor-msg-bot b { color: var(--ink); font-weight: 700; }

.tutor-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.tutor-form input {
  flex: 1; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13.5px;
}
.tutor-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 480px) {
  .tutor-panel { right: 10px; left: 10px; width: auto; bottom: calc(134px + var(--safe-b)); }
  .tutor-launcher { right: 14px; bottom: calc(70px + var(--safe-b)); }
}

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .nav, .topbar, .btn { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; page-break-inside: avoid; }
}

/* ---------- personal schedule (Today › Time blocks) ---------- */
.sched-time { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.sched-edit { font-size: 12.5px; margin-left: 4px; white-space: nowrap; }

/* ---------- Practice: tell drill types apart at a glance ---------- */
.drill-card { border-left: 4px solid var(--line-2); }
.drill-complete  { border-left-color: #8C7FFF; }
.drill-daily     { border-left-color: #22B8CF; }
.drill-academic  { border-left-color: #E0A100; }
.drill-listening { border-left-color: #3FCB9E; }
.drill-btn { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; padding-top: 7px; padding-bottom: 7px; }
.drill-btn-sub { font-size: 11.5px; font-weight: 500; opacity: .85; margin-top: 2px; }

/* ---------- auth: "or" divider above the guest option ---------- */
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- 0–120 equivalents and auto-logged errors ---------- */
.score120 { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.err-auto { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }

/* ---------- Speaking: word check, criteria, shadowing ---------- */
.wd-line { font-size: 18px; line-height: 2.1; }
.wd { display: inline-block; padding: 0 4px; border-radius: 6px; }
.wd-ok { background: var(--ok-soft, rgba(15,122,98,.10)); color: var(--ok); }
.wd-miss { background: var(--alert-soft); color: var(--alert); text-decoration: line-through; }
.wd-swap { background: rgba(224,161,0,.16); color: #9A6B00; }
.wd-swap small { display: block; font-size: 11px; line-height: 1.2; margin-bottom: 3px; }
.wd-extra { background: var(--surface-2); color: var(--muted); font-style: italic; }
.wd-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.wd-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; border-left: 2px solid var(--line-2); padding-left: 8px; }
.crit-row { display: flex; flex-wrap: wrap; gap: 8px; }
.crit { display: inline-flex; flex-direction: column; align-items: center; min-width: 92px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-size: 18px; font-weight: 600; }
.crit .k { font-family: inherit; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.crit-band { background: var(--accent); color: #fff; }
.crit-band .k { color: rgba(255,255,255,.8); }
.crit-strength { font-size: 14px; color: var(--ok); margin: 10px 0 4px; }
.crit-fix { font-size: 14.5px; margin: 4px 0; }
.crit-transcript { font-size: 13px; color: var(--muted); font-style: italic; margin: 8px 0 0; }
.sh-line { font-family: var(--serif); font-size: 26px; line-height: 1.7; text-align: center; margin: 6px 0 8px; }
.sh-stress { font-weight: 700; color: var(--ink); }
.sh-weak { color: var(--muted); }
.sh-link { color: var(--accent); font-weight: 700; margin: 0 -2px; }

/* ---------- Writing: draft history and repeated mistakes ---------- */
.draft-hist { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 12px; font-family: var(--mono); font-size: 13px; }
.draft-step { background: var(--surface-2); border-radius: 8px; padding: 4px 8px; }
.draft-arrow { color: var(--muted); }
.rm-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rm-row:last-child { border-bottom: none; }
.rm-ex { font-size: 14px; margin-top: 5px; }
.rm-tip { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Words: in-context quiz ---------- */
.ctx-sentence { font-family: var(--serif); font-size: 18px; line-height: 1.7; margin: 0; }
.ctx-blank { display: inline-block; min-width: 80px; border-bottom: 2px solid var(--accent); color: var(--accent); font-weight: 600; text-align: center; }

/* ---------- mock test: test-day screen ---------- */
.test-bar { position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.test-bar .exam-left { flex-wrap: wrap; }
.test-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.test-clock { font-family: var(--mono); font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .04em; min-width: 62px; text-align: right; text-transform: none; }
.test-clock-hidden { font-size: 11px; color: #9AA0BC; }
.test-clock-low { color: #FFB4AC; }
.test-btn { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: transparent; border: 1px solid rgba(255,255,255,.35); color: #E4E6F0; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.test-btn:hover { background: rgba(255,255,255,.08); }
.test-next { background: var(--hl); color: var(--navy); border-color: var(--hl); font-weight: 700; }
.test-next:hover { background: var(--hl); filter: brightness(1.05); }
@media (min-width: 1000px) {
  .mock-split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }
  .mock-pane { max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 6px; }
  .mock-split .passage { max-height: none; }
  .mock-qs { border-left: 1px solid var(--line); padding-left: 20px; }
}

/* ---------- Today: your week ---------- */
.week-dots { display: flex; gap: 8px; margin: 12px 0 10px; }
.week-dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.week-dot.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.week-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }

/* ============================================================
   Public landing page (#landing): shown to visitors who aren't
   logged in. Built from the app's own tokens, so it follows the
   light/dark theme and looks like the course it advertises.
   ============================================================ */
.lp[hidden] { display: none; }
body.on-landing .app { display: none; }
.lp { position: relative; z-index: 1; min-height: 100vh; }
.lp-wrap { max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.lp .ico { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }

/* header */
.lp-head { position: sticky; top: 0; z-index: 50; padding: 14px 16px 0; }
.lp-bar {
  max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 9px 10px 9px 14px; border-radius: 16px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
}
.lp-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.lp-brand:hover { text-decoration: none; }
.lp-logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--navy); color: #fff; flex: none;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px;
  box-shadow: inset 0 -7px 0 -1px var(--hl);
}
.lp-brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.lp-brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.lp-brand-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.lp-nav { display: flex; gap: 2px; margin: 0 auto; }
.lp-nav button, .lp-foot-col button {
  border: 0; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500;
  padding: 9px 13px; border-radius: 999px; min-height: 40px;
}
.lp-nav button:hover { background: var(--surface); color: var(--ink); }
.lp-actions { display: flex; gap: 8px; flex: none; margin-left: auto; }
.lp-nav + .lp-actions { margin-left: 0; }

/* hero */
.lp-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 44px; align-items: center; padding-top: 64px; padding-bottom: 40px; }
.lp-h1 { font-size: clamp(38px, 6vw, 64px); font-weight: 700; letter-spacing: -.035em; line-height: 1.04; margin: 6px 0 18px; }
.lp-lede { font-size: 18px; color: var(--ink-2); max-width: 46ch; margin-bottom: 26px; }
.lp-cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.lp-cta-row .btn { min-height: 48px; }
.lp-micro { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* try-a-question card */
.lp-try { padding: 18px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.lp-try-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lp-try-note { font-size: 12px; color: var(--muted); }
.lp-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.lp-tabs button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.lp-tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.lp-pane { min-height: 330px; }
.lp-pane[hidden] { display: none; }
.lp-task { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.lp-doc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-family: var(--serif); font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
.lp-doc p { margin: 0; }
.lp-doc-title { font-family: var(--sans); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.lp-q { font-weight: 600; font-size: 15px; margin-bottom: 9px; }
.lp-opts { display: grid; gap: 7px; }
.lp-opt {
  text-align: left; min-height: 44px; padding: 10px 13px; border-radius: 10px; font-size: 14.5px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: border-color .12s, background .12s;
}
.lp-opt:hover { border-color: var(--accent); }
.lp-opt.is-right { border-color: var(--ok); background: var(--ok-soft); }
.lp-opt.is-right::after { content: " ✓"; color: var(--ok); font-weight: 700; }
.lp-opt.is-wrong { border-color: var(--alert); background: var(--alert-soft); }
.lp-why { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); padding: 9px 12px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.lp-why[hidden] { display: none; }
.lp-why.ok { border-left-color: var(--ok); }
.lp-why.bad { border-left-color: var(--alert); }
.lp-why[data-verdict]::before { content: attr(data-verdict) " "; font-weight: 700; color: var(--ink); }
.lp-listen { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.lp-play {
  width: 52px; height: 52px; border-radius: 50%; border: 0; flex: none; color: #fff;
  background: linear-gradient(135deg, #6C5CE7, #22D3EE); box-shadow: 0 6px 18px -4px var(--glow-accent);
  display: grid; place-items: center;
}
.lp-play svg { width: 22px; height: 22px; margin-left: 3px; }
.lp-play.playing { animation: lpPulse 1s ease-in-out infinite; }
@keyframes lpPulse { 50% { transform: scale(1.07); } }
.lp-listen-t { font-weight: 600; font-size: 14.5px; }
.lp-transcript-btn { font-size: 13px; }
.lp-transcript { margin-top: 6px; font-family: var(--serif); font-style: italic; font-size: 14.5px; }
.lp-transcript[hidden] { display: none; }
.lp-build { min-height: 56px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 9px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.lp-build-empty { color: var(--muted-2); font-size: 13.5px; padding: 0 4px; }
.lp-tiles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lp-tile {
  min-height: 40px; padding: 7px 14px; border-radius: 9px; font-size: 15px; font-weight: 500;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
}
.lp-tile:hover:not(:disabled) { border-color: var(--accent); }
.lp-tile:disabled { opacity: .3; cursor: default; }
.lp-tile.in { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.lp-build-row, .lp-speak-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.lp-say { font-family: var(--serif); font-size: 20px; line-height: 1.45; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.lp-speak-row .btn { min-height: 40px; }
.lp-timer { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-left: auto; }
.lp-bar-track { height: 6px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 12px 0; }
.lp-bar-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .9s linear; }
.lp-small { font-size: 13px; color: var(--muted); margin: 0; }

/* sections */
.lp-section { padding-top: 72px; scroll-margin-top: 84px; }
.lp-sec-head { margin-bottom: 26px; }
.lp-h2 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 700; letter-spacing: -.03em; }
.lp-sec-sub { color: var(--muted); font-size: 16px; margin: 8px 0 0; }
.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: none; }
.lp-steps li { display: flex; flex-direction: column; gap: 4px; position: relative; }
/* joins the circles only: the text sits below them, so the line never crosses it */
.lp-steps li:not(:last-child)::after { content: ""; position: absolute; top: 20px; left: 52px; right: 4px; height: 1.5px; background: linear-gradient(90deg, var(--line-2), transparent); }
.lp-step-no {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--navy); color: var(--hl); font-family: var(--mono); font-weight: 600; font-size: 15px;
}
.lp-steps h3 { font-size: 17px; margin: 10px 0 6px; }
.lp-steps p { color: var(--muted); font-size: 14.5px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lp-feat { padding: 20px; margin: 0; }
.lp-feat h3 { font-size: 16.5px; margin: 12px 0 6px; }
.lp-feat p { color: var(--muted); font-size: 14.5px; margin: 0; }
.lp-feat-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lp-feat-ico .ico { width: 20px; height: 20px; }
.lp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; padding: 18px; border-radius: 16px; background: var(--navy); color: #fff; }
.lp-stats div { text-align: center; }
.lp-stats b { display: block; font-size: 30px; font-weight: 700; color: var(--hl); font-family: var(--mono); line-height: 1.2; }
.lp-stats span { font-size: 13px; color: #A9B0C7; }

/* pricing */
.lp-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 18px; justify-content: center; }
.lp-price { position: relative; padding: 26px; margin: 0; display: flex; flex-direction: column; overflow: visible; }
.lp-price-pro { border: 1.5px solid var(--accent); box-shadow: 0 18px 50px -18px var(--glow-accent); }
.lp-badge { position: absolute; top: -12px; right: 20px; background: var(--hl); color: #1A1A2E; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.lp-amount { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.lp-amount b { font-size: 46px; font-weight: 700; letter-spacing: -.03em; }
.lp-amount span { color: var(--muted); font-size: 15px; }
.lp-price-note { color: var(--muted); font-size: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.lp-check { list-style: none; padding: 0; margin: 4px 0 22px; display: grid; gap: 9px; flex: 1; }
.lp-check li { position: relative; padding-left: 26px; font-size: 14.5px; }
.lp-check li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
.lp-price-btn { width: 100%; min-height: 48px; }

/* FAQ */
.lp-narrow { max-width: 820px; }
.lp-faq { display: grid; gap: 8px; }
.lp-qa { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.lp-qa > button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
  padding: 13px 16px; border: 0; background: transparent; color: var(--ink); font-size: 15.5px; font-weight: 600; text-align: left;
}
.lp-qa > button .ico { transition: transform .18s; color: var(--muted); }
.lp-qa.open > button .ico { transform: rotate(180deg); }
.lp-a { display: none; padding: 0 16px 14px; color: var(--ink-2); font-size: 14.5px; }
.lp-a p { margin: 0; }
.lp-qa.open .lp-a { display: block; }

/* closing band and footer */
.lp-final { margin-top: 72px; padding: 44px 24px; border-radius: 24px; text-align: center; background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg); }
.lp-final p { color: var(--muted); font-size: 16px; margin: 10px 0 20px; }
.lp-foot { margin-top: 72px; padding: 40px 0 calc(28px + var(--safe-b)); background: var(--navy); color: #C9CDDD; }
.lp-foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.lp-brand-foot { color: #fff; }
.lp-brand-foot .lp-logo { background: rgba(255,255,255,.08); }
.lp-foot-line { color: #A9B0C7; font-size: 14px; margin: 12px 0 0; max-width: 42ch; }
.lp-foot-h { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #838AA5; margin-bottom: 6px; }
.lp-foot-col { display: flex; flex-direction: column; align-items: flex-start; }
.lp-foot-col button { color: #C9CDDD; padding: 6px 0; min-height: 36px; border-radius: 4px; }
.lp-foot-col button:hover { color: #fff; }
.lp-legal { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; color: #838AA5; }
.lp-legal p { margin: 0 0 6px; }

/* tablet and phone */
@media (max-width: 960px) {
  .lp-hero { grid-template-columns: 1fr; padding-top: 36px; gap: 30px; }
  .lp-grid { grid-template-columns: repeat(2, 1fr); }
  .lp-nav { display: none; }
}
@media (max-width: 640px) {
  .lp-wrap { padding-left: 16px; padding-right: 16px; }
  .lp-head { padding: 10px 10px 0; }
  .lp-bar { gap: 8px; padding: 7px 7px 7px 10px; }
  .lp-brand-sub { display: none; }
  .lp-actions .btn { padding: 9px 12px; font-size: 13.5px; }
  .lp-lede { font-size: 16px; }
  .lp-cta-row .btn { width: 100%; }
  .lp-try { padding: 14px; }
  .lp-tabs button { flex-direction: column; gap: 2px; font-size: 11.5px; min-height: 48px; }
  .lp-steps { grid-template-columns: 1fr; }
  .lp-steps li::after { display: none; }
  .lp-grid { grid-template-columns: 1fr; }
  .lp-stats { grid-template-columns: repeat(2, 1fr); }
  .lp-prices { grid-template-columns: 1fr; }
  .lp-foot-grid { grid-template-columns: 1fr 1fr; }
  .lp-foot-grid > div:first-child { grid-column: 1 / -1; }
  .lp-section { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-play.playing { animation: none; }
  .lp-bar-track i, .lp-qa > button .ico { transition: none; }
}

/* the login card's way back to the landing page */
.auth-back { background: transparent; border: 0; color: #A9B0C7; font-size: 13px; padding: 6px 0; margin: -6px 0 10px; min-height: 36px; }
.auth-back:hover { color: #fff; }
