/* Learn Lingala — app design system.
   Mobile-first; ≥900px gets a sidebar, ≥1180px adds a right rail on Learn/Review. */

/* --- Fonts: Onest (text) + Unbounded (display), self-hosted variable fonts -------- */

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/app/fonts/onest-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  /* Includes ɛ ɔ Ɛ Ɔ and the combining tone mark (U+0301) used in Lingala. */
  src: url(/app/fonts/onest-latin-ext.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0301, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(/app/fonts/unbounded-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  /* Includes ɛ ɔ Ɛ Ɔ and the combining tone mark (U+0301) used in Lingala. */
  src: url(/app/fonts/unbounded-latin-ext.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0301, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens ---------------------------------------------------------------------- */

:root {
  --font-display: 'Unbounded', 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #f3f5f2;
  --bg-elev: #ffffff;
  --surface-2: #ecf0eb;
  --surface-3: #dfe5de;
  --ink: #0b1510;
  --ink-2: #2f3c35;
  --muted: #64716a;
  --line: #e0e6df;
  --line-strong: #ccd5cc;
  --brand: #0a8458;
  --brand-600: #076c47;
  --brand-700: #05583a;
  --brand-900: #032a1c;
  --brand-50: #e3f4ec;
  --brand-100: #c5ead8;
  --on-brand: #ffffff;
  --lime: #c6f24e;
  --on-lime: #0c1a05;
  --gold: #f6b72d;
  --gold-50: #fef3d8;
  --coral: #e5483a;
  --coral-50: #fde8e5;
  --sky: #2d6fd6;
  --sky-50: #e7eefb;
  --violet: #7356d8;
  --violet-50: #efebfc;
  --amber: #b9780a;
  --shadow-sm: 0 1px 2px rgba(11, 21, 16, 0.06), 0 1px 1px rgba(11, 21, 16, 0.03);
  --shadow-md: 0 10px 28px -14px rgba(11, 21, 16, 0.25), 0 2px 6px rgba(11, 21, 16, 0.05);
  --shadow-lg: 0 28px 56px -24px rgba(5, 88, 58, 0.5);
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --sidebar: 252px;
  --rail: 336px;
  --tabbar-h: 68px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060c09;
    --bg-elev: #0e1712;
    --surface-2: #142019;
    --surface-3: #1c2a22;
    --ink: #eef5f0;
    --ink-2: #c8d5cd;
    --muted: #87978e;
    --line: #1a2720;
    --line-strong: #283a30;
    --brand: #3ddc97;
    --brand-600: #31c283;
    --brand-700: #1f9a66;
    --brand-900: #03190f;
    --brand-50: #0b2418;
    --brand-100: #113425;
    --on-brand: #03140c;
    --lime: #c6f24e;
    --on-lime: #0c1a05;
    --gold: #f8c24a;
    --gold-50: #2a2210;
    --coral: #f2675a;
    --coral-50: #2f1714;
    --sky: #6f9ff0;
    --sky-50: #142139;
    --violet: #a993f5;
    --violet-50: #1f1935;
    --amber: #f8c24a;
    --shadow-sm: none;
    --shadow-md: 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 60px -28px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

/* --- Base ------------------------------------------------------------------------ */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.icon { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.22em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.loading { padding: 4rem 1rem; text-align: center; color: var(--muted); }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

h1, .display {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.12;
}
/* Display face for headlines, numbers and the wordmark; everything else stays in Onest. */
.brand, .hero-title, .stat b, .sg b, .ring-inner b, .ex-title { font-family: var(--font-display); letter-spacing: -0.03em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand);
}
.lede { color: var(--muted); font-size: 1.04rem; margin-top: 0.45rem; max-width: 60ch; }
.section-title { font-size: 1.05rem; font-weight: 720; letter-spacing: -0.01em; margin: 2.1rem 0 0.85rem; display: flex; align-items: center; gap: 0.45rem; }
.footnote { margin-top: 2.25rem; font-size: 0.85rem; color: var(--muted); line-height: 1.6; }
.back { display: inline-flex; align-items: center; gap: 0.3rem; margin-bottom: 1rem; font-weight: 650; font-size: 0.92rem; color: var(--muted); }
.back:hover { color: var(--ink); }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin-top: 0.35rem; }

/* --- Layout ------------------------------------------------------------------------ */

.layout { min-height: 100dvh; }
.sidebar, .rail { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(0.65rem + env(safe-area-inset-top)) 1rem 0.65rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); font-weight: 500; font-size: 0.98rem; }
.brand b { font-weight: 700; color: var(--brand); margin-left: 0.2em; }
.brand-mark { width: 30px; height: 30px; }
.topbar-stats, .side-stats { display: flex; gap: 0.4rem; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.32rem 0.7rem; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--line);
  font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.stat-pill .icon { width: 1.05em; height: 1.05em; color: var(--muted); }
.stat-pill.fire { background: var(--gold-50); border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--ink); }
.stat-pill.fire .icon { color: #e8890c; }

.screen { padding: 1.5rem 1.1rem calc(var(--tabbar-h) + 2.5rem + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0.35rem 0.4rem env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  color: var(--muted); font-size: 0.7rem; font-weight: 650; border-radius: 14px;
  transition: color 0.2s var(--ease);
}
.tab .icon { width: 24px; height: 24px; transition: transform 0.2s var(--ease); }
.tab.active { color: var(--brand); }
.tab.active .icon { transform: translateY(-1px); }
.tab.active::before {
  content: ''; position: absolute; top: 4px; width: 44px; height: 30px; border-radius: 12px;
  background: var(--brand-50); z-index: -1;
}
.dot {
  position: absolute; top: 2px; left: calc(50% + 7px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--coral); color: #fff; font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center;
  font-style: normal; box-shadow: 0 0 0 2px var(--bg-elev);
}

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 1.5rem;
    position: sticky; top: 0; height: 100dvh; padding: 1.6rem 1rem 1.25rem;
    border-right: 1px solid var(--line); background: var(--bg-elev);
  }
  .sidebar .brand { padding: 0 0.6rem; font-size: 1.12rem; }
  .side-nav { display: flex; flex-direction: column; gap: 0.2rem; }
  .side-link {
    position: relative; display: flex; align-items: center; gap: 0.8rem;
    padding: 0.72rem 0.85rem; border-radius: 12px;
    color: var(--ink-2); font-weight: 620; font-size: 0.97rem;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
  }
  .side-link .icon { width: 22px; height: 22px; color: var(--muted); }
  .side-link:hover { background: var(--surface-2); }
  .side-link.active { background: var(--brand-50); color: var(--brand-700); }
  .side-link.active .icon { color: var(--brand); }
  .side-link .dot { position: static; margin-left: auto; box-shadow: none; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.8rem; padding: 0 0.4rem; }
  .side-user { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-2); font-weight: 600; font-size: 0.9rem; overflow: hidden; }
  .side-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .screen { padding: 2.75rem 2.5rem 4rem; width: 100%; }
}

@media (min-width: 1180px) {
  .layout.has-rail { grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--rail); }
  .has-rail .rail {
    display: flex; flex-direction: column; gap: 1rem;
    position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 2.75rem 1.75rem 2rem 0.25rem;
  }
  .has-rail .mobile-only { display: none; }
}

