/* Italiano. Design notes: a celadon typewriter plate, paper sheets, round keycaps.
   Black ribbon = normal, red ribbon = retry laps. Italian text is "typed" (Courier Prime). */

:root {
  --plate: #dde4da;
  --sheet: #f5f7f2;
  --ink: #18211c;
  --ink-2: #47544c;
  --line: #b4c1b3;
  --line-2: #c8d2c6;
  --key-ink: #f5f7f2;
  --ok: #1f6f4a;
  --ok-bg: #d3e8da;
  --bad: #c8372d;
  --bad-bg: #f4dad5;
  --focus: #2457c5;
  --shadow: rgba(24, 33, 28, 0.38);
  --sans: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;
  --nav-w: 212px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --plate: #121714; --sheet: #1b221e; --ink: #e9eee7; --ink-2: #a9b6ac; --line: #3a4740; --line-2: #2b362f;
    --key-ink: #121714; --ok: #6fd0a0; --ok-bg: #1d3a2c; --bad: #ff8a7e; --bad-bg: #45211d; --focus: #8fb4ff; --shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --plate: #121714; --sheet: #1b221e; --ink: #e9eee7; --ink-2: #a9b6ac; --line: #3a4740; --line-2: #2b362f;
  --key-ink: #121714; --ok: #6fd0a0; --ok-bg: #1d3a2c; --bad: #ff8a7e; --bad-bg: #45211d; --focus: #8fb4ff; --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--plate); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans); font-optical-sizing: auto;
  min-height: 100vh; min-height: 100dvh;
}
[lang='it'], .mono { font-family: var(--mono); }
h1, h2, h3 { font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.85rem, 4.2vw, 2.6rem); }
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 0.9em; }
a { color: inherit; text-underline-offset: 3px; }
code { font-family: var(--mono); background: var(--line-2); padding: 0 0.3em; border-radius: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--key-ink); padding: 0.6rem 1rem; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------------ shell */
#app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
body.focus #app { grid-template-columns: minmax(0, 1fr); }
body.focus .nav { display: none; }

.nav {
  position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 22px 14px; gap: 18px; border-right: 1.5px solid var(--ink);
}
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav li a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.98rem;
}
.nav li a:hover { background: var(--line-2); }
.nav li a.on { background: var(--ink); color: var(--key-ink); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--key-ink); display: grid; place-items: center;
  font: 700 1.05rem var(--mono); box-shadow: 0 3px 0 var(--shadow);
}
.brand-name { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; }
.sync { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-2); padding: 0 8px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.sync-dot.synced { background: var(--ok); }
.sync-dot.syncing { background: var(--ink-2); }
.sync-dot.error { background: var(--bad); }

