/* Gully Arcade base: tokens + the arcade frame (bar, leaderboard drawer,
   name dialog, toasts). Shared by the hub and every game. Each game adds its
   own CSS in public/games/<slug>/game.css; the hub design lives in hub.css.

   Palette: an Indian street at dusk. Fixed paint colours (never flip with
   the theme) plus semantic tokens that do. */
:root {
  /* paint pots: same in both themes */
  --kesar: #f2a20c;   /* marigold */
  --sindoor: #d8432b; /* vermilion */
  --neel: #2b2257;    /* dusk indigo */
  --mor: #0f6b6f;     /* peacock */
  --gulabi: #e8578a;  /* kite pink */
  --kohl: #1f160e;    /* sign-painter's black */
  --cream: #fff8ea;

  /* semantic: light theme, "chai paper" */
  --bg: #f6ead2; --paper: #fff8ea; --ink: #1f160e; --muted: #6a5a48; --line: #dfcba6;
  --accent: #c4381f; --accent-2: var(--kesar); --good: #1d7a45; --bad: #b8282a;
  --focus: var(--neel);
  --game: var(--accent); --game-ink: #fff;
  --radius: 16px; --shadow: 0 3px 0 var(--ink); --lift: 5px 5px 0 var(--ink);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
/* dark theme: "night gully" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #17121c; --paper: #221b29; --ink: #f8ecd6; --muted: #b9a993; --line: #3d3246; --accent: #f0583c; --good: #4cc27e; --bad: #ff6b6b; --focus: var(--kesar); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #17121c; --paper: #221b29; --ink: #f8ecd6; --muted: #b9a993; --line: #3d3246; --accent: #f0583c; --good: #4cc27e; --bad: #ff6b6b; --focus: var(--kesar); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 0.4em; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

/* Buttons: chunky painted pills that press down */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 2.5px solid var(--kohl); background: var(--game); color: var(--game-ink); font: 800 17px/1.1 var(--display); letter-spacing: .01em; text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 var(--kohl); transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--kohl); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--kohl); }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font: 700 13px/1.2 var(--body); cursor: pointer; text-decoration: none; }
.chip:hover { background: color-mix(in srgb, var(--kesar) 22%, var(--paper)); }
.chip.on { background: var(--ink); color: var(--bg); }

/* Bunting: a string of little paper flags. Use on any element as a strip. */
.bunting { height: 18px; background:
  linear-gradient(var(--ink), var(--ink)) 0 1px / 100% 1.5px no-repeat,
  conic-gradient(from 135deg at 14px 2px, var(--sindoor) 90deg, #0000 0) 0 0 / 112px 18px repeat-x,
  conic-gradient(from 135deg at 14px 2px, var(--kesar) 90deg, #0000 0) 28px 0 / 112px 18px repeat-x,
  conic-gradient(from 135deg at 14px 2px, var(--mor) 90deg, #0000 0) 56px 0 / 112px 18px repeat-x,
  conic-gradient(from 135deg at 14px 2px, var(--gulabi) 90deg, #0000 0) 84px 0 / 112px 18px repeat-x; }

/* Arcade frame on game pages */
.arcade-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 2.5px solid var(--ink); }
.arcade-bar::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 6px; background: var(--game); border-bottom: 2px solid var(--ink); }
.arcade-home { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 2px 10px 2px 4px; border-radius: 999px; font: 800 15px var(--display); text-decoration: none; white-space: nowrap; }
.arcade-home:hover { background: color-mix(in srgb, var(--kesar) 22%, transparent); }
.arcade-home svg { width: 30px; height: 30px; flex: none; }
.arcade-title { font: 800 17px var(--display); flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arcade-actions { display: flex; gap: 6px; flex: none; }
.arcade-actions .chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .arcade-home span, .arcade-actions .chip .lbl { display: none; } .arcade-title { text-align: left; font-size: 16px; } }

/* Leaderboard drawer */
.board { position: fixed; right: 12px; top: 72px; z-index: 60; width: min(380px, calc(100vw - 24px)); max-height: calc(100dvh - 90px); overflow: auto; background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--radius); box-shadow: 6px 6px 0 var(--ink); animation: board-in .18s ease-out; }
@keyframes board-in { from { transform: translateY(-8px); opacity: 0; } }
.board-head { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 14px 12px 16px; background: var(--game); color: var(--game-ink); border-bottom: 2.5px solid var(--kohl); }
.board-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.board-head .chip { border-color: var(--kohl); background: var(--cream); color: var(--kohl); }
.board .row { padding: 12px 16px 0; }
.board-body { padding: 4px 16px 16px; }
.board-list { list-style: none; padding: 0; margin: 8px 0 12px; counter-reset: rank; }
.board-list li { counter-increment: rank; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1.5px dashed var(--line); }
.board-list li::before { content: counter(rank); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); font: 800 13px var(--display); }
.board-list li:nth-child(1)::before { background: var(--kesar); color: var(--kohl); border-color: var(--kohl); }
.board-list li:nth-child(2)::before { background: #d9d2c4; color: var(--kohl); border-color: var(--kohl); }
.board-list li:nth-child(3)::before { background: #d08a4e; color: var(--kohl); border-color: var(--kohl); }
.board-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li b { font: 700 14px var(--mono); }
.board-list li.me { background: color-mix(in srgb, var(--game) 16%, transparent); border-radius: 8px; padding-inline: 6px; margin-inline: -6px; }
.board-list li.me span::after { content: " (you)"; color: var(--muted); font-weight: 600; }

/* Nickname dialog */
.name-dialog { width: min(400px, calc(100vw - 32px)); padding: 0; border: 2.5px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.name-dialog::backdrop { background: rgb(23 18 28 / .55); }
.name-dialog form { display: grid; gap: 12px; padding: 20px; }
.name-dialog h2 { margin: 0; font-size: 24px; }
.name-dialog input { width: 100%; min-height: 48px; padding: 10px 14px; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--bg); color: var(--ink); font: 700 18px var(--body); }
.name-dialog .row { justify-content: flex-end; }

/* Toasts: toast("Saved") from /js/kit/toast.js */
.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border: 2.5px solid var(--kohl); border-radius: 14px; background: var(--cream); color: var(--kohl); font: 700 15px/1.35 var(--body); box-shadow: 4px 4px 0 var(--kohl); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.good { background: #c9efd6; }
.toast.bad { background: #ffd2c8; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
