/* DevOps Nimbus Python for DevOps. Calm product-page styling: system font, solid surfaces,
   hairline borders, one accent (#9c9aff, the same as on the DevOps Nimbus page). */
:root {
  --bg: #fbfbfd; --surface: #fff; --surface-2: #f5f5f7; --text: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7; --hair: rgba(0, 0, 0, .08);
  --accent: #605dff; --accent-fill: #9c9aff; --accent-fill-hover: #8988e0; --on-fill: #1d1d1f; --accent-hover: #524fd9; --accent-2: #605dff; --accent-soft: #f3f3ff; --on-accent: #fff;
  --stage-accent: #9c9aff; /* the dark stage keeps the dark-mode accent */
  --ok: #1d8a3a; --ok-soft: #e9f6ec; --bad: #d70015; --bad-soft: #fdecee; --warn: #c77700; --warn-text: #8a5300; --warn-soft: #fff4e0;
  --code-bg: #f0f0f3; --nav: #fbfbfd;
  --stage: #0b0b0d; --stage-text: #f5f5f7; --stage-muted: #8e8e93; --stage-line: rgba(255, 255, 255, .09);
  --term: #0d1117; --term-text: #e6edf3; --term-dim: #8b949e;
  --shadow: 0 2px 8px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .06);
  --radius: 18px; --radius-sm: 12px; --ease: cubic-bezier(.22, .8, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --surface: #1c1c1e; --surface-2: #161617; --text: #f5f5f7; --muted: #a1a1a6; --line: #424245; --hair: rgba(255, 255, 255, .1);
    --accent: #9c9aff; --accent-fill: #9c9aff; --accent-fill-hover: #aba9ff; --on-fill: #000000; --accent-hover: #b0aeff; --accent-2: #9c9aff; --accent-soft: #2e2e42; --on-accent: #000;
    --ok: #30d158; --ok-soft: #0f2e18; --bad: #ff6961; --bad-soft: #3a1414; --warn: #ffb340; --warn-text: #ffcc80; --warn-soft: #3a2a0c;
    --code-bg: #2c2c2e; --nav: #161617; --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, sans-serif; letter-spacing: -.01em; font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0; }
code, pre { font-size: .86em; }
:not(pre) > code { background: var(--code-bg); padding: .12em .4em; border-radius: 6px; }
pre { background: var(--code-bg); padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 0; line-height: 1.6; }
h1, h2, h3, h4 { letter-spacing: -.02em; line-height: 1.12; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
button { font: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 30; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.note { color: var(--muted); font-size: .88rem; }
.lede { color: var(--muted); font-size: 1.15rem; margin: -6px 0 24px; max-width: 700px; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hair); padding: 22px 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Navigation: a translucent bar that content scrolls under; its hairline shows once it does. */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--nav) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top.scrolled { border-bottom-color: var(--hair); }
.top-inner { display: flex; align-items: center; gap: 18px; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
/* Two modes: Learn (the course) and Fix (the reference for something broken now). */
.kbd-btn { display: inline-flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); background: var(--code-bg); border: 1px solid transparent; border-radius: 99px; padding: 5px 6px 5px 14px; cursor: pointer; }
kbd { font: 500 .72rem/1 "SF Mono", ui-monospace, Menlo, monospace; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }

/* Hero: immersive, plain in light mode, the stage colour in dark mode. */
.hero { padding: 88px 0 72px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 19px; margin: 0 0 6px; }
.hero h1 { font-size: clamp(44px, 7vw, 80px); line-height: 1.04; letter-spacing: -.02em; font-weight: 700; margin: 0 0 18px; }
.hero .sub { font-size: clamp(19px, 2.2vw, 24px); color: var(--muted); line-height: 1.35; max-width: 660px; margin: 0 0 30px; }
.actions { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.btn { border-radius: 99px; padding: 12px 22px; font-size: 17px; background: var(--accent-fill); color: var(--on-fill); }
.btn:hover, .link:hover { text-decoration: none; }
.btn:hover { background: var(--accent-fill-hover); }
.link { font-size: 17px; }
.link::after { content: " ›"; }
.doors { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.door { padding: 24px 26px; border-radius: 22px; border: 1px solid var(--hair); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.door h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.02em; }
.door p { margin: 0; color: var(--muted); }
.door .door-k { font-size: .85rem; font-weight: 600; color: var(--accent); }
.door.fix { background: var(--oncall); border-color: transparent; color: var(--on-oncall); }
.door.fix p, .door.fix .door-k { color: color-mix(in srgb, var(--on-oncall) 72%, transparent); }
.door .actions { margin-top: 10px; }
.door-search { display: flex; gap: 8px; margin-top: 10px; }
.door-search input[type="search"] { flex: 1; min-width: 0; border-radius: 99px; }
.mode-banner { margin: 32px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--hair); box-shadow: inset 3px 0 0 var(--oncall); font-size: .95rem; }
.stage { position: relative; margin-top: 56px; background: var(--stage); color: var(--stage-text); border-radius: 30px; padding: 30px; overflow: hidden; isolation: isolate; border: 1px solid var(--stage-line); }
.stage::before { content: ""; position: absolute; inset: -40% -10% auto; height: 120%; background: radial-gradient(closest-side, color-mix(in srgb, var(--stage-accent) 30%, transparent), transparent 70%); z-index: -1; pointer-events: none; }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 13px; color: var(--stage-muted); }
.stage-bar strong { color: var(--stage-text); font-weight: 600; font-size: 15px; }
.toggle { border: 1px solid var(--stage-line); background: rgba(255, 255, 255, .06); color: var(--stage-text); border-radius: 99px; padding: 7px 14px; font-size: 13px; white-space: nowrap; }
.toggle:hover { text-decoration: none; border-color: var(--stage-accent); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; border-bottom: 1px solid var(--stage-line); }
.chart i { flex: 1; border-radius: 4px 4px 0 0; background: var(--stage-accent); transition: height .5s var(--ease), background .3s; }
.chart i.err { background: #ff453a; }
.readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.readout b { display: block; font-size: 26px; letter-spacing: -.03em; }
.readout .ok { color: #30d158; } .readout .bad { color: #ff453a; }
.dim { color: var(--stage-muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hair); border-radius: 22px; overflow: hidden; margin: 56px 0 0; }
.stats div { background: var(--surface); padding: 26px; }
.stats b { display: block; font-size: 40px; letter-spacing: -.04em; line-height: 1.1; }
.stats span { color: var(--muted); font-size: 15px; }
@media (prefers-color-scheme: dark) {
  .hero { background: var(--stage); }
  .stats { background: var(--stage-line); }
  .stats div { background: #161618; }
}

.section-title { font-size: clamp(30px, 4.2vw, 44px); letter-spacing: -.02em; font-weight: 700; margin: 80px 0 10px; max-width: 800px; }
.small-title { font-size: 1.6rem; margin-top: 48px; }
.section-sub { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; max-width: 720px; }
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; margin-top: 32px; }
.tile { background: var(--surface); border: 1px solid var(--hair); border-radius: 26px; padding: 26px; grid-column: span 2; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .3); }
.tile.wide { grid-column: span 3; }
.tile .k { color: var(--accent); font-weight: 600; font-size: 15px; }
.tile h3 { font-size: 26px; margin: 8px 0 0; }
.tile p { color: var(--muted); margin: 10px 0 0; font-size: 15px; }

/* Buttons and chips */
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 20px; border-radius: 99px; font-size: .95rem; color: var(--accent); background: transparent; border: 1px solid var(--accent); cursor: pointer; }
.pill:hover { text-decoration: none; background: var(--accent-soft); }
.pill.primary { background: var(--accent-fill); color: var(--on-fill); border-color: var(--accent-fill); }
.small-pill { min-height: 34px; padding: 0 16px; font-size: .86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; font-size: .84rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 4px 13px; border-radius: 99px; cursor: pointer; line-height: 1.3; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.quiet { color: var(--muted); }
.copy { font-size: .8rem; border: 1px solid var(--line); background: var(--surface); color: var(--accent); padding: 5px 12px; border-radius: 99px; cursor: pointer; flex: none; white-space: nowrap; }
.copy:hover { text-decoration: none; border-color: var(--accent); }
.copy.lab { color: var(--muted); }
.link-btn { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Playground: an editor beside the output */
.playground { margin-top: 24px; scroll-margin-top: 64px; }
.pg-scenarios { margin: 0 0 16px; padding: 4px 20px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); }
.pg-group { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: start; gap: 8px 16px; padding: 12px 0; }
.pg-group + .pg-group { border-top: 1px solid var(--hair); }
.pg-group-name { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: .84rem; font-weight: 600; }
.pg-group-count, .count { font-size: .72rem; font-weight: 500; color: var(--muted); background: var(--code-bg); border-radius: 99px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.pg-group-count.done { color: var(--ok); }
.pg-group-items { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-scn { font-size: .82rem; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.pg-scn:hover { border-color: var(--accent); }
.pg-scn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pg-scn-done { color: var(--ok); font-weight: 700; }
.pg-scn[aria-pressed="true"] .pg-scn-done { color: inherit; }
.pg-brief { margin-bottom: 16px; }
.pg-brief-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pg-brief h3 { margin: 0 0 8px; font-size: 1.35rem; }
.pg-brief p { margin: 0 0 10px; }
.pg-goal { display: inline-block; font-size: .92rem; font-weight: 500; padding: 7px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--text); }
.pg-goal.done { background: var(--ok-soft); color: var(--ok); }
.pg-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.pg-editor, .pg-term { background: var(--term); color: var(--term-text); border-radius: var(--radius); border: 1px solid var(--hair); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.pg-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px 9px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); font: .78rem "SF Mono", ui-monospace, Menlo, monospace; color: var(--term-dim); min-height: 52px; }
.pg-buttons { display: flex; gap: 6px; }
.pg-editor .pill { color: var(--term-text); border-color: rgba(255, 255, 255, .25); }
.pg-editor .pill:hover { background: rgba(255, 255, 255, .08); }
.pg-editor .pill.primary { background: var(--stage-accent); border-color: var(--stage-accent); color: #000; }
.pg-code-wrap { display: flex; flex: 1; min-height: 420px; position: relative; }
.pg-gutter { flex: none; width: 44px; overflow: hidden; padding: 12px 8px 12px 0; text-align: right; font: 13px/1.6 "SF Mono", ui-monospace, Menlo, monospace; color: #545d68; user-select: none; }
.pg-gutter span { display: block; }
.pg-gutter span.err { color: #ff7b72; font-weight: 700; }
#pg-code { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--term-text); caret-color: var(--stage-accent); padding: 12px 14px 12px 6px; font: 13px/1.6 "SF Mono", ui-monospace, Menlo, Consolas, monospace; white-space: pre; overflow: auto; tab-size: 4; }
.pg-editor:focus-within { border-color: var(--accent); }
.pg-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* Side by side, the editor takes --split of the row (set by app.js) and a divider resizes it. */
.pg-split { display: none; }
@media (min-width: 901px) {
  .pg-body { grid-template-columns: minmax(0, var(--split, 72%)) 16px minmax(0, 1fr); column-gap: 0; }
  .pg-split { align-self: stretch; display: flex; justify-content: center; cursor: col-resize; touch-action: none; outline: none; }
  .pg-split::before { content: ""; width: 1px; border-radius: 2px; background: var(--line); transition: width .15s ease-out, background-color .15s ease-out; }
  .pg-split:is(:hover, :focus-visible, :active)::before { width: 3px; background: var(--accent-fill); }
  .pg-code-wrap { min-height: clamp(460px, 62vh, 720px); }
}
.pg-out { overflow: auto; padding: 12px 16px; height: 300px; font: 12.5px/1.55 "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.pg-line { white-space: pre-wrap; word-break: break-word; min-height: 1.55em; }
.pg-line.cmd { color: #79c0ff; }
.pg-line.err { color: #ffa198; }
.pg-line.dim { color: var(--term-dim); }
.pg-line.ok { color: #56d364; font-weight: 600; white-space: pre-wrap; }
.pg-status h3 { margin: 0 0 10px; font-size: 1rem; }
.pg-status { padding: 18px 20px; }
.pg-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .92rem; }
.pg-checks li { display: flex; gap: 10px; align-items: flex-start; }
.pg-check-dot { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--code-bg); color: var(--muted); font-size: .72rem; font-weight: 700; }
.pg-checks li.ok .pg-check-dot { background: var(--ok); color: #fff; }
.pg-checks li.bad .pg-check-dot { background: var(--bad); color: #fff; }
#pg-hint p { margin: 14px 0 0; font-size: .92rem; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.pg-real { margin-top: 16px; padding: 14px 20px; }
.pg-real summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.pg-real pre { margin-top: 12px; white-space: pre-wrap; word-break: break-word; }

/* Path */
.progress-row { display: flex; align-items: center; gap: 14px; margin: 6px 0 8px; }
.bar { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent-fill); transition: width .5s var(--ease); }
#bar-text { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.stage-name { font-size: 1.25rem; margin: 36px 0 12px; }
.levels { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hair); overflow: hidden; }
.level { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 18px 22px; border-top: 1px solid var(--hair); scroll-margin-top: 70px; }
.level:first-child { border-top: 0; }
.level input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ok); }
.level-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.level .num { font: .82rem "SF Mono", ui-monospace, Menlo, monospace; color: var(--muted); }
.level.done strong { color: var(--muted); }
.topic { color: var(--muted); font-size: .88rem; }
.level .learn { margin: 8px 0; padding-left: 20px; font-size: .94rem; }
.lab { display: grid; gap: 6px; }
.lab-cmd { display: flex; align-items: center; gap: 10px; background: var(--code-bg); border-radius: 10px; padding: 8px 10px 8px 12px; margin: 4px 0; min-width: 0; }
.lab-cmd code { flex: 1; min-width: 0; background: none; padding: 0; overflow-wrap: anywhere; font-size: .82rem; }

/* Scripts */
.scripts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.script-group { grid-column: 1 / -1; margin: 22px 0 -4px; }
.script-group:first-child { margin-top: 0; }
.script h3 { margin: 0; font-size: 1.3rem; }
.script-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.script h4 { margin: 16px 0 6px; font-size: .85rem; color: var(--muted); }
.script p { margin: 8px 0 0; }
pre.sample { font-size: .78rem; max-height: 320px; }

/* Quiz */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); max-width: 560px; margin-bottom: 22px; }
.field.wide { max-width: 760px; }
select, input[type="search"] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; }
select:focus, input[type="search"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.score { position: sticky; top: 60px; z-index: 5; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 18px; }
.score .result { margin: 8px 0 0; }
.question { margin-bottom: 16px; }
.question h3 { font-size: 1.12rem; margin: 0 0 16px; font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
.tag { margin: 0 0 6px; font-size: .78rem; color: var(--muted); }
.options { display: grid; gap: 10px; }
.opt { font-size: 1rem; text-align: left; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right::before { content: "✓  "; color: var(--ok); font-weight: 700; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong::before { content: "✕  "; color: var(--bad); font-weight: 700; }
.opt:disabled:not(.right):not(.wrong) { opacity: .55; }
.feedback { margin: 14px 0 0; }
.feedback:empty { display: none; }
.feedback.ok strong { color: var(--ok); }
.feedback.bad strong { color: var(--bad); }

/* Script X-ray */
.xray-paste { margin-bottom: 18px; }
.xray-paste-label { display: block; font-weight: 600; margin-bottom: 8px; }
#xray-input { width: 100%; font: .86rem/1.6 "SF Mono", ui-monospace, Menlo, Consolas, monospace; color: var(--text); background: var(--code-bg); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 12px 14px; resize: vertical; }
#xray-input:focus { outline: none; border-color: var(--accent); }
.xray-paste-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
#xray-examples { display: contents; }
.xray-result-title { font-weight: 600; margin: 0 0 10px; }
.xray-missing { margin-bottom: 14px; }
.xray-missing summary { cursor: pointer; font-weight: 600; color: var(--warn-text); }
.xray-review { margin: 6px 0 0; padding-left: 20px; font-size: .92rem; }
.xray { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.code { list-style: none; margin: 0; padding: 10px 0; background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); border-radius: var(--radius); overflow-x: auto; counter-reset: ln; }
.code li { counter-increment: ln; display: flex; }
.code li::before { content: counter(ln); width: 38px; flex: none; text-align: right; padding-right: 12px; color: var(--muted); font: .76rem/2.1 "SF Mono", ui-monospace, Menlo, monospace; opacity: .6; }
.code > #xray-note { display: block; margin: 6px 10px 10px; }
.line { flex: 1; text-align: left; border: 0; background: transparent; color: var(--text); font: .82rem/2.1 "SF Mono", ui-monospace, Menlo, Consolas, monospace; white-space: pre; padding: 0 14px 0 4px; cursor: pointer; border-radius: 6px; }
.line:hover, .line.on { background: var(--accent-soft); }
.line.on { box-shadow: inset 3px 0 0 var(--accent); }
.line.blank { cursor: default; }
.line.blank:hover { background: none; }
.line.warn { box-shadow: inset 3px 0 0 var(--warn); }
.line.unknown { color: var(--muted); }
#xray-note { position: sticky; top: 72px; }
#xray-note pre { margin-bottom: 12px; white-space: pre-wrap; }
.xray-warn { color: var(--warn-text); background: var(--warn-soft); padding: 8px 12px; border-radius: 10px; font-size: .92rem; }

/* Troubleshoot */
.doctor-groups { margin: 0 0 20px; padding: 4px 20px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); }
.doctor-group { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 16px; padding: 12px 0; }
.doctor-group + .doctor-group { border-top: 1px solid var(--hair); }
.doctor-group-name { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: .84rem; font-weight: 600; }
.doctor-group-items { display: flex; flex-wrap: wrap; gap: 8px; }
#fix-out { scroll-margin-top: 72px; }
.fix-none { padding: 14px 0; }
.fix-none h3 { margin: 0 0 4px; font-size: 1rem; }
.fix-none > p, .fix-none-line { margin: 0; color: var(--muted); font-size: .92rem; }
.fix-none-line { padding: 14px 0; }
.fix-none .doctor-group { margin-top: 12px; border-top: 1px solid var(--hair); }
.fix h3 { margin: 0 0 12px; font: 600 1.1rem "SF Mono", ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.fix h4 { margin: 18px 0 6px; font-size: .86rem; color: var(--muted); }
.fix p, .fix ul { margin: 0; }
.fix ul { padding-left: 20px; }
.fix .causes { list-style: none; padding: 0; margin: 0; counter-reset: cause; display: grid; gap: 12px; }
.fix .cause { counter-increment: cause; position: relative; padding: 12px 0 12px 34px; border-top: 1px solid var(--hair); }
.fix .cause:first-child { border-top: 0; padding-top: 4px; }
.fix .cause::before { content: counter(cause); position: absolute; left: 0; top: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 20px; text-align: center; }
.fix .cause:first-child::before { top: 4px; }
.fix .cause-k { margin: 10px 0 4px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.fix .cause pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.fix > .note { margin-top: 8px; color: var(--muted); font-size: .92rem; }
.learn-it { margin-top: 24px; padding: 18px 20px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--hair); }
.fix .learn-it h4 { margin-top: 0; color: var(--text); }
.learn-it > p { margin: 4px 0 0; }
pre.err-text { color: var(--bad); background: var(--bad-soft); white-space: pre-wrap; word-break: break-word; }

/* Cheat sheet */
.group { font-size: 1rem; color: var(--muted); margin: 28px 0 10px; }
.cheats { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); border-radius: var(--radius); overflow: hidden; }
.cheats li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--hair); }
.cheats li:first-child { border-top: 0; }
.cheats li > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cheats code { background: none; padding: 0; overflow-wrap: anywhere; }
.cheats .muted { font-size: .86rem; }
.cheat-actions { display: flex; gap: 6px; flex: none; }

/* Architecture */
.arch-figure { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.arch-svg { display: block; width: 100%; height: auto; font-family: inherit; }
.arch-panel { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.arch-panel-label { fill: var(--muted); font-size: 12px; font-weight: 600; }
.arch-edge { fill: none; stroke: var(--line); stroke-width: 1.5; transition: stroke .15s, opacity .15s; }
.arch-edge.is-on { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; animation: arch-flow .9s linear infinite; }
@keyframes arch-flow { to { stroke-dashoffset: -11; } }
#arch-arrow path { fill: var(--line); }
#arch-arrow-on path { fill: var(--accent); }
.arch-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.arch-dot.is-on { opacity: 1; }
.arch-box { cursor: pointer; outline: none; transition: opacity .15s; }
.arch-box rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; transition: fill .15s, stroke .15s; }
.arch-name { fill: var(--text); font-weight: 600; text-anchor: middle; }
.arch-short { fill: var(--muted); text-anchor: middle; }
.arch-box:hover rect, .arch-box.is-on rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.arch-box.is-near rect { stroke: var(--accent); }
.arch-box:focus-visible rect { stroke: var(--accent); stroke-width: 3; }
.has-focus .arch-box:not(.is-on):not(.is-near), .has-focus .arch-edge:not(.is-on) { opacity: .4; }
.arch-tour { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.arch-caption { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; min-width: 220px; }
.arch-step { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.arch-tip { position: absolute; left: 0; top: 0; width: 300px; pointer-events: none; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 14px 16px; z-index: 2; opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), visibility .16s; }
.arch-tip.is-shown { opacity: 1; visibility: visible; }
.arch-tip h3 { margin: 0 0 4px; font-size: 1rem; }
.arch-tip p { margin: 0 0 8px; font-size: .86rem; line-height: 1.45; }
.arch-detail { margin-top: 16px; }
.arch-detail h3 { margin: 0 0 6px; }
.arch-detail h4 { margin: 14px 0 4px; font-size: .85rem; color: var(--muted); }
.arch-detail p, .arch-detail ul { margin: 0; font-size: .94rem; }
.arch-detail pre { margin-top: 6px; font-size: .8rem; white-space: pre-wrap; word-break: break-word; }
.arch-where { color: var(--accent); font-size: .78rem; font-weight: 600; margin: 0 0 2px; }
.stdlib { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.stdlib-card { padding: 18px; }
.stdlib-card h4 { margin: 0 0 4px; font: 600 1rem "SF Mono", ui-monospace, Menlo, monospace; color: var(--accent); }
.stdlib-card p { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
.stdlib-card pre { font-size: .76rem; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }

/* Palette */
/* The palette is a material: --p (0 to 1, set by app.js) scales it out of the search button
   and brings in its opacity, its blur and the dimming behind it together. */
.palette { --p: 1; width: min(600px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--hair); border-radius: var(--radius); color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 32px 80px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .06);
  -webkit-backdrop-filter: saturate(calc(1 + .8 * var(--p))) blur(calc(30px * var(--p))); backdrop-filter: saturate(calc(1 + .8 * var(--p))) blur(calc(30px * var(--p)));
  opacity: var(--p); transform: scale(calc(.92 + .08 * var(--p))); transform-origin: var(--ox, 50%) var(--oy, 0); }
.palette::backdrop { background: rgb(0 0 0 / calc(var(--p, 1) * .3)); }
#palette-input { width: 100%; font: inherit; font-size: 1.1rem; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--hair); padding: 18px 20px; outline: none; }
#palette-list { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
#palette-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
#palette-list li[aria-selected="true"] { background: var(--accent-soft); }
.pal-kind { color: var(--muted); font-size: .78rem; flex: none; }
.palette-foot { font-size: .76rem; margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--hair); }
/* On phones the palette is a bottom sheet: app.js moves it by --y and dims the page by --p.
   It covers most of the screen, so it is solid: through it the page would only show as ghosts.
   ::after carries the surface below it when it is pulled up. Its grip is a 40x5 bar that
   takes presses in the strip around it. */
.palette-grip { display: none; }
.palette.sheet { width: 100%; max-width: none; max-height: 80vh; margin: auto 0 0; overflow: visible; border-width: 1px 0 0; border-radius: 22px 22px 0 0;
  background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; opacity: 1; transform: translateY(var(--y, 0)); }
.palette.sheet::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 120px; background: inherit; }
.palette.sheet[open] { display: flex; flex-direction: column; }
.palette.sheet .palette-grip { display: block; flex: none; align-self: center; padding: 10px 60px 4px; cursor: grab; touch-action: none; }
.palette-grip::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.palette.sheet #palette-list { flex: 1; min-height: 0; max-height: none; }
.palette.sheet .palette-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

/* Footer */
main { min-height: 70vh; padding-bottom: 40px; }
.tab > h2 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 48px 0 14px; }
.tab > .mode-banner + h2 { margin-top: 28px; }
.foot { margin-top: 88px; background: var(--surface-2); border-top: 1px solid var(--hair); color: var(--muted); font-size: .86rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-top: 48px; padding-bottom: 36px; }
.foot-brand p { margin: 14px 0 18px; max-width: 420px; }
.foot-col { display: flex; flex-direction: column; gap: 10px; }
.foot-col h2 { margin: 4px 0; font-size: .8rem; color: var(--text); letter-spacing: 0; }
.foot-col a { color: var(--muted); width: fit-content; }
.foot-col a:hover { color: var(--text); text-decoration: none; }
.foot-base { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hair); padding-top: 18px; padding-bottom: 40px; font-size: .8rem; }
.foot-base p { margin: 0; }
.foot-base a { color: inherit; text-decoration: underline; }

/* Motion: only where it says what changed. */
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 60% { transform: scale(1.25); } 100% { opacity: 1; transform: none; } }
.tab.tab-in { animation: in .24s var(--ease) both; }
.pg-goal.done, .feedback.ok, .feedback.bad { animation: in .24s var(--ease) both; }
.pg-scn.just-solved .pg-scn-done, .pg-group-count.bump { display: inline-block; animation: pop .5s var(--ease) both; }
/* Press feedback lands on pointer-down. */
:is(.btn, .pill, .kbd-btn, .copy, .toggle, .chip, .pg-scn, .tile, .sw):active { transform: scale(.97); transition: transform .1s ease-out; }

@media (max-width: 900px) {
  .pg-body, .xray { grid-template-columns: minmax(0, 1fr); }
  .scripts, .stdlib { grid-template-columns: minmax(0, 1fr); }
  .pg-group, .doctor-group { grid-template-columns: minmax(0, 1fr); }
  #xray-note { position: static; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .kbd-btn span { display: none; }
  .kbd-btn { padding: 5px; }
  .doors { grid-template-columns: minmax(0, 1fr); }
  .door-search { flex-direction: column; }
  .hero { padding: 48px 0 48px; }
  .stage { padding: 20px; border-radius: 24px; margin-top: 40px; }
  .stage-bar { flex-wrap: wrap; }
  .readout b { font-size: 20px; }
  .stats, .bento { grid-template-columns: minmax(0, 1fr); }
  .tile, .tile.wide { grid-column: auto; min-height: 0; }
  .pg-code-wrap { min-height: 340px; }
  .pg-scenarios { padding: 4px 14px; }
  .level { padding: 16px; }
  .cheats li { flex-direction: column; align-items: stretch; gap: 10px; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .foot-brand { grid-column: 1 / -1; }
  .card { padding: 18px; }
  .arch-figure { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* problems.html: the plain, script-free reference */
.problems h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 24px 0 12px; }
.problems nav h2 { font-size: 1rem; margin: 12px 0 6px; }
.problems nav ul { margin: 0; padding-left: 20px; columns: 2 280px; }
.problems .fix { margin-top: 20px; scroll-margin-top: 16px; }
.problems .fix h2 { font: 600 1.15rem "SF Mono", ui-monospace, Menlo, monospace; margin: 0 0 12px; overflow-wrap: anywhere; }
.problems .fix h3 { margin: 18px 0 6px; font-size: .86rem; color: var(--muted); }
.pg-buttons .pill { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; }

/* Learning loop: continue, on-call shift, streak, and the order check in each level. */
.engage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0 0; text-align: left; }
.eng-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--hair); }
.eng-card h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.02em; }
.eng-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.eng-card > .pill, .eng-card > .eng-row { margin-top: auto; }
.eng-card > p:not(.eng-k) { margin-bottom: 10px; }
.eng-k { display: flex; align-items: center; gap: 8px; color: var(--accent) !important; font-weight: 600; font-size: .85rem !important; }
.eng-shift.paging { background: var(--warn-soft); border-color: var(--warn); }
.eng-shift.paging .eng-k { color: var(--warn-text) !important; }
.eng-time { font-variant-numeric: tabular-nums; }
.eng-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); animation: eng-page 1.2s ease-in-out infinite; }
@keyframes eng-page { 50% { opacity: .25; } }
.eng-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 12px; }
.eng-row .more, .eng-orderbox .more { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.eng-score { display: flex; align-items: baseline; gap: 10px; color: var(--text) !important; font-size: 2.2rem !important; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }
.eng-score span { font-size: .95rem; font-weight: 600; letter-spacing: 0; color: var(--accent); }
.eng-bar { display: block; width: 100%; height: 6px; border-radius: 99px; background: var(--code-bg); overflow: hidden; margin: 4px 0; }
.eng-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent-fill); }
.eng-session { font-size: .85rem !important; font-variant-numeric: tabular-nums; }
.eng-board { grid-column: 1 / -1; padding: 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--hair); display: grid; gap: 16px; }
.eng-panels { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
.eng-panel { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--hair); }
.eng-panel p { margin: 0; color: var(--muted); font-size: .9rem; }
.eng-radar { width: 100%; max-width: 340px; align-self: center; margin: 4px 0; overflow: visible; }
.eng-r-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.eng-r-shape { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.eng-r-dot { fill: var(--accent); }
.eng-r-label { fill: var(--muted); font-size: 10.5px; font-family: inherit; }
.eng-slo { padding: 3px 10px; border-radius: 99px; font-size: .78rem !important; }
.eng-slo.ok { color: var(--ok) !important; background: var(--ok-soft); }
.eng-slo.low { color: var(--warn-text) !important; background: var(--warn-soft); }
.eng-uptime { display: flex; gap: 2px; height: 96px; margin-top: 14px; }
.eng-30 { display: none; }
.eng-up { flex: 1; border-radius: 2px; background: var(--code-bg); }
.eng-up.on { background: var(--accent-2); }
.eng-up-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.eng-budget { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; font-size: .88rem; }
.eng-pips { display: flex; gap: 4px; }
.eng-pips span { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--accent-2); }
.eng-pips span.on { background: var(--accent-2); }
.eng-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--hair); border-radius: 14px; overflow: hidden; border: 1px solid var(--hair); }
.eng-stats div { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; }
.eng-stats b { font-size: 1.3rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.eng-stats span { color: var(--muted); font-size: .82rem; }
.eng-orderbox { display: grid; gap: 10px; }
.eng-order { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 6px; }
.eng-order li { counter-increment: step; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--hair); background: var(--surface-2); }
.eng-order li::before { content: counter(step); color: var(--muted); font-size: .8rem; width: 1ch; }
.eng-order li.ok { border-color: var(--ok); background: var(--ok-soft); }
.eng-order li.off { border-color: var(--bad); background: var(--bad-soft); }
.eng-order code { flex: 1; font-size: .8rem; overflow-wrap: anywhere; background: none; }
.eng-moves { display: flex; gap: 4px; }
.eng-moves button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.eng-moves button:disabled { opacity: .35; cursor: default; }
.eng-msg { margin: 0; font-size: .9rem; color: var(--muted); }
@media (max-width: 860px) { .engage { grid-template-columns: 1fr; } .eng-panels, .eng-stats { grid-template-columns: 1fr 1fr; } .eng-panels { grid-template-columns: 1fr; } .eng-up:nth-child(-n+60), .eng-90 { display: none; } .eng-30 { display: inline; } .eng-uptime { height: 64px; gap: 3px; } .eng-stats div:last-child { grid-column: 1 / -1; } }

