/* Computing Ninja Games: the binary arcade's look (D, 25 Oct 2026; docs/games.md). One stylesheet for the nine binary
   and number games (BinaryBlast, BitDrop, ByteBuilder, HexHero, Two's Predicament, SignSolver, LogicBumper,
   SignShifter, the GOAT), in the language the Games front page promises: its violet on a pale page, Bricolage for the
   words and Share Tech Mono for the labels, panels with a thin line, bits that light violet, and the pixel horizon
   along the foot of the page. arcade.js lays the horizon and adds the motion (bits popping as they flip, the
   countdown bar, the score bumping, the result line and its burst of pixels). It replaces themes.css, icewhite.css,
   portal-sync-binary-games.css and gcse-microgames.css on these pages; the other microgames still use those. */

@font-face { font-family: "Share Tech Mono"; font-weight: 400; font-display: swap; src: url("fonts/ShareTechMono-Regular.ttf") format("truetype"); }

:root, html[data-theme="light"] {
  --bg: #F6F5FA; --panel: #FFFFFF; --ink: #1D1B26; --muted: #625F70; --faint: #9C99A8;
  --line: #E3E0EC; --line-strong: #CBC7D8; --grey: #EAE7F1;
  --violet: #6B46E0; --violet-dark: #5432C2; --violet-soft: #ECE6FD; --violet-ink: #5432C2;
  --amber: #D9A441; --amber-soft: #F6EBD2; --amber-ink: #7A5614;
  --red: #C9463B; --red-soft: #F9E3E0;
  --green: #1F9D63; --green-soft: #DDF3E8; --green-ink: #15724A;
  --shadow: 0 24px 60px rgba(29, 27, 38, .18);
  --px1: #D3C8F4; --px2: #DED6F7; --px3: #E9E4FA; --px-on: #A993F0;
  --sans: "Bricolage Grotesque", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --arcade: "Share Tech Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --snap: cubic-bezier(.34, 1.56, .64, 1);
  /* names the games' own scripts still use (a wrong answer flashes the message) */
  --flash-color: #C9463B; --bg-color: #FFFFFF; --text-color: #1D1B26; --text-secondary: #625F70; --primary-color: #6B46E0;
  --card-bg: #FFFFFF; --box-bg-color: #F6F5FA; --border-color: #E3E0EC;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #130F1F; --panel: #1B1628; --ink: #F1EDFA; --muted: #A8A2BC; --faint: #6E6885;
  --line: #2B2540; --line-strong: #3B3456; --grey: #262038;
  --violet: #7C5BEA; --violet-dark: #A993F0; --violet-soft: #2A2250; --violet-ink: #C9BAF8;
  --amber: #E0B45A; --amber-soft: #3A2E14; --amber-ink: #F3D48A;
  --red: #E06B60; --red-soft: #3D1F1D;
  --green: #3DBD85; --green-soft: #15352A; --green-ink: #8FE0BE;
  --shadow: 0 24px 60px rgba(0, 0, 0, .5);
  --px1: #2E2552; --px2: #272046; --px3: #1F1A38; --px-on: #7C5BEA;
  --flash-color: #E06B60; --bg-color: #1B1628; --text-color: #F1EDFA; --text-secondary: #A8A2BC; --primary-color: #A993F0;
  --card-bg: #1B1628; --box-bg-color: #130F1F; --border-color: #2B2540;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); transition: background 300ms, color 300ms; }
button, input { font-family: inherit; }
a { color: var(--violet); text-decoration: none; }

/* The pixel horizon along the foot of the window, as on the Games page: square pixels in three violet tints, thick at
   the bottom and thinning as they rise, one twinkling now and then (arcade.js lays it). */
.px-horizon { position: fixed; left: 0; right: 0; bottom: 0; height: 46vh; pointer-events: none; z-index: 0; }
.px-horizon i { position: absolute; width: 12px; height: 12px; background: var(--c); transition: background 1200ms; }
.px-horizon i.f { background: var(--px-on); transition: background 120ms; }

/* ---- Header: the wordmark, the product, the page's tools ------------------------------------------------------- */
.arcade-top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.arcade-top .in { max-width: 1040px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); line-height: 1; }
.wordmark i { width: 24px; height: 24px; display: inline-grid; place-items: center; }
.wordmark i svg { width: 21px; height: 24px; fill: var(--violet); }
.wordmark .prod { font: 400 14px/1 var(--arcade); color: var(--violet-ink); background: var(--violet-soft); border-radius: 999px; padding: 5px 10px 6px; margin-left: 2px; }
.wordmark .prod { color: var(--violet-dark); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tools .all { font-size: 14.5px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-radius: 9px; transition: color 200ms, background 200ms; }
.tools .all:hover { color: var(--ink); background: var(--grey); }
/* the three tools keep their ids and icon classes for the pages' scripts; here they sit in the bar instead of floating */
.game-theme-toggle, .game-calc-toggle { position: static; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; opacity: 1; transition: background 200ms, color 200ms, border-color 200ms, transform 300ms var(--ease); }
.game-theme-toggle:hover, .game-calc-toggle:hover { background: var(--grey); color: var(--ink); }
.game-theme-toggle:active, .game-calc-toggle:active { transform: scale(.94); }
.game-calc-toggle.is-active { background: var(--violet-soft); color: var(--violet-ink); border-color: transparent; }
/* icons: the Font Awesome class names the scripts swap between, drawn here as masks, so the pages load no icon font */
i.fas { display: inline-block; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
i.fa-moon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'/%3E%3C/svg%3E"); }
i.fa-sun { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
i.fa-volume-high { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E"); }
i.fa-volume-xmark { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z'/%3E%3Cpath d='m22 9-6 6M16 9l6 6'/%3E%3C/svg%3E"); }
i.fa-calculator { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2'/%3E%3Cpath d='M8 6h8M8 11h.01M12 11h.01M16 11h.01M8 15h.01M12 15h.01M16 15h.01M8 19h.01M12 19h.01M16 19h.01'/%3E%3C/svg%3E"); }
i.fa-xmark { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }

/* ---- The game's card ------------------------------------------------------------------------------------------- */
.card { position: relative; width: min(760px, calc(100% - 32px)); margin: 28px auto 96px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px 26px 24px; display: flex; flex-direction: column; gap: 14px; animation: rise 700ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.card > * { min-width: 0; }
/* The pieces come in the order a round reads: title, the HUD, the target, the bits, the working, the buttons, the
   result, then the small print. Each page keeps its own markup order; this is the one the family shows. */
.title { order: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; text-align: left; }
.title h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.title .pill { font: 400 13px/1 var(--arcade); color: var(--violet-ink); background: var(--violet-soft); border-radius: 999px; padding: 6px 10px 7px; letter-spacing: .02em; }
.title .pill b { font-weight: 400; color: var(--violet-dark); }
.title .pill.bump { animation: bump 400ms var(--snap); }
.title .topic { margin-left: auto; font: 400 12.5px var(--arcade); letter-spacing: .04em; color: var(--faint); text-transform: uppercase; }
.game-stats { display: contents; }
.stats-grid { order: 1; }
.target-display--goal { order: 2; }
.mode-note { order: 2; }
.prompt-display { order: 3; }
.hex-blast .instruction { order: 3; }
.sum-block { order: 3; }
.binary-grid { order: 4; }
.byte-display { order: 5; }
.answer-row { order: 5; }
.overflow-row { order: 5; }
.overflow-help { order: 6; }
.decimal-input { order: 6; }
.current-value { order: 7; }
.remaining-hint { order: 8; }
.calc-inline-hint { order: 8; }
.button-container { order: 10; }
.message { order: 11; }
.controls { order: 12; }
.microgame-card .instruction { order: 12; }
.foot { order: 13; }

/* The HUD: countdown, score and best in a row, each a small panel with its label in the screen font. The old fourth
   box, Global high, has nothing to show on Computing Ninja and is kept in the markup for the scripts but not shown. */
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 0; }
.stat-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; text-align: left; display: grid; gap: 2px; min-width: 0; position: relative; }
.stat-box > div:first-child { font: 400 12px/1.2 var(--arcade); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-box > div:last-child { font: 600 26px/1.15 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-box:has(#globalHighScore) { display: none; }
.stat-box .tm { display: block; height: 5px; border-radius: 3px; background: var(--grey); overflow: hidden; margin-top: 7px; }
.stat-box .tm b { display: block; height: 100%; width: var(--p, 0%); background: var(--amber); border-radius: 3px; transition: width 150ms linear, background 300ms; }
.stat-box.low .tm b { background: var(--red); }
.stat-box.low > div:last-child { color: var(--red); animation: pulse 700ms ease-in-out infinite; }
.stat-box .bump { display: inline-block; animation: bump 450ms var(--snap); }
/* The arcade's countdown (D, 25 Oct 2026): a ring in the middle of the top row, larger, the seconds inside it, score
   and high score either side. The lab keeps its segmented bar (lab.css, body[data-family="lab"]). */
body:not([data-family="lab"]) .stats-grid:has(.stat-box.timer) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
body:not([data-family="lab"]) .stat-box.timer { order: 2; position: relative; width: 136px; height: 136px; padding: 0; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; justify-self: center; }
body:not([data-family="lab"]) .stat-box:has(#score) { order: 1; }
body:not([data-family="lab"]) .stat-box:has(#highScore) { order: 3; }
/* either side of the ring, score and high score read centred (D, 25 Oct 2026) */
body:not([data-family="lab"]) .stats-grid:has(.stat-box.timer) .stat-box:not(.timer) { text-align: center; justify-items: center; }
body:not([data-family="lab"]) .stat-box.timer > div:first-child { order: 2; font-size: 10.5px; margin-top: 2px; }
body:not([data-family="lab"]) .stat-box.timer > div:last-child { order: 1; font-size: 36px; line-height: 1; }
body:not([data-family="lab"]) .stat-box.timer .tm { display: none; }
.stat-box.timer .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.stat-box.timer .ring circle { fill: none; stroke-width: 8; }
.stat-box.timer .ring .bg { stroke: var(--grey); }
.stat-box.timer .ring .fg { stroke: var(--amber); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--pct, 0)); transition: stroke-dashoffset 150ms linear, stroke 300ms; }
.stat-box.timer.low .ring .fg { stroke: var(--red); }
body[data-family="lab"] .stat-box.timer .ring { display: none; }
@media (max-width: 560px) {
  body:not([data-family="lab"]) .stat-box.timer { width: 104px; height: 104px; }
  body:not([data-family="lab"]) .stat-box.timer > div:last-child { font-size: 28px; }
  body:not([data-family="lab"]) .stat-box.timer > div:first-child { font-size: 9.5px; }
}
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { opacity: .55; } }

/* The target: what to make, large, as the hero's "Make 77" */
.target-display--goal { background: none; border: 0; padding: 8px 0 0; text-align: center; width: 100%; margin: 0; }
.target-display--goal > div:first-child { font: 400 12.5px/1.2 var(--arcade); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.target-display--goal > div:last-child { font: 600 clamp(44px, 9vw, 60px)/1 var(--sans); letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.target-display--goal .pop { display: inline-block; animation: pop 450ms var(--snap); }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* The bits: a place value over each, the box below lighting violet when it is a 1. The games redraw the row on every
   click; arcade.js marks each box with its bit and pops the one that changed. */
.binary-grid { --bw: clamp(30px, calc((min(100vw, 760px) - 120px) / 8), 54px); display: flex; justify-content: center; gap: 8px; width: 100%; margin: 4px 0 0; }
.binary-column { position: static; display: grid; gap: 5px; justify-items: center; width: var(--bw); }
.value-box { width: auto; height: auto; margin: 0; padding: 0; border: 0; background: none; font: 400 12px/1.2 var(--mono); color: var(--faint); display: block; text-align: center; }
.binary-column.sign .value-box { color: var(--amber-ink); font-weight: 700; }
.bit-box { width: 100%; height: calc(var(--bw) * 1.3); margin: 0; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--faint); font: 600 clamp(16px, calc(var(--bw) * .5), 26px)/1 var(--mono); display: grid; place-items: center; cursor: pointer; user-select: none; -webkit-user-select: none; transition: transform 160ms var(--ease), background 200ms, border-color 200ms, color 200ms; }
.bit-box:hover { border-color: var(--violet); transform: translateY(-2px); }
.bit-box:active { transform: translateY(0) scale(.96); }
.bit-box[data-bit="1"] { background: var(--violet); border-color: var(--violet); color: #fff; }
.binary-column.sign .bit-box[data-bit="1"] { background: var(--red); border-color: var(--red); }
.bit-box.flip { animation: bitpop 280ms var(--snap); }
@keyframes bitpop { 0% { transform: scale(.82); } 100% { transform: scale(1); } }
.bit-box:empty::after { content: ""; width: 12px; height: 2px; border-radius: 1px; background: var(--line-strong); }
.bit-box:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
/* rows that are only read, not clicked: ByteBuilder's two numbers, HexHero's finished byte */
.binary-grid.readonly .bit-box, .byte-display .bit-box { height: calc(var(--bw) * .95); cursor: default; }
.binary-grid.readonly .bit-box:hover, .byte-display .bit-box:hover { transform: none; border-color: var(--line-strong); }
.binary-grid.readonly .bit-box[data-bit="1"], .byte-display .bit-box[data-bit="1"] { background: var(--violet-soft); border-color: transparent; color: var(--violet-ink); }
.binary-grid.readonly .bit-box[data-bit="1"]:hover, .byte-display .bit-box[data-bit="1"]:hover { border-color: transparent; }
.current-value { margin: 0; text-align: center; font: 13px/1.3 var(--arcade); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-height: 21px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; } /* the label, then the value on its own line (D, 25 Oct 2026) */
/* the games set the line to display:block inline, so the label is a block of its own and the value sits under it */
.current-value > span { display: block; margin-bottom: 6px; }
.current-value b { display: inline-block; font: 600 26px/1 var(--sans); letter-spacing: -0.02em; text-transform: none; color: var(--violet-ink); background: var(--violet-soft); padding: 6px 14px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.current-value.bump { animation: nudge 300ms var(--ease); }
@keyframes nudge { 30% { transform: translateY(-3px); } }

/* Hints under the working: Show remaining, the calculator */
.remaining-hint { margin: -6px 0 0; min-height: 24px; text-align: center; justify-content: center; } /* the games set it to block or flex; centred either way */
.remaining-hint > * { display: inline-block; vertical-align: middle; margin: 0 4px; }
.remaining-toggle, .calc-inline-toggle { background: none; border: 0; padding: 2px 4px; font: 500 13.5px var(--sans); color: var(--violet-ink); cursor: pointer; opacity: .9; border-radius: 6px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); transition: opacity 150ms, color 150ms; }
.remaining-toggle:hover, .calc-inline-toggle:hover { opacity: 1; text-decoration-color: currentColor; }
.calc-inline-toggle { color: var(--muted); }
.calc-inline-toggle.is-active, .calc-inline-toggle:hover { color: var(--violet-ink); }
.remaining-value { font: 600 15px var(--sans); color: var(--violet-ink); }
.calc-inline-hint { margin: -8px 0 0; text-align: center; min-height: 20px; }
.calc-inline-toggle:focus-visible, .remaining-toggle:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* Buttons: the one filled violet button is the move to make now (Start, Submit, Next); the rest are quiet. */
.button-container { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font: 600 15px/1 var(--sans); cursor: pointer; transition: transform 400ms var(--ease), background 200ms, border-color 200ms, color 200ms; }
.button:hover { background: var(--grey); transform: translateY(-1px); }
.button:active { transform: translateY(0) scale(.98); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.button-submit { background: var(--violet); border-color: var(--violet); color: #fff; padding: 14px 26px; font-size: 16px; min-width: 160px; }
.button.button-submit:hover { background: var(--violet-dark); border-color: var(--violet-dark); }
html[data-theme="dark"] .button.button-submit:hover { background: #6B46E0; border-color: #6B46E0; }
.button:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* The result line. arcade.js reads what the game wrote and marks it: ok (a tick and a lift), bad (a shake), over. */
.message { margin: 0; padding: 0; border: 0; min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; text-align: center; font-size: 15.5px; line-height: 1.4; color: var(--muted); border-radius: 10px; transition: color 200ms, background 150ms; }
.message:empty { min-height: 0; }
.message.ok { color: var(--ink); font-weight: 500; animation: lift 450ms var(--ease); }
.message.ok::before { content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 10.5 2.6 2.6L14.5 7'/%3E%3C/svg%3E") center / 20px no-repeat; animation: pop 450ms var(--snap); }
.message.bad { color: var(--red); animation: shake 420ms; }
.message.over, .message.tip { display: none; }   /* Time's up is said in the ring; the round's instruction is the brief's job */
.hex-blast .instruction { display: none; }
.stat-box.timer.over > div:first-child { color: var(--red); font-weight: 400; }
.stat-box.timer.over > div:last-child { color: var(--red); }
.stat-box.timer.over .ring .fg { stroke: var(--red); }
@keyframes lift { from { opacity: 0; transform: translateY(6px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* The small print: the keys, as chips */
.controls { margin: 4px 0 0; text-align: center; font: 400 12.5px/1.6 var(--arcade); color: var(--faint); letter-spacing: .02em; }
.controls kbd { font: inherit; color: var(--muted); background: var(--grey); border-radius: 5px; padding: 1px 6px; margin: 0 1px; }
.controls .sep { margin: 0 6px; opacity: .6; }
/* In the arcade the keys line sits on a long dark bar (D, 25 Oct 2026); :has(kbd) keeps BitDrop's input row, also
   .controls, out of it. The lab keeps its plain line. */
body:not([data-family="lab"]) .controls:has(kbd) { align-self: center; max-width: 100%; background: color-mix(in srgb, var(--violet-soft) 55%, transparent); color: var(--violet-ink); border-radius: 12px; padding: 10px 18px; }   /* the same violet, a little see-through */
body:not([data-family="lab"]) .controls:has(kbd) kbd { background: var(--panel); color: var(--violet-dark); box-shadow: 0 1px 0 rgba(84, 50, 194, .18); }
body:not([data-family="lab"]) .controls:has(kbd) .sep { opacity: .45; }

/* Reset and the way back, under a line */
.foot { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.foot .button { padding: 9px 14px; font-size: 14px; color: var(--muted); }
.foot .button:hover { color: var(--ink); }

/* Game over */
.overlay { position: fixed; inset: 0; z-index: 1000; background: color-mix(in srgb, var(--ink) 45%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 300ms both; }
@keyframes fade { from { opacity: 0; } }
.overlay-content { position: absolute; left: 50%; top: 50%; width: min(520px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 26px 30px 26px; text-align: center; min-width: 0; animation: overlayIn 550ms var(--ease) both; transform: translate(-50%, -50%); box-shadow: var(--shadow); }
@keyframes overlayIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.close-button { position: absolute; top: 26px; right: 22px; width: 34px; height: 34px; display: grid; place-items: center; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 8px; opacity: .8; transition: opacity 200ms, background 200ms; }
.close-button:hover { opacity: 1; background: var(--grey); }
/* The card (D, 25 Oct 2026): the title shares its row with the close button, the final score is a label over a big
   centred number like the tiles, the tiles read centred, and the gaps are even */
.game-summary { display: grid; gap: 16px; justify-items: center; width: 100%; }
.game-summary h2 { margin: 0; padding: 0 44px; font: 600 30px/34px var(--sans); letter-spacing: -0.02em; color: var(--ink); }
.game-summary p { margin: 0; color: var(--muted); }
.overlay .target-display { width: 100%; margin: 0; padding: 16px 22px 18px; border: 0; border-radius: 14px; background: var(--violet-soft); color: var(--violet-ink); text-align: center; }
.overlay .target-display > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.overlay .target-display small { font: 400 12.5px/1.2 var(--arcade); letter-spacing: .1em; text-transform: uppercase; color: var(--violet-ink); }
.overlay .target-display span { font: 600 40px/1 var(--sans); letter-spacing: -0.03em; color: var(--violet-ink); font-variant-numeric: tabular-nums; }
.overlay .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overlay .stat-box { padding: 12px 14px 14px; text-align: center; justify-items: center; }

/* The calculator panel, dropped from the bar */
.game-calc-backdrop { display: none; position: fixed; inset: 0; z-index: 200; }
.game-calc-backdrop.is-open { display: block; }
.game-calc-panel { display: none; position: fixed; top: 66px; right: 16px; z-index: 201; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; box-shadow: var(--shadow); max-width: min(360px, calc(100vw - 24px)); animation: calcIn 250ms var(--ease) both; }
.game-calc-panel.is-open { display: block; }
@keyframes calcIn { from { opacity: 0; transform: translateY(-6px); } }
.game-calc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.game-calc-title { font: 400 12px var(--arcade); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.game-calc-close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-grid; place-items: center; }
.game-calc-close:hover { background: var(--grey); color: var(--ink); }
.game-calc-close i.fas { width: 16px; height: 16px; }
.game-calc-penalty-note { font-size: 12px; color: var(--red); text-align: center; margin-top: 6px; min-height: 1em; }

/* ---- The microgames (LogicBumper, SignShifter, the GOAT) on the shared engine --------------------------------------- */
.microgame-card { max-width: none; }
.mode-note { margin: 0; text-align: center; font: 400 12.5px/1.3 var(--arcade); letter-spacing: .06em; text-transform: uppercase; color: var(--violet-ink); min-height: 1em; }
.mode-note:empty { display: none; }
.prompt-display { margin: 0; max-width: none; padding: 18px 22px; border: 0; border-radius: 14px; background: var(--violet-soft); color: var(--ink); text-align: center; font-size: clamp(17px, 2.4vw, 20px); font-weight: 500; line-height: 1.45; animation: lift 400ms var(--ease); }
.prompt-display strong { color: var(--violet-ink); font-weight: 600; }
/* before the game starts the box holds the game's standing rules, then the word to begin (D, 25 Oct 2026) */
.prompt-display .rules { display: block; font-size: 15.5px; font-weight: 400; }
.prompt-display .go { display: block; margin-top: 10px; font: 400 12.5px/1.2 var(--arcade); letter-spacing: .08em; text-transform: uppercase; color: var(--violet-ink); }
.microgame-card .instruction { margin: 0; text-align: center; font-size: 13px; line-height: 1.5; color: var(--faint); max-width: 48em; align-self: center; }
.answer-row { display: flex; justify-content: center; margin: 0; }
.answer-input { width: min(420px, 100%); margin: 0; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 600 22px/1.2 var(--mono); text-align: center; transition: border-color 200ms, box-shadow 200ms; }
.answer-input::placeholder { color: var(--faint); font-weight: 400; font-size: 16px; }
.answer-input:focus { outline: 0; border-color: var(--violet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }
.answer-input:disabled { opacity: .5; }
/* the engine's feedback: a tick of the thing you touched, a shake for wrong, a ring for right */
@keyframes microgame-interaction-tick { 0% { transform: scale(1); } 40% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes microgame-engine-nope { 0%, 100% { transform: translateX(0); } 18% { transform: translateX(-7px); } 36% { transform: translateX(7px); } 54% { transform: translateX(-4px); } 72% { transform: translateX(4px); } }
@keyframes microgame-engine-yep { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 0%, transparent); } 35% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--green) 35%, transparent); } 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 0%, transparent); } }
.microgame-interaction-tick { animation: microgame-interaction-tick 240ms ease-out; }
.microgame-engine-nope { animation: microgame-engine-nope 520ms ease; border-radius: 12px; outline: 2px solid color-mix(in srgb, var(--red) 55%, transparent); outline-offset: 4px; }
.microgame-engine-yep { animation: microgame-engine-yep 720ms ease-out; border-radius: 12px; outline: 2px solid color-mix(in srgb, var(--green) 50%, transparent); outline-offset: 4px; }

/* ---- HexHero: two nibbles, then the byte and its denary ------------------------------------------------------------ */
.hex-blast .binary-grid { gap: 18px; flex-wrap: wrap; }
.nibble-container { position: relative; display: flex; gap: 8px; margin: 0; padding: 22px 10px 10px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--line-strong); }
.nibble-container::before { content: "HIGH NIBBLE"; position: absolute; top: 6px; left: 12px; font: 400 10.5px var(--arcade); letter-spacing: .08em; color: var(--faint); }
.nibble-container:last-child::before { content: "LOW NIBBLE"; }
.nibble-container .bit-box { background: var(--panel); }
.nibble-container .bit-box[data-bit="1"] { background: var(--violet); }
.hex-blast .instruction { margin: 0; text-align: center; font-size: 15.5px; color: var(--muted); }
.byte-display { display: flex; justify-content: center; gap: 8px; margin: 0; width: 100%; --bw: clamp(30px, calc((min(100vw, 760px) - 120px) / 8), 54px); animation: lift 400ms var(--ease); }
.byte-display .binary-column { display: grid; gap: 5px; justify-items: center; width: var(--bw); }
.decimal-input { margin: 0; text-align: center; animation: lift 400ms var(--ease); }
.decimal-input input { width: min(260px, 100%); margin: 0; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 600 22px/1.2 var(--mono); text-align: center; transition: border-color 200ms, box-shadow 200ms; }
.decimal-input input::placeholder { color: var(--faint); font-weight: 400; font-size: 15px; }
.decimal-input input:focus { outline: 0; border-color: var(--violet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }
.hex-blast .target-display--goal > div:last-child { font-family: var(--mono); letter-spacing: .04em; }

/* ---- ByteBuilder: two numbers, a line, your answer, the overflow switch -------------------------------------------- */
.sum-block { width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.sum-label { font: 400 12.5px/1.2 var(--arcade); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; text-align: center; }
.sum-block .binary-grid { margin: 0; order: 0; }   /* the block's own order, not the card's: the numbers sit under their label */
/* The carry row (D, 25 Oct 2026): the place values head the columns, with a small dashed box under each for the
   player's own carries, amber when set. The answer row below carries no place values. */
.carry-row { position: relative; }
.carry-row .bit-box { height: calc(var(--bw) * .6); border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--amber-ink); font-size: clamp(13px, calc(var(--bw) * .36), 17px); cursor: pointer; }
.carry-row .bit-box:empty::after { display: none; }
.carry-row .bit-box:hover { border-color: var(--amber); transform: none; }
.carry-row .bit-box[data-bit="1"] { background: var(--amber-soft); border-color: var(--amber); border-style: solid; color: var(--amber-ink); }
.sum-block .binary-grid + .binary-grid { position: relative; }
.sum-block .binary-grid + .binary-grid::before { content: "+"; position: absolute; left: -4px; top: 50%; transform: translate(-100%, -50%); font: 600 22px var(--mono); color: var(--muted); }
.sum-rule { width: min(100%, calc(8 * var(--bw, 54px) + 7 * 8px)); border: 0; border-top: 2px solid var(--ink); opacity: .7; margin: 0 auto; }
.overflow-row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 0; }
.button.overflow-toggle { padding: 9px 14px; font-size: 14px; }
.button.overflow-toggle::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); transition: background 200ms, box-shadow 200ms; }
.button.overflow-toggle[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.button.overflow-toggle[aria-pressed="true"]::before { background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .25); }
.overflow-help { margin: -4px 0 0; text-align: center; font-size: 13px; color: var(--faint); max-width: 36em; align-self: center; opacity: 1; }

/* ---- BitDrop: bytes fall down the grid ------------------------------------------------------------------------------ */
/* The game's own frame (D, 25 Oct 2026): Round, Bytes and Score as three HUD tiles across the top, as the other games'
   HUD; the grid; the number box and Submit; the three power-ups as equal tiles with their count and key beneath. */
.game-card .game-container { width: 100%; max-width: 480px; margin: 0 auto; font-family: inherit; order: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.game-card .game-container > * { grid-column: 1 / -1; min-width: 0; }
.game-card .game-info { display: contents; }
.game-card .game-info > div, .game-card .score { grid-column: auto; order: -1; margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; text-align: center; display: grid; gap: 2px; font: 400 12px/1.2 var(--arcade); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.game-card .game-info > div b, .game-card .score b { display: block; font: 600 26px/1.15 var(--sans); letter-spacing: -0.02em; color: var(--ink); text-transform: none; font-variant-numeric: tabular-nums; }
.game-card .game-info > div b span, .game-card .score b span { display: inline; margin: 0; font: inherit; color: inherit; vertical-align: baseline; }
.game-card .round-counter { font-weight: inherit; }
.game-card .score span.bump, .game-card .game-info span.bump { display: inline-block; }
.grid-wrapper { position: relative; display: grid; gap: 4px; }
.place-values { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 0 10px; background: none; text-align: center; font: 400 12px var(--mono); color: var(--faint); }
/* the grid is square and its rows share its height: a square cell sized by itself would not stretch the wrapper's row */
.game-card .grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; width: 100%; gap: 4px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }   /* a new byte slides in from beyond the top edge */
.cell { width: auto; height: auto; min-width: 0; min-height: 0; display: grid; place-items: center; border-radius: 7px; background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); font: 600 clamp(14px, 4vw, 20px)/1 var(--mono); transition: background 150ms, border-color 150ms, color 150ms; }
.cell.empty { background: transparent; border: 1px dashed var(--line); }
.cell[data-bit="1"] { background: var(--violet); border-color: var(--violet); color: #fff; }
.cell[data-bit="0"] { color: var(--faint); }
.cell.falling { background: var(--violet-soft); border-color: transparent; color: var(--violet-ink); }   /* the game's tag for anything above the bottom row, stacked or falling */
/* arcade.js compares each redraw with the last: a cell that moved down a row slides the whole 250ms step (linear, so the
   fall is continuous); a cell that moved last time and stayed this time has landed and settles with a squash */
.cell.drop { animation: celldrop 250ms linear both; }   /* in the top row that is from beyond the grid's edge, which clips */
@keyframes celldrop { from { transform: translateY(calc(-100% - 4px)); } }
.cell.land { animation: celland 320ms var(--ease); transform-origin: 50% 100%; transition: none; }   /* the colour snaps, so the squash is the only motion */
.cell.drop.quick { animation-duration: 150ms; }   /* the gap-fill after a right answer moves faster than the fall */
@keyframes celland { 0% { transform: none; } 35% { transform: scaleY(.84) scaleX(1.04); } 100% { transform: none; } }   /* one squish on contact and back; no bounce */
.cell.falling[data-bit="1"] { background: color-mix(in srgb, var(--violet) 55%, var(--violet-soft)); color: #fff; }
.game-card .controls { order: 0; margin: 0; display: flex; justify-content: center; gap: 8px; font: inherit; letter-spacing: 0; }
.game-card .controls input { width: 160px; margin: 0; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); font: 600 18px/1.2 var(--mono); text-align: center; transition: border-color 200ms, box-shadow 200ms; }
.game-card .controls input::placeholder { color: var(--faint); font-weight: 400; font-size: 14px; }
.game-card .controls input:focus { outline: 0; border-color: var(--violet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }
.game-card .controls .button-submit { min-width: 0; padding: 11px 20px; font-size: 15px; }
.game-card .controls-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 0; }
.ninja-container, .blast-container, .nudge-container { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ninja-button, .blast-button, .nudge-button { --pu: var(--violet); --pu-soft: var(--violet-soft); --pu-ink: var(--violet-ink); width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 10px; border-radius: 10px; border: 1px solid transparent; background: var(--pu-soft); color: var(--pu-ink); font: 600 14px/1 var(--sans); cursor: pointer; transition: transform 300ms var(--ease), background 200ms, border-color 200ms, box-shadow 200ms; }
/* each power-up has its own colour (D, 25 Oct 2026): the ninja violet, the blast amber, the nudge blue */
.blast-button { --pu: var(--amber); --pu-soft: var(--amber-soft); --pu-ink: var(--amber-ink); }
.nudge-button { --pu: #2F6FE4; --pu-soft: #E2ECFC; --pu-ink: #1D4FB5; }
html[data-theme="dark"] .nudge-button { --pu: #6EA0FF; --pu-soft: #16274A; --pu-ink: #A9C4FF; }
.ninja-icon, .blast-icon, .nudge-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--pu); color: #fff; flex: none; }
.ninja-icon svg, .blast-icon svg, .nudge-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ninja-button:hover, .blast-button:hover, .nudge-button:hover { border-color: var(--pu); transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--pu) 22%, transparent); }
.ninja-button:active, .blast-button:active, .nudge-button:active { transform: translateY(0) scale(.98); }
.ninja-button:disabled, .blast-button:disabled, .nudge-button:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; border-color: transparent; }
.ninja-count, .blast-count, .nudge-count { font: 400 12px/1.3 var(--arcade); color: var(--faint); letter-spacing: .02em; text-align: center; }
.game-card kbd { font: inherit; color: var(--muted); background: var(--grey); border-radius: 5px; padding: 1px 6px; margin-left: 2px; }
.input-error { border-color: var(--red) !important; background: var(--red-soft) !important; animation: shake 420ms; }
.ninja-slash { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; pointer-events: none; background: color-mix(in srgb, var(--violet) 32%, transparent); border-radius: 14px; opacity: 0; transition: opacity 250ms; }
.ninja-slash-active { opacity: 1; }
.ninja-slash-text { font: 700 48px/1 var(--sans); letter-spacing: -0.03em; color: #fff; transform: rotate(-12deg); text-shadow: 0 6px 24px rgba(29, 27, 38, .35); }
.ninja-slash-active .ninja-slash-text { animation: slice 500ms var(--snap); }
@keyframes slice { 0% { transform: rotate(-12deg) scale(.6); } 100% { transform: rotate(-12deg) scale(1); } }
.game-over, .round-complete { position: absolute; left: 50%; top: 50%; width: min(330px, 92%); transform: translate(-50%, -50%); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 20px; text-align: center; display: none; z-index: 6; box-shadow: var(--shadow); animation: overlayIn 500ms var(--ease) both; }
.game-over h2, .round-complete h2 { margin: 0 0 12px; font: 600 28px/1.1 var(--sans); letter-spacing: -0.02em; }
.game-over p, .round-complete p { margin: 6px 0; color: var(--muted); font-size: 15px; display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.game-over p span, .round-complete p span { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.round-complete p { justify-content: center; border-top: 0; padding: 2px 0; }
.game-over .button, .round-complete .button { margin-top: 14px; }

/* A right answer throws a few pixels up from the bits (arcade.js) */
.px-burst { position: fixed; z-index: 50; width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--violet)); pointer-events: none; animation: burst 750ms var(--ease) forwards; }
@keyframes burst { from { opacity: 1; transform: translate(0, 0) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); } }

@media (max-width: 560px) {
  .arcade-top .in { padding: 10px 14px; gap: 10px; }
  .wordmark { font-size: 17px; }
  .tools .all { display: none; }
  .card { width: calc(100% - 20px); margin-top: 14px; padding: 18px 14px 20px; border-radius: 16px; gap: 12px; }
  .binary-grid { --bw: clamp(30px, calc((100vw - 76px) / 8), 54px); gap: 6px; }
  .byte-display { --bw: clamp(30px, calc((100vw - 76px) / 8), 54px); gap: 6px; }
  .hex-blast .binary-grid { gap: 10px; }
  .nibble-container { padding: 22px 6px 6px; gap: 5px; }
  .stats-grid { gap: 6px; }
  .stat-box { padding: 8px 10px 10px; }
  .stat-box > div:last-child { font-size: 22px; }
  .title h1 { font-size: 20px; }
  .overlay-content { padding: 30px 18px 22px; }
  .game-calc-panel { right: 8px; left: 8px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .px-horizon i { transition: none; }
  .px-burst { display: none; }
}
