@font-face {
  font-family: "Press Start 2P";
  src: url("vendor/press-start-2p-latin-400.woff2") format("woff2");
  font-display: swap;
}

:root {
  --arcade: "Press Start 2P", ui-monospace, monospace;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --border: #d5dde4;
  --text: #1e2a36;
  --muted: #5a6874;
  --accent: #2d8c55;
  --accent-strong: #1f6b40;
  --danger: #b3362b;
  --key: #ffffff;
  --key-edge: #1e2a36;   /* keys sit on a solid dark edge */
  --key-pressed: #2d8c55;
  --fill: #5f86ad;
  --radius: 0;   /* every border is deliberate: square and thick */
  --edge: 3px;
  font-family: var(--arcade);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }

.game { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; padding: 8px; }
/* Holding or double-clicking controls shouldn't select their labels (or open the iOS callout). */
.game { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.stage { position: relative; border: var(--edge) solid var(--text); border-radius: var(--radius); overflow: hidden; background: #fff; }
#scene { display: block; width: 100%; aspect-ratio: 1000 / 700; touch-action: none; }

.status {
  position: absolute; top: 10px; left: 10px; padding: 7px 10px; border-radius: var(--radius); line-height: 1.5;
  background: rgba(255, 255, 255, .9); border: 2px solid var(--text); font: 10px var(--arcade); text-transform: uppercase;
}
.status.good { color: var(--accent-strong); border-color: var(--accent-strong); }
.status.bad { color: var(--danger); border-color: var(--danger); }

.corner { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(246, 248, 250, .55); padding: 16px; }
.overlay.hidden { display: none; }
.card {
  background: #fff; border: var(--edge) solid var(--text); border-radius: var(--radius); padding: 20px 22px; max-width: 440px; width: 100%;
  box-shadow: 6px 6px 0 rgba(30, 42, 54, .18);
}
.card h1 { margin: 0 0 14px; font: 18px/1.4 var(--arcade); text-transform: uppercase; }
.card p { margin: 0 0 12px; font-size: 11px; line-height: 1.9; text-transform: uppercase; }
/* Copy is written as short lines that each fit the narrowest card, so breaks are deliberate. */
.lines > span { display: block; white-space: nowrap; }
.pad-word { color: var(--accent-strong); }
.card .tip { font: 9px/1.8 var(--arcade); color: var(--muted); text-transform: uppercase; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.or { font: 8px var(--arcade); color: var(--muted); text-transform: uppercase; }

/* Outcome: a big stamp over the scene (think "WASTED"), then the checks card slides in. */
.result { background: transparent; align-content: center; gap: 18px; transition: background .4s; }
.result.show-card { background: rgba(246, 248, 250, .55); }
.stamp {
  font: clamp(30px, 8vw, 72px)/1 var(--arcade); text-transform: uppercase; letter-spacing: .04em; color: var(--danger);
  text-shadow: 3px 3px 0 #fff, -3px -3px 0 #fff, 3px -3px 0 #fff, -3px 3px 0 #fff, 7px 7px 0 rgba(30, 42, 54, .35);
  animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp.landed { color: var(--accent); }
.stamp.other { color: #c77a12; }
@keyframes stamp { from { transform: scale(2.6) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }
.result-card { opacity: 0; transform: translateY(14px); transition: opacity .3s, transform .3s; pointer-events: none; }
.result.show-card .result-card { opacity: 1; transform: none; pointer-events: auto; }
.summary { font: 10px/1.7 var(--arcade); text-transform: uppercase; }
.checks { width: 100%; border-collapse: collapse; font: 9px/1.6 var(--arcade); text-transform: uppercase; }
.checks th { text-align: left; color: var(--muted); font-weight: 400; padding: 0 0 6px; border-bottom: 2px solid var(--text); }
.checks td { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.checks th:last-child, .checks td:last-child { text-align: right; width: 64px; }
.checks td.ok { color: var(--accent-strong); }
.checks td.fail { color: var(--danger); }

button { border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.panel {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding: 12px 14px; border: var(--edge) solid var(--text); border-radius: var(--radius); background: var(--surface);
}

/* Throttle and engine gauges sit over the scene, top right. */
.hud {
  width: 240px; display: grid; gap: 8px;
  padding: 9px 11px; border-radius: var(--radius); background: rgba(255, 255, 255, .9); border: 2px solid var(--text);
  pointer-events: none;
}

/* Arrow keys in an inverted T; they light up from the keyboard or when held by mouse or finger. */
.keys {
  display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: 52px 52px auto; gap: 6px;
  grid-template-areas: ". up ." "left down right" "label label label";
}
.key {
  font-size: 18px; padding: 0; border-radius: var(--radius); background: var(--key); border: var(--edge) solid var(--key-edge);
  box-shadow: 0 4px 0 var(--key-edge); touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .04s, background .04s, box-shadow .04s;
}
.key.up { grid-area: up; } .key.left { grid-area: left; } .key.down { grid-area: down; } .key.right { grid-area: right; }
/* Arrow triangles drawn in CSS: the pixel font has no arrow glyphs. */
.key::before { content: ""; display: block; margin: auto; width: 0; height: 0; border: 8px solid transparent; }
.key.up::before { border-bottom: 12px solid currentColor; border-top-width: 0; }
.key.down::before { border-top: 12px solid currentColor; border-bottom-width: 0; }
.key.left::before { border-right: 12px solid currentColor; border-left-width: 0; }
.key.right::before { border-left: 12px solid currentColor; border-right-width: 0; }
.key.pressed { background: var(--key-pressed); color: #fff; transform: translateY(4px); box-shadow: 0 0 0 var(--key-edge); }
/* Reset and Random look like keys too; the underlined letter is their keyboard shortcut. */
.keycap {
  padding: 12px 16px; border-radius: var(--radius); background: var(--key); border: var(--edge) solid var(--key-edge);
  box-shadow: 0 4px 0 var(--key-edge); white-space: nowrap; transition: transform .04s, background .04s, box-shadow .04s;
  font: 11px var(--arcade); text-transform: uppercase;
}
.keycap u { text-underline-offset: 4px; text-decoration-thickness: 2px; }
.keycap { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: square; stroke-linejoin: miter; }
.keycap.pressed, .keycap:active { background: var(--key-pressed); color: #fff; transform: translateY(4px); box-shadow: 0 0 0 var(--key-edge); }
.keycap.go { background: var(--accent); color: #fff; }
.keycap.go.pressed, .keycap.go:active { background: var(--accent-strong); }
.key-label { grid-area: label; display: grid; gap: 2px; font: 7px/1.6 var(--arcade); color: var(--muted); text-align: center; text-transform: uppercase; white-space: nowrap; }

.gauge-head { display: flex; justify-content: space-between; font: 9px var(--arcade); text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.gauge-head span:last-child { color: var(--text); }
.bar { position: relative; height: 10px; border-radius: var(--radius); background: #e1e7ec; overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--fill); border-radius: var(--radius); }
.bar .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .55; }


.actions { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 10px; align-content: center; justify-items: stretch; }
.hint { grid-column: 1 / -1; margin: 6px 0 0; display: grid; gap: 3px; font: 7px/1.6 var(--arcade); text-transform: uppercase; color: var(--muted); white-space: nowrap; }

@media (max-width: 760px) {
  /* The scene takes whatever height the controls leave. */
  html, body { height: 100%; }
  .game { padding: 6px; gap: 8px; height: 100dvh; }
  .stage { flex: 1 1 auto; min-height: 220px; }
  #scene { height: 100%; aspect-ratio: auto; }
  .panel { flex-direction: column; align-items: stretch; gap: 12px; padding: 10px; }
  .keys { justify-self: center; align-self: center; grid-template-columns: repeat(3, 64px); grid-template-rows: 64px 64px auto; }
  .actions { grid-template-columns: repeat(2, 1fr); }
  .hint { display: none; }
  .corner { top: 6px; right: 6px; }
  .hud { width: 150px; gap: 4px; padding: 5px 7px; }
  .hud .gauge-head { font-size: 7px; margin-bottom: 3px; }
  .hud .bar { height: 6px; }
  .status { font-size: 8px; top: 6px; left: 6px; max-width: calc(100% - 172px); }
  /* The scene is short on a phone, so cards cover the whole frame instead. */
  .overlay { position: fixed; z-index: 10; background: rgba(246, 248, 250, .8); }
  .result { background: transparent; }
  .result.show-card { background: rgba(246, 248, 250, .8); }
  .card { padding: 16px; }
  .card h1 { font-size: 15px; }
}
