:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dde1e7; --text: #18202b; --muted: #5c6878;
  --accent: #0b6bcb; --accent-ink: #ffffff; --accent-soft: #e3effb;
  --good: #1a7f4b; --good-soft: #e3f4ea; --bad: #c0362c; --bad-soft: #fbe7e5; --warn: #9a6400; --warn-soft: #fdf1dc;
  --term-bg: #0e141b; --term-text: #d6e2ee; --term-dim: #7f93a8; --term-accent: #67d58b;
  --d1: #0b6bcb; --d2: #7a4fd1; --d3: #0e8f7e; --d4: #c46a00; --d5: #c2367a;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #161d25; --surface-2: #1d2630; --border: #2b3643; --text: #e4eaf1; --muted: #93a1b1;
    --accent: #4fa3f7; --accent-ink: #08121c; --accent-soft: #15283b;
    --good: #4cc38a; --good-soft: #13291f; --bad: #f2756a; --bad-soft: #2f1716; --warn: #e5b45a; --warn-soft: #2d2412;
    --d1: #4fa3f7; --d2: #a689f0; --d3: #3cc6b2; --d4: #f0a04b; --d5: #ef77ad;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #161d25; --surface-2: #1d2630; --border: #2b3643; --text: #e4eaf1; --muted: #93a1b1;
  --accent: #4fa3f7; --accent-ink: #08121c; --accent-soft: #15283b;
  --good: #4cc38a; --good-soft: #13291f; --bad: #f2756a; --bad-soft: #2f1716; --warn: #e5b45a; --warn-soft: #2d2412;
  --d1: #4fa3f7; --d2: #a689f0; --d3: #3cc6b2; --d4: #f0a04b; --d5: #ef77ad;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
/* Theme the root too, so embedded browsers that don't repaint the page edge or scrollbar after the
   theme toggle (seen in the Claude app's browser pane) still switch with everything else. */
