/* The data structures game at /game/, Part 1 (design: svg-steps pages/practice/design.md). */
:root {
  --screen: #15171b;
  --screen-line: #2a2d33;
  --screen-text: #ece6da;
  --screen-muted: #a7a196;
  --paper: #efe4c4;
  --paper-edge: #d9cba3;
  --hole: #2a2620;
  --focus: #1593ae;
}
/* The page background: faint gold space doodles in a seamless tile (generated by svg-steps pages/practice/doodles.py),
   like a chat wallpaper, seen in the margins beside the game's column. */
/* The site menu is fixed (64 px): scrolling to the route or a result leaves room for it. */
html { scroll-padding-top: 80px; }
body { background: var(--cream) url(doodles.svg) 0 0 / 560px 560px repeat; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mission-page { max-width: 760px; margin: 0 auto; padding: 112px 16px 80px; position: relative; isolation: isolate; }
/* The game's column stays on clean cream: a cream sheet behind it whose soft edge (the shadow, which never adds a
   scrollbar) fades into the doodles at the sides. On a phone the column fills the screen, so the doodles are gone. */
.mission-page::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--cream); box-shadow: 0 0 56px 28px var(--cream); }
.mission-page h1 { font-family: 'Libre Baskerville', serif; font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 6px; }
.mission-page .lead { color: var(--ink-soft); margin: 0 0 24px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- The route: Part 1's stages, then Part 2's, announced ---- */
.route { display: flex; margin: 0 0 18px; padding: 0; list-style: none; }
.route li { flex: 1; position: relative; text-align: center; font: 600 .7rem/1.3 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.route li small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; }
.route li::before { content: ''; display: block; width: 14px; height: 14px; margin: 0 auto 6px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--cream); position: relative; z-index: 1; }
.route li::after { content: ''; position: absolute; top: 7px; left: 50%; width: 100%; height: 2px; background: var(--border); }
.route li:last-child::after { display: none; }
.route li.done::before { background: var(--ink); }
.route li.now { color: var(--ink); }
.route li.now::before { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-bg); }
.route li.later::before { border-style: dashed; }
@media (max-width: 560px) { .route li { font-size: .6rem; letter-spacing: 0; } }

/* ---- The monitor: the ship computer's voice ---- */
.monitor { background: var(--screen); color: var(--screen-text); border: 2px solid var(--ink); border-radius: 16px;
  padding: 18px 20px 20px; font: 400 .95rem/1.65 'JetBrains Mono', monospace; scroll-margin-top: 12px; }
