/*
  Brand tokens from `docs/brand/STYLE_GUIDE.md` §3, as `welcome/` carries them.

  Both faces are the tile's own files — byte-identical copies of `welcome/`'s, so the same
  CIDs — because the origin's CSP is `font-src 'self' data:` (DESIGN.md §8.3) and a font
  from anywhere else is a request the browser refuses without saying so.

  The game panel's own background is a flat sketch of the scene the canvas draws: sky over
  rust ground. It is what a visitor without JavaScript sees, and it means the panel is not
  an empty box for the moment before the first frame.
*/
@font-face {
  font-family: 'Bungee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/bungee.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/mono.woff2') format('woff2');
}

:root {
  --hp-black: #0b0b0d;
  --hp-navy: #12141f;
  --hp-cream: #f5eedd;
  --hp-chocolate: #241a12;
  --band-1: #e3a23d; /* harvest gold */
  --band-2: #d9562b; /* burnt orange */
  --band-3: #a8301f; /* brick red */
  --amber: #ffb44d;

  --font-display: 'Bungee', 'Righteous', system-ui, sans-serif;
  --font-mono: 'Atkinson Hyperlegible Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Dark by default: it is a spaceport at night. */
  --bg: var(--hp-black);
  --bg-2: #101119;
  --text: var(--hp-cream);
  --text-muted: #b9b09a;
  --label: var(--amber);
  --sky-top: #07070a;
  --sky-bottom: #3a1a12;
  --ground: #8a3520;
  --hud: var(--hp-cream);
  --hud-shadow: rgba(11, 11, 13, 0.85);
  --panel-edge: rgba(245, 238, 221, 0.08);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f9f4e7;
    --bg-2: #efe3cb;
    --text: var(--hp-chocolate);
    --text-muted: #5a4b38;
    --label: #8f2f1c;
    --sky-top: #e6b98a;
    --sky-bottom: #f6e3c4;
    --ground: #b5562f;
    --hud: var(--hp-chocolate);
    --hud-shadow: rgba(246, 227, 196, 0.9);
    --panel-edge: rgba(36, 26, 18, 0.15);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(100%, 640px);
}

/* ---- The game panel ---- */
.game {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0%,
    var(--sky-bottom) 80%,
    var(--ground) 80%,
    var(--ground) 100%
  );
  box-shadow:
    0 0 0 1px var(--panel-edge),
    0 24px 60px -30px rgba(0, 0, 0, 0.7);
  -webkit-tap-highlight-color: transparent;
}

/* A phone gets a taller panel, so the rover is not a smudge. rover.js keeps ≥420 world
   units of runway visible whatever the shape, so this changes size, not difficulty. */
@media (max-width: 560px) {
  .game {
    aspect-ratio: 5 / 2;
    border-radius: 12px;
  }
}

.game canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.hud,
.prompt {
  position: absolute;
  margin: 0;
  color: var(--hud);
  text-shadow: 0 0 6px var(--hud-shadow);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.hud {
  top: 8px;
  right: 12px;
  font-size: clamp(11px, 2.2vw, 13px);
  letter-spacing: 0.08em;
  white-space: pre;
  text-align: right;
}

.prompt {
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  font-size: clamp(12px, 2.6vw, 15px);
  letter-spacing: 0.04em;
  text-align: center;
  width: max-content;
  max-width: 90%;
}

.prompt:empty,
.hud:empty {
  display: none;
}

.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- The words ---- */
h1 {
  margin: 28px 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 6vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.host {
  margin: 0 0 16px;
  color: var(--label);
  font-size: clamp(14px, 3.4vw, 17px);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.host:empty {
  display: none;
}

.lede {
  margin: 0 0 6px;
  line-height: 1.55;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875em;
  line-height: 1.55;
}
