/* MMM — base: reset, layout helpers, grid utilities, animations, state visibility */

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: var(--font-main);
  background-color: var(--page-bg);
  color: var(--text-primary);
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
pre { white-space: pre-wrap; word-break: break-word; }
code { font-family: 'SFMono-Regular', Consolas, monospace; }

h1, h2, h3, h4 { line-height: 1.1; font-weight: 900; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1rem, 2vw, 1.3rem); }
p  { line-height: 1.65; }

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container,
.admin-main {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
}

.page-shell,
.stack-lg,
.stack-md,
.stack-sm { display: flex; flex-direction: column; }
.page-shell,
.stack-lg  { gap: 18px; }
.stack-md  { gap: 14px; }
.stack-sm  { gap: 8px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.lead-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 800;
  color: rgba(255,255,255,0.82);
}
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.center { justify-content: center; }

/* ── Grid / layout utilities ─────────────────────────────────────────────── */
.form-row,
.button-row,
.token-input-row,
.compact-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-row.two-cols > *,
.admin-grid.two-cols > *,
.token-input-row > * { flex: 1 1 260px; }

.admin-grid,
.results-grid,
.stats-grid,
.mini-player-grid { display: grid; gap: 14px; }

.admin-grid.two-cols          { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.admin-grid.three-cols        { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.admin-grid.three-overview-cols { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.column-span-2 { min-width: 0; }
.stretch-start { align-items: start; }
.stats-grid-admin { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* ── Animations ──────────────────────────────────────────────────────────── */
.loading-dots::after { content: '...'; animation: loadingDots 1.4s infinite; }
.confetti-emoji {
  position: fixed;
  top: -24px;
  pointer-events: none;
  animation: confettiFall linear forwards;
  z-index: 9999;
}
.fade-in { animation: fadeIn 0.3s ease both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes confettiFall {
  to { transform: translateY(100vh) rotate(680deg); opacity: 0; }
}
@keyframes loadingDots {
  0%  { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}
@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

/* ── State visibility ────────────────────────────────────────────────────── */
#state-no-game,
#state-select-player,
#state-game,
#state-submitted,
#state-results { display: none; }