html { background: var(--bg); scrollbar-color: var(--border) var(--bg); }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
code, kbd { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.backup { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.backup .row { gap: 8px; flex-wrap: wrap; }
.bad-text { color: var(--bad); }
.support { background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.support p { max-width: 1240px; margin: 0 auto; padding: 9px 20px; font-size: .86rem; text-align: center; text-wrap: balance; }
.support strong { color: var(--accent); }
.support a { font-weight: 600; }
.ad-slot { display: flex; flex-direction: column; gap: 4px; min-height: 120px; margin: 16px 0; }
.ad-slot .ad-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ad-slot ins { flex: 1; min-height: 100px; }
.ad-ph { flex: 1; display: grid; place-items: center; min-height: 100px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .8rem; }
.ad-slot.in-feed { margin: 0; }
tr.ad-row td { padding: 4px 0; border-bottom: 0; }
tr.ad-row:hover td { background: none; }
.ad-slot.in-feed .ad-ph { min-height: 200px; }
.foot.legal { margin-top: -18px; }
.policy { max-width: 780px; margin: 0 auto; line-height: 1.6; }
.policy h2 { margin-top: 26px; font-size: 1.1rem; }
.policy ul { padding-left: 20px; }
.policy li + li { margin-top: 4px; }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
  padding: 14px max(20px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.consent-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.consent-in p { flex: 1 1 420px; min-width: 0; margin: 0; font-size: .88rem; }
.consent-now { display: block; margin-top: 6px; color: var(--muted); }
.consent-btns { display: flex; gap: 10px; flex: 0 0 auto; }
.consent-btns .btn { min-width: 110px; justify-content: center; }
@media (max-width: 600px) { .consent-btns { flex: 1 1 100%; } .consent-btns .btn { flex: 1; } }
.storage-warn { padding: 8px 20px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); }
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 18, .55); }
.modal { max-width: 420px; width: 100%; }
.modal p { margin: 0 0 14px; }
/* feedback: tab on the right edge (bottom corner on phones), form dialog, per-item report links */
.fb-tab { position: fixed; right: env(safe-area-inset-right, 0px); top: 50%; z-index: 30; transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl;
  padding: 14px 8px; border: 0; border-radius: 0 9px 9px 0; background: var(--accent); color: var(--accent-ink); font: 600 .8rem/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .05em; cursor: pointer; box-shadow: -2px 0 10px rgba(0, 0, 0, .18); }
.fb-tab:hover { filter: brightness(1.08); }
.fb-tab:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
body:has(.consent) .fb-tab { display: none; }
@media (max-width: 700px) {
  .fb-tab { top: auto; right: auto; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: none; writing-mode: horizontal-tb; border-radius: 999px; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }
  body:has(.fb-tab) { padding-bottom: 60px; } /* so the end of each page can scroll clear of the button */
}
.fb-modal { max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.fb-modal h2 { margin: 0; }
.fb-modal p { margin: 0; }
.fb-field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; }
.fb-field select, .fb-field textarea, .fb-field input { font: inherit; font-weight: 400; width: 100%; }
.fb-field textarea { resize: vertical; min-height: 110px; }
.fb-item { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-msg:empty { display: none; }
.fb-msg { padding: 9px 12px; border-radius: 8px; }
.fb-msg.good { background: var(--good-soft); color: var(--good); }
.fb-msg.bad { background: var(--bad-soft); color: var(--bad); }
.fb-msg.warn { background: var(--warn-soft); color: var(--warn); }
/* study plan, next up, drills, bookmarks, chart, shortcuts, QR, landing pages */
.plan-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 74px; margin: 14px 0 22px; }
.week .wk { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.week .wk i { display: block; width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--accent-soft); border: 1px solid var(--accent); border-bottom: 0; }
.week .wk i.met { background: var(--accent); }
.week .wk span { position: absolute; bottom: -18px; font-size: .7rem; color: var(--muted); }
.week-goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); z-index: 1; pointer-events: none; }
.week .wk { height: 100%; }
.next-item { padding: 10px 0; border-top: 1px solid var(--border); }
.next-item:first-of-type { border-top: 0; }
.mark-btn { background: none; border: 0; padding: 0 2px; font-size: 1.15rem; line-height: 1; color: var(--muted); cursor: pointer; }
.mark-btn[aria-pressed="true"] { color: var(--warn); }
.mark-btn:hover { color: var(--warn); }
.drill .timer, .qhead .timer { font-variant-numeric: tabular-nums; }
.drill-done h2 { font-size: 1.5rem; }
.chart-wrap { overflow-x: auto; }
.score-chart { width: 100%; min-width: 420px; height: auto; display: block; }
.score-chart .grid { stroke: var(--border); stroke-width: 1; }
.score-chart .axis { fill: var(--muted); font-size: 11px; }
.score-chart .target { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 5 4; }
.score-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.score-chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.score-chart .hit { fill: transparent; }
.score-chart .pt:hover .dot, .score-chart .pt:focus .dot { r: 6.5; }
.score-chart .pt:focus { outline: none; }
.score-chart .lbl { fill: var(--text); font-size: 12px; font-weight: 700; }
.kb-help { max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; }
.kb-help h3 { margin: 16px 0 6px; font-size: .9rem; color: var(--muted); }
.kb-help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
.kb-help dt { white-space: nowrap; } .kb-help dd { margin: 0; }
.qr-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.qr-img { width: 220px; max-width: 100%; background: #fff; padding: 6px; border-radius: 8px; }
.qr-img svg { display: block; width: 100%; height: auto; }
.qr-box p { flex: 1 1 200px; margin: 0; }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.landing main { display: flex; flex-direction: column; gap: 16px; }
.land-hero h1 { margin-top: 10px; text-wrap: balance; }
.land-hero .row { margin: 14px 0 6px; }
.land-stats .stat b { font-size: 1.8rem; }
.land-dom { margin-top: 16px; display: flex; gap: 8px; align-items: center; }
.certs-links { margin-top: -10px; }
.report-link { background: none; border: 0; padding: 4px 2px; color: var(--muted); font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.report-link:hover { color: var(--accent); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 11; background: var(--surface); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { fill: var(--accent); flex: none; }
.pbq-order { list-style: decimal; padding-left: 22px; margin: 0; }
.pbq-order li { margin: 6px 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.pbq-order li > * { vertical-align: middle; }
.pbq-order li { display: list-item; }
.pbq-order li span:first-child { display: inline-block; max-width: calc(100% - 90px); }
.pbq-order li .btn { float: right; margin-left: 4px; padding: 2px 8px; }
.pbq-order li.ok { border-color: var(--good, #2e9d5b); }
.pbq-order li.bad { border-color: var(--bad, #d64545); }
.res.pbq td { vertical-align: middle; }
.cert-switch { position: relative; min-width: 0; }
#certBtn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; margin-left: -8px; color: var(--text); font: inherit; cursor: pointer; text-align: left; min-width: 0; }
#certBtn:hover, #certBtn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
#certBtn .cb-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
#certBtn .cb-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#certBtn .sub { font-size: .75rem; color: var(--muted); }
#certBtn .chev { flex: none; color: var(--muted); transition: transform .15s; }
#certBtn[aria-expanded="true"] .chev { transform: rotate(180deg); }
#certMenu { position: absolute; top: calc(100% + 6px); left: -8px; z-index: 20; min-width: min(290px, calc(100vw - 24px)); max-width: calc(100vw - 32px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
#certMenu button { display: flex; flex-direction: column; width: 100%; padding: 8px 10px 8px 28px; background: none; border: 0; border-radius: 6px; color: var(--text); font: inherit; text-align: left; cursor: pointer; position: relative; }
#certMenu button:hover, #certMenu button:focus-visible { background: var(--surface-2); outline: none; }
#certMenu button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 10px; top: 8px; color: var(--accent); font-weight: 700; }
#certMenu button { flex-direction: row; align-items: center; gap: 10px; }
#certMenu .cm-text { display: flex; flex-direction: column; }
#certMenu .cm-icon { width: 30px; height: 30px; flex: none; object-fit: contain; fill: var(--accent); }
.brand-img { height: 34px; width: auto; flex: none; }
#certMenu .cm-name { font-weight: 600; }
#certMenu .cm-sub { font-size: .75rem; color: var(--muted); }
#nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
#nav[hidden] + #themeBtn { margin-left: auto; }
#nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
#nav a:hover { background: var(--surface-2); color: var(--text); }
#nav a.on { background: var(--accent-soft); color: var(--accent); }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; flex: none; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; }
.foot { max-width: 1240px; margin: 0 auto; padding: 0 20px 30px; color: var(--muted); font-size: .8rem; }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.dom-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
select, input[type=number], input[type=text], input[type=email], input[type=date], textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; max-width: 100%; }
@media (max-width: 700px) {
  /* Wide tables scroll sideways inside their card instead of widening the page. */
  table.res { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
label.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* hero */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero h1 { font-size: 1.75rem; }
.count { display: flex; gap: 14px; margin: 14px 0 6px; }
.count div { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 74px; }
.count b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.count span { font-size: .75rem; color: var(--muted); }
.stat b { font-size: 1.6rem; display: block; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }

/* domain bars */
.dbar { margin: 10px 0; }
.dbar .lbl { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 4px; }
.track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; }
.weightbar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 8px 0 4px; }
.weightbar div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: .75rem; font-weight: 700; }

/* blueprint */
.obj { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.obj:first-of-type { border-top: 0; }
.obj .id { font-family: var(--mono); font-weight: 700; }
.obj ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.verb { font-weight: 700; }
.chg li { margin: 4px 0; }

/* question */
.qwrap { max-width: 860px; margin: 0 auto; }
.qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.qtext { font-size: 1.05rem; font-weight: 500; margin: 6px 0 12px; }
pre.ex { background: var(--term-bg); color: var(--term-text); font: 13px/1.45 var(--mono); padding: 12px 14px; border-radius: 8px; overflow-x: auto; margin: 0 0 14px; white-space: pre; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice .k { font-family: var(--mono); font-weight: 700; color: var(--muted); min-width: 18px; }
.choice.sel { border-color: var(--accent); background: var(--accent-soft); }
.choice.right { border-color: var(--good); background: var(--good-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice:disabled { cursor: default; }
.exp { margin-top: 14px; padding: 12px 14px; border-radius: 9px; border-left: 4px solid var(--accent); background: var(--surface-2); }
.exp.good { border-color: var(--good); } .exp.bad { border-color: var(--bad); }
.progressline { height: 4px; background: var(--surface-2); border-radius: 99px; margin: 6px 0 16px; overflow: hidden; }
.progressline i { display: block; height: 100%; background: var(--accent); }
.qnav { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; }
.qnav button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 12px var(--mono); cursor: pointer; }
.qnav button.ans { background: var(--accent-soft); border-color: var(--accent); }
.qnav button.flag { box-shadow: inset 0 -3px 0 var(--warn); }
.qnav button.cur { outline: 2px solid var(--accent); }
.timer { font: 600 1rem var(--mono); }
.timer.low { color: var(--bad); }

/* labs */
.labcard { display: flex; flex-direction: column; gap: 8px; }
.labcard h3 { margin: 0; }
.labcard p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.labcard.done { border-color: var(--good); }
.labview { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 16px; align-items: start; }
.labside { display: flex; flex-direction: column; gap: 12px; }
.labside .card { padding: 14px; }
pre.topo { font: 12px/1.4 var(--mono); background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 6px 0 0; white-space: pre; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.tasks li:first-child { border-top: 0; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 12px; color: transparent; }
.tasks li.ok .tick { background: var(--good); border-color: var(--good); color: #fff; }
.tasks li.ok .t { color: var(--muted); }
.hint { color: var(--muted); font-size: .8rem; margin-top: 2px; font-family: var(--mono); }
.term { background: var(--term-bg); color: var(--term-text); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; border: 1px solid #1f2a36; }
.term-tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: #0a0f15; overflow-x: auto; }
.term-tabs button { background: transparent; border: 0; color: var(--term-dim); padding: 7px 14px; border-radius: 7px 7px 0 0; font: 600 13px var(--mono); cursor: pointer; white-space: nowrap; }
.term-tabs button.on { background: var(--term-bg); color: var(--term-text); }
.term-tabs .tools { margin-left: auto; display: flex; gap: 6px; padding-bottom: 4px; }
.term-tabs .tools button { padding: 4px 10px; border: 1px solid #2a3846; border-radius: 6px; font-weight: 500; }
.term-out { flex: 1; overflow: auto; padding: 12px 14px; font: 13px/1.45 var(--mono); white-space: pre; cursor: text; }
.term-out > span { display: block; min-height: 1.45em; } /* one block per entry: appending lays out only the new line */
.term-out .cmd { color: #fff; }
.term-out .err { color: #ff8f84; }
.term-out .sys { color: var(--term-accent); }
.term-line { display: flex; padding: 0 14px 12px; font: 13px var(--mono); }
.term-line span { color: #fff; white-space: pre; }
.term-line input { flex: 1; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; padding: 0 0 0 0; caret-color: var(--term-accent); }
.hosts td { padding: 3px 6px 3px 0; font-size: .85rem; }
.hosts td:first-child { font-weight: 600; }
.banner { padding: 12px 14px; border-radius: 9px; background: var(--good-soft); color: var(--good); font-weight: 600; }
textarea.code { width: 100%; min-height: 360px; font: 13px/1.5 var(--mono); background: var(--term-bg); color: var(--term-text); border-color: #1f2a36; tab-size: 2; }
pre.run { background: var(--term-bg); color: var(--term-text); font: 12.5px/1.45 var(--mono); padding: 12px; border-radius: 8px; max-height: 380px; overflow: auto; white-space: pre-wrap; margin: 0; }
.opt { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-right: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .85rem; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
table.res { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.res td, table.res th { text-align: left; padding: 7px 6px; border-top: 1px solid var(--border); }
table.res th { color: var(--muted); font-weight: 600; border-top: 0; }

/* flashcards & resources */
.flash { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 22px 26px; min-height: 260px; cursor: pointer; box-shadow: var(--shadow); text-align: center; outline: none; }
.flash:focus-visible { border-color: var(--accent); }
.flash .front, .flash .back { margin-top: 26px; }
.flash .big { font-size: 2.6rem; font-weight: 800; letter-spacing: .5px; color: var(--accent); font-family: var(--mono); word-break: break-word; }
.flash .mid { font-size: 1.25rem; font-weight: 600; margin-top: 6px; }
.flash p { color: var(--muted); max-width: 560px; margin: 12px auto 0; }
.btn kbd { background: transparent; border: 1px solid currentColor; opacity: .7; padding: 0 5px; font-size: .75em; }
.refs { margin-top: 10px; color: var(--muted); }
.refs a { margin-right: 2px; }
.res-item { padding: 10px 0; border-top: 1px solid var(--border); }
.res-item:first-of-type { border-top: 0; }

@media (max-width: 980px) {
  .labview { grid-template-columns: minmax(0, 1fr); }
  .term { height: 70vh; }
  .hero { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  #nav { order: 3; width: 100%; margin-left: 0; }
  #themeBtn { margin-left: auto; }
  main { padding: 16px 16px 32px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .obj { grid-template-columns: 44px 1fr; }
  .obj > :last-child { grid-column: 2; }
  .count div { min-width: 0; flex: 1; padding: 8px; }
}

/* ---------- touch screens (phones and tablets) ----------
   Kept last so these win over the rules above. iOS zooms the page when a field under 16px gets
   focus, so fields and the lab command line use 16px; controls get finger-sized hit areas; the
   lab terminal gets an on-screen key row for Tab, ?, arrows and Ctrl+Z. */
.term-keys { display: none; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }
.term-keys button { flex: 1 1 0; min-width: 48px; min-height: 40px; border: 1px solid #2b3643; border-radius: 7px; background: #161d25; color: var(--term-text); font: 600 14px var(--mono); cursor: pointer; touch-action: manipulation; }
.term-keys button:active { background: #223041; }
@media (pointer: coarse) {
  select, input, textarea { font-size: 16px !important; }
  .term-line, .term-line input, .term-line span { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
  .mark-btn { min-width: 36px; min-height: 36px; }
  .report-link { min-height: 36px; }
  .foot.legal a { display: inline-block; padding: 6px 0; }
  .qnav button { width: 38px; height: 38px; }
  .term-tabs button, .term-tabs .tools button { min-height: 38px; }
  .term-line { padding-top: 6px; }
  .term-line input { min-height: 32px; }
  .term-keys { display: flex; }
}
/* Narrow phones: the certification menu spans the screen instead of starting at the title. */
@media (max-width: 420px) {
  #certMenu { left: -40px; width: calc(100vw - 24px); min-width: 0; max-width: none; }
}
/* Chart values that don't depend on hover tooltips (touch screens never show those). */
.week .wk-n { font-size: .68rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; line-height: 1; }
.score-chart .pt { cursor: pointer; }
.score-chart .val { fill: var(--text); font-size: 12px; font-weight: 600; opacity: 0; pointer-events: none; }
.score-chart .pt:hover .val, .score-chart .pt:focus .val { opacity: 1; }

/* ---------- phone and tablet layout ---------- */
/* Support banner close button */
.support { position: relative; }
.support p { padding-right: 44px; padding-left: 44px; }
.support-x { position: absolute; top: 50%; right: max(8px, env(safe-area-inset-right, 0px)); transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.support-x:hover { background: var(--surface); color: var(--text); }

/* Chip buttons for study links (What to study next, Blueprint) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; max-width: 100%; min-height: 30px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .82rem; font-weight: 500; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Lab Tasks / Terminal switch: only where the lab stacks into one column */
.lab-switch { display: none; }
@media (max-width: 980px) {
  .lab-switch { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h, 58px) + 6px); z-index: 6; }
  .lab-switch button { flex: 1; min-height: 40px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
  .lab-switch button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .lab-switch .ls-n { font-weight: 500; color: var(--muted); font-size: .85em; }
  .labview:not(.show-work) > :nth-child(2) { display: none; }
  .labview.show-work > .labside { display: none; }
  .labview.show-work .term { height: calc(100vh - 260px); min-height: 360px; }
}

/* Exam and practice: position and timer only shown in the pinned bar on phones */
.qa-pos { display: none; }

/* Bottom tab bar (phones) */
.bottombar { display: none; }
.sheet-back { place-items: center; }
.sheet { max-width: 360px; width: 100%; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 1000px) {
  body:not(.landing) #nav { display: none; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
    padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .bottombar a, .bottombar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; border: 0; background: none; color: var(--muted); font: 600 .68rem/1.1 system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none; border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .bottombar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottombar .on { color: var(--accent); background: var(--accent-soft); }
  body:has(.bottombar) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  body:has(.fb-tab) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .fb-tab { display: none !important; }
  .consent { bottom: 0; z-index: 45; }
  /* Pinned answer bar */
  .q-actions { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 5; margin: 14px -18px -18px !important; padding: 10px 18px; background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
  .q-actions .qa-pos { display: inline; font-variant-numeric: tabular-nums; }
  .q-actions .qa-rule { display: none; }
  .q-actions .btn { min-height: 44px; }
  /* More sheet */
  .sheet-back { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; max-width: none; border-radius: 16px 16px 0 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; }
}
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 4px auto 10px; }
.sheet-item { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 600; text-decoration: none; text-align: left; cursor: pointer; }
.sheet-item.small { font-weight: 500; color: var(--muted); min-height: 44px; }
.sheet-item:hover, .sheet-item:focus-visible { background: var(--surface-2); }
.sheet-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.sheet-close { margin-top: 8px; justify-content: center; min-height: 44px; }
/* Compact exam bar on phones: icons and short labels on one row */
@media (max-width: 700px) {
  .q-actions { flex-wrap: nowrap; gap: 6px; }
  .q-actions .qa-l { display: none; }
  .q-actions .btn { padding: 8px 12px; }
  .q-actions:not(:last-child) { margin-bottom: 0 !important; border-radius: 0; }
}
@media (max-width: 360px) { .q-actions .qa-pos { display: none !important; } }
@media (max-width: 700px) { .q-actions .btn, .q-actions .qa-pos { white-space: nowrap; } .q-actions .qa-pos { font-size: .78rem; } }
/* Grid cells may shrink below their content's width (long chip labels truncate instead of widening the page). */
.grid > * { min-width: 0; }
@media (max-width: 1000px) { #themeBtn { margin-left: auto; } }
/* inline-block so long chip labels end in "…" */
.chip { display: inline-block; line-height: 20px; padding: 5px 12px; }
@media (pointer: coarse) { .chip { padding: 8px 14px; } }
