/* Two Screen FC: one light theme over the pitch. Colours, sizes and shadows live in the tokens below. */

:root {
  --bg: #f6f3fa;
  --surface: #fff;
  --soft: #f7f5fb;
  --soft-2: #f1eef6;
  --line: #e6e1ec;
  --line-2: #d6d1de;
  --ink: #2c2a33;
  --ink-2: #3b3842;
  --text: #4a4652;
  --muted: #8a8594;
  --muted-2: #6d6878;
  --gold: #d4a514;
  --gold-dark: #8a6a08;
  --gold-soft: #fff7d6;
  --good: #2f9e5e;
  --good-soft: #eaf7ef;
  --bad: #d4452a;
  --focus: rgba(58, 143, 232, 0.5);
  --purple: #6a5fd6;
  --r-common: #8a8594;
  --r-rare: #3a8fe8;
  --r-legendary: #e0a020;
  --r-mythic: #a845f0;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 14px 44px rgba(60, 40, 90, 0.16), 0 2px 6px rgba(60, 40, 90, 0.06);
  --gutter: 24px;
  --title: "Arial Black", Impact, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink-2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

#pitch {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

/* ---------------------------------------------------------------- buttons, fields, focus */

.panel button, #result button, #whatsnew button, #reveal-done, #invite-toast button, #bar button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.panel button, #result button, #whatsnew button {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 1px 0 rgba(60, 40, 90, 0.05);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s, color 0.15s;
}
.panel button:hover, #result button:hover, #whatsnew button:hover { background: #fbfafd; border-color: #b9b2c6; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(60, 40, 90, 0.08); }
.panel button:active, #result button:active, #whatsnew button:active { transform: translateY(0); box-shadow: none; }
.panel button.primary, #result button.primary, #whatsnew button.primary { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.panel button.primary:hover, #result button.primary:hover, #whatsnew button.primary:hover { background: #24222a; border-color: #24222a; }
.panel button.ghost, #result button.ghost, #whatsnew button.ghost { background: transparent; color: var(--muted-2); box-shadow: none; }
.panel button.ghost:hover, #result button.ghost:hover, #whatsnew button.ghost:hover { background: var(--soft); color: var(--ink); }
.panel button:disabled, #result button:disabled, #whatsnew button:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.panel button:disabled:hover, #result button:disabled:hover, #whatsnew button:disabled:hover { background: var(--surface); border-color: var(--line-2); }
.panel button.primary:disabled:hover, #result button.primary:disabled:hover, #whatsnew button.primary:disabled:hover { background: var(--ink-2); border-color: var(--ink-2); }

.panel .link {
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.panel .link:hover { color: var(--ink); background: none; transform: none; box-shadow: none; }

/* Back: always bottom left of a screen */
.panel button.back { padding: 8px 14px 8px 10px; font-size: 14px; color: var(--muted-2); }
.panel button.back::before { content: '\2039'; font-size: 20px; line-height: 0.6; margin-top: -2px; }

button:focus-visible, summary:focus-visible, .avatar-pick:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.panel input:not([type=file]), .panel select {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.panel input:not([type=file]) { user-select: text; -webkit-user-select: text; }
.panel input::placeholder { color: #aaa4b4; }
.panel input:focus, .panel select:focus { outline: none; border-color: #3a8fe8; box-shadow: 0 0 0 3px rgba(58, 143, 232, 0.18); }
.panel select { cursor: pointer; }

.panel label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted-2); }
.panel .row { display: flex; gap: 10px; }
.panel .row > button { flex: none; }

/* ---------------------------------------------------------------- panels: fixed head and foot, scrolling body */

.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(calc(100vw - 32px), 420px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel.narrow { width: min(calc(100vw - 32px), 360px); }
.panel.mid { width: min(calc(100vw - 32px), 580px); }
.panel.wide { width: min(calc(100vw - 32px), 860px); }

.panel-head { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 22px var(--gutter) 14px; }
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px var(--gutter) 18px;
}
.panel > .panel-body:first-child { padding-top: 24px; }
.panel-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--soft);
}
.panel-foot.center { justify-content: center; }
.panel-foot .grow { flex: 1; }
.foot-actions { display: flex; gap: 10px; }

.panel h1 {
  margin: 0;
  font-family: var(--title);
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 0 2px 0 var(--gold-dark);
}
.panel .sub { margin: 0; font-size: 14px; color: var(--muted-2); line-height: 1.45; }
.panel .small { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); min-height: 16px; line-height: 1.45; }
.panel .err { margin: 0; color: #c0392b; font-size: 13px; font-weight: 600; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.group-label { margin: 2px 0 -2px; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.empty {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 18px 14px;
  background: var(--soft);
  border: 1px dashed var(--line-2);
  border-radius: 12px;
}
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.wallet {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 18px; color: var(--gold-dark); background: var(--gold-soft);
  border: 1px solid #ecd27a; border-radius: 999px; padding: 4px 14px 4px 7px;
  font-variant-numeric: tabular-nums;
}
.coin {
  width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-block;
  background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd84a 55%, #c98f0a);
  border: 2px solid #b07a00;
}
.coin.sm { width: 14px; height: 14px; border-width: 1.5px; }
.progress { font-size: 13px; font-weight: 700; color: var(--muted-2); background: var(--soft-2); border-radius: 999px; padding: 5px 12px; font-variant-numeric: tabular-nums; }
.credit { margin: 0; text-align: center; font-size: 12px; color: #a29dae; letter-spacing: 0.04em; }

/* ---------------------------------------------------------------- main menu */

#menu { width: min(calc(100vw - 32px), 820px); }
.menu-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 28px; align-items: start; }
.menu-side, .menu-main { display: flex; flex-direction: column; gap: 14px; }
.menu-main { gap: 10px; }
.brand { display: flex; flex-direction: column; gap: 8px; }
.brand h1 { font-size: 34px; }

.player-box {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
#me-card { display: flex; align-items: center; gap: 12px; }
#me-card .avatar-pick {
  position: relative; width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: var(--ink-2); color: #fff;
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; cursor: pointer; overflow: hidden;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line-2);
}
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fill { display: contents; }
.avatar-edit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0 4px;
  background: rgba(30, 26, 40, 0.7); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-align: center; opacity: 0; transition: opacity 0.15s;
}
.avatar-pick:hover .avatar-edit, .avatar-pick:focus-within .avatar-edit { opacity: 1; }
.me-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 5px; padding-right: 70px; }
.me-text b { font-size: 17px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#me-line { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 11.5px; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip b { font-size: 12px; color: var(--ink); }
.chip.gold b { color: var(--gold-dark); }
.panel .me-text .link { padding: 0; font-size: 12px; }
#account-btn { width: 100%; }
#menu.signed #account-btn {
  position: absolute; top: 10px; right: 10px; width: auto;
  font-size: 12px; font-weight: 700; padding: 5px 10px; color: var(--muted-2); background: var(--surface);
}