/* --- Buttons ------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 52px; padding: 0.8rem 1.4rem;
  border: none; border-radius: 14px;
  font-weight: 720; font-size: 1rem; letter-spacing: -0.005em;
  transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease), filter 0.15s;
  user-select: none;
}
.btn .icon { width: 20px; height: 20px; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; margin-top: 1rem; }
.btn-primary {
  background: var(--brand); color: var(--on-brand);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 6px 16px -6px color-mix(in srgb, var(--brand) 65%, transparent);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-secondary { background: var(--bg-elev); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--coral); color: #fff; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; border: none; background: transparent; color: var(--muted);
  transition: background 0.15s var(--ease), color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .icon { width: 22px; height: 22px; }

/* --- Cards, panels, badges ------------------------------------------------------------ */

.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.25rem; box-shadow: var(--shadow-sm);
}
.card + .card, .card + .btn-block { margin-top: 1rem; }
.card-title { font-size: 1rem; font-weight: 720; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; }
.card-title .icon { color: var(--brand); }
.panel {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm);
}
.panel-kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.panel-title { font-weight: 720; font-size: 1.02rem; letter-spacing: -0.01em; }
.panel-link { font-size: 0.86rem; font-weight: 650; }
.panel-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.panel-row .panel-link { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.7rem; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.18rem 0.5rem; border-radius: 6px; background: var(--gold); color: #2a2104; white-space: nowrap;
}
.badge .icon { width: 0.95em; height: 0.95em; }
.badge-next { background: var(--gold); }
.badge-local { background: var(--brand-50); color: var(--brand-700); }
.badge-done { background: var(--brand-100); color: var(--brand-700); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-stretch { background: var(--gold-50); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  .badge-local, .badge-done { color: var(--brand); }
}

.meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width 0.6s var(--ease); }
.meter-lg { height: 10px; margin-top: 1rem; border-radius: 5px; }

