/* Squad Games: retro arcade carnival. Dark by design; contrast checked against WCAG AA. */

@font-face {
  font-family: 'Press Start 2P';
  src: url('/fonts/press-start-2p.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #0d0b1e;
  --bg-glow: #1b1442;
  --panel: #18153a;
  --panel-2: #221d4f;
  --line: #3a3373;
  --text: #f5f3ff;
  --muted: #b9b4dd;
  --accent: #a78bfa;
  --good: #4ade80;
  --warn: #facc15;
  --bad: #fb7185;
  --focus: #fde047;
  --radius: 14px;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: radial-gradient(ellipse at top, var(--bg-glow), var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .pixel {
  font-family: var(--pixel);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

/* Type scale: size follows priority. Each level is about a third larger than the next, so the steps
   read clearly even in the chunky pixel font.
   Hero figures (your points, the champions, scores) > h1 page title (22px) > h2 section (16px)
   > h3 label (12px) = the masthead brand. */
h1 { font-size: 1.375rem; margin: 0 0 0.75rem; }
h2 { font-size: 1rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 0.75rem; margin: 0 0 0.5rem; }

a { color: var(--accent); }

p { margin: 0 0 0.75rem; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.65rem 1.1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #140f2e; }
.btn--good { background: var(--good); border-color: var(--good); color: #052e16; }
.btn--bad { border-color: var(--bad); color: var(--bad); }
.btn--big { min-height: 72px; font-size: 1.25rem; width: 100%; }
.btn--block { width: 100%; }
.btn--link { background: none; border-color: transparent; color: var(--accent); text-decoration: underline; padding-inline: 0.25rem; min-height: 44px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-row > .btn { flex: 1 1 8rem; }

/* ---------- panels, badges ---------- */

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.1em 0.6em;
  border: 1px solid var(--squad, var(--line));
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--squad, var(--muted));
}

.pill {
  display: inline-block;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  background: var(--warn);
  color: #1c1400;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ---------- forms ---------- */

label { display: block; font-weight: 600; margin-bottom: 0.35rem; }

input[type='text'] {
  width: 100%;
  min-height: 52px;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: 1.1rem var(--sans);
}
input[type='text']:focus { border-color: var(--accent); outline: none; }

/* One-time codes, shown and typed in the pixel font so similar letters stay distinct. */
.code { font-family: var(--pixel); font-size: 1.25rem; letter-spacing: 0.15em; text-align: center; color: var(--warn); margin: 0 0 1rem; }
.code-form { display: flex; gap: 0.5rem; }
.code-form .code-input { flex: 1; min-width: 0; font-family: var(--pixel); font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- messages ---------- */

.toast {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 10;
  max-width: 32rem;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 2px solid var(--accent);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
}
.toast--bad { border-color: var(--bad); }

.notice {
  border-left: 4px solid var(--bad);
  background: var(--panel);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.75rem;
}

dialog {
  width: min(28rem, calc(100vw - 2rem));
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 1.25rem;
}
dialog::backdrop { background: rgb(5 3 15 / 0.75); }

.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; line-height: 0; }
.qr svg { display: block; width: 100%; height: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

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