/* ASVAB Prep - phone-first dark theme. No external fonts, images or scripts. */
:root {
  --bg: #0a1320;          /* page: deep navy */
  --bg2: #101d2e;         /* cards and chart surface (validated for the chart colours) */
  --bg3: #172941;         /* inputs, chips */
  --line: #25384f;
  --ink: #eef3fa;
  --ink2: #bac7d9;
  --ink3: #8a9bb2;
  --gold: #f2bb3a;        /* the one action colour */
  --gold-ink: #1b1300;
  --red: #f0646a;         /* wrong / weak */
  --green: #46c28a;       /* right */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;   /* chart lines (dataviz-validated on --bg2) */
  --surface: var(--bg2);
  --grid: #1f3249;
  --axis: #3a5170;
  --display: "Bahnschrift", "DIN Alternate", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; font: 17px/1.5 var(--body); color: var(--ink); background: var(--bg); min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: .005em; }
h1 { font-size: 32px; }
h2 { font-size: 24px; margin: 28px 0 10px; }
h3 { font-size: 19px; margin: 18px 0 6px; }
p { margin: 8px 0; }
a { color: var(--gold); }
small, .muted { color: var(--ink3); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { max-width: 540px; margin: 0 auto; padding: 0 16px 104px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 8px; position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5; }
/* r3 (QA same pass): the sticky header also covers the 16 px page margins, so text scrolling under it cannot peek out at the sides
   (the 2 px "speck" left of the name button in 06-graphs.png was the edge of a heading's first letter) */
.top { box-shadow: -16px 0 var(--bg), 16px 0 var(--bg); }
.who { background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; min-height: 44px; font-weight: 600; cursor: pointer; }
.sync { font-size: 13px; color: var(--ink3); text-align: right; }
.sync.bad { color: var(--red); }
.view { padding-top: 6px; }
.lead { color: var(--ink2); margin-top: 6px; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg3); color: var(--ink); font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none; text-align: center; }
.btn.go { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:active:not([disabled]) { transform: scale(.985); }
.btn.sm { min-height: 44px; font-size: 15px; width: auto; display: inline-flex; padding: 8px 14px; border-radius: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* cards */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.card.flat { border-color: transparent; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }
.big { font-family: var(--display); font-size: 56px; font-weight: 700; line-height: 1; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.kpi { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kpi b { display: block; font-family: var(--display); font-size: 28px; line-height: 1.1; }
.kpi span { font-size: 13px; color: var(--ink3); }
.pill { display: inline-block; white-space: nowrap; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--bg3); border: 1px solid var(--line); color: var(--ink2); }
.pill.weak { border-color: var(--red); color: var(--red); }
.pill.ok { border-color: var(--green); color: var(--green); }

/* forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text] { width: 100%; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg3); color: var(--ink); padding: 10px 14px; font: inherit; font-size: 20px; }
input[type=text]::placeholder { color: var(--ink3); }
.err { color: var(--red); font-weight: 600; min-height: 24px; margin: 8px 0; }
.hint { font-size: 14px; color: var(--ink3); margin: 4px 0; }

/* readiness board */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.tile { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; min-height: 96px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); text-align: left; cursor: pointer; }
.tile b { font-family: var(--display); font-size: 26px; line-height: 1; }
.tile .pct { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1; }
.tile .st { font-size: 13px; font-weight: 600; opacity: .92; }
.tile.empty { border-style: dashed; color: var(--ink3); }
.tile.weak { box-shadow: inset 0 0 0 2px var(--red); }
.tile:active { transform: scale(.98); }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(10, 19, 32, .97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs nav { max-width: 540px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; color: var(--ink3); text-decoration: none; font-size: 12.5px; font-weight: 600; }
.tabs a svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current=page] { color: var(--gold); }

/* test screen */
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 10px; }
.qhead .count { font-family: var(--display); font-size: 22px; font-weight: 700; }
.qhead .timer { font-variant-numeric: tabular-nums; color: var(--ink2); font-weight: 600; }
.prog { height: 8px; border-radius: 4px; background: var(--bg3); overflow: hidden; margin-bottom: 14px; }
.prog i { display: block; height: 100%; background: var(--gold); border-radius: 4px; transition: width .2s; }
.qmeta { font-size: 14px; color: var(--ink3); margin-bottom: 4px; }
.qtext { font-size: 19px; line-height: 1.45; white-space: pre-line; margin: 4px 0 12px; }
.qfig { margin: 8px 0 14px; }
svg.fig { display: block; width: 100%; height: auto; border-radius: 12px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 58px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg2); text-align: left; cursor: pointer; font-size: 18px; line-height: 1.35; }
.opt .ltr { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg3); font-weight: 700; font-family: var(--display); font-size: 18px; }
.opt[aria-pressed=true] { border-color: var(--gold); background: #1b2a3a; }
.opt[aria-pressed=true] .ltr { background: var(--gold); color: var(--gold-ink); }
.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optgrid .opt { flex-direction: column; align-items: stretch; padding: 8px; gap: 6px; min-height: 0; }
.optgrid .opt .ltr { align-self: flex-start; flex: none; width: 34px; }
.optgrid .opt svg { width: 100%; height: auto; }
.opt.right { border-color: var(--green); background: #10281f; }
.opt.wrong { border-color: var(--red); background: #2b1519; }
.opt .why { display: block; font-size: 15px; color: var(--ink2); margin-top: 4px; font-weight: 400; }
.opt .tag { font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }
.tag.good { background: var(--green); color: #04150d; }
.tag.bad { background: var(--red); color: #1d0507; }
.remember { background: #1a2433; border-left: 4px solid var(--gold); padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.foot { position: sticky; bottom: 0; padding: 14px 0 8px; background: linear-gradient(rgba(10, 19, 32, 0), var(--bg) 35%); z-index: 4; }
.btn .lbl { display: flex; flex-direction: column; line-height: 1.25; }
.btn .lbl small { font-weight: 500; font-size: 14px; color: var(--ink3); }
.btn.go .lbl small { color: rgba(27, 19, 0, .75); }
.debrief .rows { margin: 4px 0 8px; }
.qcard .body .trow { padding-left: 0; padding-right: 0; }
/* text links that lead to the next screen get a full 44 px tap area (checked by tests/e2e_extra.py, step H) */
.lesson .muted a, .src a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.feedback { padding: 12px 14px; border-radius: 12px; font-weight: 700; margin: 12px 0; }
.feedback.ok { background: #10281f; border: 1px solid var(--green); }
.feedback.no { background: #2b1519; border: 1px solid var(--red); }

/* review */
.qcard { border: 1px solid var(--line); border-radius: 14px; background: var(--bg2); margin: 10px 0; overflow: hidden; }
.qcard > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; min-height: 56px; }
.qcard > summary::-webkit-details-marker { display: none; }
.qcard .mark { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.qcard .mark.ok { background: var(--green); color: #04150d; }
.qcard .mark.no { background: var(--red); color: #1d0507; }
.qcard .sum { flex: 1; font-size: 16px; }
.qcard .sum small { display: block; }
.qcard .body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg3); font-weight: 600; cursor: pointer; }
a.chip { text-decoration: none; color: var(--ink); line-height: 1.3; display: inline-flex; align-items: center; gap: 6px; }
a.chip small { color: var(--ink3); }
.chip[aria-pressed=true] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.debrief p { margin: 10px 0; }
.debrief .links { display: grid; gap: 8px; margin-top: 12px; }

/* bars */
.bars { display: grid; gap: 6px; margin: 8px 0; }
.barrow { display: grid; grid-template-columns: 1fr 84px auto; gap: 10px; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.barrow .bl small { display: block; color: var(--ink3); font-size: 12.5px; }
.barrow .track { height: 14px; border-radius: 4px; background: #12263d; overflow: hidden; }
.barrow .fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.barrow .bv { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink2); min-width: 50px; text-align: right; }
.barrow.low .bv { color: var(--red); font-weight: 700; }

/* lessons */
.acc { border: 1px solid var(--line); border-radius: 14px; background: var(--bg2); margin: 10px 0; }
.acc > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; min-height: 60px; font-weight: 700; }
.acc > summary::-webkit-details-marker { display: none; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; min-height: 56px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.card .trow { padding-left: 0; padding-right: 0; }
.tblx td, .tblx th { font-variant-numeric: tabular-nums; }
.dotk { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink3); display: inline-block; flex: none; }
.dotk.weak { background: var(--red); border-color: var(--red); }
.dotk.mid { background: var(--gold); border-color: var(--gold); }
.dotk.good { background: var(--green); border-color: var(--green); }
.lesson ul { padding-left: 22px; margin: 8px 0; }
.lesson li { margin: 6px 0; }
.ex { background: var(--bg3); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.ex b { display: block; margin-bottom: 4px; }

/* charts */
.chart { margin: 14px 0; padding: 14px 12px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.chart figcaption, .mini figcaption { display: flex; flex-direction: column; gap: 2px; }
.chart figcaption strong { font-family: var(--display); font-size: 20px; }
.chart figcaption span { color: var(--ink3); font-size: 14px; }
.plotwrap { position: relative; touch-action: pan-y; }
svg.plot { width: 100%; height: auto; display: block; overflow: visible; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .ref { stroke: var(--axis); stroke-width: 1; }
svg .cross { stroke: var(--ink3); stroke-width: 1; }
svg .tick { fill: var(--ink3); font-size: 14px; }   /* r2 (D7): >= 12 px on a 360 px phone */
svg .reftext { fill: var(--ink3); font-size: 14px; }
svg .endl { fill: var(--ink2); font-size: 14.5px; font-weight: 700; }
svg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .dot { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 2px; font-size: 14px; color: var(--ink2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; top: 0; left: 0; pointer-events: none; background: #0a1522; border: 1px solid var(--axis); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; line-height: 1.35; min-width: 120px; z-index: 3; }
.tip b { display: block; }
.tbl { margin: 6px 0 2px; }
.tbl summary { cursor: pointer; color: var(--gold); min-height: 44px; display: flex; align-items: center; font-size: 15px; }
.tscroll { overflow-x: auto; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.note { font-size: 13.5px; color: var(--ink3); margin: 6px 0 2px; }
.mult { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.mini { margin: 0; padding: 10px 10px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mini figcaption strong { font-family: var(--display); font-size: 18px; margin-right: 4px; }
.mini figcaption span { font-size: 12px; color: var(--ink3); }
.mini svg { width: 100%; height: auto; display: block; }
.mini svg .ref { stroke: var(--grid); }
.minival { font-weight: 700; font-size: 15px; margin-top: 2px; }
.minival.weak b { color: var(--red); font-size: 12.5px; margin-left: 4px; }
svg.spark { width: 120px; height: 34px; }

/* study plan table etc. */
.tblx { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0; }
.tblx th, .tblx td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tblx th { color: var(--ink3); font-weight: 600; }
/* r3 (QA R2): the study-plan time table must fit a 320 px phone: two-line header, smaller header text, tighter cells */
.tblx.cat th, .tblx.cat td { padding: 8px 4px; }
.tblx.cat thead th { font-size: 14px; line-height: 1.25; }
@media (max-width: 359px) { .tblx.cat { font-size: 14px; } .tblx.cat thead th { font-size: 13px; } }
ol.steps { padding-left: 22px; }
ol.steps li { margin: 8px 0; }
.src { font-size: 14px; color: var(--ink2); }
.src li { margin: 8px 0; word-break: break-word; }
.warn { border-left: 4px solid var(--gold); background: #1a2433; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 15px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(4, 9, 16, .78); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal .box { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; max-width: 440px; width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 700px) { body { font-size: 18px; } }
