:root { color-scheme: light dark; --ok: #1a7f37; --bad: #b3261e; --muted: #6b6b6b; --rule: #d0d0d0; }
@media (prefers-color-scheme: dark) { :root { --ok: #3fb950; --bad: #f85149; --muted: #9a9a9a; --rule: #3a3a3a; } }
/* A game, not a document: no text selection, copy menu or tap flash on a phone, and
   no double-tap zoom. Text fields stay selectable. */
html { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
body { font: 16px/1.5 system-ui, sans-serif; margin: 0; }
main { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .5rem; }
.lede { max-width: 48rem; }
.build, .summary { color: var(--muted); font-size: .9rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.pending { color: var(--muted); }
pre { overflow-x: auto; font-size: .8rem; }
footer { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1rem; font-size: .9rem; }
a { color: inherit; }
button { font: inherit; padding: .4rem .9rem; }
.console { max-height: 22rem; overflow: auto; border: 1px solid var(--rule); padding: .5rem; font-family: ui-monospace, monospace; }
/* The game. On a desktop it sits in the page: a small bar (rewind, fullscreen) over the
   picture. On a phone, once it runs, it takes the screen (html.play-on): the bar on
   top, the picture, and an arcade's controls under it, a stick on the left (left and
   right only; a thumb that lands on it steers wherever it slides until lifted), FIRE
   on the right, Start and Coin between. On its side the picture takes the full
   height and the bar and controls float beside it. The bar's cross docks it back
   into the page (html.play-docked). */
.play { max-width: 448px; }
.play-bar { display: flex; align-items: center; gap: .25rem; }
.play-bar .play-title { display: none; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; color: #9a9a9a; }
.play-bar .spacer { flex: 1; }
.play-bar button { background: none; border: 0; color: inherit; padding: .3rem .45rem; cursor: pointer; border-radius: .4rem; display: inline-flex; }
.play-bar button:hover { background: rgba(127,127,127,.2); }
.play-bar #play-pause.on { background: rgba(127,127,127,.35); }
#play-exit, .play-return { display: none; }
#rewind { touch-action: none; -webkit-user-select: none; user-select: none; }
#rewind.held { background: rgba(127,127,127,.35); }
#screen { width: 448px; height: auto; max-width: 100%; aspect-ratio: 224 / 256; image-rendering: pixelated; background: #000; display: block; outline: none; touch-action: none; }
.touch { display: none; touch-action: none; align-items: center; justify-content: space-between; gap: .75rem; padding: 0 .5rem; width: min(100%, 30rem); }
.touch button { touch-action: none; user-select: none; -webkit-user-select: none; font: inherit; }
.touch .stick { position: relative; width: 7.5rem; height: 7.5rem; border-radius: 50%; background: radial-gradient(circle, #23232e 0 55%, #1a1a22 56%); border: 2px solid #3a3a48; touch-action: none; flex: none; }
.touch .stick::before, .touch .stick::after { content: ""; position: absolute; top: 50%; width: 0; height: 0; border: .45rem solid transparent; margin-top: -.45rem; opacity: .55; }
.touch .stick::before { left: .55rem; border-right: .6rem solid #eee; border-left: 0; }
.touch .stick::after { right: .55rem; border-left: .6rem solid #eee; border-right: 0; }
.touch .knob { position: absolute; left: 50%; top: 50%; width: 3.4rem; height: 3.4rem; margin: -1.7rem 0 0 -1.7rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #8a8a9a, #4a4a58); box-shadow: 0 2px 6px rgba(0,0,0,.6); transform: translateX(var(--knob, 0px)); transition: transform 60ms linear; pointer-events: none; }
.touch .stick.held { border-color: #5ac8fa; }
.touch .fire { width: 6.2rem; height: 6.2rem; border-radius: 50%; padding: 0; flex: none; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 1rem; background: radial-gradient(circle at 35% 35%, #e0473a, #8c1d16); border: 2px solid #b8352a; color: #fff; }
.touch .fire.held { background: radial-gradient(circle at 35% 35%, #ff6a5c, #b8352a); transform: scale(.96); }
.touch .middle { display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.touch .pill { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; padding: .45rem 1.1rem; border-radius: 1.2rem; background: #22222c; color: #eee; border: 1px solid #555; }
.touch .pill.held { background: #444; }
@media (pointer: coarse) {
  .touch { display: flex; }
  html.play-on:not(.play-docked) { overflow: hidden; }
  html.play-on:not(.play-docked) .play { position: fixed; inset: 0; z-index: 10; max-width: none; background: #000; color: #eee; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: env(safe-area-inset-top) .5rem max(.6rem, env(safe-area-inset-bottom)); }
  html.play-on:not(.play-docked) .play-bar { width: 100%; padding: .35rem .1rem; }
  html.play-on:not(.play-docked) .play-title, html.play-on:not(.play-docked) #play-exit { display: inline-flex; }
  html.play-on:not(.play-docked) .cab { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
  html.play-on:not(.play-docked) #screen { width: auto; height: 100%; max-height: 100%; max-width: 100%; }
  html.play-on:not(.play-docked) #screen:focus { box-shadow: none; }
  html.play-on.play-docked .play { display: none; }
  html.play-on.play-docked .play-return { display: block; }
}
@media (pointer: coarse) and (orientation: landscape) {
  html.play-on:not(.play-docked) .play { padding: 0; }
  html.play-on:not(.play-docked) .play-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 3; padding: max(.2rem, env(safe-area-inset-top)) max(.6rem, env(safe-area-inset-right)) .2rem max(.6rem, env(safe-area-inset-left)); pointer-events: none; }
  html.play-on:not(.play-docked) .play-bar > * { pointer-events: auto; }
  html.play-on:not(.play-docked) .play-title { visibility: hidden; }
  html.play-on:not(.play-docked) .cab { height: 100dvh; flex: none; }
  html.play-on:not(.play-docked) .touch { position: fixed; inset: 0; z-index: 2; pointer-events: none; display: block; padding: 0; width: auto; }
  html.play-on:not(.play-docked) .touch > * { pointer-events: auto; position: absolute; }
  html.play-on:not(.play-docked) .touch .stick { position: absolute; left: max(1.25rem, env(safe-area-inset-left)); bottom: 1.25rem; }
  html.play-on:not(.play-docked) .touch .fire { right: max(1.5rem, env(safe-area-inset-right)); bottom: 1.5rem; }
  /* Start and Coin take the top-left corner, as on every site of the family. */
  html.play-on:not(.play-docked) .touch .middle { left: max(1.25rem, env(safe-area-inset-left)); top: max(.45rem, env(safe-area-inset-top)); flex-direction: row; }
}
table.controls { width: auto; margin-top: .5rem; }
details { margin: .5rem 0; }
summary { cursor: pointer; font-weight: 600; }
#screen.paused { opacity: .6; }
#screen:focus { box-shadow: 0 0 0 3px #4a90d9; }
kbd { font: .85em ui-monospace, monospace; border: 1px solid var(--rule); border-radius: 3px; padding: 0 .3em; }
.rom-url input { max-width: 100%; }
.scroll-x { overflow-x: auto; max-width: 100%; }
.build, .summary { overflow-wrap: anywhere; }
section table:not(.controls) { display: block; overflow-x: auto; }
/* Fullscreen from a desktop: the game alone, the picture as tall as the screen. */
.play:fullscreen { max-width: none; background: #000; color: #eee; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.play:fullscreen .play-bar { width: 100%; }
.play:fullscreen #screen { width: auto; height: calc(100vh - 3rem); max-width: 100%; }