/* DevOps Nimbus brand: the loop mark in the header and footer, a command chip in the eyebrow. */
.brand .mark { width: 37px; }
.foot-brand .brand img.mark { width: 47px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; }

.eng-carry { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eng-file { position: relative; }
.eng-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.eng-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header: a Learn | Fix switch, then the current mode's pages. Learn is light; Fix is "on-call dark". */
:root { --oncall: #1d1d1f; --on-oncall: #ffffff; }
@media (prefers-color-scheme: dark) { :root { --oncall: #f5f5f7; --on-oncall: #000000; } }
.top { padding-bottom: 0; }
.top-inner { justify-content: space-between; }
.switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 99px; background: var(--code-bg); flex: none; }
/* The chip is moved by app.js and sits under the labels. data-side is the side it is nearer:
   that label takes the highlight and lets presses through, so the chip itself can be dragged. */
.switch { isolation: isolate; }
.sw-chip { position: absolute; z-index: -1; inset: 3px auto 3px 3px; width: calc(50% - 3px); border-radius: 99px; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  cursor: grab; touch-action: none; transition: background-color .2s, scale .1s ease-out; }
.sw-chip:active { cursor: grabbing; scale: .97; }
.switch[data-side="fix"] .sw-chip { background: var(--oncall); }
.switch[data-side="learn"] .sw.learn, .switch[data-side="fix"] .sw.fix { pointer-events: none; }
.sw { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 96px; padding: 6px 16px; border-radius: 99px; font-size: .86rem; font-weight: 600; color: var(--muted); text-decoration: none; transition: color .28s; }
.sw:hover { text-decoration: none; color: var(--text); }
.switch[data-side="learn"] .sw.learn { color: var(--accent); }
.switch[data-side="fix"] .sw.fix { color: var(--on-oncall); }
.sub-row { box-shadow: 0 -1px 0 var(--hair); max-width: none; }
.sub-row > .subnav { max-width: 1080px; margin: 0 auto; }
.subnav { position: relative; display: flex; justify-content: center; }
.subnav .mode { display: flex; align-items: center; gap: 4px; }
.subnav .mode.fix, [data-mode="fix"] .subnav .mode.learn { display: none; }
[data-mode="fix"] .subnav .mode.fix { display: flex; }
.subnav .mode-k { font-size: .78rem; color: var(--muted); margin-right: 14px; }
.subnav a { position: relative; padding: 11px 12px; font-size: .84rem; color: var(--text); opacity: .75; text-decoration: none; white-space: nowrap; }
.subnav a:hover { opacity: 1; text-decoration: none; }
.subnav a[aria-current="page"] { opacity: 1; font-weight: 600; }
/* One underline for the row, 1px wide and scaled to the active tab by app.js. */
.tab-ind { display: none; position: absolute; left: 0; bottom: 0; width: 1px; height: 2px; background: var(--accent-fill); transform-origin: 0 0; pointer-events: none; }
[data-mode] .tab-ind { display: block; }
[data-mode="fix"] .tab-ind { background: var(--oncall); }
@media (max-width: 720px) {
  .top-inner { flex-wrap: wrap; height: auto; gap: 8px 10px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1; }
  .switch { order: 3; flex-basis: 100%; }
  .subnav .mode-k { display: none; }
  .subnav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .sw { min-width: 0; padding: 6px 12px; }
  .subnav a { padding: 11px 8px; font-size: .8rem; }
}
@media (prefers-reduced-transparency: reduce) {
  .top { background: var(--nav); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .palette { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .top, .top.scrolled { background: var(--nav); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: var(--text); }
  .palette { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--text); }
  .sw-chip { box-shadow: 0 0 0 1px var(--text); }
}
.door.fix .pill { background: var(--on-oncall); color: var(--oncall); border-color: transparent; font-weight: 600; }
.door.fix .pill:hover { background: color-mix(in srgb, var(--on-oncall) 88%, var(--oncall)); }
.door.fix input[type="search"] { border-color: transparent; }

/* Header brand: the loop and "DevOps Nimbus" go back to all tracks. */
.brand > a { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-hub { color: inherit; }
.brand > a:hover { text-decoration: none; }
.brand-hub:hover > span { opacity: .75; }
.brand-hub:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Narrow phones: the logo stands for DevOps Nimbus so the header keeps one row. */

/* While a feature's code is still arriving, its space shows calm grey lines in the shape it will
   fill, and the first screen fades in once as one piece. Both stop for reduced motion. */
#quiz-list:empty, #stdlib:empty {
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(to bottom, var(--code-bg) 0 12px, transparent 12px 28px) 0 0 / 100% 100% no-repeat;
}
#quiz-list:empty { min-height: 320px; }
#arch:empty { min-height: min(645px, calc(54vw + 40px)); border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface) linear-gradient(var(--code-bg), var(--code-bg)) 50% 50% / calc(100% - 40px) calc(100% - 40px) no-repeat; }
#stdlib:empty { min-height: 672px; border-radius: var(--radius); background: linear-gradient(var(--bg), var(--bg)) 0 242px / 100% 14px no-repeat, linear-gradient(var(--bg), var(--bg)) 0 457px / 100% 14px no-repeat, repeating-linear-gradient(to right, var(--code-bg) 0 calc((100% - 28px) / 3), transparent calc((100% - 28px) / 3) calc((100% - 28px) / 3 + 14px)); }
/* The editor: grey code lines beside the gutter until the playground draws the line numbers. */
.pg-code-wrap:has(> .pg-gutter:empty) { background: repeating-linear-gradient(to bottom, color-mix(in srgb, #fff 9%, transparent) 0 9px, transparent 9px 21px) 50px 18px / 60% 219px no-repeat; }
#quiz-list:empty, #arch:empty, #stdlib:empty, .pg-code-wrap:has(> .pg-gutter:empty) { animation: nimbus-skel 1.6s ease-in-out infinite alternate; }
@keyframes nimbus-skel { from { opacity: .5; } to { opacity: 1; } }
#stage:not(:empty), #stats:not(:empty), #engage:not(:empty), #bento:not(:empty), #levels:not(:empty) { animation: nimbus-fade .2s ease-out both; }
@keyframes nimbus-fade { from { opacity: 0; transform: translateY(4px); } }
@media (max-width: 1000px) { #stdlib:empty { min-height: 712px; } }
@media (max-width: 900px) { #stdlib:empty { min-height: 1746px; border-radius: var(--radius-sm); background: repeating-linear-gradient(to bottom, var(--code-bg) 0 12px, transparent 12px 28px); } }
@media (max-width: 760px) { .pg-code-wrap:has(> .pg-gutter:empty) { min-height: 357px; } }
@media (max-width: 720px) { #arch:empty { min-height: calc(199vw + 71px); } }
@media (max-width: 440px) { #stdlib:empty { min-height: 1826px; } }
@media (prefers-reduced-motion: reduce) {
  #quiz-list:empty, #arch:empty, #stdlib:empty, .pg-code-wrap:has(> .pg-gutter:empty) { animation: none; }
  #stage:not(:empty), #stats:not(:empty), #engage:not(:empty), #bento:not(:empty), #levels:not(:empty) { animation: none; }
}

/* The eyebrow's command chip stands for the track; the $ takes the track colour. */
.eyebrow-cmd { font: 500 .8rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #1d1d1f; color: #f5f5f7;
  padding: 5px 8px; border-radius: 7px; white-space: nowrap; }
.eyebrow-cmd span { color: #9c9aff; }
.eyebrow:has(.eyebrow-cmd) { display: block; }
.eyebrow-cmd { display: inline-block; margin-right: 8px; vertical-align: .12em; }

/* A short light in the track colour travels round the edge of the home cards, each at its own point.
   On white it uses a deeper shade so it still shows; in dark mode the bright track colour. */
:root { --accent-edge: #8380ff; }
@media (prefers-color-scheme: dark) { :root { --accent-edge: var(--accent-fill); } }
@property --edge { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.door, .tile, .stage-card { position: relative; }
.door::before, .tile::before, .stage-card::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 2.5px; pointer-events: none;
  background: conic-gradient(from var(--edge), transparent 0 64%, color-mix(in srgb, var(--accent-edge) 55%, transparent) 80%, var(--accent-edge) 90%, var(--accent-edge) 97%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: edge 7s linear infinite; animation-delay: calc(var(--i, 0) * -1.3s); }
@keyframes edge { to { --edge: 360deg; } }
:is(.door, .tile, .stage-card):nth-child(2) { --i: 1; } :is(.door, .tile, .stage-card):nth-child(3) { --i: 2; }
:is(.door, .tile, .stage-card):nth-child(4) { --i: 3; } :is(.door, .tile, .stage-card):nth-child(5) { --i: 4; }
:is(.door, .tile, .stage-card):nth-child(6) { --i: 5; } :is(.door, .tile, .stage-card):nth-child(7) { --i: 6; }
@media (prefers-reduced-motion: reduce) { .door::before, .tile::before, .stage-card::before { display: none; } }
/* Long commands inside an explanation wrap on phones instead of widening the page. */
.cause p code { overflow-wrap: anywhere; }

/* Nimbus, the loop with eyes (nimbus.js, nimbus.css): small touches in the search box, on the
   score card and in the terminal (nimbus-site.js, nimbus-terminal.js), and the quiz's pipeline
   (nimbus-quiz.js). */
.palette > .nimbus { position: absolute; left: 18px; top: 17px; width: 34px; pointer-events: none; }
.palette #palette-input { padding-left: 64px; }
.palette.sheet > .nimbus { top: 37px; }
.eng-score-card { position: relative; }
.eng-score-card > .nimbus { position: absolute; top: 20px; right: 20px; width: 52px; cursor: pointer; }
.pg-bar .nimbus { width: 34px; margin-left: auto; --nimbus-ink: #e6edf3; --nimbus-halo: #0d1117; --nimbus-ok: #56d364; --nimbus-warn: #ffa198; --nimbus-flow: #79c0ff; }
.pg-bar .nimbus + em { margin-left: 10px; }
.rule-out { margin-top: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: .9rem; color: var(--accent, var(--accent-fill)); cursor: pointer; }
.rule-out:hover { text-decoration: underline; }
.opt.ruled { opacity: .45; text-decoration: line-through; }
/* The quiz's pipeline: across the sticky score bar on narrow screens, down the margin on wide
   ones. Stages turn green or amber as questions are answered. */
/* The score bar sits just below the header (95px; up to 141px on phones), so the pipeline in it shows. */
.score { top: 103px; }
@media (max-width: 720px) { .score { top: 149px; } }
#quiz-list { position: relative; }
#quiz-list > .nimbus, .nimbus-strip .nimbus { position: absolute; left: 0; top: 0; z-index: 6; width: 44px; cursor: pointer; }
.quiz-rail { position: absolute; background: var(--line); border-radius: 2px; }
.quiz-rail span { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line); transition: background .3s var(--ease), border-color .3s var(--ease); }
.quiz-rail .passed { background: var(--ok); border-color: var(--ok); }
.quiz-rail .failed { background: var(--warn); border-color: var(--warn); }
@keyframes nimbus-release { 50% { transform: scale(1.7); box-shadow: 0 0 0 4px var(--accent-soft); } }
.quiz-rail.released span { animation: nimbus-release .5s var(--ease) calc(var(--i) * 90ms) both; }
.score:has(.nimbus-strip) .meter { display: none; } /* the pipeline shows progress instead */
.nimbus-strip { position: relative; height: 30px; margin: 0 22px; }
.nimbus-strip .quiz-rail { left: 0; right: 0; top: 15px; height: 2px; }
.nimbus-strip .quiz-rail span { top: 1px; }
.nimbus-strip .nimbus { top: 1px; }
/* On phones Nimbus is bigger, so its crest and tail still read. */
@media (max-width: 720px) {
  .nimbus-strip { height: 46px; margin: 0 32px; }
  .nimbus-strip .quiz-rail { top: 23px; }
  .nimbus-strip .nimbus { width: 62px; top: 2px; }
  .pg-bar .nimbus { width: 46px; }
  .eng-score-card > .nimbus { width: 62px; }
}
@media (min-width: 1180px) {
  #quiz-list > .nimbus { left: -96px; width: 80px; }
  #quiz-list > .quiz-rail { left: -57px; width: 2px; }
  #quiz-list > .quiz-rail span { left: 1px; width: 12px; height: 12px; margin: -6px 0 0 -6px; }
}
/* Nimbus's colours on this site: the track's theme. */
.nimbus { --nimbus-ink: var(--text); --nimbus-halo: var(--bg); --nimbus-ok: var(--ok); --nimbus-warn: var(--warn); --nimbus-flow: var(--accent-fill);
  /* It wears this track's theme colour. */
  /* Like a chameleon mid-change: from the theme colour to its neighbour on the colour wheel. */
  --nimbus-body-a: var(--accent-fill); --nimbus-body-b: color-mix(in srgb, var(--accent-fill) 78%, #000);
  --nimbus-body-b: oklch(from var(--accent-fill) calc(l - .04) c calc(h + 70));
  --nimbus-iris: color-mix(in srgb, var(--accent-fill) 70%, #000); }
.nimbus-strip .nimbus, .eng-card .nimbus, .palette .nimbus { --nimbus-halo: var(--surface); }
@media (prefers-reduced-motion: reduce) { .quiz-rail.released span { animation: none; } }

/* The narrowest phones (320px wide): everything keeps inside the screen. */
@media (max-width: 380px) {
  .doors { grid-template-columns: minmax(0, 1fr); }
  .door { min-width: 0; padding: 20px 18px; }
  .door .ctas, .door form, .door .row { flex-wrap: wrap; }
  .door input { min-width: 0; flex: 1 1 130px; }
  .arch-tip { width: min(300px, calc(100vw - 32px)); }
  .doctor-group .chip, .doctor-group-name { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  a.mono { overflow-wrap: anywhere; }
}