.monitor__head { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--screen-line); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--screen-muted); }
.monitor__head .led { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #4fc27a; vertical-align: 1px; }
.monitor__head .led.warn { background: var(--coral); }
.monitor h2 { margin: 0 0 12px; font: 700 1rem/1.4 'JetBrains Mono', monospace; color: #fff; }
.monitor h2:focus { outline: none; }
.monitor h3 { margin: 18px 0 8px; font: 700 1rem/1.4 'JetBrains Mono', monospace; color: #fff; }
.monitor p { margin: 0 0 12px; }
.monitor p:last-child { margin-bottom: 0; }
.monitor b { color: #fff; }
.monitor .label { color: var(--gold-bright); font-weight: 700; }
.monitor .muted { color: var(--screen-muted); }
.monitor .tip { font-size: .8em; }
.monitor .ok { color: #7fdc9a; font-weight: 700; }
.monitor .bad { color: #ff8a7d; font-weight: 700; }
.monitor .warn { color: var(--gold-bright); font-weight: 700; }
.monitor .good { color: #7fdc9a; font-weight: 700; }
.monitor .last { color: #ffd27a; font-weight: 700; }
.monitor .hint { border-left: 3px solid var(--gold-bright); padding-left: 12px; }
.monitor a { color: var(--gold-bright); border-bottom: 1px solid currentColor; }
.monitor ul.recap { margin: 0 0 12px 1.2em; padding: 0; }
.monitor ul.recap li { margin: 0 0 6px; }
@media (max-width: 560px) { .monitor { font-size: .86rem; padding: 14px 14px 16px; } }

/* ---- The rehearsal strip: the first operations on a few items ---- */
.strip { position: relative; height: 92px; margin: 4px 0 6px; border: 1px dashed var(--screen-line); border-radius: 10px; overflow: hidden; cursor: pointer; }
.strip .tile { position: absolute; left: 0; top: 30px; width: var(--size, 44px); height: var(--size, 44px); display: grid; place-items: center;
  font: 700 .85rem/1 'JetBrains Mono', monospace; color: var(--ink); background: var(--paper); border: 2px solid #c9b98f; border-radius: 8px;
  transition: transform .16s ease-out, background-color .16s, border-color .16s, opacity .2s; }
.strip.look-cells .tile, .strip.look-stack .tile, .strip.look-queue .tile { border-radius: 2px; }
/* A link to the next item: an arrow in the gap; a doubly linked list shows both directions. */
.strip.look-list .tile.linked::after, .strip.look-dlist .tile.linked::after, .strip.look-scan .tile.linked::after {
  content: '→'; position: absolute; left: calc(100% + 1px); top: 50%; transform: translateY(-50%);
  width: calc(var(--pitch, 58px) - var(--size, 44px) - 2px); text-align: center; color: #d9d2c4; font-size: .95rem; font-weight: 700; }
.strip.look-dlist .tile.linked::after { content: '⇄'; }
.strip .tile.new { background: #fff3c9; }
.strip .tile.read { background: #7fdc9a; border-color: #4fc27a; }
.strip .tile.moving { background: var(--gold-bright); border-color: var(--gold); }
.strip .tile.out { opacity: .35; }
.strip .tile.gone { opacity: 0; }
.strip .tile.alarm { border-color: #ff8a7d; color: #b3261e; }
.strip .tile.bad { background: #ff8a7d; border-color: var(--coral); }
.strip .tile.want { box-shadow: 0 0 0 3px var(--gold-bright); }
.strip__cursor { position: absolute; left: 0; top: 80px; width: 12px; height: 8px; background: var(--gold-bright);
  clip-path: polygon(50% 0, 100% 100%, 0 100%); transition: transform .16s ease-out, opacity .16s; opacity: 0; }
.strip__steps { position: absolute; right: 10px; top: 6px; font-size: .72rem; color: var(--screen-muted); font-variant-numeric: tabular-nums; }
.strip__ends { position: absolute; left: 10px; top: 6px; font-size: .72rem; color: var(--screen-muted); }
.monitor .strip-note { min-height: 1.65em; color: var(--screen-text); }

/* ---- The whole job: steps against the limit ---- */
.meter { margin: 6px 0 14px; }
.meter__nums { display: flex; justify-content: space-between; font-size: .8rem; color: var(--screen-muted); margin-bottom: 6px; }
.meter__nums b { color: var(--screen-text); font-variant-numeric: tabular-nums; }
.meter__track { height: 14px; border-radius: 7px; background: #2b2e35; overflow: hidden; }
.meter__fill { height: 100%; width: 0; background: var(--gold); border-radius: 7px; }
.meter.over .meter__fill { background: var(--coral); animation: overflow .5s ease-in-out 2; }
.meter.done .meter__fill { background: #4fc27a; }
.monitor .meter__need { margin: 6px 0 0; color: #ff8a7d; font-size: .82rem; }
@keyframes overflow { 50% { filter: brightness(1.6); } }

/* ---- The console: the ways to choose from ---- */
.console { margin-top: 16px; }
.console__label { margin: 0 0 8px; font: 600 .72rem/1 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); }
.console__learn { margin: 10px 0 0; font: 500 .8rem/1.5 'JetBrains Mono', monospace; color: var(--ink-soft); }
.console__learn a { color: var(--ink); border-bottom: 1px solid currentColor; text-decoration: none; }
.console__learn a:hover { color: var(--coral); }
.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 680px) { .options { grid-template-columns: minmax(0, 1fr); } }
.opt { position: relative; text-align: left; padding: 12px 14px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-sm);
  font: 400 .92rem/1.45 'DM Sans', sans-serif; color: var(--ink-soft); cursor: pointer; transition: transform .15s, box-shadow .15s, background-color .15s; }
.opt b { display: block; margin-bottom: 4px; font: 700 .85rem/1.2 'JetBrains Mono', monospace; letter-spacing: .04em; color: var(--ink); }
.opt b .key { display: inline-block; min-width: 1.6em; color: var(--ink-soft); font-weight: 500; }
.opt .how { display: block; }
.opt .tag { display: none; margin-top: 8px; font: 700 .7rem/1 'JetBrains Mono', monospace; letter-spacing: .06em; color: var(--ink); }
@media (hover: hover) { .opt:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 3px 3px 0 var(--ink); } }
.opt[aria-pressed="true"] { background: var(--gold-bg); border-color: var(--ink); border-width: 3px; padding: 11px 13px; }
.opt[aria-pressed="true"] .tag { display: block; }
.opt:disabled { cursor: default; opacity: .6; }

/* ---- The tape and the drive: the drive on the left takes the tape's leading end ---- */
.feeder { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-top: 16px; }
.feeder[hidden], .console[hidden] { display: none; }
@media (max-width: 560px) { .feeder { grid-template-columns: minmax(0, 1fr); } .load { width: 100%; } }
.tape-lane { position: relative; display: flex; align-items: center; height: 100px; overflow: hidden; padding-left: 62px; cursor: pointer; }
.tape { position: relative; z-index: 1; }
.tape svg { display: block; filter: drop-shadow(0 2px 0 rgba(0,0,0,.12)); }
.tape-empty { font: 400 .85rem/1.4 'JetBrains Mono', monospace; color: var(--ink-soft); }
.drive { position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; width: 54px; background: var(--ink); border-radius: 4px 10px 10px 4px; box-shadow: inset 0 0 0 2px #000; }
.drive::before { content: ''; position: absolute; right: 5px; top: 50%; width: 6px; height: 70px; margin-top: -35px; border-radius: 3px; background: #000; }
.drive::after { content: 'DRIVE'; position: absolute; left: 7px; bottom: 6px; font: 500 .52rem/1 'JetBrains Mono', monospace; letter-spacing: .12em; color: #8d8879; }
.drive .lamp { position: absolute; top: 8px; left: 8px; width: 7px; height: 7px; border-radius: 50%; background: #3a3a3a; }
.feeder.reading .drive .lamp { background: #4fc27a; animation: lamp .18s steps(2) infinite; }
@keyframes lamp { 50% { opacity: .25; } }
.tape.punching .col circle, .tape.punching .col text { animation: punch .16s ease-out both; animation-delay: calc(var(--i) * 90ms); transform-box: fill-box; transform-origin: center; }
@keyframes punch { 0% { opacity: 0; transform: scale(0); } 70% { opacity: 1; transform: scale(1.4); } 100% { opacity: 1; transform: scale(1); } }
.puncher { position: absolute; z-index: 3; top: 0; left: calc(62px + 30px); width: 14px; height: 10px; background: var(--ink); border-radius: 0 0 3px 3px; opacity: 0; pointer-events: none; }
.feeder.punch .puncher { animation: puncher calc(var(--n) * 90ms + 120ms) linear both; }
@keyframes puncher {
  0% { opacity: 1; transform: translateX(0); }
  92% { opacity: 1; transform: translateX(calc((var(--n) - 1) * 14px)); }
  100% { opacity: 0; transform: translateX(calc((var(--n) - 1) * 14px)); }
}
.load { min-width: 120px; padding: 12px 22px; font: 700 .95rem/1 'JetBrains Mono', monospace; letter-spacing: .1em; color: #faf7f2; background: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-pill); cursor: pointer; }
.load:disabled { background: transparent; color: #8f887c; border-color: var(--border); cursor: default; }
@media (hover: hover) { .load:hover:not(:disabled) { background: var(--gold); color: var(--ink); } }

/* ---- Buttons after a result, the end of Part 1 ---- */
.next { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.next button { padding: 12px 22px; font: 700 .95rem/1 'DM Sans', sans-serif; color: #faf7f2; background: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-pill); cursor: pointer; }
.log-wrap { overflow-x: auto; margin: 0 0 12px; }
.monitor table.log { border-collapse: collapse; width: 100%; font-size: .8rem; }
.monitor table.log th, .monitor table.log td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--screen-line); vertical-align: top; }
.monitor table.log th { color: var(--screen-muted); font-weight: 500; }
.keepsake { overflow-x: auto; padding: 6px 0 10px; }
.app-card { display: grid; grid-template-columns: 48px 1fr; gap: 14px; width: 100%; padding: 14px 16px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-sm); }
.app-card img { border-radius: 11px; }
.app-card b { display: block; color: var(--ink); }
.app-card p { margin: 4px 0 0; font-size: .92rem; color: var(--ink-soft); }
.app-card .stores { display: flex; gap: 8px; margin-top: 10px; }
.app-card .stores a { padding: 6px 14px; border: 2px solid var(--ink); border-radius: var(--radius-pill); font-weight: 700; font-size: .85rem; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .tape.punching .col circle, .tape.punching .col text, .feeder.punch .puncher, .feeder.reading .drive .lamp, .meter.over .meter__fill { animation: none; }
  .strip .tile, .strip__cursor, .opt { transition: none; }
}

/* ---- Round 2 ---- */
.meter.stopped .meter__fill { background: var(--coral); }
/* A failure the stage survives is shown in gold; coral is kept for the catastrophe that loses the mission. */
.meter.over.mild .meter__fill, .meter.stopped.mild .meter__fill { background: var(--gold-bright); }
.meter.mild .meter__need { color: var(--gold-bright); }
.monitor .strip-note.closing { color: var(--gold-bright); font-weight: 700; }
.route li.later { color: #6f6a60; }
.route li.later::before { border-color: #6f6a60; }
.monitor .outcome a { margin-left: 4px; font-weight: 500; }
.monitor h3:focus { outline: none; }
.app-card { margin: 4px 0 14px; color: var(--ink); font-family: 'DM Sans', sans-serif; line-height: 1.45; }
.app-card .stores { flex-wrap: wrap; }
.app-card .stores a { white-space: nowrap; }

/* ---- Each job's device API ---- */


/* TRIAL (owner, 2026-11-13): a picture of the job's situation under its story, in the monitor's own line style. */
.monitor .scene { margin: 0 0 14px; }
.monitor .scene svg { display: block; width: 100%; max-width: 500px; height: auto; margin: 0 auto; overflow: hidden; }
.scene text { font: 500 10.5px 'JetBrains Mono', monospace; fill: var(--screen-muted); }
.scene .s-earth { fill: rgba(167, 161, 150, .13); }
.scene .s-star, .scene .s-dot { fill: var(--screen-muted); }
.scene .s-hull { fill: none; stroke: var(--screen-text); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.scene .s-line { fill: none; stroke: var(--screen-muted); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.scene .s-gold { fill: none; stroke: var(--gold-bright); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.scene .s-dash { stroke-dasharray: 4 4; }
.scene .s-tile { fill: #2c2617; stroke: var(--gold-bright); stroke-width: 1.3; }
.scene .s-tt { font-size: 10px; font-weight: 700; fill: var(--gold-bright); text-anchor: middle; }
.scene .s-ask { fill: var(--screen); stroke: var(--screen-text); stroke-width: 1.3; }
.scene .s-q { font-size: 10px; font-weight: 700; fill: var(--screen-text); text-anchor: middle; }
.scene .s-badge { fill: none; stroke: var(--screen-muted); stroke-width: 1.2; }
.scene .s-bt { font-size: 9px; font-weight: 700; text-anchor: middle; }
.scene .s-small { font-size: 9px; text-anchor: middle; }
.scene .s-sub { font-size: 9.5px; fill: #8a857b; }
.scene .s-n { font-size: 10px; }
.scene .s-big { font-size: 26px; font-weight: 700; fill: var(--gold-bright); text-anchor: middle; }
.scene .s-warn { font-size: 10px; fill: #ff8f80; text-anchor: end; }
.scene .s-rim { stroke: var(--screen-muted); stroke-width: 1.2; }
.scene .s-thick { stroke-width: 2.4; }
.scene .s-dot2 { stroke-dasharray: 1 4; stroke-width: 2; }
.scene .s-ship { fill: var(--screen); stroke: var(--screen-text); stroke-width: 1.5; stroke-linejoin: round; }
.scene .s-fall { fill: none; stroke: #ff8f80; stroke-width: 1.4; stroke-dasharray: 1 4; stroke-linecap: round; }
.scene .s-mark { font-size: 10px; font-weight: 700; fill: var(--gold-bright); text-anchor: middle; }

.scene .s-sensor { fill: var(--gold-bright); }
.scene .s-fillbar { fill: var(--gold-bright); opacity: .75; }
.scene .s-note { fill: var(--screen); stroke: var(--gold-bright); stroke-width: 1.3; stroke-dasharray: 3 2; }
.scene .s-nt { font-size: 10px; font-weight: 700; fill: var(--gold-bright); text-anchor: middle; }
.scene .s-flag { fill: none; stroke: #ff8f80; stroke-width: 1.3; }
.scene .s-ft { font-size: 9px; font-weight: 700; fill: #ff8f80; text-anchor: middle; }

/* Checkpoint codes (owner, 2026-11-13): the line after each job, and the form under the briefing. */
.monitor .checkpoint { color: var(--screen-muted); }
.monitor .checkpoint b { color: var(--gold-bright); letter-spacing: .08em; }
/* The code is a button that copies it. */
.monitor .checkpoint .code { font: inherit; font-weight: 700; color: var(--gold-bright); letter-spacing: .08em; background: none;
  border: 0; border-bottom: 1px dashed currentColor; border-radius: 0; padding: 0 1px; cursor: pointer; }
.monitor .checkpoint .code:hover { background: rgba(240, 180, 42, .15); }
.monitor .checkpoint .code:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.monitor .checkpoint .copied { color: #7fdc9a; font-size: .85em; }
.monitor .checkpoint .copied:not(:empty) { margin-left: 8px; }
.monitor .code-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 14px 0 0; }
.monitor .code-form label { color: var(--screen-muted); font-size: .85em; }
.monitor .code-form input { width: 9.5em; padding: 6px 10px; font: 700 1rem/1.2 'JetBrains Mono', monospace; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold-bright); background: var(--screen); border: 1px solid var(--screen-muted); border-radius: 6px; }
.monitor .code-form button { padding: 7px 14px; font: 700 .85rem/1 'JetBrains Mono', monospace; color: var(--screen); background: var(--gold-bright); border-radius: 6px; }
.monitor .code-msg { flex-basis: 100%; margin: 0; color: #ff8a7d; }
.monitor .code-msg:empty { display: none; }
.scene .s-head { font-size: 11px; font-weight: 700; fill: var(--screen-text); text-anchor: middle; }
.scene .s-okt { font-size: 10px; font-weight: 700; fill: #7fdc9a; text-anchor: end; }
.scene .s-broken { fill: rgba(255, 143, 128, .08); stroke: #ff8f80; stroke-width: 1.4; stroke-dasharray: 4 3; }
.scene .s-free { font-size: 10px; font-weight: 700; fill: var(--gold-bright); }
.scene .s-here { font-size: 10.5px; font-weight: 700; fill: var(--gold-bright); }
.scene .s-tape { fill: var(--paper); stroke: var(--paper-edge); }
.scene .s-hole { fill: var(--hole); }
.scene .s-limit { stroke: #ff8f80; stroke-width: 2.5; }

.scene .s-vib { fill: none; stroke: var(--screen-muted); stroke-width: 1.2; stroke-linecap: round; }
.scene .s-false { fill: var(--screen); stroke: #ff8f80; stroke-width: 1.3; stroke-dasharray: 3 2; }
.scene .s-ftt { font-size: 10px; font-weight: 700; fill: #ff8f80; text-anchor: middle; }
.scene .s-warnl { font-size: 10px; fill: #ff8f80; }

.scene .s-trace { fill: none; stroke: var(--screen-muted); stroke-width: 1; opacity: .7; }
.scene .s-spike { fill: #ff8f80; }
.scene .s-markl { font-size: 10px; font-weight: 700; fill: var(--gold-bright); }

.scene .s-fov { fill: rgba(240, 180, 42, .08); stroke: var(--gold-bright); stroke-width: .8; stroke-dasharray: 2 3; }
.scene .s-cur { fill: #2c2617; stroke: var(--gold-bright); stroke-width: 2.4; }

.scene .s-panel { fill: #2a2d33; stroke: var(--screen-muted); stroke-width: 1; }
.scene .s-seam { stroke: #4a4e57; stroke-width: 1.4; }
.scene .s-rivet { fill: #5d626c; }
.scene .s-crack { fill: none; stroke: #ff8f80; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.scene .s-shadow { fill: #0e0f12; opacity: .9; }

.scene .s-past { fill: none; stroke: var(--screen-muted); stroke-width: 1.3; opacity: .55; }
.scene .s-cmp { stroke: var(--screen-muted); stroke-width: .7; opacity: .55; stroke-dasharray: 2 2; }

/* Stage 1 review (2026-11-14): job rows as capsules (the briefing's square tile means a cell), reflections, the cost
   table under the plans. */
.scene .s-item { fill: #2c2617; stroke: var(--gold-bright); stroke-width: 1.3; }
.scene .s-glint { fill: #f4efe2; opacity: .85; }
.console__costs { margin: 10px 0 0; font: 500 .78rem/1.5 'JetBrains Mono', monospace; color: var(--ink-soft); }
.scene .s-tiny { font-size: 9px; fill: var(--screen-muted); }
.scene .s-duct { fill: none; stroke: rgba(167, 161, 150, .2); stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
