/* ---- Playgora: one dark arcade theme shared by the lobby and every game ---- */
:root {
  --bg: #0b0d17;
  --bg-soft: #141830;
  --panel: #191e3a;
  --panel-2: #222847;
  --line: #2e3560;
  --text: #e8ebff;
  --muted: #99a0c8;
  --accent: #ffd21e;
  --accent-2: #5ac8fa;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

/* A game is something you tap, not text you read.
   Two things a phone does by default get in the way. A long press on the
   board selects it and offers to copy it, which needs the prefixed property
   as well — Safari only learned the plain one recently — and the callout
   turned off on top. And a double tap zooms the page in, then will not zoom
   back out, because the tap that would undo it lands on a play surface that
   has asked not to receive taps. `manipulation` refuses the double tap and
   nothing else: pinch still zooms, so the page can still be made bigger by
   anyone who needs it to be. */
body { touch-action: manipulation; }
.stage-wrap, .hud {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 15% -10%, #1d2450 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #23184a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 16px 64px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(11, 13, 23, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; letter-spacing: .5px; color: var(--text);
  font-size: 17px;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; display: block; }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.who strong { color: var(--text); font-weight: 600; }

/* ---- buttons ---- */
.btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text);
  padding: 9px 15px; font: inherit; font-weight: 600;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #2b3260; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #20180a; }
.btn.primary:hover { background: #ffdc4d; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; }

/* ---- generic panels ---- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
h1 { font-size: 30px; margin: 28px 0 6px; letter-spacing: -.3px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.lede { color: var(--muted); margin: 0 0 26px; max-width: 62ch; }

/* ---- lobby cards ---- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  display: block; color: inherit;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent-2); text-decoration: none; }
.card .icon { font-size: 34px; line-height: 1; }
.card h3 { margin: 10px 0 4px; font-size: 19px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; min-height: 42px; }
.card .stat { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.card .stat b { color: var(--accent); font-weight: 700; }

/* ---- tables / leaderboards ---- */
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
table.board th { text-align: left; color: var(--muted); font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.board td { padding: 7px 8px; border-bottom: 1px solid rgba(46, 53, 96, .5); }
table.board tr:last-child td { border-bottom: 0; }
table.board td.rank { width: 34px; color: var(--muted); }
table.board td.score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
table.board tr.me td { background: rgba(255, 210, 30, .09); }
table.board tr.me td.name::after { content: " (you)"; color: var(--muted); font-weight: 400; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }

/* ---- forms ---- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email] {
  width: 100%; padding: 11px 13px; font: inherit;
  background: #0e1226; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
}
input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* The sign-in modal styles itself from public/js/app.js, so it also renders
   on game pages that bring their own look and never load this file. */
.msg { margin-top: 14px; font-size: 14px; min-height: 20px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---- game page chrome ---- */
.game-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 24px 0 14px; }
.game-head h1 { margin: 0; }
.hud {
  display: flex; gap: 22px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 14px;
}
.hud div { font-size: 13px; color: var(--muted); }
.hud b { display: block; font-size: 21px; color: var(--text); font-variant-numeric: tabular-nums; }
.stage { display: flex; justify-content: center; }
canvas { max-width: 100%; height: auto; touch-action: none;
  border: 1px solid var(--line); border-radius: 12px; background: #05060e; }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; text-align: center; }
.layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* Game-over overlay shared by the arcade games.

   It is a caption over the board rather than a lid on it. A game that says
   "tap to start" needs that tap to reach the board underneath, and the
   overlay was swallowing it — on a phone the heading sits exactly where a
   thumb lands, so Pacman and Snake could not be started at all. Every game
   already checks its own state before acting on a tap, so nothing is let
   through that a game did not want. Buttons are the exception: they are in
   the overlay to be pressed. */
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  background: rgba(5, 6, 14, .84); border-radius: 12px; padding: 20px;
  pointer-events: none;
}
.overlay .btn { pointer-events: auto; }
.overlay h3 { margin: 0; font-size: 26px; }
.overlay p { margin: 0; color: var(--muted); }
.stage-wrap { position: relative; display: inline-block; max-width: 100%; min-width: 0; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 210, 30, .16); color: var(--accent); font-size: 12px; font-weight: 700; }
