/* The play page: the site's pastel palette (site/.vitepress/theme/hills.css), light and dusk. */
:root {
  --sky-top: #a9bfd4;
  --sky-mid: #d3dbe0;
  --horizon: #f5d3bf;
  --hill-mid: #a2b996;
  --hill-near: #87a585;
  --verge: #d4c3a2;
  --car: #e9826f;
  --car-hover: #ef9583;
  --car-text: #3a2724;
  --bg: #f7f8f5;
  --bg-alt: #eef1ec;
  --bg-elv: #ffffff;
  --divider: #dbe2d8;
  --border: #cfd8cc;
  --text-1: #2d3a3f;
  --text-2: #56656a;
  --text-3: #85929a;
  --link: #b9503d;
  --code-bg: rgba(233, 220, 195, 0.45);
  --code: #8a4334;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: ui-rounded, 'SF Pro Rounded', Nunito, Quicksand, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky-top: #1f1c3d;
    --sky-mid: #3a3263;
    --horizon: #d0918c;
    --hill-mid: #3b4466;
    --hill-near: #2d3654;
    --verge: #6c6182;
    --car: #f4b896;
    --car-hover: #f7c7aa;
    --car-text: #2a2140;
    --bg: #1b1930;
    --bg-alt: #16142a;
    --bg-elv: #221f3b;
    --divider: #34305a;
    --border: #403b68;
    --text-1: #efe8f0;
    --text-2: #bcb3cb;
    --text-3: #8c85a3;
    --link: #f4b896;
    --code-bg: rgba(244, 184, 150, 0.1);
    --code: #f4c3a6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.6 var(--font);
  color: var(--text-1);
  background: linear-gradient(180deg, var(--sky-top) 0, var(--sky-mid) 340px, var(--bg) 640px) no-repeat;
}
a { color: var(--link); text-underline-offset: 2px; }
code { font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: var(--code-bg); color: var(--code); }
kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--bg-elv);
  color: var(--text-1);
  font: 0.82em/1.6 var(--font-display);
  text-align: center;
}
.small { font-size: 14px; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--car); outline-offset: 2px; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; text-decoration: none; }
/* the title logo (scripts/promo/logo.py --svg site/public/logo): charcoal on the light sky, cream at dusk */
.brand img { display: block; width: auto; height: 50px; }
.bar nav { display: flex; gap: 20px; flex-wrap: wrap; }
.bar nav a { color: var(--text-1); text-decoration: none; font-size: 15px; font-weight: 500; opacity: 0.8; }
.bar nav a:hover, .bar nav a[aria-current] { opacity: 1; color: var(--link); }

main { max-width: 1200px; margin: 0 auto; padding: 8px 24px 32px; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.15; margin: 12px 0 8px; }
h2 { font-size: 24px; margin: 0 0 4px; }
h2::before {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  margin-bottom: 16px;
  border-radius: 2px;
  background: var(--verge);
}
.lead { max-width: 52em; margin: 0 0 22px; color: var(--text-1); opacity: 0.85; }

/* the game: a 16:9 box, centred; the canvas fills it (fullscreen: the whole screen) */
.stage {
  position: relative;
  width: 100%;
  max-width: min(1200px, calc((100vh - 120px) * 16 / 9));
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-mid) 0%, var(--horizon) 62%, var(--hill-mid) 62%, var(--hill-near) 100%);
  box-shadow: 0 18px 50px -24px rgba(45, 58, 63, 0.45);
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}
/* gasm's splash while the engine starts: its own 2D canvas over the game's, sharp pixels */
.stage canvas.splash { position: absolute; inset: 0; z-index: 3; background: #000; image-rendering: pixelated; }
.stage canvas.splash[hidden] { display: none; }
.stage:fullscreen { max-width: none; border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; background: #000; }
.stage:-webkit-full-screen { max-width: none; border-radius: 0; width: 100vw; height: 100vh; background: #000; }

.cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 42%, rgba(251, 234, 219, 0.75), rgba(251, 234, 219, 0) 70%);
}
.cover[hidden] { display: none; }
/* the logo over the Play button and the loading bar: about a third of the box's height (the box is
   16:9, its width the container's), and none in a box too small for it and the hint */
.stage { container-type: inline-size; }
.cover-logo img { display: block; width: auto; height: 19cqw; max-height: 210px; }
@container (max-width: 560px) { .cover-logo { display: none; } }
.cover-inner { display: grid; justify-items: center; gap: 18px; max-width: 34em; text-align: center; }
.hint { margin: 0; color: #4a4458; }
@media (prefers-color-scheme: dark) {
  .cover { background: radial-gradient(ellipse at 50% 42%, rgba(27, 25, 48, 0.7), rgba(27, 25, 48, 0) 70%); }
  .hint, .loading .small { color: var(--text-1) !important; }
  .track { background: rgba(255, 255, 255, 0.18); }
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 46px 18px 38px;
  border: 0;
  border-radius: 999px;
  background: var(--car);
  color: var(--car-text);
  font: 700 30px var(--font-display);
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(185, 80, 61, 0.65);
  transition: transform 0.15s ease, background 0.15s ease;
}
.play:hover { background: var(--car-hover); transform: translateY(-1px); }
.play:active { transform: translateY(1px); }
.play[hidden] { display: none; }
.play .tri {
  width: 0;
  height: 0;
  border-left: 20px solid currentColor;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
}

.loading { width: min(420px, 80vw); }
.loading[hidden] { display: none; }
.track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.6); overflow: hidden; }
.fill { width: 0; height: 100%; border-radius: 3px; background: var(--car); transition: width 0.2s linear; }
.loading .small { margin: 10px 0 0; color: #4a4458; }

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: min(1200px, calc((100vh - 120px) * 16 / 9));
  margin: 14px auto 0;
}
.toolbar .spacer { flex: 1; }
.toolbar button {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elv);
  color: var(--text-1);
  font: 500 14px var(--font);
  cursor: pointer;
}
.toolbar button:hover { border-color: var(--car); }
.toolbar button:disabled { opacity: 0.5; cursor: default; }

.message {
  max-width: min(1200px, calc((100vh - 120px) * 16 / 9));
  margin: 14px auto 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(233, 220, 195, 0.55);
}
.message.error { background: rgba(233, 130, 111, 0.2); }

.controls { margin-top: 48px; }
.controls > .small { margin: 4px 0 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--divider); border-radius: 12px; overflow: hidden; font-size: 14px; }
th, td { padding: 7px 12px; text-align: left; vertical-align: top; }
thead tr:first-child th { font: 650 16px var(--font-display); background: var(--bg-alt); padding-top: 10px; }
thead tr:nth-child(2) th { font-weight: 600; color: var(--text-2); background: var(--bg-alt); border-bottom: 1px solid var(--divider); }
tbody tr:nth-child(2n) { background: var(--bg-alt); }
td:first-child { color: var(--text-1); }
td { color: var(--text-2); }

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}
.foot p { margin: 4px 0; }

/* "Screenshot copied" over the game */
.stage { position: relative; }
.flash {
  position: absolute; left: 50%; top: 18px; transform: translate(-50%, -8px);
  z-index: 5; pointer-events: none; opacity: 0;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(253, 249, 244, 0.92); color: #4a4458; font-size: 15px;
  box-shadow: 0 6px 20px rgba(60, 50, 80, 0.18);
  transition: opacity 0.2s, transform 0.2s;
}
.flash.show { opacity: 1; transform: translate(-50%, 0); }
