:root {
  --bg: #0E1B2C; --bg-2: #0B1624; --card: #16263B; --card-2: #1F3550; --line: #24364D; --line-2: #2C4260; --line-3: #3A5272;
  --text: #E8EEF5; --text-2: #CBD6E2; --muted: #9FB1C6; --muted-2: #8A9CB1;
  --amber: #F2A33A; --ink-on-amber: #0E1B2C; --sky: #5CC8E8; --sky-2: #9BDDF0; --ok: #7BD88F; --err: #F28B82;
  --display: 'Space Grotesk', system-ui, sans-serif; --body: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 14px; --r-lg: 16px; --gutter: 20px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; }
a { color: var(--sky); } a:hover { color: var(--sky-2); }
h1, h2 { font-family: var(--display); margin: 0; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
.h-sm { font-size: 16px; } .h-lg { font-size: 20px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
@media (min-width: 560px) { body { background: var(--bg-2); } #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.screen { padding-bottom: 24px; }
.screen.has-tabs { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.loading { padding: 80px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* layout helpers */
.pad { padding: 20px var(--gutter) 0; }
.pad.top { padding-top: 28px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.px { padding-left: var(--gutter); padding-right: var(--gutter); }
.mx { margin-left: var(--gutter); margin-right: var(--gutter); }
.sect { margin-top: 24px; } .sect-sm { margin-top: 12px; }
section.card.mx { margin-top: 16px; }
.top-bar { padding-top: 14px; min-height: 52px; display: flex; align-items: center; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .baseline { align-items: baseline; }
.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.gap-xs { gap: 6px; } .gap-sm { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.spacer { height: 12px; }
.center { text-align: center; }

/* type */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--sky); }
.eyebrow.dim { color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; } .xsmall { font-size: 12px; } .lead { font-size: 15px; }
.mono { font-family: var(--mono); } .amber { color: var(--amber); } .sky { color: var(--sky); }
.pre { white-space: pre-line; }
.num { font-family: var(--display); font-size: 24px; font-weight: 700; } .num small { font-size: 13px; color: var(--muted); font-weight: 500; }
.alt { font-family: var(--display); font-size: 42px; font-weight: 700; color: var(--amber); line-height: 1; }
.alt span { font-size: 16px; color: var(--text); }
.hint { font-size: 12px; color: var(--muted); }

/* surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); text-decoration: none; color: var(--text); }
.tile:hover { color: var(--text); border-color: var(--line-3); }
.tile-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--card-2); color: var(--sky); display: flex; align-items: center; justify-content: center; }
.tile-title, .step-title { font-weight: 600; font-size: 15px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; border-radius: 4px; background: var(--amber); transition: width .4s; }
.bar.thin { height: 6px; } .bar.sky > div { background: var(--sky); }
.pill { font-family: var(--mono); font-size: 10px; padding: 4px 8px; border-radius: 10px; letter-spacing: .04em; white-space: nowrap; }
.pill.amber { background: var(--amber); color: var(--ink-on-amber); }
.pill.outline { border: 1px solid var(--sky); color: var(--sky); }
.pill.dark { background: var(--card-2); color: var(--sky); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--card-2); font-size: 13px; line-height: 1.5; }
.note svg { flex: none; color: var(--sky); margin-top: 1px; }
.viewing { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.viewing select { min-height: 36px; padding: 0 10px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--amber); color: var(--ink-on-amber); }
.btn.primary:hover { color: var(--ink-on-amber); filter: brightness(1.06); }
.btn.ghost { border-color: var(--line-2); color: var(--text); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: transparent; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--amber); border-color: var(--amber); color: var(--ink-on-amber); font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form .btn { margin-top: 8px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-size: 16px; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
details > summary { cursor: pointer; list-style: none; min-height: 32px; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }

/* auth */
.auth { padding: 40px var(--gutter); display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--amber); color: var(--ink-on-amber); display: flex; align-items: center; justify-content: center; }
.brand-sub { font-size: 13px; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 18px; background: transparent; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--card-2); color: var(--text); }

/* home */
.avatar { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--card); color: var(--amber); font-family: var(--display); font-weight: 700; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.badges { display: flex; justify-content: space-between; gap: 8px; }
.badges.wrap { flex-wrap: wrap; justify-content: flex-start; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; font-size: 11px; text-align: center; color: var(--muted-2); }
.badge-c { width: 56px; height: 56px; border-radius: 28px; border: 2px dashed var(--line-3); display: flex; align-items: center; justify-content: center; }
.badge.on { color: var(--text); } .badge.on .badge-c { background: var(--amber); border: 0; color: var(--ink-on-amber); }

/* roadmap */
.timeline { margin-top: 18px; }
.phase { display: flex; gap: 14px; }
.rail { display: flex; flex-direction: column; align-items: center; width: 28px; flex: none; }
.dot { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--sky); color: var(--sky); font-family: var(--display); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.line { flex: 1; width: 2px; background: var(--line-2); }
.phase.now .dot, .phase.past .dot { background: var(--amber); border-color: var(--amber); color: var(--ink-on-amber); }
.phase.now .line, .phase.past .line { background: var(--amber); }
.phase:last-child .line { display: none; }
.phase-body { padding-bottom: 26px; }
.list { padding: 6px 12px; display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li:hover { color: var(--text); }
.li.approved .grow { color: var(--muted); text-decoration: line-through; }
.li.in_progress .grow, .li.submitted .grow { font-weight: 600; }
.li .date { width: 56px; flex: none; }
.st { flex: none; }

/* milestone */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-size: 14px; }
.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.facts { display: flex; flex-direction: column; }
.facts h2 { margin-bottom: 6px; }
.fact { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fact:last-child { border-bottom: 0; }
.cite { font-size: 12px; text-decoration: none; }
.step { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; cursor: pointer; padding: 14px; }
.step .box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--muted-2); display: flex; align-items: center; justify-content: center; color: var(--ink-on-amber); }
.step.done .box { background: var(--amber); border-color: var(--amber); }
.step.done .step-title { color: var(--muted); }
.step:disabled { cursor: default; }
.drop { border: 2px dashed var(--line-3); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; color: var(--sky); }
.drop span { color: var(--text); } .drop .muted { color: var(--muted); }
.drop:focus-within { outline: 2px solid var(--sky); }
.proof { border-radius: 10px; max-height: 320px; object-fit: contain; background: var(--bg); }
.src { scroll-margin: 80px; }
.coach { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* school */
.ladder { display: flex; flex-direction: column; }
.rung { display: flex; gap: 14px; }
.rung .rail { width: 48px; }
.gr { width: 48px; height: 30px; border-radius: 8px; border: 1px solid var(--line-3); color: var(--muted); font-family: var(--mono); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.rung.now .gr { background: var(--amber); border-color: var(--amber); color: var(--ink-on-amber); }
.rung.done .gr { border-color: var(--amber); color: var(--amber); }
.rung:last-child .line { display: none; }
.rung-body { padding-bottom: 18px; }
.course { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.course .edit { padding-top: 4px; }

/* parent */
.dot-ok { width: 10px; height: 10px; border-radius: 5px; background: var(--ok); flex: none; }
.dot-ok.warn { background: var(--amber); }

/* tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; display: flex; justify-content: space-around; border-top: 1px solid var(--line); background: var(--bg-2); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 48px; padding-top: 6px; text-decoration: none; color: var(--muted); font-size: 11px; }
.tabbar a.on { color: var(--amber); font-weight: 600; }

/* flash */
#flash { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 488px; z-index: 20; pointer-events: none; }
.flash { padding: 12px 16px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--sky); font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.flash.err { border-color: var(--err); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
