/* Caderno de laboratório: papel quadriculado frio, tinta azul-cobalto, vetores com código de cores fixo
   (peso vermelho, normal azul, aplicada verde, atrito âmbar, tração violeta). */
:root {
  --bg: #f2f4f8;
  --grid: rgba(40, 70, 216, 0.05);
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --ink: #17203a;
  --muted: #586180;
  --line: #d8ddea;
  --accent: #2846d8;
  --accent-ink: #ffffff;
  --accent-soft: #e7ebff;
  --ok: #1d7a49; --ok-soft: #e3f4ea;
  --bad: #b0361f; --bad-soft: #fbe8e3;
  --warn: #8f5b00; --warn-soft: #fff3d6;
  --v-p: #cf3f2a; --v-n: #1f6fc7; --v-f: #198553; --v-at: #c27705; --v-t: #7b3fc4; --v-c: #c1336f; --v-v: #0a8796; --v-el: #7b3fc4;
  --st-none: #8a91a8; --st-learning: #2f6fd0; --st-review: #b86e00; --st-provisional: #0e8a8a; --st-proven: #1d7a49;
  --body-ramp: #e3e8f5;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 70, 0.06), 0 4px 14px rgba(20, 30, 70, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1323; --grid: rgba(142, 162, 255, 0.05); --surface: #161d33; --surface-2: #1b2340; --ink: #e8ebf6; --muted: #a3abc4; --line: #2b3454;
    --accent: #93a6ff; --accent-ink: #0e1323; --accent-soft: #232c55;
    --ok: #5fd39a; --ok-soft: #133426; --bad: #ff8a73; --bad-soft: #3a1d18; --warn: #f2c25a; --warn-soft: #3a2e12;
    --v-p: #ff7a63; --v-n: #6fb1ff; --v-f: #4fd18f; --v-at: #f5b13d; --v-t: #b58cff; --v-c: #ff79b0; --v-v: #46d3e3; --v-el: #b58cff;
    --st-none: #8790aa; --st-learning: #7aa8ff; --st-review: #f2b347; --st-provisional: #4fd6d6; --st-proven: #5fd39a;
    --body-ramp: #2a3459;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1323; --grid: rgba(142, 162, 255, 0.05); --surface: #161d33; --surface-2: #1b2340; --ink: #e8ebf6; --muted: #a3abc4; --line: #2b3454;
  --accent: #93a6ff; --accent-ink: #0e1323; --accent-soft: #232c55;
  --ok: #5fd39a; --ok-soft: #133426; --bad: #ff8a73; --bad-soft: #3a1d18; --warn: #f2c25a; --warn-soft: #3a2e12;
  --v-p: #ff7a63; --v-n: #6fb1ff; --v-f: #4fd18f; --v-at: #f5b13d; --v-t: #b58cff; --v-c: #ff79b0; --v-v: #46d3e3; --v-el: #b58cff;
  --st-none: #8790aa; --st-learning: #7aa8ff; --st-review: #f2b347; --st-provisional: #4fd6d6; --st-proven: #5fd39a;
  --body-ramp: #2a3459;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
}
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); }
sub, sup { line-height: 0; }
dfn { font-style: normal; font-weight: 700; border-bottom: 2px dotted var(--accent); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.warn { color: var(--warn); font-weight: 600; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- moldura ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark .bm-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.brand-mark .bm-dot { fill: var(--accent); }
.brand-mark .bm-arrow { stroke: var(--v-p); stroke-width: 2.5; }
.brand-mark .bm-head { fill: var(--v-p); }
.brand b { font-family: var(--font-display); font-size: 1.1rem; display: block; line-height: 1.1; }
.brand span { font-size: 0.78rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--ink); padding: 6px 12px; font: 600 0.85rem var(--font-body); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }

.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 56px); }
#nav {
  position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); align-self: start; max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 16px 12px 40px; border-right: 1px solid var(--line); background: var(--surface);
}
.nav-group { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.nav-group:last-child { border-bottom: 0; }
.nav-h { margin: 4px 10px; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
#nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 0.95rem; }
#nav a:hover { background: var(--surface-2); }
#nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
#nav .num, .num { font-family: var(--font-mono); font-size: 0.8rem; min-width: 1.6em; height: 1.6em; display: inline-grid; place-items: center; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); flex: none; }
#nav .dot { margin-left: auto; font-size: 0.9rem; }
#nav .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 0.72rem; padding: 1px 7px; font-weight: 700; }

main#view { padding-block: 24px 80px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 920px; width: 100%; outline: none; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-block; }
  #nav { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 0; bottom: 0; width: min(300px, 85vw); max-height: none; z-index: 25; transform: translateX(-105%); transition: transform 0.2s ease; padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  body.nav-open #nav { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 15, 30, 0.35); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- componentes ---------- */
.page-h { display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.callout { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--r); padding: 14px 16px; }
.callout h2 { font-size: 1.05rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: 600 0.95rem var(--font-body); padding: 9px 16px; min-height: 42px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 0.875rem; }
.btn.big { font-size: 1.05rem; padding: 12px 20px; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px 0; }
input[type=text], input[type=number], input[type=date], select, textarea {
  font: 1rem var(--font-body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; max-width: 100%;
}
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.92rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1.5px solid currentColor; white-space: nowrap; }
.st-none { color: var(--st-none); } .st-learning { color: var(--st-learning); } .st-review { color: var(--st-review); } .st-provisional { color: var(--st-provisional); } .st-proven { color: var(--st-proven); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 600 0.85rem var(--font-body); cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.matrix td small { color: var(--muted); }

/* ---------- início ---------- */
.hero-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 640px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-main { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; border-top: 4px solid var(--accent); }
.hero-main h2 { font-size: 1.5rem; }
.countdown { text-align: center; }
.big-num { font: 700 3rem/1 var(--font-mono); color: var(--accent); margin: 6px 0; font-variant-numeric: tabular-nums; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.stat .v { font: 700 1.35rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .d { font-size: 0.8rem; color: var(--muted); }
.steps-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.topic-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; flex-wrap: wrap; }
.topic-list a:hover { background: var(--surface-2); }
.topic-list .tt { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.topic-list small { color: var(--muted); }

/* ---------- lição ---------- */
.stepper { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.stepper button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; cursor: pointer; font: 600 0.7rem var(--font-body); min-width: 0; }
.stepper .l { font: 700 1rem var(--font-mono); }
.stepper .n { line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.stepper button.seen { color: var(--ink); border-color: var(--accent-soft); background: var(--surface-2); }
.stepper button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 720px) { .stepper .n { display: none; } }
.step-l { font-family: var(--font-mono); color: var(--accent); margin-right: 4px; }
.prose { max-width: 68ch; }
.prose ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.statement { font-size: 1.05rem; }
details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 700; color: var(--accent); }
details.more, details.model { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; }
.predict { background: var(--accent-soft); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.formula { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; background: var(--surface-2); }
.formula .expr { font: 600 1.35rem var(--font-mono); color: var(--accent); margin-bottom: 8px; overflow-x: auto; }
.formula.compact .expr { font-size: 1.1rem; }
.syms .sym { font-family: var(--font-mono); font-weight: 700; white-space: nowrap; }
.fdl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 10px 0 0; }
.fdl dt { font-weight: 700; margin-top: 6px; }
.fdl dd { margin: 0; }
.exsteps { display: flex; flex-direction: column; gap: 8px; padding-left: 1.4em; }
.exsteps li { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.mistake { display: grid; gap: 12px; }
.mistake > div { border-radius: 8px; padding: 12px 14px; }
.m-wrong { background: var(--bad-soft); } .m-why { background: var(--surface-2); } .m-fix { background: var(--ok-soft); }
.m-wrong p { text-decoration: line-through; text-decoration-color: var(--bad); }
.remember .summary { font-size: 1.1rem; background: var(--accent-soft); padding: 12px 14px; border-radius: 8px; }
.checks { list-style: none; padding: 0; }
.checks label { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; }

/* ---------- figuras SVG ---------- */
svg.fig { width: 100%; max-width: 560px; height: auto; display: block; margin: 8px auto; font-family: var(--font-body); }
.q-fig svg.fig { max-width: 420px; }
svg .vec line { stroke-width: 3; stroke: currentColor; }
svg .vec polygon { fill: currentColor; }
svg .vec text { fill: currentColor; font-size: 12px; font-weight: 700; }
svg .vec.dash line { stroke-dasharray: 5 4; stroke-width: 2; }
svg .v-p { color: var(--v-p); } svg .v-n { color: var(--v-n); } svg .v-f { color: var(--v-f); } svg .v-at { color: var(--v-at); } svg .v-t { color: var(--v-t); } svg .v-c { color: var(--v-c); } svg .v-v { color: var(--v-v); } svg .v-el { color: var(--v-el); }
svg .body { fill: var(--body-ramp); stroke: var(--ink); stroke-width: 1.5; }
svg .blabel { fill: var(--ink); font: 700 11px var(--font-mono); }
svg .ground, svg .beam { stroke: var(--ink); stroke-width: 2.5; }
svg .beam { stroke-width: 6; stroke-linecap: round; stroke: var(--muted); }
svg .hatch { stroke: var(--muted); stroke-width: 1; }
svg .ramp { fill: var(--surface-2); stroke: var(--ink); stroke-width: 1.5; }
svg .ramp-line { stroke: var(--ink); stroke-width: 3; }
svg .angle { fill: none; stroke: var(--muted); stroke-width: 1.5; }
svg .cable, svg .spring { stroke: var(--ink); stroke-width: 2; fill: none; }
svg .pivot { fill: var(--ink); }
svg .path { stroke: var(--line); stroke-width: 2; stroke-dasharray: 6 5; }
svg .stone { fill: var(--accent); }
svg .lbl, svg .tick, svg .alabel, svg .mlabel { fill: var(--muted); font-size: 11px; font-family: var(--font-mono); }
svg .alabel { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font-body); }
svg .big { fill: var(--ink); font-size: 30px; font-weight: 700; }
svg .dim line { stroke: var(--muted); stroke-width: 1; }
svg .dim text { fill: var(--muted); font-size: 11px; font-family: var(--font-mono); }
svg .axis { stroke: var(--ink); stroke-width: 1.5; }
svg .grid { stroke: var(--line); stroke-width: 1; }
svg .line { stroke-width: 3; fill: none; }
svg .line.s0 { stroke: var(--accent); } svg .line.s1 { stroke: var(--muted); stroke-width: 1.5; }
svg .area { fill: var(--accent-soft); stroke: none; }
svg .mark { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
svg .bar.b0 { fill: var(--v-v); } svg .bar.b1 { fill: var(--v-n); } svg .bar.b2 { fill: var(--accent); } svg .bar.b3 { fill: var(--v-at); }

/* ---------- simulações ---------- */
.sim { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 8px; }
@media (max-width: 760px) { .sim { grid-template-columns: minmax(0, 1fr); } }
.sim-stage { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; min-width: 0; }
.sim-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sim-controls { display: flex; flex-direction: column; gap: 10px; }
.ctrl label { flex-direction: row; justify-content: space-between; gap: 8px; font-size: 0.88rem; }
.ctrl output { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 28px; }
.readout { margin: 0; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.readout div { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.readout dt { color: var(--muted); font-size: 0.85rem; }
.readout dd { margin: 0; font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.readout .big dd { color: var(--accent); font-size: 1.05rem; }
.readout .warn dd { color: var(--warn); font-family: var(--font-body); }

/* ---------- questões ---------- */
.question { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.q-statement { font-size: 1.05rem; }
.note { background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; font-size: 0.9rem; margin: 0; }
.opts { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; }
.opt { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: 500 0.98rem var(--font-body); text-align: left; }
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: 4px; accent-color: var(--accent); }
.opt.is-ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-ok::after { content: '✔'; margin-left: auto; color: var(--ok); font-weight: 700; }
.opt.is-bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-bad::after { content: '✘'; margin-left: auto; color: var(--bad); font-weight: 700; }
.num-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.num-row label { flex: 1 1 140px; }
.num-row input { font-family: var(--font-mono); font-size: 1.1rem; }
.q-help { display: flex; flex-wrap: wrap; gap: 6px; }
.hints { display: flex; flex-direction: column; gap: 6px; }
.hint { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 6px; padding: 8px 12px; }
.hint.sol { border-left-color: var(--warn); }
.feedback .big { font-size: 1.1rem; font-weight: 700; }
.errtype { display: inline-block; font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--bad-soft); margin-left: 6px; }
.sol { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 6px; font-family: var(--font-body); }
.controls { display: flex; flex-direction: column; gap: 10px; }
.session { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); margin: 0; }

/* ---------- erros, cartões, simulado, progresso ---------- */
.err-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.inline-q:empty { display: none; }
.empty { text-align: center; }
.flash { display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--v-t); }
.flash .front { font: 600 1.25rem var(--font-display); }
.flash .back { font-size: 1.1rem; background: var(--ok-soft); padding: 12px; border-radius: 8px; }
.qmap { display: flex; flex-wrap: wrap; gap: 6px; }
.qmap button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 0.85rem var(--font-mono); cursor: pointer; }
.qmap button.done { background: var(--accent-soft); }
.qmap button.on { outline: 3px solid var(--accent); }
.clock { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.review.ok-b { border-left: 5px solid var(--ok); } .review.bad-b { border-left: 5px solid var(--bad); }
.topic-progress { display: flex; flex-direction: column; gap: 6px; }
details.tp { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
details.tp summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink); }
details.tp .tt { flex: 1; min-width: 140px; }
.crit { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; }
.crit li { color: var(--muted); }
.crit li.met { color: var(--ok); }
.badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.badges li { padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--line); color: var(--muted); }
.badges li.got { border-style: solid; color: var(--ink); background: var(--warn-soft); }
.xp { font-family: var(--font-mono); }
.routes { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.routes legend { font-weight: 700; margin-bottom: 6px; }
.route { border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; font-weight: 500; }
.route.on { border-color: var(--accent); background: var(--accent-soft); }
.route input { position: absolute; opacity: 0; }
.route:focus-within { outline: 3px solid var(--accent); }
.plan { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.plan ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.danger { border-color: var(--bad); }

/* ---------- modal e avisos ---------- */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 15, 30, 0.5); display: grid; place-items: center; padding: 16px; }
#modal[hidden] { display: none; }
.modal-box { background: var(--surface); color: var(--ink); border-radius: 12px; width: min(720px, 100%); max-height: 90vh; overflow: auto; padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
#toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-weight: 600; box-shadow: var(--shadow); max-width: 320px; }

/* ---------- impressão ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, #nav, .btn, #toasts, .stepper, .q-help { display: none !important; }
  .layout { display: block; }
  main#view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .formula .expr { color: #000; }
}
