:root { color-scheme: dark; --bg: #000; --fg: #eee; --muted: #9a9a9a; --accent: #5ac8fa; --panel: rgba(12, 12, 20, .94); --rule: #333; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* 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; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
#app { display: flex; flex-direction: column; min-height: 100dvh; }
#bar { display: flex; align-items: center; gap: .25rem; padding: .35rem .6rem; padding-top: max(.35rem, env(safe-area-inset-top)); }
#bar .title { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; color: var(--muted); }
.spacer { flex: 1; }
#bar button { background: none; border: 0; color: var(--fg); padding: .3rem .45rem; cursor: pointer; border-radius: .4rem; display: inline-flex; }
#bar button:hover, #bar button:focus-visible { background: #222; outline: none; }
#stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: .25rem .5rem max(.5rem, env(safe-area-inset-bottom)); }
#cabinet { position: relative; width: min(100%, calc((100dvh - 4.5rem) * 224 / 288)); aspect-ratio: 224 / 288; background: #000; }
#cabinet.with-touch { width: min(100%, calc((100dvh - 12rem) * 224 / 288)); }
#screen { display: block; width: 100%; height: 100%; image-rendering: pixelated; background: #000; outline: none; touch-action: none; }
#scanlines { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.28) 2px, rgba(0,0,0,.28) 3px); mix-blend-mode: multiply; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.overlay span { background: rgba(0,0,0,.65); color: var(--fg); padding: .4rem .9rem; border-radius: 2rem; font-size: .95rem; letter-spacing: .02em; }
#hint span { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.notice { position: absolute; left: 0; right: 0; bottom: 0; padding: .25rem .5rem; font-size: .75rem; color: var(--muted); background: rgba(0,0,0,.6); text-align: center; }
.panel { position: absolute; inset: 0; background: var(--panel); padding: 1.25rem 1rem; display: flex; flex-direction: column; justify-content: center; gap: .75rem; overflow: auto; }
.panel h1 { margin: 0; font-size: 1.6rem; letter-spacing: .06em; }
.panel p { margin: 0; }
.drop { display: block; border: 2px dashed #555; border-radius: .6rem; padding: 1rem; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--accent); background: rgba(90,200,250,.08); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row input[type=url] { flex: 1; min-width: 10rem; padding: .5rem .6rem; border-radius: .4rem; border: 1px solid #555; background: #111; color: var(--fg); font: inherit; }
button { font: inherit; padding: .5rem .9rem; border-radius: .4rem; border: 1px solid #555; background: #1c1c24; color: var(--fg); cursor: pointer; }
button.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.status { font-size: .9rem; }
.status.bad { color: #ff8a80; }
.status.ok { color: #8be28b; }
.fine { font-size: .78rem; color: var(--muted); }
code { font-family: ui-monospace, monospace; font-size: .95em; }
/* Touch: a stick on the left (left and right only: the arcade's lever), FIRE on the
   right, Start and Coin between them. A finger that lands on the stick steers it
   wherever it slides until lifted; the knob follows it. */
#touch { display: none; touch-action: none; width: min(100%, 30rem); align-items: center; justify-content: space-between; gap: .75rem; padding: 0 .5rem; }
#touch button { touch-action: none; user-select: none; -webkit-user-select: none; }
#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 var(--fg); border-left: 0; }
#touch .stick::after { right: .55rem; border-left: .6rem solid var(--fg); 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: var(--accent); }
#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; }
#touch .pill.held { background: #444; }
#touch button.held { outline: none; }
@media (pointer: coarse) { #touch { display: flex; } }
#bar #rewind { touch-action: none; -webkit-user-select: none; user-select: none; }
#bar #rewind.held { background: #333; }
/* A phone on its side: the picture takes the whole height, and the bar and the
   controls float over the black either side of it. */
@media (pointer: coarse) and (orientation: landscape) {
  #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; background: none; }
  #bar > * { pointer-events: auto; }
  #bar button { opacity: .7; filter: drop-shadow(0 0 2px #000); }
  #bar .title { visibility: hidden; }
  #stage { padding: 0; height: 100dvh; }
  #cabinet, #cabinet.with-touch { width: auto; height: 100dvh; max-width: 100%; }
  #touch { position: fixed; inset: 0; z-index: 2; pointer-events: none; display: block; padding: 0; width: auto; }
  #touch > * { pointer-events: auto; position: absolute; }
  #touch .stick { position: absolute; left: max(1.25rem, env(safe-area-inset-left)); bottom: 1.25rem; }
  #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. */
  #touch .middle { left: max(1.25rem, env(safe-area-inset-left)); top: max(.45rem, env(safe-area-inset-top)); flex-direction: row; }
}
:fullscreen #stage, #stage:fullscreen { background: #000; }
dialog { background: #14141c; color: var(--fg); border: 1px solid #444; border-radius: .8rem; max-width: min(92vw, 26rem); width: 100%; padding: 1rem 1.1rem; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
dialog form { display: flex; flex-direction: column; gap: .55rem; }
dialog label { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
dialog select, dialog input[type=range] { max-width: 60%; }
dialog select { font: inherit; padding: .25rem .4rem; background: #111; color: var(--fg); border: 1px solid #555; border-radius: .3rem; }
dialog details { border-top: 1px solid var(--rule); padding-top: .4rem; }
dialog summary { cursor: pointer; }
table.controls { border-collapse: collapse; font-size: .85rem; width: 100%; }
table.controls td, table.controls th { text-align: left; padding: .2rem .3rem; border-bottom: 1px solid var(--rule); }
a { color: var(--accent); }