/* Progress ring */
.ring { position: relative; flex: none; }
.ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-3); }
.ring-fill { fill: none; stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); }
.ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-inner b { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-inner small { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

/* --- Rail panels ---------------------------------------------------------------------- */

.goal-panel { display: flex; align-items: center; gap: 1.1rem; }
.goal-panel .panel-title { margin: 0.15rem 0 0.25rem; }
.streak-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.streak-flame {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
}
.streak-flame .icon { width: 24px; height: 24px; }
.streak-flame.lit { background: linear-gradient(160deg, #ffcf5a, #f08a1c); color: #fff; box-shadow: 0 8px 18px -8px #f08a1c; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.35rem; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.wday i {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
}
.wday i .icon { width: 15px; height: 15px; }
.wday.on i { background: var(--gold-50); color: #e8890c; }
.wday.met i { background: var(--brand); color: var(--on-brand); }
.wday.today i { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 4px var(--line-strong); }
.wday small { font-size: 0.7rem; color: var(--muted); font-weight: 650; text-transform: uppercase; }

.path { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem; margin: 0.9rem 0 0.2rem; }
.path-step a { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; color: var(--muted); min-width: 0; }
.path-dot {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem; background: var(--surface-2); border: 2px solid var(--line-strong);
}
.path-dot .icon { width: 16px; height: 16px; }
.path-step.now .path-dot { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.path-step.done .path-dot { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.path-name { font-size: 0.68rem; font-weight: 700; text-align: center; line-height: 1.15; hyphens: manual; max-width: 100%; }
.path-step.now .path-name { color: var(--ink); }
.path-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.path-bar span { display: block; height: 100%; background: var(--brand); }
.path-eta { margin-top: 0.9rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.path-eta strong { color: var(--ink); }

/* --- Home ---------------------------------------------------------------------------- */

.hello { margin-bottom: 1.35rem; }
.hello h1 { margin-top: 0.35rem; }

.today-strip {
  display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem;
  padding: 0.75rem 1rem; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line);
}
.today-strip div { display: flex; flex-direction: column; line-height: 1.3; }
.today-strip span { font-size: 0.85rem; color: var(--muted); }
.today-strip .ring-inner small { color: var(--ink); font-weight: 800; font-size: 0.8rem; }

.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.4rem 1.35rem; border-radius: var(--r-xl);
  color: #fff;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(198, 242, 78, 0.22) 0%, transparent 55%),
    radial-gradient(80% 120% at 0% 100%, rgba(61, 220, 151, 0.25) 0%, transparent 60%),
    linear-gradient(150deg, #0a5c3f 0%, #053b28 60%, #032a1c 100%);
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; z-index: -1;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}
.hero::before { width: 260px; height: 260px; right: -70px; top: -120px; }
.hero::after { width: 170px; height: 170px; right: -20px; top: -70px; border-color: rgba(198, 242, 78, 0.35); }
.hero:hover { transform: translateY(-2px); }
.hero:active { transform: translateY(0) scale(0.995); }
.hero-art {
  flex: none; width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); color: var(--lime);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.hero-art .icon { width: 30px; height: 30px; }
.hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.hero-kicker { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lime); }
.hero-title { font-size: 1.3rem; font-weight: 650; line-height: 1.15; }
.hero-meter { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; margin-top: 0.35rem; }
.hero-meter span { display: block; height: 100%; background: var(--lime); border-radius: 3px; }
.hero-sub { font-size: 0.86rem; opacity: 0.8; }
.hero-cta {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--lime); color: var(--on-lime); box-shadow: 0 8px 22px -8px rgba(198, 242, 78, 0.6);
}
.hero-cta .icon { width: 22px; height: 22px; fill: currentColor; margin-left: 3px; }

.callout {
  display: flex; align-items: center; gap: 0.9rem; margin-top: 0.9rem;
  padding: 0.95rem 1.1rem; border-radius: var(--r); color: var(--ink);
  border: 1px solid var(--line); background: var(--bg-elev);
  transition: border-color 0.15s, transform 0.15s var(--ease);
}
.callout:hover { border-color: var(--line-strong); }
.callout > .icon:first-child { width: 40px; height: 40px; padding: 9px; border-radius: 12px; }
.callout > .icon:last-child { color: var(--muted); }
.callout span { flex: 1; display: flex; flex-direction: column; }
.callout small { color: var(--muted); font-size: 0.86rem; }
.callout-review > .icon:first-child { background: var(--sky-50); color: var(--sky); }
.callout-save > .icon:first-child { background: var(--gold-50); color: #c98a0b; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.9rem; }
.quick {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem 1.05rem; border-radius: var(--r);
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--ink);
  transition: transform 0.15s var(--ease), border-color 0.15s;
}
.quick:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.quick > .icon { width: 38px; height: 38px; padding: 8px; border-radius: 12px; margin-bottom: 0.45rem; }
.quick small { color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.quick-chat > .icon { background: var(--brand-50); color: var(--brand); }
.quick-tr > .icon { background: var(--sky-50); color: var(--sky); }
.mobile-only .path-panel { margin-top: 0.9rem; }

.levels { display: flex; flex-direction: column; gap: 0.75rem; }
.level { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.level summary { display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.1rem; cursor: pointer; list-style: none; }
.level summary::-webkit-details-marker { display: none; }
.level summary:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.level-num {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-weight: 800; color: var(--ink-2);
}
.level[open] .level-num { background: var(--gold); color: #2a2104; }
.level-num.done, .level[open] .level-num.done { background: var(--brand); color: var(--on-brand); }
.level-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.level-title { font-weight: 760; font-size: 1.05rem; letter-spacing: -0.015em; }
.level-sub { font-size: 0.84rem; color: var(--muted); }
.level-count { font-size: 0.85rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chev { color: var(--muted); transition: transform 0.2s var(--ease); }
.level[open] .chev { transform: rotate(90deg); }
.level .units { padding: 0 0.75rem 0.2rem; }
.level-more { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.6rem 1.1rem 1rem; font-weight: 650; font-size: 0.9rem; }

.units { display: flex; flex-direction: column; gap: 0.5rem; }
.unit-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0.85rem;
  border-radius: var(--r); color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.unit-row:hover { border-color: var(--line-strong); transform: translateX(2px); }
.unit-row.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.uicon {
  flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--lv-bg); color: var(--lv-fg);
}
.uicon .icon { width: 55%; height: 55%; }
.uicon.in-ring { width: 34px; height: 34px; border-radius: 50%; }
.uicon.sm { width: 26px; height: 26px; border-radius: 8px; vertical-align: -0.45em; margin-right: 0.3rem; }
.uicon.lg { width: 72px; height: 72px; border-radius: 22px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lv-fg) 18%, transparent); }
.uicon.lg .icon { width: 46%; height: 46%; }
/* One hue per level, so the course map stays colourful without emoji. */
.lv-1 { --lv-bg: var(--brand-50); --lv-fg: var(--brand); }
.lv-2 { --lv-bg: var(--sky-50); --lv-fg: var(--sky); }
.lv-3 { --lv-bg: var(--coral-50); --lv-fg: var(--coral); }
.lv-4 { --lv-bg: var(--violet-50); --lv-fg: var(--violet); }
.lv-5 { --lv-bg: var(--gold-50); --lv-fg: var(--amber); }
.unit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.unit-title { font-weight: 700; display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.unit-sub { font-size: 0.85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.25rem; }
.unit-sub .icon { width: 0.95em; height: 0.95em; }
.unit-count { font-weight: 700; color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.unit-row.done .unit-count { color: var(--brand); }

.stats-row, .summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; margin-top: 1.25rem; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem 0.6rem; text-align: center; }
.stat b { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.76rem; color: var(--muted); font-weight: 600; }

/* --- Level & unit pages ----------------------------------------------------------------- */

.level-head { margin-bottom: 1.25rem; }
.can-do { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.can-do li { display: flex; gap: 0.65rem; align-items: flex-start; }
.can-do .icon { color: var(--muted); margin-top: 0.1rem; }
.can-do li.done .icon { color: var(--brand); }
.checkpoint-card { display: flex; gap: 1rem; align-items: flex-start; margin-top: 1rem; background: linear-gradient(160deg, var(--gold-50), var(--bg-elev)); }
.checkpoint-card .card-title { margin-bottom: 0.3rem; }
.checkpoint-card .btn { margin-top: 0.9rem; min-height: 46px; }
.checkpoint-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--gold); color: #2a2104; }

.unit-head { display: flex; align-items: center; gap: 1rem; }
.notes { line-height: 1.65; }
.notes p { margin-bottom: 0.75rem; }
.notes p:last-child { margin-bottom: 0; }
.notes strong { color: var(--brand-700); }
@media (prefers-color-scheme: dark) { .notes strong { color: var(--brand); } }
.notes .tip { background: var(--gold-50); border-radius: 12px; padding: 0.75rem 0.95rem; font-size: 0.93rem; }

.word-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.word { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 0.95rem; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line); }
.word-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.word-lg { font-weight: 720; }
.word-en { color: var(--muted); font-size: 0.9rem; }
.strength { font-size: 0.7rem; font-weight: 750; padding: 0.22rem 0.55rem; border-radius: 6px; white-space: nowrap; }
.strength-new { background: var(--surface-2); color: var(--muted); }
.strength-weak { background: var(--coral-50); color: var(--coral); }
.strength-ok { background: var(--gold-50); color: var(--ink-2); }
.strength-strong, .strength-mastered { background: var(--brand-50); color: var(--brand); }

/* Chat bubbles (dialogues, lessons, chat) */
.chat { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.85rem 0 1rem; }
.bubble {
  max-width: 85%; text-align: left; display: flex; flex-direction: column; gap: 0.12rem;
  padding: 0.65rem 0.95rem; border-radius: 18px; border: 1px solid var(--line); background: var(--bg-elev);
  box-shadow: var(--shadow-sm); transition: background 0.15s;
}
.bubble-them { align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble-you { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.bubble-who { font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; opacity: 0.6; }
.bubble-lg { font-weight: 680; font-size: 1.04rem; }
.bubble-en { display: none; font-size: 0.88rem; opacity: 0.75; }
.bubble.revealed .bubble-en { display: block; }

/* --- Review ---------------------------------------------------------------------------- */

.review-hero { display: flex; align-items: center; gap: 1.4rem; }
.review-hero .btn { margin-top: 0.9rem; }
.review-hero .muted { margin-top: 0.2rem; }
.empty { text-align: center; padding: 2rem 1.25rem; }
.empty .empty-icon { width: 48px; height: 48px; color: var(--brand); margin-bottom: 0.75rem; }
.empty p { margin-bottom: 1.1rem; color: var(--muted); }
.strength-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
.sg { padding: 0.95rem 1rem; border-radius: var(--r); font-size: 0.86rem; font-weight: 650; }
.sg b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.sg-weak { background: var(--coral-50); }
.sg-ok { background: var(--gold-50); }
.sg-strong { background: var(--brand-50); }
.sg-mastered { background: var(--brand); color: var(--on-brand); }

/* --- Account ---------------------------------------------------------------------------- */

.profile { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 0.5rem; }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-700)); color: #fff; font-weight: 800; font-size: 0.9rem;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; box-shadow: var(--shadow-md); }
.sync { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--brand); font-weight: 600; margin-top: 0.2rem; }
.settings { margin-top: 1.25rem; }
.settings .card-title:not(:first-child) { margin-top: 1.4rem; }
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--surface-2); margin: 1rem 0; }
.settings .seg { margin: 0; }
.seg a, .seg button {
  flex: 1; text-align: center; padding: 0.6rem; border-radius: 11px; border: none; background: transparent;
  color: var(--muted); font-weight: 720;
}
.seg .active { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow-sm); }
.goal-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-bottom: 0.8rem; }
.goal {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 0.85rem 1rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg-elev);
  transition: border-color 0.15s, background 0.15s;
}
.goal span { font-size: 0.8rem; color: var(--muted); }
.goal.selected { border-color: var(--brand); background: var(--brand-50); }
.form { display: flex; flex-direction: column; gap: 1rem; }
.form label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 650; font-size: 0.92rem; }
.form input {
  font: inherit; font-size: 1rem; padding: 0.85rem 0.95rem; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.form-error { color: var(--coral); font-weight: 650; font-size: 0.9rem; min-height: 1px; }
.form .btn-block { margin-top: 0.2rem; }
#signout { margin-top: 1.25rem; }
.danger-zone { margin-top: 1.5rem; }
.danger-zone summary { cursor: pointer; color: var(--coral); font-weight: 650; font-size: 0.92rem; }
.danger-zone .form { margin-top: 0.9rem; }

/* --- Onboarding --------------------------------------------------------------------------- */

body.in-session { overflow: hidden; }
.onboard {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(1rem + env(safe-area-inset-top)) 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(90% 60% at 50% -10%, var(--brand-50) 0%, transparent 70%),
    var(--bg);
}
.ob-top, .ob-body, .ob-foot { width: 100%; max-width: 520px; }
.ob-top { display: flex; align-items: center; gap: 0.75rem; min-height: 42px; }
.ob-progress { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.ob-progress span { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width 0.4s var(--ease); }
.ob-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 0; animation: enter 0.35s var(--ease); }
.ob-body h1 { margin-bottom: 0.4rem; }
.ob-body .lede { margin-bottom: 1.5rem; }
.ob-welcome { text-align: center; align-items: center; }
.ob-hero { display: flex; flex-direction: column; align-items: center; }
.ob-hero .lede { margin-left: auto; margin-right: auto; }
.ob-mark .brand-mark { width: 76px; height: 76px; filter: drop-shadow(0 18px 30px color-mix(in srgb, var(--brand) 45%, transparent)); margin-bottom: 1.4rem; }
.ob-points { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; text-align: left; margin: 0.5rem 0 2rem; }
.ob-points li { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; color: var(--ink-2); }
.ob-points .icon { width: 36px; height: 36px; padding: 8px; border-radius: 11px; background: var(--brand-50); color: var(--brand); }
.ob-actions { width: 100%; }
.ob-actions .btn-block + .btn-block { margin-top: 0.6rem; }
.ob-options { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1rem; }
.ob-options.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.ob-option {
  display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.1rem; text-align: left;
  border-radius: var(--r); border: 1.5px solid var(--line); background: var(--bg-elev);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, transform 0.12s var(--ease), background 0.15s;
}
.ob-option:hover { border-color: var(--line-strong); }
.ob-option:active { transform: scale(0.99); }
.ob-option.selected { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-50); }
.ob-option span:last-child { display: flex; flex-direction: column; }
.ob-option small { color: var(--muted); font-size: 0.86rem; }
.ob-flag {
  flex: none; min-width: 44px; height: 44px; padding: 0 0.4rem; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-weight: 800; font-size: 1rem; color: var(--ink-2);
}
.ob-flag .icon { width: 22px; height: 22px; color: var(--brand); }
.grid-2 .ob-option { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.ob-foot .btn-block { margin-top: 0; }

/* --- Summary ------------------------------------------------------------------------------- */

.summary {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  padding: 2.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
}
.summary-badge {
  align-self: center; width: 96px; height: 96px; border-radius: 30px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #ffd66b, #f2a31b); color: #fff; margin-bottom: 1.4rem;
  box-shadow: 0 20px 40px -18px #f2a31b; animation: pop 0.55s var(--ease);
}
.summary-badge.muted { background: linear-gradient(150deg, var(--surface-3), var(--line-strong)); color: var(--ink-2); box-shadow: none; }
.summary-badge .icon { width: 48px; height: 48px; }
@keyframes pop { from { transform: scale(0.4) rotate(-12deg); opacity: 0; } 65% { transform: scale(1.08) rotate(3deg); } to { transform: none; opacity: 1; } }
.summary .summary-stats { margin: 1.6rem 0 1.25rem; }
.summary .callout { text-align: left; }
.goal-hit { display: inline-flex; align-items: center; gap: 0.35rem; align-self: center; margin-top: 0.6rem; font-weight: 750; color: #c4760a; background: var(--gold-50); padding: 0.35rem 0.8rem; border-radius: 999px; }

/* --- Lesson session ------------------------------------------------------------------------ */

.session { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); padding-top: env(safe-area-inset-top); }
.session-top { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; max-width: 720px; width: 100%; margin: 0 auto; }
.progress { flex: 1; height: 12px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--brand), #3ddc97); transition: width 0.45s var(--ease); }
.combo { min-width: 3rem; display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.2rem; font-weight: 800; color: #e8890c; }
.combo .icon { width: 18px; height: 18px; }

.session-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.exercise { max-width: 680px; margin: 0 auto; padding: 1.25rem 1.1rem 2.5rem; animation: enter 0.28s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ex-label { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-weight: 700; color: var(--muted); font-size: 0.95rem; margin-bottom: 1.1rem; }
.ex-title { font-size: 1.5rem; font-weight: 650; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.6rem; }
.prompt { font-size: 1.45rem; font-weight: 760; letter-spacing: -0.02em; margin-bottom: 1.4rem; line-height: 1.25; }
.prompt-lg { font-size: clamp(2rem, 1.6rem + 2vw, 2.6rem); color: var(--brand); letter-spacing: -0.03em; }

.intro-card {
  position: relative; overflow: hidden; text-align: center; padding: 2.4rem 1.4rem 2rem; border-radius: var(--r-xl);
  background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-md);
}
.intro-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.intro-lg { font-size: clamp(2.2rem, 1.7rem + 2.4vw, 3rem); font-weight: 780; color: var(--brand); line-height: 1.12; letter-spacing: -0.03em; }
.intro-en { font-size: 1.25rem; font-weight: 650; margin-top: 0.55rem; color: var(--ink-2); }
.intro-note { margin-top: 1.1rem; color: var(--muted); font-size: 0.97rem; }
.local-tip { margin-top: 1rem; padding: 0.9rem 1.05rem; border-radius: var(--r); background: var(--gold-50); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); font-size: 0.95rem; line-height: 1.55; }
.local-tip strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: #b47406; margin-bottom: 0.2rem; }
.setting { color: var(--muted); font-style: italic; margin-bottom: 0.6rem; }
.hint { font-size: 0.85rem; color: var(--muted); }

.options { display: grid; gap: 0.7rem; }
.option {
  display: flex; align-items: center; gap: 0.85rem; min-height: 60px; padding: 0.85rem 1.05rem; text-align: left;
  border-radius: var(--r); border: 1.5px solid var(--line); background: var(--bg-elev);
  font-size: 1.06rem; font-weight: 650; box-shadow: 0 2px 0 var(--line);
  transition: border-color 0.12s, background 0.12s, transform 0.08s var(--ease);
}
.option:hover:not(:disabled) { border-color: var(--line-strong); }
.option:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.option .key {
  flex: none; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-strong); font-size: 0.78rem; font-weight: 750; color: var(--muted);
}
.option.selected { border-color: var(--sky); background: var(--sky-50); box-shadow: 0 2px 0 color-mix(in srgb, var(--sky) 45%, transparent); }
.option.selected .key { border-color: var(--sky); color: var(--sky); }
.option.correct { border-color: var(--brand); background: var(--brand-50); }
.option.correct .key { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.option.wrong { border-color: var(--coral); background: var(--coral-50); }
.option.wrong .key { background: var(--coral); border-color: var(--coral); color: #fff; }
@media (min-width: 720px) { .options { grid-template-columns: 1fr 1fr; } }

.tile-answer {
  display: flex; flex-wrap: wrap; gap: 0.55rem; align-content: flex-start;
  min-height: 72px; padding: 0.6rem 0 0.8rem; margin-bottom: 1.4rem;
  background-image: repeating-linear-gradient(to bottom, transparent 0 57px, var(--line) 57px 59px);
}
.tile-bank { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; }
.tile {
  min-height: 48px; padding: 0.55rem 0.95rem; border-radius: 13px;
  border: 1.5px solid var(--line-strong); background: var(--bg-elev);
  font-size: 1.05rem; font-weight: 680; box-shadow: 0 2px 0 var(--line-strong);
  transition: transform 0.08s var(--ease), opacity 0.15s;
}
.tile:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.tile.used { opacity: 0.22; box-shadow: none; }

.type-input {
  width: 100%; font: inherit; font-size: 1.25rem; font-weight: 650; padding: 1rem 1.1rem;
  border-radius: var(--r); border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.type-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.type-input.correct { border-color: var(--brand); background: var(--brand-50); }
.type-input.wrong { border-color: var(--coral); background: var(--coral-50); }
.special-keys { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
.key-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg-elev);
  font-size: 1.15rem; font-weight: 700; box-shadow: 0 2px 0 var(--line-strong);
}

.drill { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.drill-from {
  display: flex; flex-direction: column; padding: 0.95rem 1.1rem; border-radius: var(--r);
  background: var(--bg-elev); border: 1.5px dashed var(--line-strong); font-size: 1.35rem; font-weight: 760;
}
.drill-from small { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.drill-cue { align-self: flex-start; padding: 0.4rem 0.9rem; border-radius: 999px; background: var(--gold); color: #2a2104; font-weight: 800; }

.speak-cue { display: flex; justify-content: center; margin: 0.6rem 0 0.8rem; }
.speak-cue .icon {
  width: 84px; height: 84px; padding: 22px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 10px color-mix(in srgb, var(--brand-50) 50%, transparent);
}
.speak-instr { text-align: center; color: var(--muted); }
.speak-answer { margin-top: 1.1rem; text-align: center; animation: enter 0.25s var(--ease); }
.speak-lg { font-size: 1.9rem; font-weight: 780; color: var(--brand); letter-spacing: -0.02em; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.match-col { display: flex; flex-direction: column; gap: 0.65rem; }
.match-tile { width: 100%; font-size: 0.97rem; min-height: 56px; }
.match-tile.selected { border-color: var(--sky); background: var(--sky-50); }
.match-tile.done { opacity: 0.3; border-color: var(--brand); box-shadow: none; }
.shake { animation: shake 0.35s; border-color: var(--coral) !important; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.session-foot { border-top: 1px solid var(--line); background: var(--bg-elev); transition: background 0.2s; padding-bottom: env(safe-area-inset-bottom); }
.session-foot-inner { max-width: 680px; margin: 0 auto; padding: 1rem 1.1rem; }
.session-foot .btn-block { margin-top: 0; }
.session-foot.good { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.session-foot.bad { background: var(--coral-50); border-color: color-mix(in srgb, var(--coral) 35%, transparent); }
.session-foot.bad .btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--coral) 65%, transparent); }
.feedback:empty { display: none; }
.feedback { margin-bottom: 0.85rem; animation: enter 0.2s var(--ease); }
.fb-title { display: flex; align-items: center; gap: 0.45rem; font-weight: 800; font-size: 1.1rem; }
.fb-title .icon { width: 26px; height: 26px; padding: 4px; border-radius: 50%; }
.good .fb-title { color: var(--brand); }
.good .fb-title .icon { background: var(--brand); color: var(--on-brand); }
.bad .fb-title { color: var(--coral); }
.bad .fb-title .icon { background: var(--coral); color: #fff; }
.fb-answer { font-size: 1.15rem; font-weight: 750; margin-top: 0.3rem; }
.feedback-sub { color: var(--muted); font-size: 0.92rem; margin-top: 0.15rem; }
.self-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }

/* Desktop lessons: more air, bigger type, answer bar laid out in a row. */
@media (min-width: 900px) {
  .session-top { padding-top: 1.5rem; }
  .exercise { padding-top: 3rem; max-width: 720px; }
  .prompt { font-size: 1.75rem; }
  .ex-label { font-size: 1rem; }
  .session-foot-inner { max-width: 720px; display: flex; align-items: center; gap: 1.5rem; padding: 1.4rem 1.1rem; min-height: 112px; }
  .session-foot-inner .feedback { flex: 1; margin: 0; }
  .session-foot-inner .feedback:empty { display: block; }
  .session-foot-inner .action { width: 220px; flex: none; margin: 0 0 0 auto; }
  .session-foot-inner .self-grade { width: 100%; max-width: 460px; margin-left: auto; }
}

/* --- Chat practice --------------------------------------------------------------------------- */

.notice {
  display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1.1rem; padding: 0.9rem 1.05rem;
  border-radius: var(--r); background: var(--surface-2); color: var(--ink-2); font-size: 0.95rem;
}
.notice > .icon { width: 22px; height: 22px; color: var(--muted); }
.notice-cta { background: var(--gold-50); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); color: var(--ink); }
.notice-cta > .icon { color: #c98a0b; }
.scenarios { display: grid; gap: 0.7rem; }
@media (min-width: 1100px) { .scenarios { grid-template-columns: 1fr 1fr; } }
.scenario {
  display: flex; gap: 0.9rem; align-items: flex-start; padding: 1rem 1.05rem; border-radius: var(--r-lg);
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s;
}
.scenario:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.scenario.locked { opacity: 0.55; pointer-events: none; }
.scenario-avatar { flex: none; width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; background: var(--surface-2); }
.scenario-text { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.scenario-title { font-weight: 760; display: flex; flex-direction: column; line-height: 1.25; }
.scenario-role { font-weight: 550; font-size: 0.86rem; color: var(--muted); }
.scenario-mission { font-size: 0.88rem; color: var(--ink-2); display: flex; gap: 0.35rem; line-height: 1.4; }
.scenario-mission .icon { color: var(--coral); margin-top: 0.1rem; }
.scenario-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.15rem; }
.scenario-go { color: var(--muted); align-self: center; }

.chat-app { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); padding-top: env(safe-area-inset-top); }
.chat-head {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-elev) 90%, transparent);
  backdrop-filter: blur(12px);
}
.chat-avatar { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--surface-2); }
.chat-who { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-status { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.online { width: 8px; height: 8px; border-radius: 50%; background: #2cc28d; box-shadow: 0 0 0 3px color-mix(in srgb, #2cc28d 25%, transparent); }
.chat-reset { display: inline-flex; align-items: center; gap: 0.3rem; border: 1.5px solid var(--line-strong); background: var(--bg-elev); border-radius: 999px; padding: 0.4rem 0.85rem; font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.chat-reset .icon { width: 16px; height: 16px; }
@media (max-width: 520px) { .chat-reset { padding: 0.45rem; } .chat-reset span { display: none; } }
.chat-log { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 1rem 1rem 1.4rem; }
.chat-log > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.chat-intro { margin-bottom: 1rem; text-align: center; }
.chat-intro .setting { font-size: 0.92rem; }
.mission {
  display: flex; gap: 0.5rem; align-items: flex-start; text-align: left; padding: 0.75rem 0.95rem; border-radius: 14px;
  background: var(--gold-50); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); font-size: 0.92rem; margin: 0.6rem 0;
}
.mission .icon { color: var(--coral); margin-top: 0.1rem; }
.mission.done { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.mission.done .icon { color: var(--brand); }
.chat-messages { display: flex; flex-direction: column; gap: 0.55rem; }
.chat-messages .bubble { max-width: 80%; cursor: pointer; }
.msg-you { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; max-width: 86%; }
.msg-you .bubble { max-width: 100%; cursor: default; }
.fb { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.84rem; padding: 0.5rem 0.7rem; border-radius: 12px; text-align: left; max-width: 100%; }
.fb .icon { width: 16px; height: 16px; margin-top: 0.12rem; }
.fb-great { color: var(--brand); background: var(--brand-50); }
.fb-ok { background: var(--gold-50); }
.fb-ok .icon { color: #c98a0b; }
.fb-fix { background: var(--coral-50); }
.fb-fix .icon { color: var(--coral); }
.fb-note { display: block; color: var(--muted); margin-top: 0.15rem; }
.mission-done { display: flex; align-items: center; justify-content: center; gap: 0.45rem; font-weight: 750; color: var(--brand); padding: 0.75rem; }
.typing { flex-direction: row; gap: 4px; padding: 0.85rem 1rem; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-foot { border-top: 1px solid var(--line); background: var(--bg-elev); padding-bottom: env(safe-area-inset-bottom); }
.chat-foot-inner { max-width: 720px; margin: 0 auto; padding: 0.55rem 0.65rem 0.65rem; }
.chat-suggest { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.15rem 0 0.55rem; scrollbar-width: none; }
.chat-suggest:empty { display: none; }
.suggest-chip {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 0.45rem 0.8rem; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--brand) 45%, transparent);
  background: var(--brand-50); font-weight: 700; font-size: 0.9rem; max-width: 75vw;
}
.suggest-chip small { font-weight: 500; color: var(--muted); font-size: 0.74rem; }
.chat-error { color: var(--coral); font-weight: 650; font-size: 0.86rem; padding: 0 0.2rem 0.4rem; }
.chat-error:empty { display: none; }
.chat-compose { display: flex; gap: 0.4rem; align-items: center; }
.chat-compose .key-btn { width: 38px; height: 44px; flex: none; }
.chat-input {
  flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 0.75rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink);
}
.chat-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.chat-send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--brand); color: var(--on-brand); display: flex; align-items: center; justify-content: center; }
.chat-send .icon { width: 20px; height: 20px; }
.chat-send:disabled { opacity: 0.45; }

/* --- Translate & dictionary --------------------------------------------------------------------- */

.translator { padding: 1rem 1.1rem 1.1rem; }
.tr-dir { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.tr-lang { text-align: center; font-weight: 720; padding: 0.5rem; border-radius: 12px; background: var(--surface-2); font-size: 0.95rem; }
.tr-swap { border: 1.5px solid var(--line); background: var(--bg-elev); border-radius: 50%; }
.tr-input-wrap { position: relative; }
.tr-input {
  display: block; width: 100%; resize: none; font: inherit; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em;
  padding: 0.9rem 6.2rem 0.9rem 1rem; min-height: 96px; border-radius: var(--r);
  border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); line-height: 1.35;
}
.tr-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.tr-tools { position: absolute; top: 0.6rem; right: 0.6rem; display: flex; gap: 0.35rem; align-items: center; }
.mic-btn {
  width: 48px; height: 48px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--brand) 70%, transparent);
}
.mic-btn .icon { width: 22px; height: 22px; }
.mic-btn:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.mic-btn.listening { background: var(--coral); animation: pulse 1.3s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--coral) 55%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.tr-status { min-height: 1.25rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.tr-actions { display: flex; justify-content: flex-end; }
.tr-actions .btn { min-height: 46px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-card {
  margin-top: 1.1rem; padding: 1.2rem 1.25rem; border-radius: var(--r-lg);
  background: linear-gradient(170deg, var(--brand-50), var(--bg-elev) 55%);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); box-shadow: var(--shadow-md);
  animation: enter 0.3s var(--ease);
}
.ai-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.confidence { font-size: 0.74rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 6px; }
.conf-high { background: var(--brand-100); color: var(--brand-700); }
.conf-medium { background: var(--gold-50); color: #9a6406; }
.conf-low { background: var(--coral-50); color: var(--coral); }
@media (prefers-color-scheme: dark) { .conf-high { color: var(--brand); } .conf-medium { color: var(--gold); } }
.ai-main { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.6rem 0 0.4rem; }
.ai-translation { flex: 1; font-size: 1.75rem; font-weight: 780; letter-spacing: -0.025em; line-height: 1.2; color: var(--ink); }
.ai-note { color: var(--ink-2); font-size: 0.95rem; }
.ai-card h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.1rem 0 0.5rem; }
.breakdown { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.bd { display: flex; flex-direction: column; padding: 0.45rem 0.7rem; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--line); }
.bd b { font-weight: 750; }
.bd small { color: var(--muted); font-size: 0.8rem; }
.alts { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.alts li { display: flex; flex-direction: column; padding: 0.55rem 0.8rem; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--line); font-weight: 650; }
.alts small { font-weight: 500; color: var(--muted); }
.example { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.9rem; border-left: 3px solid var(--gold); background: var(--bg-elev); border-radius: 0 12px 12px 0; font-weight: 650; }
.example small { font-weight: 500; color: var(--muted); }
.ai-foot { margin-top: 1rem; font-size: 0.78rem; color: var(--muted); }

.dict-results .section-title .icon { color: var(--brand); }
.dict-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.dict-row {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.95rem; border-radius: var(--r);
  background: var(--bg-elev); border: 1px solid var(--line);
}
.dict-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dict-lg { font-weight: 720; }
.dict-gloss { color: var(--muted); font-size: 0.9rem; }
.dict-tags { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.dict-unit { font-size: 0.78rem; font-weight: 650; color: var(--muted); }
.dict-unit:hover { color: var(--brand); }
.dict-group { font-size: 0.95rem; margin: 1.4rem 0 0.55rem; }
.recent-row { cursor: pointer; }
.recent-row:hover { border-color: var(--line-strong); }
.recent-row > .icon { color: var(--muted); }
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.filter { padding: 0.45rem 0.95rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-elev); font-weight: 680; font-size: 0.86rem; }
.filter.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* --- Motion preferences ------------------------------------------------------------------------- */

/* --- Install card + offline bar ------------------------------------------------------ */

.install-card {
  display: grid; grid-template-columns: 40px 1fr auto; column-gap: 0.9rem; row-gap: 0.7rem; align-items: center; margin-top: 0.9rem;
  padding: 0.95rem 0.6rem 0.95rem 1.1rem; border-radius: var(--r);
  background: var(--brand-50); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.install-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); }
