/* Seneca — design system.
   Typography: system stack on purpose. On Andre's Mac/iPhone this resolves to
   New York (reading serif) and SF Pro (UI) — no webfont download, nothing to
   block from Russia, no layout shift. */

:root {
  color-scheme: light;

  --paper:      #f9f9f7;
  --surface:    #ffffff;
  --surface-2:  #fcfcfb;
  --sunken:     #f2f1ed;
  --ink:        #0b0b0b;
  --ink-2:      #52514e;
  --muted:      #898781;
  --line:       #e4e3dc;
  --line-soft:  #eeede7;
  --accent:     #1c5cab;
  --accent-ink: #ffffff;
  --good:       #0ca30c;
  --warn:       #b06a00;
  --bad:        #d03b3b;
  --ring:       rgba(11, 11, 11, .08);
  --shadow:     0 1px 2px rgba(11,11,11,.04), 0 8px 24px -12px rgba(11,11,11,.10);
  --shadow-lg:  0 2px 4px rgba(11,11,11,.04), 0 24px 48px -20px rgba(11,11,11,.18);

  /* Topic identity — validated categorical order (adjacent CVD ΔE 9.1 light /
     8.4 dark). Always shown next to a text label, never as the only cue. */
  --t-marketing-core: #eda100;
  --t-marketing-now:  #e87ba4;
  --t-ecom:           #4a3aa7;
  --t-business:       #2a78d6;
  --t-tech-ai:        #1baf7a;
  --t-health:         #008300;
  --t-travel:         #eb6834;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, "New York", Charter, Georgia, "Iowan Old Style", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --measure: 40rem;
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:     #0d0d0d;
    --surface:   #1a1a19;
    --surface-2: #201f1e;
    --sunken:    #141413;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #8f8d86;
    --line:      #2c2c2a;
    --line-soft: #232322;
    --accent:    #6da7ec;
    --accent-ink:#0d0d0d;
    --good:      #0ca30c;
    --warn:      #fab219;
    --bad:       #e66767;
    --ring:      rgba(255, 255, 255, .10);
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 24px 48px -20px rgba(0,0,0,.6);

    --t-marketing-core: #c98500;
    --t-marketing-now:  #d55181;
    --t-ecom:           #9085e9;
    --t-business:       #3987e5;
    --t-tech-ai:        #199e70;
    --t-health:         #008300;
    --t-travel:         #d95926;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:     #0d0d0d;
  --surface:   #1a1a19;
  --surface-2: #201f1e;
  --sunken:    #141413;
  --ink:       #ffffff;
  --ink-2:     #c3c2b7;
  --muted:     #8f8d86;
  --line:      #2c2c2a;
  --line-soft: #232322;
  --accent:    #6da7ec;
  --accent-ink:#0d0d0d;
  --good:      #0ca30c;
  --warn:      #fab219;
  --bad:       #e66767;
  --ring:      rgba(255, 255, 255, .10);
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 24px 48px -20px rgba(0,0,0,.6);

  --t-marketing-core: #c98500;
  --t-marketing-now:  #d55181;
  --t-ecom:           #9085e9;
  --t-business:       #3987e5;
  --t-tech-ai:        #199e70;
  --t-health:         #008300;
  --t-travel:         #d95926;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ chrome */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .75rem max(1.25rem, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em;
  text-decoration: none; margin-right: .25rem;
}
.wordmark span { color: var(--muted); font-weight: 400; }

.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: .375rem .7rem; border-radius: 99px; text-decoration: none;
  color: var(--ink-2); font-size: .9rem; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--paper); }

.badge-due {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .35rem;
  border-radius: 99px; background: var(--accent); color: var(--accent-ink);
  font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nav a.on .badge-due { background: var(--paper); color: var(--ink); }

.chrome-right { display: flex; align-items: center; gap: .5rem; }

.streak {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .85rem; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 99px;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-2); transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--sunken); border-color: var(--line); }

main { padding: 2rem max(1.25rem, env(safe-area-inset-left)) 6rem; }
.wrap { max-width: 62rem; margin: 0 auto; }
.wrap-narrow { max-width: var(--measure); margin: 0 auto; }

/* ------------------------------------------------------------- typography */

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; margin: 0; }

