/* ================= Couch Party — design tokens ================= */
/* "Block Party" language: flat-shaded voxel chrome. Opaque surfaces,
   hard zero-blur shadows, bevel faces, everything snapped to the 4px
   UI-voxel grid. Palette is the original night carnival — unchanged. */

@font-face {
  font-family: 'Bungee'; /* display: chunky signage face, single weight */
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/bungee.woff2') format('woff2');
}
@font-face {
  font-family: 'Jersey 10'; /* pixel numerals: scores, timers, room codes */
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jersey10.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/fredoka.woff2') format('woff2');
}

:root {
  /* palette — night carnival: deep violet dusk, neon midway lights */
  --night-950: #06020f;
  --night-900: #090318;
  --night-800: #120724;
  --night-700: #1e0d3f;
  --night-600: #2e1156;
  --night-500: #3d1a6e;
  --ink: #fff7ff;
  --ink-dim: rgba(255, 247, 255, 0.7);
  --ink-faint: rgba(255, 247, 255, 0.52);

  --pink: #ff5d9e;
  --coral: #ff5d5d;
  --amber: #ffb84d;
  --gold: #ffe14d;
  --lime: #7dff6b;
  --mint: #4dffc3;
  --sky: #4dd7ff;
  --violet: #7b8cff;
  --orchid: #d67bff;

  /* dark bevel faces — hand-picked partners, never computed darkens */
  --pink-face: #8c3157;
  --coral-face: #8a2e35;
  --amber-face: #8a5a1c;
  --gold-face: #a3771c;
  --lime-face: #3d8a33;
  --mint-face: #1c7a5c;
  --sky-face: #1c6c8a;
  --violet-face: #3d478f;
  --orchid-face: #6f3a8a;

  /* economy accents */
  --star: #ffe14d;
  --coin: #ffce3d;
  --beer: #ffb84d;

  --danger: #ff4d6a;
  --ok: #58e07c;

  /* the UI-voxel grid: one unit = 4px, everything snaps to it */
  --vx: 4px;
  --vx2: 8px;
  --vx3: 12px;
  --vx4: 16px;

  /* surfaces — opaque block panels (glass retired; --glass-blur kept as a
     no-op so legacy scene styles degrade harmlessly) */
  --card: var(--night-700);
  --card-hi: var(--night-600);
  --card-border: var(--night-500);
  --card-border-hi: #55258f;
  --glass-blur: 0px;

  /* typography */
  --font-display: 'Bungee', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --font-px: 'Jersey 10', 'Courier New', monospace;
  /* big sizes track the SHORTER axis too, so wide-short windows don't blow up vertically */
  --fs-xs: clamp(11px, 1.1vw, 13px);
  --fs-sm: clamp(13px, 1.35vw, 17px);
  --fs-md: clamp(16px, 1.7vw, 21px);
  --fs-lg: clamp(18px, min(2.3vw, 3.4vh), 28px);
  --fs-xl: clamp(22px, min(3.2vw, 4.6vh), 40px);
  --fs-2xl: clamp(30px, min(4.6vw, 6.6vh), 60px);
  --fs-3xl: clamp(38px, min(6.5vw, 9vh), 86px);
  --fs-hero: clamp(54px, min(11.5vw, 15vh), 165px);

  /* spacing & shape — radii are dead; corners are sharp or stepped */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --r-sm: 0; --r-md: 0; --r-lg: 0; --r-xl: 0; --r-pill: 0;

  /* elevation — hard offset shadows, zero blur, grid-snapped */
  --shadow-1: var(--vx) var(--vx) 0 rgba(0, 0, 0, 0.35);
  --shadow-2: var(--vx2) var(--vx2) 0 rgba(0, 0, 0, 0.45);
  /* bevel: light top face + dark bottom face on any filled block */
  --bevel: inset 0 var(--vx) 0 rgba(255, 255, 255, 0.32), inset 0 calc(-1 * var(--vx)) 0 rgba(0, 0, 0, 0.28);
  --bevel-soft: inset 0 2px 0 rgba(255, 255, 255, 0.14), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  /* glows survive only as FX accents (big moments), never chrome */
  --glow-pink: 0 0 34px rgba(255, 93, 158, 0.45);
  --glow-sky: 0 0 34px rgba(77, 215, 255, 0.4);
  --glow-gold: 0 0 40px rgba(255, 225, 77, 0.45);
  --glow-violet: 0 0 34px rgba(123, 140, 255, 0.4);
  --glow-coin: 0 0 26px rgba(255, 206, 61, 0.5);

  /* hard stepped extrusion for display type — the long-shadow staircase */
  --text-step: 2px 2px 0 var(--night-950), 4px 4px 0 var(--night-950), 6px 6px 0 rgba(0, 0, 0, 0.45);
  --text-step-sm: 2px 2px 0 var(--night-950), 3px 3px 0 rgba(0, 0, 0, 0.45);

  /* motion */
  --ease-pop: cubic-bezier(0.2, 1.6, 0.4, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 120ms;
  --t-med: 260ms;
  --t-slow: 550ms;

  /* gradients — flattened to solids where scenes still reference them;
     the curtain keeps its dusk wash until the block-mosaic replaces it */
  --grad-party: linear-gradient(180deg, var(--gold), var(--gold));
  --grad-cool: linear-gradient(180deg, var(--mint), var(--mint));
  --grad-text: linear-gradient(180deg, var(--gold), var(--gold));
  --grad-gold: linear-gradient(180deg, var(--gold), var(--gold));
  --grad-curtain: linear-gradient(115deg, #240b47 0%, #3b1168 34%, #55187f 62%, #341058 100%);

  /* 50% checker dither — texture without gradients (use as background) */
  --dither: repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%);
}

/* base reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

/* explicit background on the root: some phone browsers paint the *propagated*
   canvas background with a light system colour, leaving a washed-out lavender
   behind the UI. An explicit background on <html> is respected like any other
   element's, so the backdrop stays night-dark everywhere. */
html { background: var(--night-950); }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--night-800);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Bungee ships one weight and reads as caps — no synthetic bold */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.015em; line-height: 1.1; }

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