.install-icon .icon { width: 22px; height: 22px; }
.install-text { min-width: 0; display: flex; flex-direction: column; }
.install-card [data-install] { grid-column: 2; grid-row: 2; justify-self: start; }
.install-close { grid-column: 3; grid-row: 1; }
.install-text small { color: var(--ink-2); font-size: 0.86rem; line-height: 1.45; }
.install-close { color: var(--muted); }
.share-glyph { display: inline-flex; vertical-align: -0.2em; color: var(--sky); }
.share-glyph .icon { width: 1.15em; height: 1.15em; }
.install-done { display: flex; align-items: center; gap: 0.4rem; color: var(--brand); font-weight: 650; }
.settings [data-install] { margin-top: 0.6rem; }

.net-bar {
  position: fixed; z-index: 60; left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  display: flex; align-items: center; gap: 0.6rem; margin: 0 auto; max-width: 520px;
  padding: 0.7rem 1rem; border-radius: 14px; font-size: 0.9rem; line-height: 1.35;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-md);
  animation: net-in 0.25s var(--ease);
}
.net-bar .icon { width: 20px; height: 20px; flex: none; }
.net-offline .icon { color: var(--gold); }
.net-online { background: var(--brand); color: var(--on-brand); }
body.in-session .net-bar { bottom: auto; top: calc(env(safe-area-inset-top) + 10px); }
@keyframes net-in { from { opacity: 0; transform: translateY(8px); } }
/* AI actions still respond (with an explanation), but look unavailable. */
.is-offline .tr-go, .is-offline .chat-send { opacity: 0.45; }
@media (min-width: 900px) {
  .net-bar { bottom: 20px; left: calc(var(--sidebar) + 20px); right: 20px; }
  body.in-session .net-bar { left: 20px; }
}