.page-title {
  font-family: var(--serif); font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 600; margin-bottom: .3rem;
}
.page-sub { color: var(--muted); font-size: .95rem; margin-bottom: 2rem; }

.section-label {
  font-size: .75rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 2.5rem 0 .9rem;
}
.section-label:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ atoms */

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem .2rem .5rem; border-radius: 99px;
  background: var(--sunken); border: 1px solid var(--line-soft);
  font-size: .78rem; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.dot { width: .5rem; height: .5rem; border-radius: 99px; background: var(--muted); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.15rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .92rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { background: var(--sunken); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { filter: brightness(1.08); background: var(--accent); }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ today */

.hero-greet { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.lesson-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }

.lesson-card {
  display: flex; flex-direction: column; gap: .7rem;
  padding: 1.35rem; text-decoration: none; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
}
.lesson-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--topic, var(--muted));
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--ring); }

.lesson-card h3 {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.28;
}
.lesson-card .dek { color: var(--ink-2); font-size: .92rem; line-height: 1.45; flex: 1; }
.lesson-meta { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--muted); }
.lesson-card.read { opacity: .62; }
.lesson-card.read:hover { opacity: 1; }

.review-cta {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: 1.5rem 1.6rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.review-cta .n {
  font-family: var(--serif); font-size: 2.6rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.review-cta .txt { flex: 1; min-width: 12rem; }
.review-cta .txt strong { display: block; font-size: 1.02rem; }
.review-cta .txt span { color: var(--muted); font-size: .88rem; }

/* ----------------------------------------------------------------- reader */

.reader { max-width: var(--measure); margin: 0 auto; }
.reader-head { margin-bottom: 2rem; }
.reader-head h1 {
  font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 600; line-height: 1.14; margin: .8rem 0 .6rem;
}
.reader-head .dek {
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.5;
  color: var(--ink-2); font-style: italic;
}
.reader-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }

.prose { font-family: var(--serif); font-size: 1.16rem; line-height: 1.62; color: var(--ink); }
.prose p { margin: 0 0 1.15em; }
.prose h3 {
  font-family: var(--sans); font-size: .82rem; font-weight: 650;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin: 2.2em 0 .8em;
}
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose strong { font-weight: 650; }
.prose em { font-style: italic; }
.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--sunken); padding: .1em .35em; border-radius: 5px;
}
.prose blockquote {
  margin: 1.4em 0; padding-left: 1.1em; border-left: 2px solid var(--line);
  color: var(--ink-2); font-style: italic;
}

.keypoints { margin: 2.2rem 0; padding: 1.25rem 1.4rem; border-radius: var(--radius); background: var(--sunken); }
.keypoints ol { margin: 0; padding-left: 1.15rem; }
.keypoints li { margin-bottom: .55rem; font-size: .98rem; line-height: 1.45; }
.keypoints li:last-child { margin-bottom: 0; }
.keypoints li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }

.callout {
  margin: 2.2rem 0; padding: 1.3rem 1.45rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--topic, var(--accent));
}
.callout .label {
  font-size: .72rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .5rem;
}
.callout .prose { font-size: 1.02rem; }
.callout.evidence { border-left-color: var(--good); }

.sources { margin-top: 2.5rem; padding-top: 1.3rem; border-top: 1px solid var(--line); font-size: .88rem; }
.sources a { color: var(--accent); text-decoration: none; }
.sources a:hover { text-decoration: underline; }

.verify { margin-top: 1.25rem; font-size: .86rem; }
.verify summary {
  display: flex; align-items: center; gap: .55rem; cursor: pointer;
  color: var(--ink-2); list-style: none; padding: .5rem 0;
}
.verify summary::-webkit-details-marker { display: none; }
.verify summary::after { content: "▾"; color: var(--muted); font-size: .75rem; }
.verify[open] summary::after { content: "▴"; }
.verify-dot {
  display: inline-grid; place-items: center; flex: none;
  width: 1.15rem; height: 1.15rem; border-radius: 99px;
  color: #fff; font-size: .7rem; font-weight: 700;
}
.verify-body { padding: .3rem 0 .5rem 1.7rem; color: var(--ink-2); line-height: 1.5; }
.verify-body p { margin: 0 0 .6rem; }
.verify-body ul { margin: 0; padding-left: 1.1rem; }
.verify-body li { margin-bottom: .45rem; }