.howto { font-size: 13px; }
.howto summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--muted-2); border-radius: 6px; padding: 2px 0;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: '\203A'; font-size: 18px; line-height: 0.8; transition: transform 0.15s; }
.howto[open] summary::before { transform: rotate(90deg); }
.howto summary:hover { color: var(--ink); }
.howto p { margin-top: 6px; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-grid .wide { grid-column: 1 / -1; }
.panel button.tile {
  position: relative;
  flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px;
  text-align: left; padding: 12px 14px; min-height: 62px;
}
.t-name { font-size: 16px; font-weight: 800; color: inherit; }
.t-meta { font-size: 12px; font-weight: 500; color: var(--muted); min-height: 15px; font-variant-numeric: tabular-nums; }
.t-meta.coins { color: var(--gold-dark); font-weight: 700; }
.panel button.tile.primary { min-height: 76px; padding: 14px 18px; }
.panel button.tile.primary .t-name { font-size: 20px; }
.panel button.tile.primary .t-meta { color: #cfcad8; }
.panel button.tile.primary::after { content: '\203A'; position: absolute; right: 20px; top: 50%; transform: translateY(-54%); font-size: 34px; font-weight: 400; color: #ffd84a; }

/* ---------------------------------------------------------------- log in */

.auth-brand { margin: 0 0 2px; text-align: center; font-family: var(--title); font-size: 20px; color: var(--gold); text-shadow: 0 1px 0 var(--gold-dark); letter-spacing: 0.02em; }
.tabs2 { display: flex; background: var(--soft-2); border-radius: 12px; padding: 4px; }
.panel .tabs2 button { flex: 1; border: 0; border-radius: 9px; background: transparent; box-shadow: none; font-size: 14px; padding: 8px; color: var(--muted-2); }
.panel .tabs2 button:hover { transform: none; background: rgba(255, 255, 255, 0.5); box-shadow: none; }
.panel .tabs2 button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(60, 40, 90, 0.15); }
#auth-form { display: flex; flex-direction: column; gap: 10px; }
#auth-form button[type=submit] { margin-top: 4px; padding: 12px; }
#auth-back { align-self: center; }

/* ---------------------------------------------------------------- Play: the queue */

#games li button { width: 100%; justify-content: flex-start; gap: 12px; padding: 12px 12px 12px 16px; text-align: left; }
#games .g-name { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#games .age { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
#games .join { font-size: 12px; font-weight: 800; color: #fff; background: var(--ink-2); border-radius: 999px; padding: 5px 12px; }
.mode-tag { display: inline-block; vertical-align: 1px; font-size: 11px; font-weight: 700; color: #fff; background: var(--purple); border-radius: 999px; padding: 2px 8px; margin-left: 8px; }
.host-box { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- Practice: modes */

#practice-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#practice-modes li { display: flex; }
#practice-modes li button { width: 100%; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; padding: 14px 16px; text-align: left; }
#practice-modes li button b { font-size: 15px; color: var(--ink); }
#practice-modes li button span { font-size: 12.5px; font-weight: 500; color: var(--muted); line-height: 1.4; }

/* ---------------------------------------------------------------- rarity: grey, blue, gold, purple */

.r-common { --rc: var(--r-common); }
.r-rare { --rc: var(--r-rare); }
.r-legendary { --rc: var(--r-legendary); }
.r-mythic { --rc: var(--r-mythic); }
.rarity { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rc, var(--muted)); }
.legend { display: flex; gap: 14px; margin-left: auto; font-size: 12px; color: var(--muted-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--rc); }

/* ---------------------------------------------------------------- packs */

#pack-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; padding-top: 4px; }
.pack {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 16px 14px 14px;
  display: flex; flex-direction: column; gap: 12px; color: #fff;
  box-shadow: 0 6px 18px rgba(40, 30, 70, 0.16);
}
.pack.p-common { background: linear-gradient(160deg, #9a95a6, #5c5868); --pc: #5c5868; }
.pack.p-rare { background: linear-gradient(160deg, #56a8f7, #2559b8); --pc: #2559b8; }
.pack.p-legendary { background: linear-gradient(160deg, #ffc94f, #d7731c); --pc: #c4650f; }
.pack.p-mythic { background: linear-gradient(160deg, #d56bff, #5b2bd1); --pc: #5b2bd1; box-shadow: 0 8px 24px rgba(120, 50, 220, 0.35); }
.pack h3 { margin: 0; font-size: 17px; font-weight: 800; text-align: center; letter-spacing: 0.01em; }
.pack-art { position: relative; height: 80px; }
.pack-art i {
  position: absolute; left: 50%; top: 8px; width: 44px; height: 62px; margin-left: -22px;
  border-radius: 7px; background: #fff;
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(0, 0, 0, 0.06) 5px 10px);
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px var(--pc), 0 4px 10px rgba(0, 0, 0, 0.22);
}
.pack-art i:nth-child(1) { transform: translateX(-26px) rotate(-14deg); }
.pack-art i:nth-child(2) { transform: translateY(-4px); z-index: 1; }
.pack-art i:nth-child(3) { transform: translateX(26px) rotate(14deg); }
.odds { list-style: none; margin: 0; padding: 8px 10px; background: rgba(255, 255, 255, 0.16); border-radius: 10px; display: flex; flex-direction: column; gap: 3px; }
.odds li { display: flex; align-items: center; gap: 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.odds li b { margin-left: auto; font-weight: 700; }
.odds li i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 0 1.5px #fff; }
.pack .guar { margin: -4px 0 0; font-size: 11.5px; text-align: center; opacity: 0.92; min-height: 15px; }
.panel .pack button { margin-top: auto; width: 100%; background: #fff; color: var(--ink); border: 0; padding: 10px 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
.panel .pack button:hover { background: #fff; }
.panel .pack button:disabled { opacity: 0.65; }
.panel .pack button:disabled:hover { background: #fff; }
.pack .short { margin: -4px 0 0; font-size: 11.5px; text-align: center; opacity: 0.9; }

/* Opening a pack */
#reveal {
  position: fixed; inset: 0; z-index: 5;
  background: radial-gradient(circle at 50% 45%, rgba(48, 40, 84, 0.95), rgba(16, 12, 30, 0.98));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px;
}
.reveal-title { margin: 0; color: #fff; font-family: var(--title); font-size: 26px; letter-spacing: 0.02em; }
.reveal-hint { margin: 0; color: #b9b3c8; font-size: 13px; min-height: 18px; }
#reveal-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.flip { width: clamp(120px, 24vw, 176px); aspect-ratio: 176 / 244; perspective: 800px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip:not(.open):hover .flip-inner { transform: translateY(-4px); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 12px; text-align: center; overflow: hidden;
}
.flip-back {
  background: linear-gradient(160deg, #5b5870, #2a2838);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px), linear-gradient(160deg, #5b5870, #2a2838);
  border: 3px solid rgba(255, 255, 255, 0.18);
  color: #ffd84a; font-family: var(--title); font-size: 40px;
}
.flip-back::before {
  content: ''; position: absolute; width: 64%; aspect-ratio: 1; border-radius: 50%;
  border: 3px solid rgba(255, 216, 74, 0.5);
}
.flip-front { background: #fff; transform: rotateY(180deg); border: 3px solid var(--rc); justify-content: flex-start; padding-top: 16px; }
.flip-front::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--rc); }
.flip-front canvas { width: 100%; height: 42%; flex: none; border-radius: 10px; background: #eef1fa; }
.flip-front .nm { font-weight: 800; font-size: 15px; color: var(--ink); line-height: 1.2; margin-top: 2px; }
.flip-front .rarity { color: #fff; background: var(--rc); border-radius: 999px; padding: 2px 9px; }
.flip-front .cat { font-size: 11.5px; color: var(--muted); }
.flip-front .new, .flip-front .dup { margin-top: auto; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; border-radius: 999px; padding: 2px 9px; }
.flip-front .new { background: #3ac17a; }
.flip-front .dup { background: var(--r-common); }
.flip.open.r-mythic .flip-front, .flip.open.r-legendary .flip-front { animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 6px var(--rc); } to { box-shadow: 0 0 28px var(--rc); } }
#reveal-done {
  font-weight: 800; font-size: 16px; color: var(--ink); background: #fff;
  border: 0; border-radius: 12px; padding: 12px 34px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}
#reveal-done:hover { transform: translateY(-1px); }

/* ---------------------------------------------------------------- collection */

#tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.panel #tabs button { font-size: 13.5px; padding: 7px 12px; border-radius: 999px; gap: 6px; box-shadow: none; }
.panel #tabs button.on { background: var(--ink-2); color: #fff; border-color: var(--ink-2); }
.tab-count { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
#tabs button.on .tab-count { color: #cfcad8; }

#cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding-top: 4px; }
.card-item {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px 10px;
}
.card-item::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--rc, var(--line-2)); }
.card-item canvas { width: 100%; height: 84px; border-radius: 10px; background: #eef1fa; display: block; margin-bottom: 3px; }
.card-item .name { font-weight: 800; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-item .desc { font-size: 12px; color: var(--muted); min-height: 32px; line-height: 1.35; flex: 1; }
.panel .card-item button { font-size: 13px; padding: 7px 8px; margin-top: 3px; }
.card-item.r-legendary:not(.locked) { box-shadow: 0 4px 14px rgba(224, 160, 32, 0.2); }
.card-item.r-mythic:not(.locked) { box-shadow: 0 4px 16px rgba(168, 69, 240, 0.24); }
.card-item.equipped { border-color: var(--good); box-shadow: 0 0 0 2px rgba(47, 158, 94, 0.22); }
.panel .card-item.equipped button:disabled { opacity: 1; background: var(--good-soft); color: var(--good); border-color: #bfe5cc; }
.card-item.locked { background: var(--soft); }
.card-item.locked::before { opacity: 0.5; }
.card-item.locked canvas { background: repeating-linear-gradient(45deg, #ebe8f0 0 8px, #e3dfea 8px 16px); }
.card-item.locked .name { color: #aaa4b4; }
.card-item.locked .desc { color: #aaa4b4; }
.card-item.locked .rarity { opacity: 0.6; }
.card-item.locked button { display: none; }
.card-item .count { position: absolute; top: 18px; right: 16px; background: var(--ink-2); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 8px; }

/* ---------------------------------------------------------------- trade */

.field-row input { flex: 1; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trade-col {
  display: flex; flex-direction: column; gap: 10px; min-height: 190px;
  background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.trade-col.ready { border-color: var(--good); box-shadow: 0 0 0 2px rgba(47, 158, 94, 0.18); }
.trade-col h3 { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 800; color: var(--ink-2); min-height: 20px; }
.trade-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.trade-col li {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--rc, var(--line-2));
  border-radius: 10px; padding: 7px 8px 7px 14px; font-size: 13.5px;
}
.trade-col .ti { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.trade-col .ti b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-col li.none { background: transparent; border: 1px dashed var(--line-2); box-shadow: none; padding: 12px; color: var(--muted); justify-content: center; }
.panel .trade-col li button { padding: 0; width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; box-shadow: none; font-size: 16px; color: var(--muted); flex: none; }
.panel .trade-col li button:hover { background: var(--soft-2); color: var(--bad); transform: none; }
.trade-col .row { gap: 6px; }
.trade-col .row select { flex: 1; padding: 8px 10px; font-size: 13.5px; }
.panel .trade-col .row button { padding: 8px 14px; font-size: 13.5px; }
.ready-tag { font-size: 11px; font-weight: 800; color: #fff; background: var(--good); border-radius: 999px; padding: 2px 9px; letter-spacing: 0.04em; }
.panel button#trade-ready.on { background: var(--good); border-color: var(--good); }

/* ---------------------------------------------------------------- leaderboard */

#board-table { overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
#board-table:not(:has(table)) {
  margin: 0; text-align: center; color: var(--muted); font-size: 14px; padding: 26px 14px;
  background: var(--soft); border: 1px dashed var(--line-2); border-radius: 12px;
}
#board-table table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
#board-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  text-align: left; font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
#board-table td { padding: 8px 10px; border-bottom: 1px solid #f0edf5; color: var(--text); }
#board-table .num { text-align: right; }
#board-table td.strong { font-weight: 800; color: var(--ink); }
#board-table tr.me td { background: #fff8dc; }
#board-table tr.me td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
#board-table tr:not(.me):hover td { background: var(--soft); }
.on-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--soft-2); color: var(--muted-2); }
.on-status.s-in-game { background: #e3f6e8; color: #17703a; }
.on-status.s-watching { background: #e8eefc; color: #2d4fa3; }
.player-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 999px; font-size: 12px; font-weight: 800; color: var(--muted-2); background: var(--soft-2); padding: 0 6px; }
.rank.r1 { background: #ffd84a; color: #5a3d00; }
.rank.r2 { background: #dcdde3; color: #45434d; }
.rank.r3 { background: #e9b48a; color: #5a2f10; }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink-2); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; overflow: hidden; flex: none; }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- toasts */

#status {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  max-width: calc(100vw - 32px); text-align: center;
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(20, 15, 35, 0.3);
  pointer-events: none; animation: toast-in 0.2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
#invite-toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 11;
  max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 18px;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(20, 15, 35, 0.35);
  animation: invite-in 0.25s ease-out;
}
@keyframes invite-in { from { opacity: 0; transform: translate(-50%, -10px); } }
.toast-actions { display: flex; gap: 6px; }
#invite-toast button { font-weight: 800; font-size: 13px; border: 0; border-radius: 9px; padding: 7px 14px; background: #ffd84a; color: var(--ink); }
#invite-toast button:hover { background: #ffe27a; }
#invite-toast button.ghost { background: rgba(255, 255, 255, 0.1); color: #e3dfea; }
#invite-toast button.ghost:hover { background: rgba(255, 255, 255, 0.18); }

/* ---------------------------------------------------------------- in a game: the HUD */

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-top {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
#board {
  display: flex; align-items: center; gap: 14px;
  padding: 5px 6px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(220, 214, 230, 0.9); border-radius: 999px;
  box-shadow: 0 6px 20px rgba(60, 40, 90, 0.1);
}
#score {
  font-size: 22px; font-weight: 800; letter-spacing: 0.06em; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--ink-2); border-radius: 999px; padding: 2px 16px;
  transition: transform 0.25s;
}
#score.bump { transform: scale(1.3); }
.team { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 70px; }
#team-left { text-align: right; padding-left: 12px; }
#team-right { text-align: left; padding-right: 12px; }
.team.me { color: var(--ink); }
#team-left.me::after { content: ' \25CF'; color: var(--gold); }
#team-right.me::before { content: '\25CF  '; color: var(--gold); }

#clock {
  font-size: 15px; font-weight: 800; letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
  color: #5b5665; background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(220, 214, 230, 0.9); border-radius: 999px; padding: 2px 14px;
}
#clock.low { color: var(--bad); animation: pulse 1s infinite; }
#clock.sudden { color: #5a3d00; background: linear-gradient(#ffe27a, #e0b324); border-color: #b88a00; }
@keyframes pulse { 50% { transform: scale(1.1); } }

#speedo { display: flex; align-items: center; gap: 8px; }
#speed-track { width: 90px; height: 5px; border-radius: 3px; background: rgba(60, 50, 80, 0.12); overflow: hidden; }
#speed-fill {
  height: 100%; width: 0%; border-radius: 3px;
  background: linear-gradient(90deg, #6cbf6a, #e0b324 60%, #e0662d); background-size: 90px 100%;
  transition: width 0.3s;
}
#speed { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: #9a95a5; font-variant-numeric: tabular-nums; min-width: 62px; transition: color 0.3s; }
#speed.hot { color: #d4632a; }
#modebadge { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: rgba(106, 95, 214, 0.92); border-radius: 999px; padding: 3px 12px; white-space: nowrap; }

/* Top corner on the inner side, away from the goal and the team name */
#bar {
  position: absolute; top: 12px;
  display: flex; gap: 2px; align-items: center;
  padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(220, 214, 230, 0.9);
  font-size: 12px; color: var(--muted);
  pointer-events: auto; opacity: 0.6; transition: opacity 0.2s;
}
#bar:hover, #bar:focus-within { opacity: 1; }
#bar.left { left: 14px; }
#bar.right { right: 14px; }
#bar button {
  font-size: 12px; font-weight: 600; color: var(--muted-2);
  border: 0; background: transparent; border-radius: 999px; padding: 5px 10px;
  transition: background 0.15s, color 0.15s;
}
#bar button:hover { background: var(--soft-2); color: var(--ink); }
#bar #leave { color: var(--bad); }
#bar #leave:hover { background: #fdecea; }
#bar #leave.armed { background: var(--bad); color: #fff; }
#ping { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 6px 0 8px; }
#ping:empty { display: none; }
#ping.good { color: #3a9d5d; }
#ping.ok { color: #c08a10; }
#ping.bad { color: var(--bad); }

#countdown {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--title); font-size: min(26vh, 220px); white-space: nowrap;
  color: var(--gold); text-shadow: 0 6px 0 var(--gold-dark), 0 14px 30px rgba(60, 40, 0, 0.25);
  animation: pop 0.5s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

#banner {
  position: absolute; top: 36%; left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 32px); text-align: center;
  background: rgba(40, 35, 50, 0.9); color: #ffe27a;
  font-weight: 800; font-size: 22px; letter-spacing: 0.04em;
  padding: 10px 24px; border-radius: 999px; box-shadow: 0 10px 30px rgba(20, 15, 35, 0.25);
}

#waiting {
  position: fixed; top: max(124px, 18%); left: 50%; transform: translateX(-50%);
  width: min(calc(100vw - 32px), 440px); text-align: center; pointer-events: none;
  color: var(--muted-2); font-size: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(220, 214, 230, 0.7); border-radius: 16px; padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(60, 40, 90, 0.08);
}
#waiting p { margin: 4px 0; line-height: 1.4; }
#waiting .big { font-size: 19px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
#waiting .url {
  font-family: ui-monospace, Menlo, monospace; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px;
  display: inline-block; pointer-events: auto; user-select: text; -webkit-user-select: text;
}
#waiting .small { font-size: 12px; color: var(--muted); margin-top: 10px; }
#place-hint { font-weight: 700; color: var(--ink); margin-top: 10px !important; }

/* ---------------------------------------------------------------- versus */

#versus {
  position: fixed; inset: 0; z-index: 4;
  background: radial-gradient(circle at 50% 40%, rgba(60, 50, 110, 0.94), rgba(20, 16, 40, 0.97));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: min(4vh, 26px);
  color: #fff; padding: 16px;
}
.vs-label {
  font-size: 12px; font-weight: 800; letter-spacing: 0.25em; text-transform: uppercase; color: #ffd84a;
  border: 1px solid rgba(255, 216, 74, 0.45); border-radius: 999px; padding: 6px 16px 6px 19px;
}
.vs-row { display: flex; align-items: center; gap: min(4vw, 36px); }
.vs-card {
  width: min(36vw, 280px); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 20px;
  padding: min(4vh, 26px) 16px;
  animation: vsin 0.5s ease-out;
}
.vs-card:empty { visibility: hidden; }
#vs-right { animation-name: vsin-r; }
@keyframes vsin { from { transform: translateX(-60px); opacity: 0; } }
@keyframes vsin-r { from { transform: translateX(60px); opacity: 0; } }
.vs-avatar {
  width: min(18vw, 18vh, 110px); height: min(18vw, 18vh, 110px); border-radius: 50%;
  background: var(--ink-2); border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(255, 216, 74, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: min(8vh, 44px); font-weight: 900; overflow: hidden;
}
.vs-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vs-name { font-size: min(4.5vw, 26px); font-weight: 900; letter-spacing: 0.02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-stats { display: flex; gap: 8px; font-size: 11px; color: #cfcad8; text-transform: uppercase; letter-spacing: 0.06em; flex-wrap: wrap; justify-content: center; }
.vs-stats > div { background: rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 6px 10px; min-width: 64px; }
.vs-stats b { display: block; font-size: 19px; color: #fff; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.vs-mid { font-family: var(--title); font-size: min(9vw, 60px); color: #ffd84a; text-shadow: 0 4px 0 var(--gold-dark); }

/* ---------------------------------------------------------------- full time */

#result {
  position: fixed; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(240, 236, 248, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#result .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px 28px 22px; text-align: center; box-shadow: var(--shadow);
  width: min(calc(100vw - 32px), 360px);
  max-height: calc(100vh - 32px); overflow-y: auto;
}
#result .kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
#result h2 { margin: 6px 0 2px; font-family: var(--title); font-size: 36px; color: var(--gold); text-shadow: 0 2px 0 var(--gold-dark); }
#result[data-outcome=loss] h2 { color: var(--muted-2); text-shadow: 0 2px 0 #c9c4d2; }
#result #result-score { margin: 0; font-size: 34px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
#result #result-coins {
  display: inline-block; margin: 10px 0 0; font-size: 14px; font-weight: 700; color: var(--gold-dark);
  background: var(--gold-soft); border: 1px solid #ecd27a; border-radius: 999px; padding: 4px 14px;
}
#result #result-coins:empty { display: none; }
#result .row { display: flex; gap: 10px; margin-top: 18px; }
#result .row button { flex: 1; }

/* ---------------------------------------------------------------- smaller windows */

@media (max-width: 760px) {
  #menu { width: min(calc(100vw - 32px), 440px); }
  .menu-body { grid-template-columns: 1fr; gap: 16px; }
  /* One column: the buttons come straight after the profile, the rules last. */
  .menu-side { display: contents; }
  .menu-main { order: 1; }
  .howto { order: 2; }
  .legend { display: none; }
}
@media (max-width: 600px) {
  :root { --gutter: 18px; }
  #practice-modes, .trade-cols { grid-template-columns: 1fr; }
  #board-table th:nth-child(n+5), #board-table td:nth-child(n+5) { display: none; }
  .panel-foot { flex-wrap: wrap; }
}
@media (min-width: 1600px) and (min-height: 900px) {
  /* Big laptop screens: everything a touch larger */
  .panel { zoom: 1.15; max-height: calc((100vh - 32px) / 1.15); max-width: calc((100vw - 32px) / 1.15); }
  #result .card, #invite-toast { zoom: 1.15; }
}
@media (max-width: 1440px) {
  /* The buttons sit on their own line above the score so they never cover it. */
  #hud-top { top: 52px; }
}
@media (max-height: 620px) {
  .panel-head { padding-top: 16px; padding-bottom: 10px; gap: 6px; }
  .panel > .panel-body:first-child { padding-top: 18px; }
  .panel h1 { font-size: 26px; }
  .brand h1 { font-size: 28px; }
  .panel .sub { font-size: 13px; }
  .panel-foot { padding-top: 9px; padding-bottom: 9px; }
  .panel button.tile { min-height: 52px; padding: 9px 14px; }
  .panel button.tile.primary { min-height: 62px; }
  .menu-body { gap: 20px; }
  .menu-side { gap: 10px; }
  #reveal { gap: 14px; }
  .flip { width: clamp(110px, 22vw, 150px); }
}
@media (max-height: 520px) {
  .pack-art { height: 58px; }
  .pack-art i { width: 34px; height: 46px; margin-left: -17px; top: 6px; }
  .pack-art i:nth-child(1) { transform: translateX(-20px) rotate(-14deg); }
  .pack-art i:nth-child(3) { transform: translateX(20px) rotate(14deg); }
  .card-item canvas { height: 66px; }
}
@media (max-height: 480px) {
  .brand .sub { display: none; }
  .reveal-title { font-size: 20px; }
}

/* Quick messages and the how-you-play choice */
#emote-feed { position: absolute; top: 146px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 5; }
.emote-msg { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: var(--ink); border: 1px solid rgba(220, 214, 230, 0.9); animation: emote-in 0.2s ease-out; }
.emote-msg.mine { background: rgba(255, 244, 214, 0.95); }
@keyframes emote-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
#emotes { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.78); border: 1px solid rgba(220, 214, 230, 0.9); opacity: 0.55; transition: opacity 0.2s; pointer-events: auto; z-index: 5; }
#emotes:hover { opacity: 1; }
#emotes[hidden] { display: none; }
#emotes button { font-size: 12px; font-weight: 600; color: var(--muted-2); border: 0; background: transparent; border-radius: 999px; padding: 4px 9px; cursor: pointer; }
#emotes button:hover { background: var(--soft-2); color: var(--ink); }
.style-row { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }

/* ================================================================ Floodlit theme
   Night-pitch panels: deep pitch green with mowing stripes and chalk lines, chalk-white type,
   kit yellow for the one thing to press. Blue is you, red is the computer.
   (Placed last so it re-tones everything above through the tokens.) */

:root {
  --bg: #0b2a20;
  --surface: #12392b;
  --soft: #0f3326;
  --soft-2: #1a4a37;
  --line: rgba(236, 246, 238, 0.12);
  --line-2: rgba(236, 246, 238, 0.22);
  --ink: #f2f8f1;
  --ink-2: #e2ede4;
  --text: #cddcd2;
  --muted: #8fb0a0;
  --muted-2: #b2cabd;
  --gold: #ffd23f;
  --gold-dark: #b8860b;
  --gold-soft: rgba(255, 210, 63, 0.12);
  --good: #4ad08a;
  --good-soft: rgba(74, 208, 138, 0.14);
  --bad: #ff6a5a;
  --focus: rgba(255, 210, 63, 0.7);
  --purple: #8a7bff;
  --you: #3fa9ff;
  --cpu: #ff5a4e;
  --chalk: rgba(236, 246, 238, 0.09);
  --kit-ink: #0b2a20;
  --shadow: 0 24px 60px rgba(4, 20, 14, 0.45), 0 2px 8px rgba(4, 20, 14, 0.3);
  --title: "Big Shoulders Display", "Arial Black", Impact, sans-serif;
  --body: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --r-common: #9fb6aa;
  --r-rare: #4aa8ff;
  --r-legendary: #ffb22e;
  --r-mythic: #c77bff;
}

html, body { font-family: var(--body); color: var(--ink-2); }

/* Panels: a strip of night pitch, mown in stripes */
.panel {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 56px, rgba(0, 0, 0, 0.03) 56px 112px),
    linear-gradient(180deg, #13402f, #0d3125);
  border: 1px solid rgba(236, 246, 238, 0.14);
  color: var(--ink-2);
}
.panel-foot { background: rgba(4, 22, 15, 0.35); border-top-color: var(--line); }
.panel h1 {
  font-family: var(--title); font-weight: 900; font-size: 38px; letter-spacing: 0.01em; line-height: 0.95;
  color: var(--ink); text-shadow: none;
}
.panel .sub { color: var(--muted-2); }
.credit { color: var(--muted); }
.group-label { color: var(--muted); }

/* Buttons: chalk-outlined on the green; kit yellow for the main action */
.panel button, #result button, #whatsnew button {
  background: rgba(236, 246, 238, 0.04); color: var(--ink); border-color: var(--line-2); box-shadow: none;
}
.panel button:hover, #result button:hover, #whatsnew button:hover { background: rgba(236, 246, 238, 0.1); border-color: rgba(236, 246, 238, 0.4); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.panel button.primary, #result button.primary, #whatsnew button.primary { background: var(--gold); border-color: var(--gold); color: var(--kit-ink); }
.panel button.primary:hover, #result button.primary:hover, #whatsnew button.primary:hover { background: #ffdc66; border-color: #ffdc66; }
.panel button.ghost:hover, #result button.ghost:hover, #whatsnew button.ghost:hover { background: rgba(236, 246, 238, 0.08); color: var(--ink); }
.panel button:disabled:hover, #result button:disabled:hover, #whatsnew button:disabled:hover { background: rgba(236, 246, 238, 0.04); border-color: var(--line-2); }
.panel button.primary:disabled:hover, #result button.primary:disabled:hover, #whatsnew button.primary:disabled:hover { background: var(--gold); border-color: var(--gold); }
.panel .link { color: var(--muted-2); }
.panel .link:hover { color: var(--ink); }
.panel input:not([type=file]), .panel select { background: rgba(4, 22, 15, 0.45); color: var(--ink); border-color: var(--line-2); }
.panel select option { background: #12392b; color: var(--ink); }
.panel input::placeholder { color: #6f9282; }
.panel input:focus, .panel select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.2); }
.panel label { color: var(--muted-2); }

/* ---- main menu: the tactics board. Chalk halfway line and centre circle behind the buttons. */
#menu { width: min(calc(100vw - 32px), 900px); }
#menu::before, #menu::after { content: ''; position: absolute; pointer-events: none; }
#menu::before {
  left: 44%; top: 0; bottom: 0; width: 2px; background: var(--chalk);
}
#menu::after {
  left: 44%; top: 46%; width: 180px; height: 180px; margin: -90px 0 0 -89px;
  border: 2px solid var(--chalk); border-radius: 50%;
}
.menu-body { position: relative; z-index: 1; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 40px; }
.brand h1 {
  font-size: 84px; line-height: 0.8; letter-spacing: -0.01em; color: var(--ink);
  -webkit-text-stroke: 0;
  text-shadow: 4px 4px 0 rgba(4, 22, 15, 0.55);
}
.brand .sub { font-size: 15px; max-width: 30ch; }
.player-box { background: rgba(4, 22, 15, 0.35); border-color: var(--line); }
#me-card .avatar-pick { background: var(--you); box-shadow: 0 0 0 3px #0d3125, 0 0 0 5px var(--you); }
.chip { background: rgba(236, 246, 238, 0.06); border-color: var(--line); color: var(--muted); }
.chip b { color: var(--ink); }
.chip.gold b { color: var(--gold); }
#menu.signed #account-btn { background: rgba(4, 22, 15, 0.5); color: var(--muted-2); }
.guest-hint { margin-top: -2px; }
.howto summary { color: var(--muted-2); }
.howto summary:hover { color: var(--ink); }
.howto .screen-field { margin-top: 8px; }

.menu-main { gap: 12px; }
.menu-grid.club { margin-top: 6px; padding-top: 14px; border-top: 2px solid var(--chalk); }
.panel button.tile { background: rgba(4, 22, 15, 0.38); border-color: var(--line-2); border-radius: 12px; }
.panel button.tile:hover { background: rgba(236, 246, 238, 0.08); }
.t-name { font-size: 17px; letter-spacing: 0.005em; }
.t-meta { color: var(--muted); }
.t-meta.coins { color: var(--gold); }
.panel button.tile.hero-tile {
  min-height: 104px; padding: 18px 22px; border-radius: 14px;
  background: var(--gold); border-color: var(--gold); color: var(--kit-ink);
  box-shadow: 0 10px 0 -4px #b8860b, 0 18px 30px rgba(0, 0, 0, 0.3);
}
.panel button.tile.hero-tile:hover { background: #ffdc66; transform: translateY(-2px); }
.panel button.tile.hero-tile:active { transform: translateY(2px); box-shadow: 0 4px 0 -2px #b8860b; }
.panel button.tile.hero-tile .t-name { font-family: var(--title); font-weight: 900; font-size: 40px; line-height: 0.9; letter-spacing: 0.01em; }
.panel button.tile.hero-tile .t-meta { color: rgba(11, 42, 32, 0.72); font-size: 13px; font-weight: 600; }
.panel button.tile.hero-tile::after { content: '\203A'; position: absolute; right: 22px; top: 50%; transform: translateY(-54%); font-size: 52px; font-weight: 400; color: var(--kit-ink); }
.shop-tile .badge {
  display: inline-block; vertical-align: 2px; margin-left: 6px; font-size: 11px; font-weight: 800;
  color: var(--kit-ink); background: var(--gold); border-radius: 999px; padding: 2px 8px;
  animation: badge 1.6s ease-in-out infinite;
}
@keyframes badge { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .shop-tile .badge { animation: none; } }

.title-tag {
  display: inline-block; font-family: var(--title); font-weight: 900; font-size: 13px; letter-spacing: 0.04em;
  color: var(--tc, var(--muted-2)); line-height: 1;
}
.title-tag.shine { text-shadow: 0 0 10px var(--tc); }

/* ---- auth, queue, practice */
.auth-brand { font-size: 30px; font-weight: 900; color: var(--ink); text-shadow: none; }
.tabs2 { background: rgba(4, 22, 15, 0.45); }
.panel .tabs2 button.on { background: var(--soft-2); color: var(--ink); box-shadow: none; }
.panel .tabs2 button:hover { background: rgba(236, 246, 238, 0.06); }
#games .join { background: var(--gold); color: var(--kit-ink); }
#practice-modes li button b { color: var(--ink); }
.empty { background: rgba(4, 22, 15, 0.35); border-color: var(--line-2); color: var(--muted); }

/* ---- vs computer */
.level-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level-list li { display: flex; }
.level-list li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.panel button.level {
  width: 100%; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; text-align: left;
  background: rgba(4, 22, 15, 0.38); border-width: 2px;
}
.panel button.level.on { border-color: var(--cpu); background: rgba(255, 90, 78, 0.12); }
.level b { font-family: var(--title); font-weight: 900; font-size: 24px; line-height: 1; color: var(--ink); }
.level .desc { font-size: 12.5px; font-weight: 500; color: var(--muted-2); }
.level .pay { font-size: 12px; font-weight: 800; color: var(--gold); }
.level .meter { display: flex; gap: 3px; margin-bottom: 2px; }
.level .meter i { width: 18px; height: 5px; border-radius: 2px; background: rgba(236, 246, 238, 0.15); }
.level .meter i.lit { background: var(--cpu); }
.lv-easy .meter i.lit { background: #4ad08a; }
.lv-normal .meter i.lit { background: var(--gold); }
.lv-hard .meter i.lit { background: #ff9a3d; }
.lv-pro .meter i.lit { background: #ff5a4e; }
.lv-legend .meter i.lit { background: #b06bff; }
.cpu-options { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: end; }
.seg { display: inline-flex; background: rgba(4, 22, 15, 0.45); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.panel .seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 14px; border-radius: 8px; color: var(--muted-2); box-shadow: none; }
.panel .seg button:hover { transform: none; box-shadow: none; }
.panel .seg button.on { background: var(--ink); color: var(--kit-ink); }

/* ---- shop */
.wallet { color: var(--gold); background: var(--gold-soft); border-color: rgba(255, 210, 63, 0.4); }
.shop-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
.gift-card, .featured {
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: rgba(4, 22, 15, 0.38); border: 1px solid var(--line);
}
.gift-card h3, .featured h3, .shop-row-head h3 { margin: 0; font-family: var(--title); font-weight: 900; font-size: 22px; color: var(--ink); letter-spacing: 0.01em; }
.streak { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.streak .day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  border-radius: 8px; background: rgba(236, 246, 238, 0.05); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.streak .day i { font-style: normal; font-size: 10px; color: var(--muted); }
.streak .day b { font-size: 13px; color: var(--ink); }
.streak .day.got { background: rgba(74, 208, 138, 0.16); border-color: rgba(74, 208, 138, 0.5); }
.streak .day.got b { color: var(--good); }
.streak .day.today { background: var(--gold); border-color: var(--gold); }
.streak .day.today i, .streak .day.today b { color: var(--kit-ink); }
.streak .day:last-child b { color: var(--gold); }
.streak .day.today:last-child b { color: var(--kit-ink); }
.gift-card button { align-self: flex-start; margin-top: auto; }
.featured { border-color: rgba(255, 178, 46, 0.45); background: linear-gradient(160deg, rgba(255, 178, 46, 0.14), rgba(4, 22, 15, 0.38) 60%); }
.featured-head, .shop-row-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.deal { font-size: 12px; font-weight: 800; color: var(--kit-ink); background: var(--gold); border-radius: 999px; padding: 2px 9px; }
.timer { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.shop-row-head { margin-top: 6px; }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.shop-item {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px;
  background: rgba(4, 22, 15, 0.38); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  box-shadow: inset 0 3px 0 var(--rc);
}
.shop-item canvas { width: 100%; height: 80px; border-radius: 8px; background: #e7efe9; display: block; margin-bottom: 4px; }
.shop-item .cat { font-size: 11px; font-weight: 700; color: var(--muted); }
.shop-item .name { font-weight: 800; font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-item .desc { font-size: 12px; color: var(--muted-2); line-height: 1.35; flex: 1; min-height: 32px; }
.panel .shop-item button { margin-top: 4px; gap: 6px; font-variant-numeric: tabular-nums; }
.panel .shop-item button s { font-size: 12px; font-weight: 600; color: rgba(11, 42, 32, 0.55); margin-left: 2px; }
.panel .shop-item:not(.owned) button:not(:disabled) { background: var(--gold); border-color: var(--gold); color: var(--kit-ink); }
.panel .shop-item:not(.owned) button:not(:disabled):hover { background: #ffdc66; }
.shop-item.owned { opacity: 0.7; }
.shop-item.big { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto auto 1fr auto; column-gap: 12px; box-shadow: none; background: transparent; border: 0; padding: 0; }
.shop-item.big canvas { grid-row: 1 / -1; height: 100%; min-height: 130px; }
.shop-item.big .name { font-size: 20px; white-space: normal; }

/* ---- collection, packs, trade, leaderboard on the dark green */
.panel #tabs button.on { background: var(--ink); color: var(--kit-ink); border-color: var(--ink); }
#tabs button.on .tab-count { color: rgba(11, 42, 32, 0.6); }
.card-item { background: rgba(4, 22, 15, 0.38); border-color: var(--line); }
.card-item canvas, .flip-front canvas { background: #e7efe9; }
.card-item.locked { background: rgba(4, 22, 15, 0.2); }
.card-item.locked canvas { background: repeating-linear-gradient(45deg, rgba(236, 246, 238, 0.06) 0 8px, rgba(236, 246, 238, 0.02) 8px 16px); }
.card-item.locked .name, .card-item.locked .desc { color: #5f8273; }
.card-item .count { background: var(--gold); color: var(--kit-ink); }
.panel .card-item.equipped button:disabled { border-color: rgba(74, 208, 138, 0.5); }
.progress { background: rgba(236, 246, 238, 0.08); color: var(--muted-2); }
.trade-col { background: rgba(4, 22, 15, 0.38); }
.trade-col li { background: rgba(236, 246, 238, 0.05); }
#board-table th { background: #11392a; }
#board-table td { border-bottom-color: var(--line); }
#board-table tr.me td { background: var(--gold-soft); }
#board-table tr:not(.me):hover td { background: rgba(236, 246, 238, 0.04); }
.rank { background: rgba(236, 246, 238, 0.08); color: var(--muted-2); }
.mini-avatar { background: var(--you); }
.flip-front { background: #f6faf6; }
.flip-front .nm { color: #12392b; }
#reveal { background: radial-gradient(circle at 50% 45%, rgba(20, 70, 50, 0.96), rgba(4, 20, 14, 0.98)); }
#status, #invite-toast { background: #071d15; border: 1px solid var(--line-2); }

/* ---- in a game: dark scoreboard pills that read on any sky */
#board, #clock, #bar, #emotes {
  background: rgba(8, 32, 24, 0.82); border-color: rgba(236, 246, 238, 0.16);
  box-shadow: 0 8px 22px rgba(4, 20, 14, 0.25);
}
#score { font-family: var(--title); font-weight: 900; font-size: 28px; letter-spacing: 0.04em; color: var(--kit-ink); background: var(--ink); padding: 0 16px; line-height: 1.15; }
.team { color: #a7c2b4; display: inline-flex; flex-direction: column; gap: 1px; }
#team-left { align-items: flex-end; }
.team.me { color: #ffffff; }
.team.bot { color: #ff8a80; }
.team .title-tag { font-size: 11px; letter-spacing: 0.06em; }
#team-left.me::after, #team-right.me::before { content: none; }
.team.me { text-shadow: 0 0 12px rgba(63, 169, 255, 0.6); }
#clock { color: #e2ede4; font-family: var(--title); font-size: 19px; font-weight: 900; padding: 0 14px; }
#clock.sudden { color: var(--kit-ink); }
#speed { color: #7f9a8d; }
#speed-track { background: rgba(8, 32, 24, 0.25); }
#bar { color: #a7c2b4; }
#bar button { color: #cddcd2; }
#bar button:hover { background: rgba(236, 246, 238, 0.1); color: #fff; }
#bar #leave:hover { background: rgba(255, 106, 90, 0.18); }
#emotes button { color: #cddcd2; }
#emotes button:hover { background: rgba(236, 246, 238, 0.1); color: #fff; }
.emote-msg { background: rgba(8, 32, 24, 0.9); color: #f2f8f1; border-color: rgba(236, 246, 238, 0.16); }
.emote-msg.mine { background: rgba(63, 169, 255, 0.9); }
#countdown { font-weight: 900; color: var(--gold); text-shadow: 0 6px 0 #8a6408, 0 14px 30px rgba(0, 0, 0, 0.35); }
#banner { background: rgba(8, 32, 24, 0.92); color: var(--gold); font-family: var(--title); font-weight: 900; font-size: 30px; letter-spacing: 0.03em; }
#waiting { background: rgba(8, 32, 24, 0.82); border-color: rgba(236, 246, 238, 0.16); color: #cddcd2; }
#waiting .big { color: #fff; font-family: var(--title); font-weight: 900; font-size: 26px; }
#waiting .url { background: #071d15; color: #fff; border-color: var(--line-2); }
#place-hint { color: #fff; }
#result { background: rgba(4, 20, 14, 0.55); }
#result .card { background: linear-gradient(180deg, #13402f, #0d3125); border-color: rgba(236, 246, 238, 0.14); }
#result h2 { font-weight: 900; font-size: 52px; line-height: 0.95; color: var(--gold); text-shadow: none; }
#result[data-outcome=loss] h2 { color: var(--muted-2); text-shadow: none; }
#result #result-score { font-family: var(--title); font-weight: 900; font-size: 44px; color: #fff; }
#result #result-coins { color: var(--gold); background: var(--gold-soft); border-color: rgba(255, 210, 63, 0.4); }
.vs-avatar { background: var(--you); }
#versus { background: radial-gradient(circle at 50% 40%, rgba(20, 70, 50, 0.95), rgba(4, 20, 14, 0.97)); }
.vs-name, .vs-mid { font-family: var(--title); font-weight: 900; }

.menu-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---- smaller windows */
@media (max-width: 760px) {
  .menu-grid.three { grid-template-columns: 1fr 1fr; }
  .menu-grid.three > :last-child { grid-column: 1 / -1; }
  #menu::before, #menu::after { display: none; }
  .brand h1 { font-size: 64px; }
  .menu-body { grid-template-columns: 1fr; }
  .shop-top { grid-template-columns: 1fr; }
  .level-list { grid-template-columns: 1fr; }
}
@media (max-height: 700px) {
  .panel .brand h1 { font-size: 60px; }
  .panel button.tile { min-height: 54px; padding: 9px 13px; }
  .panel button.tile.hero-tile { min-height: 84px; padding: 14px 20px; }
  .panel button.tile.hero-tile .t-name { font-size: 34px; }
}
@media (max-height: 620px) {
  .panel h1 { font-size: 30px; }
  .panel .brand h1 { font-size: 52px; }
  .brand .sub { font-size: 13px; }
  .menu-main { gap: 8px; }
  .menu-grid { gap: 8px; }
  .menu-grid.club { margin-top: 2px; padding-top: 8px; }
  .panel button.tile { min-height: 44px; padding: 7px 12px; }
  .panel button.tile .t-meta { display: none; }
  .panel button.tile.hero-tile .t-meta { display: block; }
  .panel button.tile.hero-tile { min-height: 70px; padding: 10px 18px; }
  .panel button.tile.hero-tile .t-name { font-size: 30px; }
}
.chip { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- two-player clarity
   Blue is you, red is the other player, on the scoreboard, the cursors, the goals and the goal flash. */
:root { --them: #ff5a4e; }
.team.me { color: var(--you); text-shadow: none; }
.team.them { color: var(--them); }
.team.bot { color: var(--them); }
.team.me::before, .team.them::before, .team.bot::before {
  font-size: 9px; font-weight: 800; letter-spacing: 0.14em; line-height: 1; padding: 2px 6px; border-radius: 999px; color: #fff;
  align-self: stretch; text-align: center; width: fit-content;
}
#team-left.me::before, #team-left.them::before, #team-left.bot::before { align-self: flex-end; }
.team.me::before { content: 'YOU'; background: rgba(63, 169, 255, 0.9); color: var(--kit-ink); }
.team.them::before { content: 'OPPONENT'; background: rgba(190, 45, 40, 0.9); }
.team.bot::before { content: 'COMPUTER'; background: rgba(190, 45, 40, 0.9); }
#team-left.me::after, #team-right.me::before { content: none; }
#team-right.me::before { content: 'YOU'; }
#board { min-height: 54px; }
.team { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

/* The 15 second timer: calm, then amber, then red and pulsing. Red on your own half means act. */
#sidetimer {
  display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 14px; border-radius: 999px;
  background: rgba(8, 32, 24, 0.82); border: 1px solid rgba(236, 246, 238, 0.16);
  font-size: 12px; font-weight: 800; letter-spacing: 0.03em; color: #cddcd2; font-variant-numeric: tabular-nums;
  white-space: nowrap; transition: background 0.3s, border-color 0.3s, color 0.3s;
}
#sidetimer-bar { width: 70px; height: 5px; border-radius: 3px; background: rgba(236, 246, 238, 0.14); overflow: hidden; }
#sidetimer-bar i { display: block; height: 100%; border-radius: 3px; background: #7fbf9a; transition: width 0.25s linear; }
#sidetimer[data-level=warn] { color: var(--gold); border-color: rgba(255, 210, 63, 0.5); }
#sidetimer[data-level=warn] #sidetimer-bar i { background: var(--gold); }
#sidetimer[data-level=crit] { color: #fff; background: rgba(190, 45, 40, 0.92); border-color: #ff8a80; animation: pulse 0.7s infinite; }
#sidetimer[data-level=crit] #sidetimer-bar { background: rgba(255, 255, 255, 0.25); }
#sidetimer[data-level=crit] #sidetimer-bar i { background: #fff; }
#sidetimer[data-level=warn][data-mine="1"] { background: rgba(120, 85, 8, 0.9); }

/* Connection quality: a dot and the delay, readable on the dark pill */
#ping::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 0; }
#ping { font-size: 12px; color: #a7c2b4; }
#ping.good { color: #5fe09a; }
#ping.ok { color: var(--gold); }
#ping.bad { color: #ff7a6a; }

/* Waiting for an opponent */
#waiting { width: min(calc(100vw - 32px), 480px); }
#waiting .url-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 !important; }
#waiting .url { font-size: 18px; font-weight: 700; padding: 8px 14px; border: 2px solid var(--gold); max-width: 100%; overflow-wrap: anywhere; }
#waiting #copy-link {
  pointer-events: auto; cursor: pointer; font: inherit; font-size: 14px; font-weight: 800; color: var(--kit-ink);
  background: var(--gold); border: 1px solid var(--gold); border-radius: var(--radius-sm); padding: 9px 14px;
}
#waiting #copy-link:hover { background: #ffdc66; }
#waiting #copy-link:active { transform: translateY(1px); }
#waiting #copy-link:focus-visible, #bar button:focus-visible, #emotes button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#waiting-title::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
#waiting .small { color: #9fb6aa; }

/* Full time */
#result #result-coins { margin-top: 10px; }
#result-note { margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--muted-2); min-height: 0; }
#result-note:empty { display: none; }
#result button:disabled, #whatsnew button:disabled { opacity: 0.6; }

/* ---------------------------------------------------------------- polish: states, keyboard focus, motion */
.panel input:not([type=file]):focus-visible, .panel select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.panel input:not([type=file]):focus, .panel select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.2); }
.panel select option { color: #12392b; background: #fff; }
.panel button:disabled, #result button:disabled, #whatsnew button:disabled { cursor: not-allowed; }
.panel input:disabled, .panel select:disabled { opacity: 0.5; cursor: not-allowed; }
.panel .tabs2 button[role=tab]:focus-visible, .panel #tabs button:focus-visible { outline-offset: -2px; }
.panel li button:focus-visible, .panel .tile:focus-visible { outline-offset: 3px; }
.panel-body { overscroll-behavior: contain; }
.panel .err { color: #ff8a80; }
.empty { line-height: 1.45; }
@media (max-width: 480px) {
  .team { max-width: 110px; min-width: 0; }
  #sidetimer { font-size: 11px; padding: 3px 10px; }
  #sidetimer-bar { width: 44px; }
  #waiting .url { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  #clock.low, #sidetimer[data-level=crit] { animation: none !important; }
}

/* Quick messages: a column in the outer top corner, so they never sit on the clock or the countdown */
#emotes { top: 12px; left: 14px; transform: none; flex-direction: column; border-radius: 14px; gap: 1px; opacity: 0.7; }
#hud[data-outer=right] #emotes { left: auto; right: 14px; }
#emotes button { text-align: left; padding: 4px 12px; }
#emote-feed { top: 12px; left: 132px; transform: none; align-items: flex-start; }
#hud[data-outer=right] #emote-feed { left: auto; right: 132px; align-items: flex-end; }
@media (max-width: 760px) { #emotes { display: none; } #emote-feed { left: 14px; top: 60px; } #hud[data-outer=right] #emote-feed { right: 14px; } }
.shop-grid > .empty { grid-column: 1 / -1; }
#board-table:not(:has(table)) { padding: 14px 4px; color: var(--muted-2); font-size: 14px; }
@media (max-width: 480px) {
  .brand h1, .panel .brand h1 { font-size: 46px; }
  #cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #pack-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
/* Pack buttons: dark text on the white button (the cream ink was invisible on it) */
.panel .pack button { color: var(--kit-ink); background: #fff; white-space: normal; text-align: center; line-height: 1.15; }
.panel .pack button:hover { background: #fffbe8; color: var(--kit-ink); }
.panel .pack button:disabled, .panel .pack button:disabled:hover { opacity: 1; background: rgba(255, 255, 255, 0.55); color: rgba(11, 42, 32, 0.75); }

/* ---- the game mode picker: grouped cards instead of a long drop-down */
.mode-field { display: grid; gap: 6px; margin-top: 14px; }
.mode-field .group-label { margin: 0; }
.mode-picker { display: grid; gap: 10px; }
.mode-group { display: grid; gap: 6px; }
.mode-group h4 { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.panel button.mode-card {
  width: 100%; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; text-align: left;
  background: rgba(4, 22, 15, 0.38); border-width: 2px; min-height: 0; justify-content: flex-start; align-self: stretch;
}
.panel button.mode-card.on { border-color: var(--gold); background: var(--gold-soft); }
.mode-card b { font-family: var(--title); font-weight: 900; font-size: 17px; line-height: 1.05; color: var(--ink); }
.mode-card .desc { font-size: 11.5px; font-weight: 500; line-height: 1.3; color: var(--muted-2); }

/* Rumble: the power you hold, and what is running */
#power { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 5; }
#power[hidden] { display: none; }
#power-slot { display: flex; align-items: center; gap: 10px; padding: 7px 16px; border-radius: 999px; background: rgba(20, 18, 34, 0.82); color: #fff; border: 2px solid var(--pw, rgba(255, 255, 255, 0.25)); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25); transition: border-color 0.15s, transform 0.15s; }
#power-slot.has { animation: powerpulse 1.1s ease-in-out infinite; }
#power-name { font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pw, #fff); }
#power-desc { font-size: 12px; opacity: 0.8; max-width: 280px; }
#power-key { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.16); font-family: inherit; }
#power-slot:not(.has) #power-desc, #power-slot:not(.has) #power-key { display: none; }
#power-fx { display: flex; gap: 6px; }
#power-fx span { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; color: #fff; background: var(--pw, #555); }
#power-fx span.them { outline: 2px solid rgba(255, 90, 70, 0.9); }
@keyframes powerpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* What's new: a card over the menu, once after an update */
/* Watch an ad for coins */
.ad-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: rgba(245, 197, 24, 0.12); border: 1px solid rgba(245, 197, 24, 0.35); }
.ad-bar[hidden] { display: none; }
#ad-overlay { position: fixed; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 20, 14, 0.7); }
#ad-overlay[hidden] { display: none; }
#ad-overlay .card { background: linear-gradient(180deg, #13402f, #0d3125); border: 1px solid rgba(236, 246, 238, 0.2); border-radius: 20px;
  padding: 24px 28px; box-shadow: var(--shadow); width: min(calc(100vw - 32px), 460px); color: #ecf6ee; text-align: center; }
#ad-overlay h2 { margin: 0 0 12px; }
#ad-slot { min-height: 150px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(0, 0, 0, 0.25); margin-bottom: 12px; padding: 8px; }
#ad-slot .test-ad { opacity: 0.8; font-weight: 700; }
.ad-progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ad-progress i { display: block; height: 100%; width: 0; background: #f5c518; transition: width 0.25s linear; }
.ad-actions { display: flex; justify-content: center; gap: 10px; margin: 14px 0 8px; }
#ad-overlay button { cursor: pointer; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 700; border: 1px solid rgba(236, 246, 238, 0.3); background: rgba(255, 255, 255, 0.08); color: #ecf6ee; }
#ad-overlay button.primary { background: #f5c518; border-color: #f5c518; color: #1b2b14; }
#ad-overlay button:disabled { opacity: 0.45; cursor: default; }
#ad-overlay a { color: #f5c518; }

#whatsnew {
  position: fixed; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(4, 20, 14, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#whatsnew[hidden] { display: none; }
#whatsnew .card {
  background: linear-gradient(180deg, #13402f, #0d3125); border: 1px solid rgba(236, 246, 238, 0.2); border-radius: 20px;
  padding: 26px 30px 24px; box-shadow: var(--shadow);
  width: min(calc(100vw - 32px), 500px);
  max-height: calc(100vh - 32px); overflow-y: auto;
}
#whatsnew .kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
#whatsnew h2 { margin: 6px 0 16px; font-family: var(--title); font-weight: 900; font-size: 46px; line-height: 0.95; color: var(--gold); }
#whatsnew-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
#whatsnew-list li { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#whatsnew-list li:last-child { border-bottom: 0; padding-bottom: 0; }
#whatsnew-list h3 { margin: 0 0 5px; font-size: 18px; color: var(--ink); }
#whatsnew-list p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text); }
#whatsnew-list .row { margin-top: 10px; justify-content: flex-start; }
#whatsnew .row { display: flex; gap: 10px; }
#whatsnew > .card > .row { justify-content: flex-end; }
#whatsnew-btn { margin-top: 6px; padding: 0; }

/* ---------------------------------------------------------------- main menu: online first */

.menu-main { gap: 10px; }
.online-hero {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 14px;
  border-radius: 16px; background: linear-gradient(160deg, rgba(255, 210, 63, 0.16), rgba(63, 169, 255, 0.10) 70%), rgba(4, 22, 15, 0.45);
  border: 1px solid rgba(255, 210, 63, 0.45);
}
.online-hero h2 { margin: 0; font-family: var(--title); font-weight: 900; font-size: 40px; line-height: 0.92; color: var(--ink); letter-spacing: 0.01em; }
.online-hero p { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted-2); }
.oh-actions { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.panel .oh-actions button { min-height: 46px; padding: 10px 8px; font-size: 15px; flex-wrap: wrap; row-gap: 2px; }
.panel .oh-actions button.primary { font-size: 17px; font-weight: 800; box-shadow: 0 5px 0 -2px #b8860b; }
.live-count { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 800; color: var(--kit-ink); background: #5fe09a; border-radius: 999px; padding: 1px 7px; }
.menu-main > .menu-grid:not(.club) .tile { min-height: 56px; }
.menu-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 0; padding-top: 0; }
.menu-grid.compact .wide { grid-column: span 2; }
.panel .menu-grid.compact button.tile { min-height: 46px; padding: 7px 12px; gap: 1px; }
.menu-grid.compact .t-name { font-size: 14.5px; }
.menu-grid.compact .t-meta { font-size: 11px; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* More games: a small button in the footer that opens a short list above it */
.more-foot { position: relative; justify-content: space-between; }
.more-foot .credit { text-align: left; }
#more-games { position: relative; }
.panel button.more-btn { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; color: var(--muted-2); }
.panel button.more-btn[aria-expanded=true] { background: rgba(236, 246, 238, 0.12); color: var(--ink); }
.more-btn::after { content: '\25B4'; font-size: 10px; margin-left: 6px; }
.more-btn[aria-expanded=true]::after { content: '\25BE'; }
.more-panel {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 4; width: min(300px, calc(100vw - 48px));
  display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px;
  background: #0d3125; border: 1px solid var(--line-2); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.more-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--ink); background: rgba(236, 246, 238, 0.05); }
.more-item:hover { background: rgba(236, 246, 238, 0.12); }
.more-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.more-item .t-meta { color: var(--muted); white-space: normal; }

/* Watch live list */
.live-game { width: 100%; justify-content: flex-start !important; gap: 12px !important; padding: 12px 12px 12px 16px !important; text-align: left; flex-wrap: wrap; }
.live-game .g-name { flex: 1 1 160px; min-width: 0; font-size: 15px; }
.live-game .live-score { font-family: var(--title); font-weight: 900; font-size: 22px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--gold); }
.live-game .age { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.live-game .join { font-size: 12px; font-weight: 800; color: var(--kit-ink); background: var(--gold); border-radius: 999px; padding: 5px 12px; }
.live-game:disabled .join { background: var(--soft-2); color: var(--muted); }

/* Spectating */
#spectate {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: calc(100vw - 24px); text-align: center;
}
.spectate-title { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: rgba(8, 32, 24, 0.82); border: 1px solid rgba(236, 246, 238, 0.16); border-radius: 999px; padding: 4px 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spectate-hint { margin: 0; font-size: 11.5px; font-weight: 600; color: #d6e6dc; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
#cannon {
  position: relative; overflow: hidden; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; min-width: 190px;
  color: var(--kit-ink); background: var(--gold); border: 0; border-radius: 12px; padding: 11px 22px; box-shadow: 0 5px 0 -1px #b8860b, 0 10px 22px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}
#cannon:hover { background: #ffdc66; }
#cannon:active { transform: translateY(2px); box-shadow: 0 2px 0 -1px #b8860b; }
#cannon:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
#cannon.cooling { background: #8a7a3a; color: #fff6cf; cursor: default; box-shadow: none; }
#cannon.cooling::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); transform-origin: right; transform: scaleX(var(--p, 0)); }
#cannon span { position: relative; }
#watching { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #d6e6dc; background: rgba(8, 32, 24, 0.7); border-radius: 999px; padding: 3px 12px; white-space: nowrap; }
.team.watch-left { color: var(--you); }
.team.watch-right { color: var(--them); }
.team.watch-left::before, .team.watch-right::before { content: none; }
#result[data-watching="1"] #rematch { display: none; }

@media (max-width: 760px) {
  .online-hero h2 { font-size: 34px; }
}
@media (max-width: 480px) {
  .oh-actions { grid-template-columns: 1fr 1fr; }
  .oh-actions #go-host { grid-column: 1 / -1; }
  .menu-grid.compact .t-meta { display: none; }
  .menu-grid.compact .wide { grid-column: span 1; }
  .menu-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-grid.compact .tile:last-child { grid-column: 1 / -1; }
  #cannon { min-width: 0; font-size: 15px; }
  .spectate-hint { display: none; }
}
@media (max-height: 700px) {
  .online-hero { padding: 12px; gap: 8px; }
  .online-hero h2 { font-size: 30px; }
  .online-hero p { display: none; }
  .panel .oh-actions button { min-height: 40px; }
}
@media (max-width: 760px) and (max-height: 900px) { #spectate .spectate-hint { display: none; } }

/* One column (narrow windows): the title, then Play online and the other buttons, then who you are, then the rules. */
@media (max-width: 760px) {
  .menu-body .brand { order: 0; }
  .menu-main { order: 1; }
  .player-box { order: 2; }
  .howto { order: 3; }
}

/* The privacy page */
body:has(main.legal) { overflow: auto; }
main.legal { max-width: 640px; margin: 32px auto; padding: 0 20px; color: #123; font: 16px/1.5 system-ui, sans-serif; }
main.legal h1 { font-size: 28px; }

/* The menu fills its height (no empty gap under the buttons) and More games is a tile at the bottom of the right column */
.more-games { position: relative; margin-top: auto; }
.panel button.more-tile { width: 100%; min-height: 46px; padding: 7px 12px; gap: 1px; border-radius: inherit; font-size: inherit; color: var(--ink); }
.more-tile::after { content: none; }
.more-games .more-panel { left: 0; right: 0; width: auto; bottom: calc(100% + 8px); }
@media (min-width: 761px) {
  .menu-body { align-items: stretch; }
  .menu-main > .menu-grid { flex: 1 1 auto; grid-auto-rows: 1fr; }
}

/* A watcher sees the whole (long) pitch, so the score is made bigger to use the room above it */
#hud:has(#spectate:not([hidden])) #hud-top { transform: translateX(-50%) scale(1.45); transform-origin: top center; }

/* Wider boxes across the site */
.panel { width: min(calc(100vw - 32px), 560px); }
.panel.narrow { width: min(calc(100vw - 32px), 460px); }
.panel.mid { width: min(calc(100vw - 32px), 860px); }
.panel.wide { width: min(calc(100vw - 32px), 1200px); }
#menu { width: min(calc(100vw - 32px), 1180px); }
#waiting { width: min(calc(100vw - 32px), 620px); }
#result .card { width: min(calc(100vw - 32px), 460px); }
#whatsnew .card { width: min(calc(100vw - 32px), 640px); }
#ad-overlay .card { width: min(calc(100vw - 32px), 560px); }
@media (max-width: 760px) { #menu { width: min(calc(100vw - 32px), 440px); } }

/* Play online: open games and the way you play on the left, the game modes on the right */
.queue-body { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); gap: 0 32px; align-items: start; }
.q-left, .q-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.q-right { padding-left: 32px; border-left: 1px solid var(--line); }
.q-right .mode-field { margin-top: 0; }
.q-left .play-style { width: 100%; }
#queue .mode-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
#queue .mode-card .desc { font-size: 11px; }
.panel button.q-watch { width: 100%; min-height: 52px; align-items: flex-start; text-align: left; }
@media (max-width: 860px) {
  .queue-body { grid-template-columns: 1fr; gap: 16px; }
  .q-right { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
}

/* A taller menu box, so the wider box is not a flat strip */
@media (min-width: 761px) {
  #menu { min-height: min(calc(100vh - 32px), 700px); }
  #menu > .panel-body { flex: 1 1 auto; }
}
@media (min-width: 761px) { .menu-main .menu-grid .tile { justify-content: center; } }

/* Better text in the menu boxes: bigger names, easier to read descriptions */
@media (min-width: 761px) {
  .menu-main .menu-grid:not(.club) .t-name { font-size: 24px; letter-spacing: 0.01em; }
  .menu-main .menu-grid:not(.club) .t-meta { font-size: 14px; line-height: 1.35; color: var(--ink-2); opacity: 0.85; }
  .menu-grid.compact .t-name { font-size: 18px; }
  .menu-grid.compact .t-meta { font-size: 13px; color: var(--ink-2); opacity: 0.8; }
  .more-tile .t-name { font-size: 17px; }
  .more-tile .t-meta { font-size: 13px; color: var(--ink-2); opacity: 0.8; }
}
.oh-text p { font-size: 14px; line-height: 1.45; color: var(--ink-2); opacity: 0.9; }
.mode-card b { font-size: 18px; }
.mode-card .desc { font-size: 12.5px; line-height: 1.4; color: var(--ink-2); opacity: 0.85; }
#queue .mode-card .desc { font-size: 12px; }
.panel .sub { font-size: 15px; line-height: 1.45; }
.group-label { font-size: 12px; color: var(--muted-2); }

/* The update notice: covers everything */
#maintenance { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #1b5a42, #0a2a1e 70%); color: #ecf6ee; }
#maintenance[hidden] { display: none; }
#maintenance .card { text-align: center; width: min(calc(100vw - 32px), 560px); display: grid; gap: 14px; justify-items: center; }
#maintenance h2 { margin: 0; font-family: var(--title); font-weight: 900; font-size: clamp(36px, 7vw, 64px); line-height: 0.95; }
#maintenance p { margin: 0; font-size: 19px; line-height: 1.45; }
#maintenance .small { font-size: 14px; opacity: 0.7; }
#maintenance .spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid rgba(236,246,238,0.2); border-top-color: var(--gold, #f3c63f); animation: mspin 1s linear infinite; }
@keyframes mspin { to { transform: rotate(360deg); } }

/* The power-up bar sits up under the score, not over the floor where the ball bounces */
#power { bottom: auto; top: 196px; }
@media (max-width: 760px) { #power { top: 150px; } #power-desc { max-width: 200px; } }

/* ================================================================ Layout pass
   Placement, spacing and grouping only: the look and colours above stay as they are. */

/* ---- main menu: Play online is the biggest thing, then the two ways to play alone, then the club */
.menu-main { gap: 8px; }
.menu-label { margin: 8px 0 0; }
.brand #whatsnew-btn { align-self: flex-start; margin-top: 2px; }
.panel button.tile { min-width: 0; }
.panel .menu-grid button.tile { justify-content: center; }
.panel .menu-grid.solo button.tile { min-height: 88px; padding: 14px 18px; }
.panel .menu-grid.compact button.tile { min-height: 60px; padding: 9px 14px; }
.online-hero { gap: 14px; }
.panel .oh-actions button { min-height: 52px; }
@media (min-width: 761px) {
  /* The wide box keeps its height, but the spare room goes to the Play online card, not to empty tiles */
  .menu-main > .menu-grid { flex: none; grid-auto-rows: auto; }
  .online-hero { flex: 1 1 auto; justify-content: space-between; padding: 22px 22px 20px; min-height: 0; }
  .online-hero h2 { font-size: 52px; }
  .oh-text p { max-width: 46ch; }
  .panel .oh-actions button { min-height: 60px; font-size: 16px; }
  .panel .oh-actions button.primary { font-size: 19px; }
  /* Left column: title and who you are at the top, the help folded away under them */
  .menu-side { gap: 16px; }
  .player-box { padding: 14px; }
}


/* ---- section labels: a little air above each group so they read as groups */
.panel-body > .group-label:not(:first-child),
.q-left > .group-label:not(:first-child),
.q-right > .group-label:not(:first-child) { margin-top: 10px; }
.mode-picker { gap: 14px; }

/* ---- Vs Computer: levels on the left, game mode on the right (like Play online), on wide screens */
@media (min-width: 1000px) {
  #cpu { width: min(calc(100vw - 32px), 1200px); }
  /* The bot list and the game modes scroll on their own, side by side, so both always stay reachable */
  #cpu > .panel-body {
    display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px 32px; align-items: stretch; overflow: hidden;
  }
  #cpu .level-list { grid-template-columns: 1fr; grid-row: 1 / span 2; min-height: 0; overflow-y: auto; padding-right: 6px; }
  #cpu .level-list li:last-child:nth-child(odd) { grid-column: auto; }
  #cpu .mode-field { margin-top: 0; padding-left: 32px; border-left: 1px solid var(--line); min-height: 0; overflow-y: auto; }
  #cpu #cpu-reward-hint { grid-column: 2; padding-left: 32px; }
  #cpu .mode-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
}

/* ---- shop: more of today's items per row on wide screens, buttons always at the bottom of a tile */
/* Six items a day: three a row, or all six in one row on a wide screen (never five and one left over) */
@media (min-width: 1180px) { .shop-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.shop-item .desc { flex: 1 1 auto; }
.gift-card .hint { flex: 1 1 auto; }

/* ---- collection and packs: the button always lines up along the bottom of the row */
.card-item .desc { flex: 1 1 auto; }
.panel .card-item button { margin-top: auto; }

/* ---- in a game: the score always sits in the middle, whatever the team names */
#board { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 14px; }
.team { min-width: 90px; }
#bar button { padding: 6px 11px; }

/* ---- full time: score first, then what you got, then the buttons */
#result h2 { margin-bottom: 6px; }
#result .row { margin-top: 22px; }
@media (max-width: 380px) { #result .row { flex-direction: column; } }

/* ---- What's new: the button sits apart from the list */
#whatsnew > .card > .row { padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- the privacy page: a readable card on the night pitch */
html:has(main.legal), body:has(main.legal) { overflow: auto; height: auto; }
body:has(main.legal) { user-select: text; -webkit-user-select: text; padding: 16px; }
main.legal {
  max-width: 680px; margin: 32px auto; padding: 28px 32px 24px;
  font: 16px/1.6 var(--body); color: var(--text);
  background: linear-gradient(180deg, #13402f, #0d3125); border: 1px solid rgba(236, 246, 238, 0.14);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
main.legal h1 { margin: 0 0 12px; font-family: var(--title); font-weight: 900; font-size: 44px; line-height: 0.95; color: var(--ink); }
main.legal h2 { margin: 24px 0 6px; font-size: 18px; color: var(--ink); }
main.legal p { margin: 0 0 12px; }
main.legal a { color: var(--gold); text-underline-offset: 3px; }
main.legal a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 600px) { main.legal { margin: 8px auto; padding: 20px 18px; } main.legal h1 { font-size: 36px; } }
@media (min-width: 761px) {
  /* The help sits at the bottom of the left column, level with the club buttons */
  .menu-side .player-box + .howto { margin-top: auto; }
  .menu-side .howto { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 22, 15, 0.25); }
  .menu-side { gap: 10px; }
  .menu-side .brand { margin-bottom: 6px; }
}
/* The labels group the menu now, so the chalk line above the club buttons goes */
.menu-grid.club { border-top: 0; }
@media (max-width: 760px) { .menu-body { gap: 16px; } .howto summary { padding: 6px 0; } }

/* Play online buttons: a name and a short line, so the big card is filled with something useful */
.oh-name { display: inline-flex; align-items: center; }
.oh-meta { display: none; }
@media (min-width: 761px) and (min-height: 701px) {
  .panel .oh-actions button { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left; padding: 14px 16px; min-height: 92px; }
  .oh-meta { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--muted-2); }
  .panel .oh-actions button.primary .oh-meta { color: rgba(11, 42, 32, 0.72); font-weight: 600; }
  .oh-actions { margin-top: auto; }
}

/* Packs: the packs share the row instead of bunching up on the left */
#pack-list { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 480px) { #pack-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Trade, before a trade starts: a short form, not a stretched strip */
#trade-start { display: flex; flex-direction: column; gap: 10px; max-width: 560px; padding: 4px 0 8px; }

/* Practice: three modes a row on wider screens, so the list needs less scrolling */
@media (min-width: 761px) { #practice-modes { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }

/* Leaderboard: the two tabs stay a sensible size in the wide box */
.board-tabs { width: 100%; max-width: 440px; }

/* Left column: a short record for signed-in players, or three steps for guests, so the column is not empty */
.record-box, .start-box { display: grid; gap: 10px; padding: 16px 18px; border-radius: 14px; background: rgba(4, 22, 15, 0.35); border: 1px solid var(--line-2); }
.record-box[hidden], .start-box[hidden] { display: none; }
.record-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.record-grid div { display: grid; gap: 2px; }
.record-grid dt { font-size: 12px; color: var(--muted-2); letter-spacing: 0.04em; text-transform: uppercase; }
.record-grid dd { margin: 0; font-family: var(--title); font-weight: 900; font-size: 28px; color: var(--ink); line-height: 1; }
.record-box .link { justify-self: start; }
.start-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.4; color: var(--ink-2); }

/* Play online: the open games and the game modes scroll on their own, side by side, on wide screens */
@media (min-width: 861px) {
  #queue > .panel-body.queue-body { overflow: hidden; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #queue .q-left, #queue .q-right { min-height: 0; overflow-y: auto; padding-right: 6px; }
}

/* 2v2: the lobby (two teams, the start rule, the host's Start button), a 2v2 game in the open games list, the Players choice and the Watch live row */
#team-lobby { pointer-events: auto; }
#team-lobby .lobby-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 12px; text-align: left; }
#team-lobby .lobby-side { border-radius: 12px; padding: 10px 12px 12px; background: rgba(4, 22, 15, 0.45); border: 1px solid var(--line-2); border-top: 4px solid #3fa9ff; min-width: 0; }
#team-lobby .lobby-right { border-top-color: #ff5a4e; }
#team-lobby .lobby-side b { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
#team-lobby ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#team-lobby li { font-size: 15px; font-weight: 800; color: #fff; padding: 9px 10px; border-radius: 8px; background: rgba(236, 246, 238, 0.09); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#team-lobby li.free { font-weight: 500; font-size: 13px; color: #9fb6aa; font-style: italic; background: transparent; border: 1px dashed rgba(236, 246, 238, 0.28); }
#team-lobby .lobby-rule { max-width: 46ch; margin: 4px auto 0 !important; font-size: 13.5px; color: #cddcd2; }
#team-lobby .small { margin-top: 6px; }
#team-start {
  margin-top: 12px; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; color: var(--kit-ink);
  background: var(--gold); border: 1px solid var(--gold); border-radius: var(--radius-sm); padding: 11px 26px;
}
#team-start[hidden] { display: none; }
#team-start:disabled { opacity: 0.45; cursor: default; }
#team-start:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Open games: a 2v2 entry has a head (name, tags, how many are in) and the two teams side by side with a Join button each */
#games li.team-game { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(236, 246, 238, 0.04); }
#games .tg-head { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
#games .tg-head .age { font-weight: 700; color: var(--ink-2); }
#games .tg-sides { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: stretch; }
#games .tg-vs { align-self: center; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.panel #games .tg-sides button.tg-side { width: 100%; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 8px 10px 10px; text-align: left; border-top: 3px solid #3fa9ff; background: rgba(4, 22, 15, 0.38); }
.panel #games .tg-sides button.tg-right { border-top-color: #ff5a4e; }
#games .tg-team { font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); }
#games .tg-names { display: grid; gap: 2px; margin-bottom: 4px; min-width: 0; }
#games .tg-name { font-size: 14px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#games .tg-name.tg-open { font-weight: 500; font-size: 13px; font-style: italic; color: var(--muted); }
#games .tg-side .join { align-self: stretch; text-align: center; padding: 6px 10px; }
.panel #games .tg-sides button.tg-side:disabled { opacity: 1; cursor: not-allowed; background: rgba(236, 246, 238, 0.05); border-color: var(--line); border-top-color: var(--line-2); transform: none; box-shadow: none; }
.panel #games .tg-sides button.tg-side:disabled .tg-name, .panel #games .tg-sides button.tg-side:disabled .tg-team { color: var(--muted); }
#games .tg-side:disabled .join { background: transparent; color: var(--muted); border: 1px solid var(--line-2); }

/* Host a game: the Players choice, as cards like the game modes */
.q-right .size-field { display: grid; gap: 8px; }
.q-right .size-field .size-label { margin: 0; }
.size-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel button.size-card b { font-size: 24px; }
.size-field .size-desc { min-height: 0; font-size: 13px; color: var(--muted-2); }

/* Watch live: a 2v2 row shows both teams, a "2 v 2" tag and the time */
.live-team .g-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; white-space: normal; }
.live-team .mode-tag { order: -1; margin-left: 0; }
.live-team .lg-team { font-weight: 800; overflow-wrap: anywhere; }
.live-team .lg-vs { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.live-team .lg-left { color: #7cc4ff; }
.live-team .lg-right { color: #ff8a80; }
.live-team .g-name { flex: 1 1 260px; }

/* Play online, left column: the play style sits in a card, and "Watch instead" sits at the foot so the column fills its height */
.q-left { display: flex; flex-direction: column; gap: 12px; }
.q-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; background: rgba(4, 22, 15, 0.35); border: 1px solid var(--line-2); }
.q-card .play-style { width: 100%; }
.q-card .hint { margin: 0; }
.q-foot { margin-top: auto; display: grid; gap: 10px; }
.q-foot .q-watch { width: 100%; }

/* ===== Play online, left column redesign (.q-left) =====
   One column: an Open games panel (header row with a live count), a How you play card, and Watch instead at the foot.
   The count is a CSS counter: the header comes last in the markup so it can count the rows, and is shown first with order. */
#queue .q-left { gap: 14px; }
#queue .q-games { counter-reset: qgames; display: flex; flex-direction: column; flex: 1 0 auto; min-height: 168px; border-radius: 14px; background: rgba(4, 22, 15, 0.35); border: 1px solid var(--line-2); overflow: hidden; }
#queue .q-games-head { order: -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: rgba(4, 22, 15, 0.3); }
#queue .q-games-head .group-label { margin: 0; color: var(--ink-2); }
#queue .q-count { color: var(--gold); }
#queue .q-count::before { content: "(" counter(qgames) ")"; }
#queue .q-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
#queue .q-games:has(#games li) .q-dot { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
#queue .q-games #games { padding: 8px; gap: 6px; overflow-y: auto; }
#queue .q-games #games:empty { display: none; }
#queue .q-games #games li { counter-increment: qgames; }
#queue .q-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 20px 16px; border: 0; border-radius: 0; background: transparent; }
#queue .q-empty[hidden] { display: none; }
#queue .q-empty p { margin: 0; }
#queue .q-empty-title { font-family: var(--title); font-weight: 900; font-size: 18px; letter-spacing: 0.01em; color: var(--ink); }
#queue .q-empty-text { max-width: 30ch; font-size: 13px; line-height: 1.45; color: var(--muted-2); }
#queue .q-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; width: 100%; }
.panel button.q-act { flex: 1 1 110px; justify-content: center; text-align: center; padding: 9px 12px; font-size: 14px; font-weight: 800; border-radius: 10px; background: transparent; border: 1px solid var(--line-2); color: var(--ink); }
.panel button.q-act:hover { background: rgba(236, 246, 238, 0.08); }
.panel button.q-act.q-act-quick { background: var(--gold); border-color: var(--gold); color: #0b2a20; }
.panel button.q-act.q-act-quick:hover { background: #ffdc66; }
#queue .q-card { gap: 8px; padding: 12px 14px; }
#queue .q-card .group-label { margin: 0; color: var(--ink-2); }
#queue .q-card .hint { font-size: 12.5px; line-height: 1.4; color: var(--muted-2); }
#queue .q-foot { gap: 8px; }
#queue .q-foot .group-label { margin: 0; color: var(--ink-2); }
@media (max-width: 860px) {
  #queue .q-games { flex: 0 0 auto; min-height: 0; }
}

/* Bigger chat messages */
.emote-msg { font-size: 20px; padding: 8px 18px; }
#emote-feed { gap: 6px; }
@media (max-width: 760px) { .emote-msg { font-size: 17px; padding: 6px 14px; } }