/* --- Study cards ------------------------------------------------------------------------ */

.study { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); padding-top: env(safe-area-inset-top); }
.study-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; max-width: 720px; width: 100%; margin: 0 auto; }
.study-count { min-width: 3.2rem; text-align: right; font-weight: 700; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.study-main { flex: 1; overflow-y: auto; padding: 0.5rem 1rem 1.5rem; }
.study-card { max-width: 640px; margin: 0 auto; }
.study-card.is-front {
  min-height: 52vh; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 0.9rem;
  padding: 1.6rem 1.3rem; border-radius: var(--r-xl); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-md);
}
.sc-top { display: flex; align-items: center; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.sc-top .uicon.sm { margin-right: 0; }
.sc-ask { font-weight: 650; color: var(--muted); }
.sc-face { display: flex; flex-direction: column; gap: 0.35rem; }
.sc-lg { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.03em; font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem); line-height: 1.15; color: var(--brand); }
.sc-meaning { font-size: 1.25rem; font-weight: 650; color: var(--ink-2); }
.sc-face .sc-meaning { font-size: clamp(1.4rem, 1.2rem + 1.2vw, 1.9rem); color: var(--ink); }
.sc-hint { max-width: 26rem; margin: 0 auto; }
.study-card.is-back .sc-answer {
  display: flex; flex-direction: column; gap: 0.3rem; text-align: center; padding: 1.3rem 1.1rem;
  border-radius: var(--r-xl); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-md); margin-bottom: 0.9rem;
}
.flipping .sc-answer { animation: card-flip 0.35s var(--ease); }
@keyframes card-flip { from { transform: perspective(900px) rotateY(80deg); opacity: 0.2; } }
.study-foot { border-top: 1px solid var(--line); background: var(--bg-elev); padding-bottom: env(safe-area-inset-bottom); }
.study-foot-inner { max-width: 680px; margin: 0 auto; padding: 0.9rem 1rem; }
.conf-row, .grade-row { display: grid; gap: 0.5rem; }
.conf-row { grid-template-columns: repeat(3, 1fr); }
.grade-row { grid-template-columns: repeat(4, 1fr); }
.grade-q { text-align: center; margin-bottom: 0.5rem; }
.conf, .grade { padding: 0.85rem 0.3rem; font-size: 0.95rem; border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); }
.conf-sure { border-color: var(--brand); color: var(--brand); }
.grade-0 { border-color: color-mix(in srgb, var(--coral) 55%, var(--line)); color: var(--coral); }
.grade-1 { color: #c4760a; }
.grade-2 { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.grade-3 { color: var(--sky); }
.hyper { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.8rem 0.9rem; border-radius: var(--r); background: var(--gold-50); margin-bottom: 0.7rem; font-size: 0.93rem; }
.hyper .icon { color: #c4760a; margin-top: 2px; }
.study-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; padding-top: 8vh; }
.xp-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.8rem; border-radius: 999px; background: var(--gold-50); font-weight: 750; margin-top: 0.4rem; }
.xp-pill .icon { color: #e8890c; }

/* Card back sections (session and card page) */
.cb-section { padding: 1.05rem 1.1rem; border-radius: var(--r-lg); background: var(--bg-elev); border: 1px solid var(--line); margin-bottom: 0.75rem; }
.cb-title { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.75rem; }
.cb-title .icon { width: 1.1em; height: 1.1em; color: var(--brand); }
.cb-saved { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--brand); font-weight: 650; }
.wbd { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bd-word { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.6rem 0.75rem; border-radius: 14px; background: var(--surface-2); min-width: 0; max-width: 100%; }
.bd-lg { font-weight: 750; font-size: 1.08rem; color: var(--ink); }
.bd-gloss { font-size: 0.88rem; color: var(--ink-2); }
.bd-meta { font-size: 0.78rem; color: var(--muted); }
.bd-meta b { color: var(--brand); font-weight: 700; }
.bd-pieces { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.2rem; }
.bd-piece { display: flex; flex-direction: column; padding: 0.25rem 0.45rem; border-radius: 9px; background: var(--bg-elev); border: 1px solid var(--line); line-height: 1.2; }
.bd-piece b { font-size: 0.92rem; }
.bd-piece small { font-size: 0.7rem; color: var(--muted); }
.bd-subject b { color: var(--violet); }
.bd-stem b { color: var(--brand); }
.bd-piece:not(.bd-subject):not(.bd-stem) b { color: #c4760a; }
.bd-end small { display: none; }
.bd-dot { align-self: center; color: var(--muted); }
.bd-pattern { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.7rem; font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }
.bd-pattern .icon { color: var(--brand); margin-top: 3px; flex: none; }
.bd-pattern b { color: var(--ink); }
.cb-note { margin-top: 0.75rem; font-size: 0.9rem; color: var(--ink-2); }
.cb-context { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.8rem; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 12px 12px 0; margin-bottom: 0.5rem; }
.cb-context .bubble-lg { font-weight: 700; }
.cb-alike { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.cb-alike a, .cb-alike li > span { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.75rem; border-radius: 12px; background: var(--surface-2); color: var(--ink); }
.cb-alike span span, .cb-alike a span { color: var(--muted); font-size: 0.88rem; text-align: right; }
.cb-meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 0.45rem; }
.cb-meter span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #3ddc97); }
.cb-tricky { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.7rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--coral-50); font-size: 0.9rem; }
.cb-tricky .icon { color: var(--coral); flex: none; margin-top: 2px; }
.cb-mine textarea {
  width: 100%; font: inherit; font-size: 0.95rem; font-weight: 400; color: var(--ink); background: var(--bg); resize: vertical;
  border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0.65rem 0.75rem; margin-top: 0.35rem;
}
.cb-mine textarea:focus { outline: none; border-color: var(--brand); }
.cb-hook-label { display: block; margin-top: 0.8rem; font-weight: 700; font-size: 0.9rem; }
.cb-hook-label .icon { color: #c4760a; }
.cb-hook-ai { margin-top: 0.6rem; }
.cb-hook-signin { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.6rem; }
.cb-hook-out { margin-top: 0.7rem; padding: 0.8rem 0.9rem; border-radius: 12px; background: var(--gold-50); font-size: 0.93rem; }
.cb-hook-out:empty { display: none; }
.cb-hook-out .btn { margin-top: 0.6rem; }
.cb-hook-why { margin-top: 0.7rem; }

/* Card page */
.cp-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.cp-head h1 { color: var(--brand); }
.cp-head .lede { margin-top: 0.2rem; }
.card-page .btn-block { margin-top: 0.4rem; }

/* Decks on the Review screen */
.study-sub { margin: -0.4rem 0 0.8rem; }
.decks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.deck { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.9rem 1rem; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line); color: var(--ink); transition: border-color 0.15s, transform 0.15s var(--ease); }
.deck:hover { border-color: var(--brand); transform: translateY(-1px); }
.deck.empty { opacity: 0.5; pointer-events: none; }
.deck-n { font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; letter-spacing: -0.03em; color: var(--brand); }
.deck-tricky .deck-n { color: var(--coral); }
.deck-weak .deck-n { color: #c4760a; }
.deck-name { font-weight: 720; }
.deck small { color: var(--muted); font-size: 0.8rem; }
.deck-all { grid-column: 1 / -1; }
@media (min-width: 640px) { .decks { grid-template-columns: repeat(3, 1fr); } .deck-all { grid-column: auto; } }
.study-opts { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.9rem; flex-wrap: wrap; }
.seg-sm { margin: 0; flex: 1; max-width: 320px; }
.seg-sm button { padding: 0.45rem; font-size: 0.88rem; }
.calib { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.8rem; font-size: 0.92rem; color: var(--ink-2); }
.calib .icon { color: var(--brand); flex: none; margin-top: 2px; }
.why { margin-top: 0.8rem; border-radius: var(--r); background: var(--surface-2); padding: 0.75rem 0.95rem; }
.why summary { cursor: pointer; font-weight: 700; }
.why ul { margin: 0.6rem 0 0.2rem 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem; color: var(--ink-2); }
.why b { color: var(--ink); }

/* Unit page actions and phrase rows */
.unit-actions { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
a.word { color: var(--ink); transition: border-color 0.15s; }
a.word:hover { border-color: var(--brand); }
.word-note { color: #c4760a; display: inline-flex; }
a.dict-main { color: inherit; }

/* --- Word of the day, ad slot ------------------------------------------------------------- */

.wotd {
  display: flex; align-items: center; gap: 0.8rem; margin-top: 0.9rem;
  padding: 1rem 1.15rem; border-radius: var(--r-lg); background: var(--bg-elev); border: 1px solid var(--line); color: var(--ink);
  transition: border-color 0.15s, transform 0.15s var(--ease);
}
.wotd:hover { border-color: var(--brand); transform: translateY(-1px); }
.wotd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; color: var(--ink); }
.wotd-kicker { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--brand); }
.wotd-lg { font-family: var(--font-display); font-size: 1.4rem; font-weight: 650; letter-spacing: -0.03em; color: var(--brand); }
.wotd-gloss { color: var(--ink-2); }
.wotd-email { flex: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.45rem 0.7rem; border-radius: 999px; background: var(--surface-2); font-size: 0.8rem; font-weight: 650; color: var(--ink-2); }
.wotd-email:hover { color: var(--brand); }

.ad-slot { position: relative; margin-top: 0.9rem; padding: 1.35rem 0.75rem 0.75rem; border-radius: var(--r); border: 1px dashed var(--line-strong); background: var(--surface-2); min-height: 116px; }
.ad-label { position: absolute; top: 0.4rem; left: 0.75rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ad-house { display: flex; align-items: center; gap: 0.8rem; color: var(--ink); }
.ad-house-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-50); color: #c4760a; }
.ad-house-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ad-house-text small { color: var(--muted); font-size: 0.85rem; }
.ad-house-cta { display: inline-flex; align-items: center; gap: 0.2rem; margin-top: 0.3rem; font-weight: 700; font-size: 0.88rem; color: var(--brand); }
.ad-house-cta .icon { width: 1em; height: 1em; }
.ad-translate { margin-top: 1.6rem; }

/* --- Email & reminders (profile) ------------------------------------------------------------ */

.notify { margin-top: 1rem; }
.nt-saved { margin-left: auto; font-size: 0.8rem; font-weight: 650; color: var(--brand); }
.nt-status { margin-bottom: 0.4rem; }
.nt-ok > span { min-width: 0; overflow-wrap: anywhere; }
.nt-ok { display: flex; align-items: center; gap: 0.4rem; color: var(--brand); font-weight: 650; font-size: 0.92rem; }
.nt-verify { display: flex; gap: 0.6rem; align-items: flex-start; flex-wrap: wrap; padding: 0.75rem 0.85rem; border-radius: 12px; background: var(--gold-50); font-size: 0.92rem; margin-bottom: 0.4rem; }
.nt-verify > .icon { color: #c4760a; margin-top: 2px; }
.nt-verify span { flex: 1; min-width: 12rem; }
.nt-row { display: flex; align-items: center; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.nt-row.disabled { opacity: 0.5; cursor: default; }
.nt-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.nt-text small { color: var(--muted); font-size: 0.86rem; }
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background 0.2s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s var(--ease); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.nt-remind { padding-top: 0.85rem; display: flex; flex-direction: column; gap: 0.6rem; }
.nt-remind .seg { max-width: none; }
.nt-remind .seg button:disabled { opacity: 0.4; }
.pro-tag { display: inline-block; padding: 0 0.35rem; border-radius: 6px; background: var(--gold); color: #1c1606; font-size: 0.66rem; font-weight: 800; vertical-align: 0.1em; }
.nt-time { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; }
.nt-time select { font: inherit; padding: 0.5rem 0.6rem; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); }
.nt-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; }
.nt-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.nt-warn { font-size: 0.88rem; color: #b47406; }
.nt-pro { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 0.75rem; align-items: center; padding: 0.85rem; border-radius: 14px; background: var(--gold-50); }
.nt-pro-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--gold); color: #1c1606; }
.nt-pro .btn, .nt-pro .nt-ok { grid-column: 2; justify-self: start; }
.nt-phone { display: flex; flex-direction: column; gap: 0.5rem; }
.nt-phone label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 650; font-size: 0.92rem; }
.nt-phone input { font: inherit; padding: 0.65rem 0.75rem; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); }
.nt-phone .btn { align-self: flex-start; }
.nt-code { display: flex; gap: 0.5rem; align-items: flex-end; }
.nt-code label { flex: 1; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 0.88rem; padding: 0; }
.nt-error:empty { display: none; }
.nt-error { margin-top: 0.5rem; }
.notice-ok { background: var(--brand-50); }
.notice-ok > .icon { color: var(--brand); }
.forgot-link { display: block; text-align: center; margin-top: 0.85rem; font-weight: 650; font-size: 0.92rem; }

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