/*! © 2026 LogosVox. All rights reserved. Copying, modifying or redistributing this code is not permitted. https://games.logosvox.com/terms */
/* LogosVox Learn. Tokens follow the portal's "Calm" set (apps/portal/src/app/globals.css). */
:root {
  --void: #ffffff;
  --void-raised: #f9f9f9;
  --ink: #0d0d0d;
  --ink-muted: rgb(13 13 13 / 0.74);
  --ink-subtle: rgb(13 13 13 / 0.66);
  --edge: rgb(13 13 13 / 0.1);
  --edge-strong: rgb(13 13 13 / 0.18);
  --surface: rgb(13 13 13 / 0.035);
  --surface-hover: rgb(13 13 13 / 0.06);
  --accent: #0d0d0d;
  --on-accent: #ffffff;
  --positive: #047857;
  --positive-bg: rgb(5 150 105 / 0.1);
  --critical: #be123c;
  --critical-bg: rgb(225 29 72 / 0.08);
  --focus: #2a78d6;
  /* Ordinal blue ramp for learning → known → mastered (validated for contrast and steps on this surface). */
  --s-learning: #86b6ef;
  --s-known: #3987e5;
  --s-mastered: #184f95;
  --s-new: rgb(13 13 13 / 0.07);
  --bar: #2a78d6;
  --grid: rgb(13 13 13 / 0.08);
  --radius-card: 1.25rem;
  --radius-control: 0.75rem;
  --shadow: 0 1px 2px rgb(13 13 13 / 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 120ms;
  --base: 200ms;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --void: #141414;
    --void-raised: #1b1b1b;
    --ink: #f4f4f4;
    --ink-muted: rgb(255 255 255 / 0.72);
    --ink-subtle: rgb(255 255 255 / 0.62);
    --edge: rgb(255 255 255 / 0.1);
    --edge-strong: rgb(255 255 255 / 0.18);
    --surface: rgb(255 255 255 / 0.045);
    --surface-hover: rgb(255 255 255 / 0.08);
    --accent: #f4f4f4;
    --on-accent: #141414;
    --positive: #34d399;
    --positive-bg: rgb(52 211 153 / 0.12);
    --critical: #fb7185;
    --critical-bg: rgb(251 113 133 / 0.12);
    --focus: #6da7ec;
    /* Dark steps of the same ramp, validated against #141414. */
    --s-learning: #184f95;
    --s-known: #3987e5;
    --s-mastered: #9ec5f4;
    --s-new: rgb(255 255 255 / 0.08);
    --bar: #3987e5;
    --grid: rgb(255 255 255 / 0.08);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  }
}