img, svg, canvas { display: block; max-width: 100%; }

/* ambient background — flat night sky, no blur orbs */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(130% 110% at 18% -8%, var(--night-600) 0%, transparent 55%),
    radial-gradient(120% 120% at 100% 110%, #241040 0%, transparent 60%),
    var(--night-800);
}

/* starfield twinkle — tiled pixel specks, opacity-only animation (GPU-cheap);
   hard color stops keep each star a crisp square-ish pixel, no soft halo */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 22px 34px, rgba(255, 247, 255, 0.8) 0 100%, transparent 100%),
    radial-gradient(1px 1px at 128px 96px, rgba(255, 225, 200, 0.6) 0 100%, transparent 100%),
    radial-gradient(2px 2px at 214px 180px, rgba(190, 220, 255, 0.7) 0 100%, transparent 100%),
    radial-gradient(1px 1px at 66px 210px, rgba(255, 247, 255, 0.5) 0 100%, transparent 100%),
    radial-gradient(1.5px 1.5px at 176px 42px, rgba(255, 200, 235, 0.55) 0 100%, transparent 100%);
  background-size: 260px 260px;
  animation: twinkle 5.5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.9; } }

/* shared bits */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.9em;
  background: var(--night-700);
  border: 2px solid var(--night-500);
  font-weight: 800;
  font-size: var(--fs-sm);
}
/* legacy rainbow gradient text → solid gold with stepped extrusion */
.grad-text {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--gold);
  text-shadow: var(--text-step-sm);
}

@keyframes pop { from { transform: scale(0.35); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes thump { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shake-x { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes chip-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.09); box-shadow: 0 0 26px color-mix(in srgb, var(--c, #ffe14d) 70%, transparent); }
  100% { transform: scale(1); }
}
@keyframes stat-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.7); filter: brightness(1.8); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
