:root {
  color-scheme: light;
  --white: #fff;
  --paper: #f7f8fa;
  --ink: #18191d;
  --muted: #555c66;
  --line: #e6e8ec;
  --search: #f1f2f4;
  --red: #c72b37;
  --red-hover: #ab1e2b;
  --focus: #265cc8;
  --tile-background: #25262c;
  --tile-shade: rgb(14 17 24 / .84);
  --game-bg: #f5f5f5;
  --game-ink: #505050;
  --game-faint: #dedede;
  --game-border: #626262;
  --game-button: #dedede;
  --game-button-hover: #cecece;
  --mono: "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, "Segoe UI", sans-serif;
  --radius: .875rem;
  --gutter: clamp(1rem, 3.5vw, 3.625rem);
  --hit: 2.75rem;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 1rem/1.5 var(--sans); background: var(--white); color: var(--ink); }
button, input { font: inherit; color: inherit; }
button:not(:disabled), summary { cursor: pointer; }
button:disabled { opacity: .45; }
button, a, .arena { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: .1875rem solid var(--focus); outline-offset: .1875rem; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 10; top: .5rem; left: .5rem; padding: .75rem; background: var(--white); }
svg { display: block; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 110rem; min-height: 4.25rem; margin-inline: auto; padding: .625rem var(--gutter); display: grid; grid-template-columns: 1fr minmax(14rem, 32.5rem) 1fr; align-items: center; gap: 1rem; }
.header-brand, .brand { display: inline-flex; align-items: center; gap: .625rem; }
.brand { min-height: var(--hit); width: fit-content; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 2.125rem; height: 2.125rem; background: var(--red); color: var(--white); border-radius: .5rem; }
.brand-mark svg { width: 1.5rem; }
.brand-name { font-size: 1.18rem; font-weight: 900; line-height: 1; letter-spacing: -.065em; text-transform: uppercase; }
.brand-name > span { color: var(--red); }
.nav-menu { position: relative; }
.nav-menu summary, .tool { display: grid; place-items: center; min-width: var(--hit); min-height: var(--hit); border: 0; background: none; border-radius: .5rem; }
.nav-menu summary { list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu svg, .search svg, .tool svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-menu nav { position: absolute; z-index: 5; top: calc(100% + .25rem); left: 0; display: grid; min-width: 12rem; padding: .375rem; background: var(--white); border: 1px solid var(--line); border-radius: .625rem; box-shadow: 0 .5rem 1.5rem rgb(22 25 34 / .12); }
.nav-menu nav a { display: flex; align-items: center; min-height: var(--hit); padding: .5rem .75rem; border-radius: .375rem; text-decoration: none; font-weight: 650; white-space: nowrap; }
.nav-menu nav a:hover, .nav-menu summary:hover, .tool:hover:not(:disabled) { background: var(--search); }
.search { display: flex; align-items: center; gap: .625rem; padding-inline: .875rem; border-radius: .625rem; background: var(--search); color: var(--muted); }
.search svg { flex: none; }
.search:focus-within { outline: .125rem solid var(--focus); }
.search input { width: 100%; min-width: 0; min-height: var(--hit); border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.header-play, .back-link { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: fit-content; min-height: var(--hit); padding: .5rem .875rem; border-radius: .5rem; font-weight: 700; font-size: .875rem; text-decoration: none; white-space: nowrap; }
.header-play { justify-self: end; background: var(--red); color: var(--white); }
.header-play:hover { background: var(--red-hover); }
.header-play span { font-size: .75em; }
.back-link { justify-self: end; background: var(--search); }

.catalog-wrap { max-width: 110rem; margin-inline: auto; padding: 1.125rem var(--gutter) 2.5rem; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 .75rem; }
.catalog-heading h1 { font-size: clamp(1.125rem, 2vw, 1.375rem); font-weight: 780; letter-spacing: -.025em; }
.catalog-heading p { font-size: .8125rem; color: var(--muted); }
.game-list { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; padding: 0; list-style: none; }
.game-list li { width: min(100%, clamp(8rem, 13.35vw, 11rem)); }
.game-tile { position: relative; isolation: isolate; display: flex; align-items: end; aspect-ratio: 4 / 3; overflow: hidden; padding: .5rem .625rem; border-radius: var(--radius); background: var(--tile-background); color: var(--white); text-decoration: none; }
.game-tile::before { content: ""; position: absolute; z-index: -1; inset: 30% 0 0; background: linear-gradient(transparent, var(--tile-shade)); }
.game-tile:hover .game-thumb { filter: brightness(1.1); }
.game-thumb { position: absolute; z-index: -2; inset: 0; background: center / cover no-repeat; }
.flappy-tile .game-thumb { background-image: url("art/flappy-pipe.svg"); }
.dino-tile .game-thumb { background-image: url("art/dino-run.svg"); }
.ghost-tile .game-thumb { background-image: url("art/ghost-chase.svg"); }
.skip-ad-tile .game-thumb { background-image: url("art/skip-ad.svg"); }
.water-tile .game-thumb { background-image: url("art/water-for-kofi.svg"); }
.ethnic-wars-tile .game-thumb { background-image: url("art/ethnic-wars-jacques.jpg"); }
.dice-chess-tile .game-thumb { background-image: url("art/dice-chess.svg"); }
.cursor-escape-tile .game-thumb { background-image: url("art/cursor-escape.png"); }
.cotton-tile .game-thumb { background-image: url("art/cotton-picking.svg"); }
/* Keep the hosted editor shortcut out of the arcade pages. */
body > [data-sites-widget="editor-composer"] { display: none !important; }
.snake-tile .game-thumb { background-image: url("art/snake-snack.svg"); }
.revolt-tile .game-thumb { background-image: url("art/fruit-revolt.svg"); }
.tile-title { font-size: .875rem; line-height: 1.18; font-weight: 750; }
.tile-badge { position: absolute; top: .5rem; right: .5rem; padding: .125rem .375rem; border-radius: .25rem; background: var(--red); color: var(--white); font-size: .625rem; font-weight: 800; text-transform: uppercase; }
.cotton-badge { background: #3f3227; }
.empty { max-width: 27rem; padding: 1.25rem; text-align: center; background: var(--paper); border-radius: var(--radius); }
.empty p { margin: .375rem 0 1rem; color: var(--muted); }
.empty button { min-height: var(--hit); padding-inline: .875rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--white); font-weight: 700; }
.site-footer { max-width: 110rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-inline: auto; padding: 1.25rem var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.site-footer strong { color: var(--ink); }

.game-header { display: flex; justify-content: space-between; }
.game-wrap { width: min(62rem, calc(100% - 2 * var(--gutter))); margin: 1.75rem auto 3rem; }
.game-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; margin-bottom: .75rem; }
.game-heading h1 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -.035em; }
.game-heading p { color: var(--muted); font-size: .8125rem; }
.cabinet { scroll-margin-top: .75rem; }
.cabinet-body { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.arena { position: relative; aspect-ratio: 2.25; overflow: hidden; background: var(--game-bg); color: var(--game-ink); touch-action: manipulation; }
.arena[data-state="running"] { cursor: pointer; }
.arena:focus-visible { outline-color: var(--game-border); outline-offset: -.25rem; }
.arena canvas { display: block; width: 100%; height: 100%; }
.hud { position: absolute; top: .875rem; right: .875rem; display: flex; gap: .875rem; font: 700 .75rem var(--mono); pointer-events: none; }
.hud div { display: flex; align-items: baseline; gap: .25rem; }
.hud output { font-size: .9375rem; }
.arena[data-state="ready"] .hud { visibility: hidden; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.125rem .75rem; pointer-events: none; }
.message { display: flex; flex-direction: column; align-items: center; gap: .375rem; max-width: min(100%, 22rem); padding: .875rem 1.25rem; border: 2px solid var(--game-border); background: var(--game-bg); color: var(--game-ink); text-align: center; }
.message h2 { font: 800 clamp(1.125rem, 2.7vw, 1.75rem)/1.1 var(--mono); }
.message-kicker { font: 750 .75rem/1.2 var(--mono); letter-spacing: .05em; }
#message-detail { font: .8125rem var(--mono); }
.action { min-width: 8.5rem; min-height: var(--hit); margin-top: .25rem; padding: .375rem .75rem; border: 2px solid var(--game-border); background: var(--game-button); color: var(--game-ink); font: 800 .875rem var(--mono); pointer-events: auto; }
.action:hover { background: var(--game-button-hover); }
.ready-title { display: none; }
.arena[data-state="ready"] .overlay { align-items: start; padding-top: clamp(.875rem, 3.2vw, 2.25rem); }
.arena[data-state="ready"] .message { width: 100%; max-width: none; padding: 0; border: 0; background: transparent; gap: clamp(.375rem, 1.2vw, .875rem); }
.arena[data-state="ready"] .message h2 { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.arena[data-state="ready"] .message p { display: none; }
.arena[data-state="ready"] .ready-title { display: block; width: clamp(11.5rem, 34%, 21rem); height: auto; }
.control-bar { display: flex; align-items: center; justify-content: space-between; gap: .25rem; min-height: 3.25rem; padding-inline: .625rem; border-top: 1px solid var(--line); }
.key-hint, .touch-hint { color: var(--muted); font-size: .8125rem; }
.key-hint { display: flex; align-items: center; gap: .375rem; }
.touch-hint { display: none; }
kbd { display: inline-block; padding: .125em .375em; border: 1px solid var(--line); border-radius: .25rem; background: var(--white); font: 700 .85em/1.3 var(--mono); color: var(--ink); }
.game-tools { display: flex; align-items: center; }
.tool { padding: 0; color: var(--muted); }
#audio[aria-pressed="true"] .muted-icon, #audio[aria-pressed="false"] .sound-icon { display: none; }
.cabinet-body:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; background: var(--game-bg); }
.cabinet-body:fullscreen .arena { flex: 0 1 auto; min-height: 0; }
.cabinet-body:fullscreen .control-bar { background: var(--white); }
.no-script { padding: .75rem; }
.rules { margin-top: 1.125rem; padding: 1.125rem; border: 1px solid var(--line); border-radius: var(--radius); }
.rules h2 { margin-bottom: .25rem; font-size: 1.0625rem; }
.rules p { color: var(--muted); font-size: .9375rem; }

.pipe-page {
  --pipe-sky: #d9f1ff;
  --pipe-cloud: #fff;
  --pipe-hills: #a3d7ce;
  --pipe-hills-dark: #82beb8;
  --pipe-ink: #173957;
  --pipe-light: #aaf48b;
  --pipe-mid: #62c46a;
  --pipe-dark: #309257;
  --bird-body: #bb96f7;
  --bird-wing: #8b62db;
  --bird-beak: #ff9864;
  --pipe-alert: #9e2d3a;
}
.pipe-page .arena { background: var(--pipe-sky); color: var(--pipe-ink); touch-action: none; }
.pipe-page .arena[data-state="running"] { cursor: ns-resize; }
.pipe-page .arena:focus-visible { outline-color: var(--pipe-ink); }
.pipe-page .hud { padding: .375rem .625rem; border-radius: .375rem; background: var(--white); }
.pipe-page .message { border: 2px solid var(--pipe-ink); border-radius: .625rem; background: var(--white); color: var(--pipe-ink); box-shadow: .25rem .25rem 0 var(--pipe-ink); }
.pipe-page .arena[data-state="ready"] .overlay { align-items: center; padding-top: 1.125rem; }
.pipe-page .arena[data-state="ready"] .message { width: fit-content; max-width: 100%; padding: .75rem 1rem; gap: .375rem; border: 2px solid var(--pipe-ink); background: var(--white); }
.pipe-page .arena[data-state="ready"] .message h2 { position: static; width: auto; height: auto; clip-path: none; }
.pipe-page .arena[data-state="ready"] .message p { display: block; }
.pipe-page .action { border-color: var(--pipe-ink); border-radius: .375rem; background: var(--pipe-light); color: var(--pipe-ink); }
.pipe-page .action:hover { background: var(--pipe-mid); }

.snake-page {
  --snake-floor: #172c35;
  --snake-grid: #1b333c;
  --snake-wall: #375461;
  --snake-wall-light: #587782;
  --snake-body: #7fd686;
  --snake-head: #adf6a5;
  --snake-apple: #ff6c78;
  --snake-apple-light: #ffc0c5;
  --snake-decoy: #ffcc67;
}
.snake-page .game-wrap { width: min(54rem, calc(100% - 2 * var(--gutter))); }
.snake-page .arena { aspect-ratio: 5 / 3; background: var(--snake-floor); touch-action: none; }
.snake-page .arena canvas { image-rendering: pixelated; }
.snake-page .arena[data-state="running"] { cursor: default; }
.snake-page .arena:focus-visible { outline-color: var(--snake-decoy); }
.snake-scorebar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; padding: .625rem .75rem; background: var(--snake-floor); color: var(--white); font: 700 .75rem var(--mono); }
.snake-scores, .snake-legend { display: flex; align-items: center; gap: .75rem; }
.snake-scores output { color: var(--snake-head); font-size: .875rem; }
.snake-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.snake-legend span::before { content: ""; width: .5rem; height: .5rem; border-radius: .125rem; background: var(--snake-apple); }
.snake-legend .legend-decoy::before { background: var(--snake-decoy); }
.snake-page .message { border-color: var(--snake-wall); border-radius: .625rem; background: var(--snake-floor); color: var(--white); box-shadow: .25rem .25rem 0 var(--snake-wall); }
.snake-page .arena[data-state="ready"] .overlay { align-items: center; padding: .75rem; }
.snake-page .arena[data-state="ready"] .message { width: fit-content; max-width: 100%; padding: .75rem 1rem; border: 2px solid var(--snake-wall); background: var(--snake-floor); }
.snake-page .arena[data-state="ready"] .message h2 { position: static; width: auto; height: auto; clip-path: none; }
.snake-page .arena[data-state="ready"] .message p { display: block; }
.snake-page .action { border-color: var(--snake-head); border-radius: .375rem; background: var(--snake-head); color: var(--snake-floor); }
.snake-page .action:hover { background: var(--snake-body); }
.snake-move { display: flex; }
.snake-move .tool { color: var(--ink); font-size: 1.125rem; touch-action: none; }
.snake-page .game-tools .tool { touch-action: manipulation; }
.snake-page .game-tools svg { pointer-events: none; }
.snake-page .cabinet-body:fullscreen { background: var(--snake-floor); }
.snake-page .cabinet-body:fullscreen .arena { width: min(100%, calc((100dvh - 6rem) * 5 / 3)); margin-inline: auto; flex: none; }

@media (max-width: 53rem) {
  .header-inner { grid-template-columns: auto minmax(10rem, 1fr) auto; gap: .625rem; }
  .header-brand { gap: .25rem; }
}
@media (max-width: 40rem) {
  .header-inner:not(.game-header) { grid-template-columns: 1fr auto; padding-block: .375rem .625rem; gap: .375rem; }
  .search { grid-row: 2; grid-column: 1 / -1; }
  .catalog-heading { flex-wrap: wrap; gap: .125rem .5rem; }
  .arena { aspect-ratio: 1.55; }
  .game-wrap { margin-top: 1rem; }
  .control-bar { padding-inline: .375rem; }
  .pipe-page .arena[data-state="ready"] .overlay { align-items: start; }
  .snake-page .arena[data-state="ready"] .overlay { align-items: start; padding-top: .5rem; }
  .snake-page .arena[data-state="ready"] .message { padding: .5rem .75rem; }
  .snake-hint { display: none; }
}
@media (pointer: coarse), (max-width: 35rem) {
  .key-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (max-width: 26rem) {
  .brand-name { font-size: 1rem; }
  .brand-name > span { display: block; }
}
@media (max-width: 23rem) {
  .header-play { padding-inline: .625rem; }
  .touch-hint { font-size: .75rem; }
  .game-heading { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