/* Dark pinned in Settings (the shell puts data-theme on <html>): the same dark tokens. */
:root[data-theme="dark"] {
  --void: #141414;
  --void-raised: #1b1b1b;
  --ink: #f4f4f4;
  --ink-muted: rgb(255 255 255 / 0.72);
  --ink-subtle: rgb(255 255 255 / 0.62);
  --edge: rgb(255 255 255 / 0.1);
  --edge-strong: rgb(255 255 255 / 0.18);
  --surface: rgb(255 255 255 / 0.045);
  --surface-hover: rgb(255 255 255 / 0.08);
  --accent: #f4f4f4;
  --on-accent: #141414;
  --positive: #34d399;
  --positive-bg: rgb(52 211 153 / 0.12);
  --critical: #fb7185;
  --critical-bg: rgb(251 113 133 / 0.12);
  --focus: #6da7ec;
  --s-learning: #184f95;
  --s-known: #3987e5;
  --s-mastered: #9ec5f4;
  --s-new: rgb(255 255 255 / 0.08);
  --bar: #3987e5;
  --grid: rgb(255 255 255 / 0.08);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
body[data-mode="focus"] { padding-bottom: 0; }
body[data-mode="focus"] .tabs { display: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }

/* Tabs */
/* The top bar is the shared one (lv-shell.js); the sync note sits in its slot, on wider screens only. */
#sync { margin: 0; font-size: 12px; color: var(--ink-subtle); text-align: right; max-width: 16em; line-height: 1.3; }
body > #sync { display: none; }
@media (max-width: 719.98px) { .lv-shell #sync { display: none; } }
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--void); border-top: 1px solid var(--edge);
  padding: 4px max(8px, env(safe-area-inset-left)) calc(4px + env(safe-area-inset-bottom));
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; text-decoration: none; font-size: 12px; color: var(--ink-subtle); border-radius: 12px; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabs a[aria-current="page"] svg { color: var(--bar); }
@media (min-width: 720px) {
  .tabs { position: static; max-width: 560px; margin: 0 auto 8px; border: 1px solid var(--edge); border-radius: 16px; order: -1; }
  body { padding-bottom: 24px; }
}

/* Layout */
main { display: block; max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; align-items: center; }
.pad { padding: 32px 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.gap { gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.title { font-family: var(--display); font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; margin: 4px 0 0; outline: none; }
.title small { font-family: var(--font); font-size: 14px; font-weight: 400; letter-spacing: 0; display: block; }
.h2 { font-family: var(--display); font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.h3 { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; }
p { margin: 0; }
.card { background: var(--void-raised); border: 1px solid var(--edge); border-radius: var(--radius-card); padding: 16px; box-shadow: var(--shadow); }
.eyebrow { font-size: 13px; color: var(--ink-subtle); text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-control);
  border: 1px solid var(--edge-strong); background: var(--void); cursor: pointer; text-decoration: none;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { opacity: 0.92; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.wide { width: 100%; }
.btn.big { flex-direction: column; gap: 2px; min-height: 72px; font-size: 18px; }
.btn.big small { font-weight: 400; font-size: 14px; opacity: 0.8; }
.btn kbd { font: 12px var(--font); opacity: 0.6; }
.icon-btn { min-height: 44px; min-width: 44px; padding: 0; }
.listen { min-height: 64px; font-size: 18px; }
select, input[type="search"], .answer input {
  min-height: 48px; padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--edge-strong); background: var(--void); width: 100%;
}
.answer input { font-size: 20px; min-height: 56px; }
.answer input[readonly] { background: var(--surface); }
.course-pick select { min-height: 40px; font-size: 14px; max-width: 200px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-muted); }
.form label.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); }
.form input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--bar); }
.field { border: 0; padding: 0; margin: 0; }
.field legend { font-size: 14px; color: var(--ink-muted); margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented label, .choice { position: relative; cursor: pointer; }
.segmented input, .choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--edge-strong); border-radius: var(--radius-control); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice > span { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--edge-strong); border-radius: var(--radius-control); }
.choice small { color: var(--ink-muted); font-size: 14px; }
.segmented input:checked + span, .choice input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.segmented input:focus-visible + span, .choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--edge-strong); background: var(--void); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip[aria-pressed="true"] .muted { color: inherit; opacity: 0.75; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters .select { flex: 1; min-width: 140px; }

/* Tiles and meters */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles .span { grid-column: 1 / -1; }
.tile { background: var(--void-raised); border: 1px solid var(--edge); border-radius: var(--radius-card); padding: 14px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--ink-subtle); margin: 0 0 4px; }
.tile-value { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0; line-height: 1.2; }
.tile-sub { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.meter { height: 8px; border-radius: 999px; background: var(--s-new); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--bar); border-radius: 999px; transition: width var(--base) var(--ease); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 52px; padding: 10px 14px; border-radius: var(--radius-control);
  border: 1px solid var(--edge); background: var(--void-raised); text-decoration: none; text-align: left; cursor: pointer;
}
.list-row.static { cursor: default; }
.list-row:hover { background: var(--surface-hover); }
.words .w { font-weight: 600; }
.word-row.open .list-row { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.word-detail { border: 1px solid var(--edge); border-top: 0; border-radius: 0 0 var(--radius-control) var(--radius-control); padding: 12px 14px; }
.pill { flex: none; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--edge-strong); }
.pill.s-new { color: var(--ink-subtle); }
.pill.s-learning, .pill.s-known, .pill.s-mastered { border-color: transparent; }
.pill.s-learning { background: var(--s-learning); color: #0d0d0d; }
.pill.s-known { background: var(--s-known); color: #ffffff; }
.pill.s-mastered { background: var(--s-mastered); color: var(--void); }

/* Lesson */
.lesson { display: flex; flex-direction: column; gap: 16px; min-height: calc(100dvh - 90px); }
.lesson-top { display: flex; align-items: center; gap: 8px; }
.lesson-body { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.lesson-foot { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--void); }
.word { font-family: var(--display); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; outline: none; }
.meaning { font-size: 18px; margin: 0; }
.meaning.big { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.3; outline: none; }
.sentence { font-size: 21px; line-height: 1.45; font-weight: 500; margin: 0; outline: none; }
.pos { font-size: 13px; color: var(--ink-subtle); margin: 0; }
.example { font-size: 16px; margin: 0; padding-left: 12px; border-left: 3px solid var(--edge-strong); }
mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--bar); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.word-block { display: flex; flex-direction: column; gap: 6px; }
.word-block .word { font-size: 26px; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  text-align: left; border-radius: var(--radius-control); border: 1px solid var(--edge-strong); background: var(--void); cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.option:hover:not([disabled]) { background: var(--surface-hover); }
.option kbd { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--edge-strong); font: 12px var(--font); color: var(--ink-subtle); }
.option[disabled] { cursor: default; opacity: 0.7; }
.option.is-right { border-color: var(--positive); background: var(--positive-bg); opacity: 1; }
.option.is-wrong { border-color: var(--critical); background: var(--critical-bg); opacity: 1; }
.option.match { min-height: 64px; justify-content: center; text-align: center; font-size: 15px; }
.option.match[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.feedback { border-radius: var(--radius-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; animation: rise var(--base) var(--ease); }
.feedback.ok { background: var(--positive-bg); }
.feedback.no { background: var(--critical-bg); }
.feedback-head { font-weight: 700; }
.feedback.ok .feedback-head { color: var(--positive); }
.feedback.no .feedback-head { color: var(--critical); }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
.grades .btn { padding: 0 6px; font-size: 14px; }
.passage { font-size: 16px; line-height: 1.6; background: var(--surface); border-radius: var(--radius-control); padding: 12px 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; margin: 0; }
.stats div { background: var(--void-raised); border: 1px solid var(--edge); border-radius: var(--radius-card); padding: 12px; }
.stats dt { font-size: 13px; color: var(--ink-subtle); }
.stats dd { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 600; }
.done-mark { color: var(--positive); animation: rise 320ms var(--ease); }

/* Charts */
.chart { margin: 0; }
.chart-wrap { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .bar-hit { outline: none; cursor: default; }
.chart .bar-hit:focus-visible rect { stroke: var(--focus); stroke-width: 2; }
.chart .bar-hit:hover rect { fill: var(--surface); }
.chart .goal { stroke: var(--ink-subtle); stroke-dasharray: 4 4; stroke-width: 1.5; }
.axis-label { font: 10px var(--font); fill: var(--ink-subtle); }
.tip { position: absolute; top: -8px; width: 160px; padding: 6px 10px; font-size: 12px; background: var(--ink); color: var(--void); border-radius: 8px; pointer-events: none; transform: translateY(-100%); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 0 0 10px; font-size: 13px; color: var(--ink-muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.s-new { background: var(--s-new); border: 1px solid var(--edge-strong); }
.swatch.s-learning, .seg.s-learning { background: var(--s-learning); }
.swatch.s-known, .seg.s-known { background: var(--s-known); }
.swatch.s-mastered, .seg.s-mastered { background: var(--s-mastered); }
.stacks { display: flex; flex-direction: column; gap: 10px; }
.stack-row { display: grid; grid-template-columns: 64px 1fr 72px; align-items: center; gap: 10px; font-size: 14px; border-radius: 6px; }
.stack-name { color: var(--ink-muted); }
.stack-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.stack-track { display: flex; gap: 2px; height: 14px; border-radius: 4px; background: var(--s-new); overflow: hidden; }
.seg { display: block; height: 100%; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.table-toggle { margin-top: 12px; font-size: 14px; }
.table-toggle summary { cursor: pointer; color: var(--ink-muted); min-height: 32px; display: flex; align-items: center; }
.table-toggle table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.table-toggle th, .table-toggle td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--edge); font-weight: 400; }
.table-toggle thead th { color: var(--ink-subtle); font-size: 13px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 380px) {
  .word { font-size: 28px; }
}