main { min-width: 0; outline: none; padding: 34px clamp(18px, 4vw, 48px) 72px; }
.page { max-width: 1080px; margin: 0 auto; }
.page.narrow { max-width: 740px; }
.page.practice { max-width: 760px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head.slim { margin: 30px 0 4px; align-items: center; }
.page-head.slim h2 { margin: 0; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 60ch; margin-top: 8px; }
.empty { color: var(--ink-2); }
.hint { font-size: 0.9rem; color: var(--ink-2); max-width: 62ch; }
.hint-inline { font-size: 0.88rem; color: var(--ink-2); align-self: center; }
.status-line { color: var(--ink-2); }
.source, .ref, .gloss { font-size: 0.88rem; color: var(--ink-2); }
.ref { margin: 14px 0 0; }

/* ---------------------------------------------------------------- buttons */
.btn, .go-btn, .grade, .choice, .pair, .tok, .key, .icon-btn, .speak { font: inherit; cursor: pointer; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 650;
  background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; padding: 0.55em 1.2em; line-height: 1.2;
  box-shadow: 0 3px 0 var(--shadow); transition: transform 0.06s, box-shadow 0.06s;
}
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.btn.primary { background: var(--ink); color: var(--key-ink); }
.btn.primary:hover { background: var(--ink); filter: brightness(1.18); }
.btn.quiet { border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 4px; padding-inline: 0.7em; }
.btn.quiet:hover { background: transparent; text-decoration-thickness: 2px; }
.btn.quiet:active { transform: none; }
.btn.small { font-size: 0.88rem; padding: 0.4em 0.95em; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn:disabled, .go-btn:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; align-items: center; }
.actions.center { justify-content: center; }

.key {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: var(--key-ink); font-family: var(--mono); font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 3px 0 var(--shadow); display: inline-grid; place-items: center; padding: 0; transition: transform 0.06s, box-shadow 0.06s;
}
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.key.small { width: 26px; height: 26px; font-size: 0.8rem; box-shadow: 0 2px 0 var(--shadow); flex: none; }
.key.plain { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); box-shadow: none; }
.accents { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; }
.icon-btn { background: transparent; border: 1.5px solid var(--ink); border-radius: 50%; width: 38px; height: 38px; display: inline-grid; place-items: center; text-decoration: none; font-size: 1.3rem; line-height: 1; flex: none; }
.icon-btn:hover { background: var(--line-2); }
.speak { background: transparent; border: 0; padding: 2px 6px; border-radius: 50%; color: var(--ink-2); display: inline-grid; place-items: center; margin-left: 4px; vertical-align: middle; }
.speak:hover { color: var(--ink); background: var(--line-2); }
.icon { display: inline-grid; place-items: center; }

/* ---------------------------------------------------------------- sheet */
.sheet {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 5px 5px 12px 12px; padding: clamp(20px, 4vw, 34px);
  box-shadow: 0 1px 0 var(--line), 0 7px 0 -3px var(--sheet), 0 8px 0 -3px var(--line), 0 14px 0 -6px var(--sheet), 0 15px 0 -6px var(--line);
  margin-bottom: 26px;
}
.sheet-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; color: var(--ink-2); font-size: 0.88rem; }
.flash-ok { animation: flashok 0.5s ease-out; }
.flash-bad { animation: flashbad 0.5s ease-out; }
@keyframes flashok { from { background: var(--ok-bg); } to { background: var(--sheet); } }
@keyframes flashbad { from { background: var(--bad-bg); } to { background: var(--sheet); } }

