/* Scroggy's Bingo — brand tokens lifted from scroggygames.com (wizard + cosmic themes). */
:root {
  color-scheme: dark;
  --ink: #171817;
  --bg: #171817;
  --bg-deep: #100f14;
  --surface: #232522;
  --surface-2: #2c2a36;
  --paper: #f0f0e6;
  --muted: #bdbfb2;
  --line: #41443b;
  --accent: #d5ed58;      /* Scroggy lime */
  --accent-ink: #171817;
  --cosmic: #c1a3f5;      /* cosmic theme accent */
  --robe: #4b3fa6;        /* Scroggy's robe */
  --robe-deep: #2b2366;
  --gold: #f2d38a;        /* robe pixel trim */
  --danger: #ff6b5b;
  --ball-b: #5b8def;
  --ball-i: #e8603c;
  --ball-n: #f0f0e6;
  --ball-g: #8fd14f;
  --ball-o: #f0a04b;
  --display: 'Henny Penny', Georgia, serif;
  --body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --radius: calc(14 * var(--u, 1px));
  --shadow: 0 calc(12 * var(--u, 1px)) calc(30 * var(--u, 1px)) #0007;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
svg.star { width: 1em; height: 1em; fill: currentColor; display: inline-block; vertical-align: -0.12em; }

/* Starfield backdrop + arcade texture from the main site */
.backdrop {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 0%, #4b3fa655, transparent 60%),
    radial-gradient(ellipse at 90% 100%, #d5ed5822, transparent 55%),
    var(--bg-deep);
}
.backdrop::before {
  content: ''; position: absolute; inset: 0;
  background: url('/img/arcade-texture.webp') center/cover;
  opacity: .22; mix-blend-mode: screen;
}
.stars { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.stars i {
  position: absolute; width: var(--s, calc(14 * var(--u, 1px))); height: var(--s, calc(14 * var(--u, 1px))); color: var(--accent);
  opacity: 0; animation: twinkle var(--d, 4s) ease-in-out infinite; animation-delay: var(--delay, 0s);
}
.stars i svg { width: 100%; height: 100%; fill: currentColor; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  50% { opacity: .8; transform: scale(1) rotate(45deg); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(10 * var(--u, 1px));
  border: calc(3 * var(--u, 1px)) solid var(--ink); border-radius: calc(12 * var(--u, 1px)); padding: calc(14 * var(--u, 1px)) calc(26 * var(--u, 1px));
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: calc(18 * var(--u, 1px));
  box-shadow: 0 calc(6 * var(--u, 1px)) 0 var(--ink), 0 calc(10 * var(--u, 1px)) calc(24 * var(--u, 1px)) #0008;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-2px); box-shadow: 0 calc(8 * var(--u, 1px)) 0 var(--ink), 0 calc(14 * var(--u, 1px)) calc(28 * var(--u, 1px)) #0009; }
.btn:active { transform: translateY(calc(4 * var(--u, 1px))); box-shadow: 0 calc(2 * var(--u, 1px)) 0 var(--ink), 0 calc(4 * var(--u, 1px)) calc(10 * var(--u, 1px)) #0008; }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--paper); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.purple { background: var(--cosmic); }

/* Bingo balls */
.ball {
  --c: var(--ball-n);
  position: relative; display: grid; place-items: center; border-radius: 50%;
  width: var(--size, calc(64 * var(--u, 1px))); height: var(--size, calc(64 * var(--u, 1px)));
  background:
    radial-gradient(circle at 32% 28%, #fff9 0 8%, transparent 22%),
    radial-gradient(circle at 50% 50%, var(--c) 0 58%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  box-shadow: inset -6px -8px calc(14 * var(--u, 1px)) #0006, 0 calc(6 * var(--u, 1px)) calc(14 * var(--u, 1px)) #0008;
  border: calc(2 * var(--u, 1px)) solid #0008;
  font-weight: 800; color: var(--ink);
}
.ball::before {
  content: ''; position: absolute; inset: 20%; border-radius: 50%; background: #fbfbf2;
  box-shadow: inset 0 -3px calc(6 * var(--u, 1px)) #0002;
}
.ball > span { position: relative; text-align: center; line-height: .9; font-size: calc(var(--size, calc(64 * var(--u, 1px))) * .3); }
.ball > span b { display: block; font-size: .62em; letter-spacing: .04em; opacity: .75; }
.ball.B { --c: var(--ball-b); } .ball.I { --c: var(--ball-i); } .ball.N { --c: #cfcfc4; }
.ball.G { --c: var(--ball-g); } .ball.O { --c: var(--ball-o); }

/* Avatars */
.avatar {
  --ring: var(--accent);
  position: relative; width: var(--size, calc(80 * var(--u, 1px))); height: var(--size, calc(80 * var(--u, 1px))); border-radius: 50%;
  border: calc(4 * var(--u, 1px)) solid var(--ring); background: var(--ring) center/cover no-repeat;
  box-shadow: 0 0 0 calc(3 * var(--u, 1px)) var(--ink), 0 calc(8 * var(--u, 1px)) calc(20 * var(--u, 1px)) #0009; overflow: hidden; flex-shrink: 0;
  display: grid; place-items: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .fallback { font-family: var(--display); font-size: calc(var(--size, calc(80 * var(--u, 1px))) * .42); color: var(--ink); }

.speech {
  position: relative; background: var(--paper); color: var(--ink); border: calc(3 * var(--u, 1px)) solid var(--ink);
  border-radius: calc(18 * var(--u, 1px)); padding: calc(14 * var(--u, 1px)) calc(18 * var(--u, 1px)); font-weight: 700; box-shadow: calc(6 * var(--u, 1px)) calc(6 * var(--u, 1px)) 0 var(--ink);
}

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

/* Way home: pinned bottom-right on every screen */
.home-link {
  position: fixed; right: calc(14 * var(--u, 1px)); bottom: max(calc(10 * var(--u, 1px)), env(safe-area-inset-bottom));
  z-index: 45; display: inline-flex; align-items: center; gap: calc(6 * var(--u, 1px));
  padding: calc(6 * var(--u, 1px)) calc(12 * var(--u, 1px)); border-radius: 999px;
  background: #100f14d9; border: 1px solid var(--line); color: var(--paper);
  font-family: var(--display); font-size: calc(15 * var(--u, 1px)); line-height: 1; text-decoration: none;
  backdrop-filter: blur(6px); box-shadow: 0 4px 14px #0007; transition: border-color .2s, color .2s, transform .2s;
}
.home-link svg { width: calc(14 * var(--u, 1px)); height: calc(14 * var(--u, 1px)); fill: var(--accent); }
.home-link span { color: var(--accent); }
.home-link:hover, .home-link:focus-visible { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
