  @font-face { font-family: 'Russo One'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('/fonts/russo-one-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url('/fonts/bricolage-latin-wght.woff2') format('woff2-variations'); }
  /* Layout: a 4:3 console screen (3:4 on a phone held upright), rendered at low resolution and
     scaled up with hard pixels, in the spirit of a 1997 PlayStation chase-cam game.
     Deliberately single-theme. */
  :root {
    --night: #0B1F18;
    --green: #1C523B;
    --cream: #F6EDDF;
    --cream-dim: #CFDCD3;
    --hud-yellow: #FFD23F;
    --amber: #E2A03C;
    --clay:  #A94E2E;
    --clay-d:#8F3D1F;
    --ink:   #101010;
    --hud: 'Russo One', 'Arial Black', Impact, system-ui, sans-serif;
    --body: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: dark;
  }
  html, body { height: 100%; }
  body {
    background: var(--night); color: var(--cream);
    font-family: var(--body); margin: 0;
    padding-inline: 16px; padding-block: 16px; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    -webkit-font-smoothing: antialiased;
  }
  .stage {
    position: relative;
    width: min(100%, 860px, calc((100dvh - 190px) * 4 / 3));
    aspect-ratio: 4 / 3; max-width: 100%;
    border-radius: 14px; overflow: hidden;
    background: #9CC9D9;
    box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(246,237,223,.1);
    touch-action: none; user-select: none; -webkit-user-select: none;
    container-type: inline-size;
  }
  @media (orientation: portrait) {
    .stage { aspect-ratio: 3 / 4; width: min(100%, calc((100dvh - 190px) * 3 / 4)); }
  }
  /* the river is drawn at low resolution and upscaled inside the canvas; the signs are drawn sharp on top */
  canvas { display: block; width: 100%; height: 100%; }

  /* ---------- HUD, chunky like a 90s console ---------- */
  .hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--hud); }
  .hud[hidden] { display: none !important; }
  .outline { color: var(--hud-yellow); -webkit-text-stroke: 0; text-shadow:
      2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
      2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
      4px 5px 0 rgba(0,0,0,.35); }
  .white { color: #fff; }

  .wins { position: absolute; top: 4.5cqw; left: 50%; transform: translateX(-50%); display: flex; gap: 1cqw; align-items: center; }
  .wins i {
    width: 6cqw; height: 4.4cqw; max-width: 46px; max-height: 34px; display: block; border-radius: 3px;
    background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.7);
  }
  .wins i.on { background: var(--amber); border-color: var(--ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); position: relative; }
  .wins i.on::after {
    content: ""; position: absolute; left: 32%; top: 18%; width: 22%; height: 46%;
    border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(40deg);
  }
  .wins b { font-weight: 400; font-size: 3.4cqw; margin-left: .6cqw; }

  .dist { position: absolute; top: 4cqw; left: 4cqw; font-size: 3.6cqw; line-height: 1; font-variant-numeric: tabular-nums; }
  .compass {
    position: absolute; top: 3cqw; right: 3.5cqw; width: 12cqw; height: 12cqw; max-width: 92px; max-height: 92px;
    border-radius: 50%; background: radial-gradient(circle at 50% 45%, #2E7A4F 0 55%, #1C523B 56% 100%);
    border: 3px solid var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,.5);
  }
  .compass .needle {
    position: absolute; left: 50%; top: 50%; width: 12%; height: 80%;
    transform-origin: 50% 50%;
    background: linear-gradient(180deg, var(--hud-yellow) 0 50%, #E8E4D8 50% 100%);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
    translate: -50% -50%;
  }
  .compass span { position: absolute; left: 0; right: 0; bottom: -4.4cqw; text-align: center; font-size: 2cqw; white-space: nowrap; }

  .stretch { position: absolute; left: 4cqw; bottom: 6cqw; font-size: 5.6cqw; line-height: 1; transform: skewX(-12deg); transition: opacity .5s ease; white-space: nowrap; }
  .clock { position: absolute; right: 4cqw; bottom: 9.5cqw; font-size: 6.4cqw; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: .02em; transform: skewX(-8deg); }
  .energy { position: absolute; right: 4cqw; bottom: 4cqw; display: flex; gap: .8cqw; }
  .energy i {
    width: 7cqw; height: 2.6cqw; max-width: 54px; display: block; border-radius: 99px;
    background: repeating-linear-gradient(90deg, #E8E4D8 0 30%, #9DA3A6 30% 40%);
    border: 2px solid var(--ink);
  }
  .energy i.gone { background: rgba(0,0,0,.35); }
  .pause {
    position: absolute; left: 4cqw; top: 9.5cqw; pointer-events: auto;
    font: inherit; font-family: var(--body); font-weight: 600; font-size: max(.75rem, 1.9cqw); cursor: pointer;
    color: #fff; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.45); border-radius: 999px; padding: .4em .9em;
  }
  .flash { position: absolute; inset: 0; background: #C4603C; opacity: 0; pointer-events: none; mix-blend-mode: multiply; }
  .callout { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: 7cqw; transform: skewX(-10deg); opacity: 0; pointer-events: none; white-space: nowrap; }

  @media (orientation: portrait) {
    .stretch { font-size: 7cqw; bottom: 8cqw; }
    .clock { font-size: 8cqw; bottom: 13cqw; }
    .energy i { width: 9cqw; height: 3.4cqw; }
    .compass { width: 15cqw; height: 15cqw; }
    .compass span { font-size: 2.6cqw; bottom: -5.4cqw; }
    .dist, .wins b { font-size: 4.6cqw; }
    .wins i { width: 7.5cqw; height: 5.4cqw; }
    .pause { top: 12cqw; }
  }

  /* ---------- Screens ---------- */
  .screen {
    position: absolute; inset: 0; overflow-y: auto;
    display: flex; flex-direction: column; justify-content: center; gap: 14px;
    padding: clamp(18px, 5cqw, 40px);
    background: linear-gradient(180deg, rgba(11,31,24,.55) 0%, rgba(11,31,24,.9) 55%);
  }
  .screen[hidden] { display: none !important; }
  .kicker { font-family: var(--body); font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
  .screen h1, .screen h2 { font-family: var(--hud); font-weight: 400; margin: 0; line-height: .95; transform: skewX(-8deg); transform-origin: left; text-wrap: balance; }
  .screen h1 { font-size: clamp(2.2rem, 8.5cqw, 4.2rem); }
  .screen h2 { font-size: clamp(1.7rem, 6.4cqw, 3rem); font-variant-numeric: tabular-nums; }
  .screen p { margin: 0; color: var(--cream-dim); font-size: clamp(.92rem, 2.2cqw, 1.05rem); line-height: 1.5; max-width: 44ch; }
  .tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .tags span { font-family: var(--hud); font-size: .78rem; padding: 4px 10px; border-radius: 4px; background: #5A3820; color: var(--hud-yellow); }
  .tags span.win { background: var(--amber); color: var(--ink); }
  .keys { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .9rem; color: var(--cream-dim); }
  .keys b { color: var(--cream); font-weight: 600; display: inline-block; min-width: 5.6em; }
  .stats { display: flex; gap: 26px; flex-wrap: wrap; font-size: .9rem; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
  .stats b { display: block; font-family: var(--hud); font-weight: 400; font-size: 1.5rem; color: var(--cream); }
  .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
  .btn {
    display: inline-flex; justify-content: center; align-items: center;
    font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none;
    background: var(--clay); color: var(--cream); border: 0;
    padding: 13px 22px; border-radius: 999px; min-height: 48px;
    transition: background .15s ease, transform .15s ease;
  }
  .btn:hover { background: var(--clay-d); transform: translateY(-1px); }
  .btn.ghost { background: transparent; border: 1.5px solid rgba(246,237,223,.5); }
  .btn.ghost:hover { background: rgba(246,237,223,.1); }
  .credit { font-size: .76rem; color: rgba(207,220,211,.8); }
  .credit a { color: inherit; }
  .loading { font-family: var(--body); font-size: .9rem; color: var(--cream-dim); }
  :focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
  @media (prefers-reduced-motion: reduce) { .btn, .stretch { transition: none; } }

  .screen p a { color: inherit; }
  .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .page-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: .88rem; }
  .page-foot .home { color: var(--cream-dim); text-underline-offset: 3px; }
  .built-by { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none;
    color: rgba(207,220,211,.85); font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; }
  .built-by img { width: 132px; height: auto; display: block; border-radius: 7px; }
  .built-by:hover { color: var(--cream); }