/* ------------------------------------------------------------- exercises */
.ex .prompt { font-size: 1.2rem; font-weight: 550; margin: 0 0 16px; }
.ex .prompt .say { color: var(--ink-2); font-weight: 500; }
.fill-line { font: 400 clamp(1.15rem, 3.2vw, 1.45rem)/2.5 var(--mono); margin: 0; overflow-wrap: anywhere; }
.blank {
  font: 700 inherit var(--mono); font-size: 1em; color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  text-align: center; margin: 0 0.15em; padding: 0 0.1em; max-width: 100%; min-width: 3.2ch;
}
.blank:focus { outline: none; background: var(--line-2); border-bottom-color: var(--focus); }
.blank.ok, .line-input.ok { color: var(--ok); border-bottom-color: var(--ok); }
.blank.bad, .line-input.bad { color: var(--bad); border-bottom-color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; }
.line-input, select, textarea, input[type='number'] {
  font: 400 1.2rem var(--mono); width: 100%; color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 8px 2px;
}
textarea.line-input { border: 1.5px solid var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 1rem; font-family: var(--sans); resize: vertical; }
input[type='text'].line-input:not(.ok):not(.bad):focus, select:focus, textarea:focus, input[type='number']:focus { outline: none; background: var(--line-2); border-color: var(--focus); }
select { font-family: var(--sans); font-size: 1rem; border: 1.5px solid var(--ink); border-radius: 8px; padding: 9px 10px; background: var(--sheet); }
input[type='number'] { width: 7ch; font-size: 1rem; font-family: var(--sans); text-align: center; border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px; }
.num { font-variant-numeric: tabular-nums; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: transparent; border: 1.5px solid var(--ink); border-radius: 10px; padding: 11px 14px;
  font-family: var(--mono); font-size: 1.08rem; box-shadow: 0 3px 0 var(--shadow);
}
.choice:hover:not(:disabled) { background: var(--line-2); }
.choice:disabled { cursor: default; }
.choice.ok { background: var(--ok-bg); border-color: var(--ok); }
.choice.bad { background: var(--bad-bg); border-color: var(--bad); }
.choice.bad .choice-text { text-decoration: line-through; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.pair { display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; border: 1.5px solid var(--ink); border-radius: 10px; padding: 9px 12px; font-size: 1rem; }
.pair:hover:not(:disabled) { background: var(--line-2); }
.pair.active { outline: 3px solid var(--focus); outline-offset: 1px; }
.pair.paired { background: var(--line-2); }
.pair.ok { background: var(--ok-bg); border-color: var(--ok); }
.pair.bad { background: var(--bad-bg); border-color: var(--bad); }
.pair .tag:empty { display: none; }
.pair[lang='it'] { font-family: var(--mono); }

.order-line { min-height: 62px; border-bottom: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; margin-bottom: 16px; }
.order-line.ok { border-bottom-color: var(--ok); }
.order-line.bad { border-bottom-color: var(--bad); }
.order-line .placeholder { color: var(--ink-2); font-family: var(--sans); font-size: 0.95rem; }
.order-bank { display: flex; flex-wrap: wrap; gap: 10px; }
.tok { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 10px; padding: 7px 14px; font-family: var(--mono); font-size: 1.15rem; box-shadow: 0 3px 0 var(--shadow); }
.tok.used { opacity: 0.22; box-shadow: none; }
.tok.placed { background: var(--ink); color: var(--key-ink); }

.passage-ref { margin-bottom: 14px; font-size: 0.95rem; }
.passage-ref summary { cursor: pointer; color: var(--ink-2); }
.passage-ref p { font-family: var(--mono); max-width: 62ch; }

.feedback { margin-top: 22px; padding-left: 16px; border-left: 5px solid var(--ok); }
.feedback.bad { border-left-color: var(--bad); }
.feedback .verdict { font-weight: 750; font-size: 1.1rem; margin: 0 0 4px; }
.feedback.ok .verdict { color: var(--ok); font-family: var(--mono); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .answer { font-size: 1.3rem; margin: 0 0 6px; white-space: pre-wrap; }
.feedback .explain, .feedback .note { margin: 0 0 4px; color: var(--ink-2); }

.practice-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.practice-title h1 { font-size: 1.1rem; letter-spacing: 0; }
.practice-meta { display: flex; gap: 10px; align-items: center; font-size: 0.88rem; color: var(--ink-2); }
.rail { height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-bottom: 24px; border: 1px solid var(--line); }
.rail-fill { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.3s; }
.round-chip { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 1px 10px; border-radius: 99px; border: 1.5px solid var(--ink); }
.round-chip.retry { background: var(--bad); border-color: var(--bad); color: #fff; }
.interlude h2, .summary h2 { margin-top: 0; }
.stubborn ul { list-style: none; margin: 0; padding: 0; }
.stubborn li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.stubborn .p { color: var(--ink-2); }
.stubborn .a { font-weight: 700; }

/* ---------------------------------------------------------------- facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px 22px; margin: 18px 0; }
.facts dt { font-size: 0.85rem; color: var(--ink-2); }
.facts dd { margin: 0; font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.facts.inline { display: flex; gap: 34px; flex-wrap: wrap; }
.facts.big dd { font-size: 1.9rem; }

/* ------------------------------------------------------------ dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 44px; max-width: 1180px; }
.hero { margin-bottom: 26px; }
.typed {
  font: 700 clamp(1.5rem, 4.4vw, 2.3rem)/1.2 var(--mono); letter-spacing: 0; display: inline-block; overflow: hidden; white-space: nowrap; max-width: 100%;
  border-right: 3px solid var(--ink); width: calc(var(--n, 20) * 1ch); animation: type 1s steps(var(--n, 20)) both, caret 0.7s step-end 4 forwards;
}
@keyframes type { from { width: 0; } }
@keyframes caret { 50% { border-right-color: transparent; } 100% { border-right-color: transparent; } }
.hero-line { font-size: 1.12rem; margin: 10px 0 12px; }
.goal { height: 12px; border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; max-width: 460px; background: var(--sheet); }
.goal span { display: block; height: 100%; background: var(--ink); transition: width 0.5s; }
.go { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 8px; }
.go-btn {
  display: flex; flex-direction: column; gap: 2px; text-align: left; text-decoration: none; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 12px; padding: 14px 16px; box-shadow: 0 3px 0 var(--shadow);
}
.go-btn:hover:not(:disabled) { background: var(--line-2); }
.go-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.go-btn.primary { background: var(--ink); color: var(--key-ink); grid-column: 1 / -1; }
.go-btn.primary:hover { background: var(--ink); filter: brightness(1.18); }
.go-btn.off { opacity: 0.55; }
.go-label { font-weight: 700; font-size: 1.02rem; }
.go-sub { font-size: 0.86rem; opacity: 0.8; }
.side section { margin-bottom: 30px; }
.side h2 { margin-top: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar-good { fill: var(--ink); }
.chart .bar-bad { fill: var(--bad); }
.chart .bar-empty { fill: var(--line); }
.chart .goal-line { stroke: var(--ink-2); stroke-dasharray: 3 3; stroke-width: 1; }
.chart .axis { font: 600 9px var(--mono); fill: var(--ink-2); }
.chart .axis.today { fill: var(--ink); font-weight: 700; }
.legend { font-size: 0.82rem; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; }
.sw { width: 10px; height: 10px; display: inline-block; border-radius: 2px; margin-left: 8px; }
.sw.good { background: var(--ink); } .sw.bad { background: var(--bad); } .sw.line { height: 0; width: 14px; border-top: 1.5px dashed var(--ink-2); border-radius: 0; }
.weak, .sessions { list-style: none; margin: 0; padding: 0; }
.weak li, .sessions li { padding: 9px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.weak-p { font-size: 0.95rem; color: var(--ink-2); overflow-wrap: anywhere; }
.weak-a { font-size: 1rem; display: flex; gap: 10px; flex-wrap: wrap; }
.weak-a .was { color: var(--bad); text-decoration: line-through; }
.weak-a .right { font-weight: 700; color: var(--ok); }
.s-title { font-weight: 650; }
.s-meta { font-size: 0.85rem; color: var(--ink-2); }

/* ----------------------------------------------------------------- rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 250px); gap: 8px 28px; padding: 18px 0; border-top: 1px solid var(--line); align-items: center; }
.rows .row:first-child { border-top: 1.5px solid var(--ink); }
.rows.compact .row { padding: 12px 0; }
.row-title { font-weight: 700; font-size: 1.1rem; text-decoration: none; }
a.row-title:hover { text-decoration: underline; }
.row-title.plain { cursor: default; }
.row-sub { font-size: 0.88rem; color: var(--ink-2); }
.row-text { margin: 6px 0 0; color: var(--ink-2); max-width: 58ch; }
.row-side { display: grid; gap: 6px; }
.row-num { font-size: 0.85rem; color: var(--ink-2); }
.row-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.meter { position: relative; height: 9px; border-radius: 99px; background: var(--line-2); border: 1px solid var(--line); overflow: hidden; min-width: 90px; }
.meter span { position: absolute; left: 0; top: 0; bottom: 0; }
.meter .seen { background: var(--line); } .meter .mastered { background: var(--ink); }

.module-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 270px); gap: 12px 32px; margin-bottom: 18px; }
.module-head .back { grid-column: 1 / -1; font-size: 0.9rem; color: var(--ink-2); }
.module-actions { display: grid; gap: 6px; align-content: start; }
.tabs { display: flex; gap: 6px; border-bottom: 1.5px solid var(--ink); margin: 18px 0 22px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 12px 12px 0 0; text-decoration: none; font-weight: 650; }
.tabs a:hover { background: var(--line-2); }
.tabs a.on { background: var(--ink); color: var(--key-ink); }
.notes-sec { margin-bottom: 34px; }
.notes-sec h2 { margin-top: 0; }
.prose { max-width: 66ch; }
.prose em { font-family: var(--mono); font-style: normal; font-weight: 700; }
ul.prose { padding-left: 1.2em; }

.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: 0.98rem; }
caption { text-align: left; padding: 8px 14px; font-size: 0.85rem; color: var(--ink-2); caption-side: bottom; }
th, td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line-2); vertical-align: top; }
thead th { border-top: 0; border-bottom: 1.5px solid var(--ink); font-weight: 700; }
tbody th { font-weight: 650; }
table[lang='it'] td, table.vocab th .it { font-family: var(--mono); }
td strong, th strong { font-weight: 800; }
td em, th em { font-family: var(--mono); font-style: normal; }
table.vocab td[lang] { font-family: var(--sans); }
td.num, th.num { text-align: right; }
.vnote { font: 400 0.85rem var(--sans); color: var(--ink-2); }
.status { font-size: 0.85rem; color: var(--ink-2); }

.callout { border-left: 5px solid var(--ink-2); background: var(--sheet); padding: 12px 16px; margin: 0 0 20px; border-radius: 0 8px 8px 0; max-width: 70ch; font-size: 1rem; }
.callout.tip { border-left-color: var(--ok); }
.callout.trap { border-left-color: var(--bad); }
.callout-title { display: block; margin-bottom: 2px; }
.examples { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.examples li { padding-left: 14px; border-left: 3px solid var(--line); }
.ex-it { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; }
.ex-tr { font-size: 0.9rem; color: var(--ink-2); }
.passage { margin: 0 0 22px; padding: 22px 26px; background: var(--sheet); border: 1px solid var(--line); border-radius: 5px 5px 12px 12px; box-shadow: 0 1px 0 var(--line), 0 7px 0 -3px var(--sheet), 0 8px 0 -3px var(--line); }
.passage figcaption { font-weight: 750; font-size: 1.1rem; margin-bottom: 10px; }
.passage p { font-family: var(--mono); font-size: 1.08rem; line-height: 1.85; max-width: 62ch; }

/* ------------------------------------------------------------ flashcards */
.card { text-align: center; padding-block: clamp(28px, 7vw, 60px); }
.card-face { display: grid; gap: 6px; justify-items: center; }
.card-it { font: 700 clamp(1.8rem, 6vw, 2.7rem)/1.2 var(--mono); }
.card-mean .en { font-size: clamp(1.4rem, 4.5vw, 2rem); font-weight: 700; }
.card-mean .fr { font-size: 1.15rem; color: var(--ink-2); }
.card-mean .note { font-size: 0.95rem; color: var(--ink-2); margin-top: 6px; max-width: 40ch; }
.rule { width: 60%; border: 0; border-top: 1.5px dashed var(--line); margin: 22px auto; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grade { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px 14px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--shadow); font-weight: 650; }
.grade.again { border-color: var(--bad); }
.grade.again .key { background: var(--bad); color: #fff; }
.grade:hover { background: var(--line-2); }
.cards-page .practice-meta { flex-wrap: wrap; }

/* ------------------------------------------------------------- forms etc */
.field { display: grid; gap: 6px; margin-bottom: 20px; border: 0; padding: 0; min-width: 0; }
.field > span, fieldset.field legend { font-weight: 650; font-size: 0.95rem; padding: 0; }
.field .hint { margin: 0; }
.check { display: flex; gap: 10px; align-items: center; margin: 4px 0; font-size: 1rem; }
.check.wide { align-items: flex-start; margin-bottom: 14px; }
.check.wide small { display: block; color: var(--ink-2); font-size: 0.86rem; }
input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--ink); flex: none; margin-top: 2px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; }
.preview { position: sticky; top: 18px; align-self: start; }
.preview-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.preview-canvas { border: 1px solid var(--line); background: #fff; display: block; border-radius: 4px; box-shadow: 0 3px 0 var(--shadow); }
.drop {
  display: grid; justify-items: center; gap: 4px; text-align: center; padding: 44px 20px; border: 2px dashed var(--ink); border-radius: 14px; cursor: pointer; background: var(--sheet);
}
.drop:hover, .drop.over { background: var(--line-2); }
.drop input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-main { font-weight: 750; font-size: 1.2rem; }
.drop-sub { color: var(--ink-2); font-size: 0.92rem; }
.file-line { margin: 0 0 22px; }
.working h2 { margin-top: 0; }
.indeterminate { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; border: 1px solid var(--line); }
.indeterminate span { display: block; height: 100%; width: 34%; background: var(--ink); border-radius: 99px; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { from { margin-left: -34%; } to { margin-left: 100%; } }
.review .sample ul { list-style: none; margin: 0; padding: 0; }
.review .sample li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.review .sample .p { color: var(--ink-2); }
.review .sample .a { font-weight: 700; }
.warn { margin: 12px 0; font-size: 0.92rem; }
.warn summary { cursor: pointer; font-weight: 650; }

dialog.dialog { border: 1.5px solid var(--ink); border-radius: 14px; background: var(--sheet); color: var(--ink); padding: 24px; max-width: 380px; width: calc(100% - 32px); box-shadow: 0 6px 0 var(--shadow); }
dialog::backdrop { background: rgba(10, 14, 11, 0.5); }
dialog h2 { margin-top: 0; }
dialog input { font: 1.1rem var(--sans); width: 100%; padding: 10px; border: 1.5px solid var(--ink); border-radius: 8px; background: transparent; color: var(--ink); margin: 6px 0 14px; }
dialog .row { display: flex; padding: 0; border: 0; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: var(--key-ink); padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100% - 32px); font-weight: 600; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: var(--sheet); }

.prog th a { text-decoration: none; font-weight: 650; }
.prog .meter { min-width: 110px; }
.settings h2:first-of-type { margin-top: 1.5rem; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 960px) {
  .dash { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}
@media (max-width: 820px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: fixed; z-index: 20; inset: auto 0 0 0; top: auto; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1.5px solid var(--ink); background: var(--plate); gap: 0;
  }
  .brand, .sync { display: none; }
  .nav ul { flex-direction: row; width: 100%; justify-content: space-between; }
  .nav li { flex: 1; }
  .nav li a { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 0.72rem; border-radius: 12px; text-align: center; }
  main { padding: 22px 16px 96px; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .module-head { grid-template-columns: minmax(0, 1fr); }
  .match { grid-template-columns: minmax(0, 1fr); }
  body.focus main { padding-bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .typed { border-right-color: transparent; }
}
@media print { .nav, .actions { display: none; } #app { display: block; } }

.noscript { padding: 2rem; font-family: system-ui, sans-serif; }

/* ---- Build with Claude (copy and paste handoff) ---- */
.handoff .steps { list-style: none; counter-reset: step; margin: 18px 0 0; padding: 0; display: grid; gap: 22px; }
.handoff .steps > li { counter-increment: step; position: relative; padding-left: 46px; }
.handoff .steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--key-ink); font: 700 0.95rem/1 var(--sans);
}
.handoff .steps .actions { margin-top: 10px; }
.handoff textarea { width: 100%; margin-top: 10px; }
textarea.mono { font-family: var(--mono); font-size: 0.85rem; line-height: 1.45; }
.prompt-peek { margin-top: 10px; }
.prompt-peek summary { cursor: pointer; color: var(--ink-2); font-size: 0.9rem; }