.reader-foot {
  margin-top: 2.5rem; padding-top: 1.8rem; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}

.progress-rail { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; background: transparent; }
.progress-rail i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* ----------------------------------------------------------------- review */

.review-stage { max-width: 42rem; margin: 0 auto; }

.review-progress { display: flex; gap: .3rem; margin-bottom: 2.5rem; }
.review-progress i {
  height: 3px; flex: 1; border-radius: 99px; background: var(--line);
  transition: background .3s;
}
.review-progress i.done { background: var(--ink); }
.review-progress i.now { background: var(--accent); }

.q-topic { margin-bottom: 1.1rem; }
.question {
  font-family: var(--serif); font-size: clamp(1.4rem, 3.6vw, 1.85rem);
  font-weight: 500; line-height: 1.32; margin-bottom: 1.75rem;
}

.answer-box { position: relative; }
.answer-box textarea {
  width: 100%; min-height: 9.5rem; padding: 1.05rem 3.4rem 1.05rem 1.15rem;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); resize: vertical; line-height: 1.55; font-size: 1.02rem;
  transition: border-color .15s, box-shadow .15s;
}
.answer-box textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.answer-box textarea::placeholder { color: var(--muted); }

.mic {
  position: absolute; top: .7rem; right: .7rem;
  width: 2.25rem; height: 2.25rem; border-radius: 99px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2);
  transition: background .15s, color .15s, transform .15s;
}
.mic:hover { background: var(--line-soft); }
.mic.rec { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }

.review-actions { display: flex; align-items: center; gap: .75rem; margin-top: 1.1rem; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .82rem; }
kbd {
  font-family: var(--sans); font-size: .72rem; font-weight: 600;
  padding: .12rem .35rem; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}

.verdict { margin-top: 1.75rem; padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.verdict-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; flex-wrap: wrap; }
.grade-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .75rem; border-radius: 99px;
  font-size: .82rem; font-weight: 650;
  border: 1px solid currentColor;
}
.grade-4 { color: var(--good); }
.grade-3 { color: var(--accent); }
.grade-2 { color: var(--warn); }
.grade-1 { color: var(--bad); }
.next-due { margin-left: auto; font-size: .82rem; color: var(--muted); }

.verdict .fb { font-size: 1rem; line-height: 1.55; margin-bottom: 1rem; }
.missed { margin: 0 0 1rem; padding-left: 1.15rem; }
.missed li { font-size: .93rem; color: var(--ink-2); margin-bottom: .3rem; }
.ideal { padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--sunken); font-size: .96rem; line-height: 1.5; }
.ideal .label { font-size: .72rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }

/* ---------------------------------------------------------------- library */

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.5rem; }
.filter {
  padding: .35rem .8rem; border-radius: 99px; cursor: pointer;
  background: transparent; border: 1px solid var(--line);
  font-size: .85rem; font-weight: 550; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background .15s, border-color .15s, color .15s;
}
.filter:hover { background: var(--sunken); }
.filter.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.search {
  flex: 1; min-width: 11rem; padding: .4rem .9rem; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); font-size: .88rem;
}
.search:focus { outline: none; border-color: var(--accent); }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: flex-start; gap: 1rem; padding: 1.1rem .25rem;
  border-bottom: 1px solid var(--line-soft); text-decoration: none;
  transition: background .12s;
}
.row:hover { background: var(--surface-2); }
.row .bar { width: 3px; align-self: stretch; border-radius: 99px; background: var(--topic, var(--muted)); flex: none; }
.row .body { flex: 1; min-width: 0; }
.row h4 { font-family: var(--serif); font-size: 1.06rem; font-weight: 600; margin: 0 0 .25rem; line-height: 1.3; }
.row .dek { color: var(--ink-2); font-size: .9rem; line-height: 1.45; margin-bottom: .45rem; }
.row .meta { display: flex; gap: .55rem; align-items: center; font-size: .76rem; color: var(--muted); flex-wrap: wrap; }

/* --------------------------------------------------------------- progress */

.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-bottom: 2.5rem; }
.tile { padding: 1.15rem 1.25rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile .k { font-size: .76rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-bottom: .45rem; }
.tile .v { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; line-height: 1; }
.tile .v small { font-family: var(--sans); font-size: .85rem; font-weight: 500; color: var(--muted); margin-left: .25rem; }
.tile .sub { font-size: .8rem; color: var(--muted); margin-top: .4rem; }

.panel { padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.panel h3 { font-size: .95rem; font-weight: 650; margin-bottom: .2rem; }
.panel .note { font-size: .82rem; color: var(--muted); margin-bottom: 1.1rem; }

.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; max-width: 100%; height: auto; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.axis-text.tabular { font-variant-numeric: tabular-nums; }
.bar-mark { fill: var(--accent); rx: 4; transition: opacity .12s; }
.bar-mark:hover { opacity: .75; }
.line-mark { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dot-mark { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

.mastery-row { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr auto; gap: .85rem; align-items: center; padding: .55rem 0; }
.mastery-row .name { display: flex; align-items: center; gap: .5rem; font-size: .89rem; font-weight: 550; }
.mastery-track { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.mastery-fill { height: 100%; border-radius: 99px; background: var(--topic, var(--accent)); }
.mastery-row .val { font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 3.4rem; text-align: right; }

.weak-item { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem 0; border-bottom: 1px solid var(--line-soft); }
.weak-item:last-child { border-bottom: 0; }
.weak-item .q { flex: 1; font-size: .92rem; line-height: 1.45; }
.weak-item .g { font-size: .8rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.tooltip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--paper); font-size: .8rem; line-height: 1.35;
  box-shadow: var(--shadow-lg); transition: opacity .12s;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tooltip.on { opacity: 1; }

/* --------------------------------------------------------------- settings */

.field { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft); }
.field:last-child { border-bottom: 0; }
.field .lbl { font-size: .93rem; font-weight: 550; }
.field .desc { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.field input[type="range"] { width: 11rem; accent-color: var(--accent); }
.field .num { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 2.5rem; text-align: right; }

.switch { position: relative; width: 2.6rem; height: 1.5rem; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px; background: var(--line);
  transition: background .18s; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem;
  border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s;
}
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(1.1rem); }

.form-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.form-row input, .form-row select {
  padding: .55rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: .9rem;
}
.form-row input { flex: 1; min-width: 12rem; }
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--accent); }

.src-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line-soft); font-size: .88rem; }
.src-row .t { flex: 1; min-width: 0; }
.src-row .t b { font-weight: 600; }
.src-row .t small { display: block; color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row.off { opacity: .45; }
.src-err { color: var(--bad); font-size: .74rem; }

/* ------------------------------------------------------------------ login */

.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(23rem, 100%); padding: 2rem; text-align: center; }
.login-card .wordmark { font-size: 1.6rem; display: block; margin-bottom: .35rem; }
.login-card p { color: var(--muted); font-size: .88rem; margin: 0 0 1.5rem; }
.login-card input {
  width: 100%; padding: .7rem .9rem; margin-bottom: .8rem; text-align: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card .btn { width: 100%; }
.err { color: var(--bad); font-size: .85rem; min-height: 1.2rem; margin-top: .6rem; }

/* ------------------------------------------------------------------ misc */

.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 1.3rem; color: var(--ink-2); margin-bottom: .5rem; }

.spinner {
  width: 1.1rem; height: 1.1rem; border-radius: 99px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(1rem);
  padding: .7rem 1.1rem; border-radius: 99px; z-index: 100;
  background: var(--ink); color: var(--paper); font-size: .88rem; font-weight: 550;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; max-width: calc(100vw - 2rem);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.fade-in { animation: fade .28s cubic-bezier(.2,.7,.3,1); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  main { padding: 1.5rem 1rem 5rem; }
  .topbar { padding: .6rem 1rem; gap: .75rem; }
  .wordmark { font-size: 1rem; }
  .nav a { padding: .35rem .6rem; font-size: .85rem; }
  .mastery-row { grid-template-columns: 1fr; gap: .3rem; }
  .mastery-row .val { text-align: left; }
}

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