/* ===============================
   GLOBAL RESET & VARIABLES
================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0b0e;
  --panel-bg: #141418;
  --panel-border: #222;
  --text: #ffffff;
  --muted: #aaaaaa;
  --accent: #ff4d4d;
  --purple: #7c3aed;
  --azure: #0ea5e9;
  --dark: #020617;
  --light: #f1f5f9;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.player-lobby {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lobby-card {
  background: #11142c;
  padding: 2rem;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lobby-card label {
  font-size: 0.9rem;
  color: #c7c9ff;
}

.lobby-card input {
  width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  border: none;
  background: #1b1f44;
  color: white;
}

.error {
  color: #ff6b6b;
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

.logo {
  font-weight: bold;
  font-size: 1.2rem;
}

.menu {
  position: relative;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
}

.menu-dropdown a {
  display: block;
  padding: 0.6rem 1rem;
  color: white;
  text-decoration: none;
}

.menu-dropdown a:hover {
  background: #333;
}

.hidden {
  display: none;
}

.home {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.hero {
  text-align: center;
}

.action-buttons {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  padding: 0.8rem 1.4rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
}

.btn.primary {
  background: #7c3aed;
  color: white;
}

.btn.secondary {
  background: #2563eb;
  color: white;
}
/* ===============================
   APP WRAPPER
================================ */
.app {
  height: calc(100vh - 52px);
}

/* ===============================
   HOST LAYOUT GRID
================================ */
.host-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 1rem;
  padding: 1rem;
  height: 100%;
}

.auth-blocked {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0f0f14;
  color: white;
  text-align: center;
}

/* ===============================
   PANELS
================================ */
.panel {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 0.75rem;
  border: 1px solid var(--panel-border);
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ===============================
   PLAYER LIST
================================ */
#playerList {
  list-style: none;
}

#playerList li {
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.95rem;
}

.host-winners {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.host-winners ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.host-winners li {
  font-size: 1.1rem;
  margin: 6px 0;
}

.hidden {
  display: none;
}

/* ===============================
   BINGO HEADER (HOST)
================================ */
.bingo-header {
  display: flex;
  gap: 0.6rem;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.25rem;
}

.bingo-header span {
  background: #1f1f24;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

/* ===============================
   CURRENT BALL LETTER COLORS
================================ */

.current-ball {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  color: #fff;
  font-size: 2.6rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  box-shadow:
    inset -6px -6px 12px rgba(0,0,0,0.25),
    0 0 30px rgba(0,0,0,0.5);
}

/* Letter-specific colors */
.current-ball.B {
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c1121f);
  box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
}

.current-ball.I {
  background: radial-gradient(circle at 30% 30%, #4dabf7, #1c4ed8);
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.9);
}

.current-ball.N {
  background: radial-gradient(circle at 30% 30%, #ffa94d, #f76707);
  box-shadow: 0 0 40px rgba(255, 140, 0, 0.9);
}

.current-ball.G {
  background: radial-gradient(circle at 30% 30%, #ffe066, #f59f00);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.9);
  color: #222;
}

.current-ball.O {
  background: radial-gradient(circle at 30% 30%, #69db7c, #2f9e44);
  box-shadow: 0 0 40px rgba(0, 200, 0, 0.9);
}
/* ===============================
   COUNTDOWN
================================ */
.countdown {
  font-size: 4rem;
  font-weight: bold;
  color: var(--accent);
}

.hidden {
  display: none;
}

/* ===============================
   CALLED NUMBERS
================================ */
.called-center {
  width: 100%;
  max-width: 420px;
}

.call-history {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
}

.call-history span {
  background: #1f1f24;
  border-radius: 6px;
  padding: 0.35rem;
  text-align: center;
  font-weight: bold;
}

/* ===============================
   ROOM CODE
================================ */
.room-code {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
  letter-spacing: 0.15rem;
  background: #1f1f24;
  padding: 0.5rem;
  border-radius: 8px;
}

/* ===============================
   MODES
================================ */
.modes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.modes label {
  cursor: pointer;
}

/* ===========================
   PRESENTER MODE
=========================== */

.presenter {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #111 0%, #000 70%);
  overflow: hidden;
  z-index: 1000;
}

.presenter.hidden {
  display: none;
}

/* Background floating balls */
#ballField {
  position: absolute;
  inset: 0;
}

.bg-ball {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #999);
  opacity: 0.15;
  animation: floatBall linear infinite;
}

/* Bingo ball colors */
.ball-B { background: radial-gradient(circle at 30% 30%, #7cc7ff, #1e88e5); }
.ball-I { background: radial-gradient(circle at 30% 30%, #ff9a9a, #e53935); }
.ball-N { background: radial-gradient(circle at 30% 30%, #9cffb2, #43a047); }
.ball-G { background: radial-gradient(circle at 30% 30%, #d1b3ff, #7e57c2); }
.ball-O { background: radial-gradient(circle at 30% 30%, #ffd59a, #fb8c00); }

/* Text contrast */
.active-ball,
.bg-ball {
  color: #ffffff;
  font-weight: bold;
}

.active-ball.show {
  animation-name: popBall;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-fill-mode: forwards;
}

.active-ball.roll-away {
  animation-name: rollAway;
  animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
  animation-fill-mode: forwards;
}

/* ===========================
   PRESENTER MODE TEXT COLOR
=========================== */

.presenter .active-ball,
.presenter .active-ball span,
.presenter .bg-ball {
  color: #000000; /* BLACK */
}

@keyframes floatBall {
  from {
    transform: translateY(110vh) rotate(0deg);
  }
  to {
    transform: translateY(-120vh) rotate(360deg);
  }
}

@keyframes popBall {
  from {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes rollAway {
  to {
    transform: translate(140vw, -50%) rotate(1080deg) scale(0.65);
    opacity: 0;
  }
}

.exit-presenter-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 1100;

  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  font-size: 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.exit-presenter-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===========================
   ACTIVE CALLED BALL
=========================== */

.active-ball {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
  transform: translate(-50%, -50%) scale(0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: bold;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.active-ball.show {
  animation: popBall 0.4s ease-out forwards;
}

@keyframes popBall {
  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

.active-ball.roll-away {
  animation: rollAway 1s ease-in forwards;
}

@keyframes rollAway {
  to {
    transform: translate(120vw, -50%) rotate(720deg) scale(0.6);
    opacity: 0;
  }
}

/* ===============================
   CONTROLS
================================ */
button {
  background: #1f1f24;
  color: white;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.3rem;
}

button:hover {
  background: #2a2a33;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="range"] {
  width: 100%;
  margin-top: 0.4rem;
}

/* ======================================================
   PLAYER VIEW — COMPLETE REWRITE (AUTHORITATIVE)
====================================================== */

/* Page wrapper */
.player-game {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
}

/* Card title */
#cardTitle {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
}

/* Main two-column layout */
.player-layout {
  display: grid;
  grid-template-columns: auto 260px;
  gap: 3.5rem;
  align-items: start;
}

/* ===============================
   CARD COLUMN
================================ */
.card-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* BINGO letters */
.bingo-letters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.bingo-letters div {
  font-weight: 800;
  text-align: center;
  opacity: 0.6;
}

/* Bingo grid */
.bingo-card {
  display: grid;
  grid-template-columns: repeat(5, 80px);
  grid-auto-rows: 80px;
  gap: 0.6rem;
}

/* Bingo cells */
.bingo-card .cell {
  background: #14182f;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.bingo-card .cell:hover {
  transform: scale(1.05);
}

/* FREE cell */
.bingo-card .cell.free {
  background: #32d46b;
  color: #000;
  font-weight: 900;
}

/* Marked cell */
.bingo-card .cell.marked {
  background: var(--daub-color, #7c4dff);
  color: #fff;
  box-shadow: 0 0 18px color-mix(in srgb, var(--daub-color) 70%, transparent);
}

/* ===============================
   BINGO BUTTON
================================ */
.bingo-btn {
  margin-top: 1.5rem;
  width: 400px;
  height: 64px;
  font-size: 1.6rem;
  font-weight: 900;
  border-radius: 14px;
  align-items: center;
}

/* ===============================
   CALLED NUMBERS COLUMN
================================ */
.called-numbers {
  background: linear-gradient(180deg, #0f1330, #0a0d1f);
  border-radius: 16px;
  padding: 1.2rem;
  width: 260px;
}

.called-numbers h3 {
  text-align: center;
  margin-bottom: 0.8rem;
}

#calledNumbersList {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

/* Called number pill */
#calledNumbersList span {
  background: #1b2045;
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  font-weight: 700;
}

/* ===============================
   PLAYER BINGO BUTTON ALIGNMENT
================================*/

/* Allow internal alignment control */
.card-area {
  align-items: flex-start;
}

/* Center the bingo grid itself */
.card-area .bingo-card {
  margin-left: auto;
  margin-right: auto;
}

/* Align BINGO button with left edge of card */
.card-area .bingo-btn {
  align-self: flex-start;
}

/* ===============================
   WINNER OVERLAY
================================*/
.winner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.winner-banner {
  position: relative;
  background: linear-gradient(
    135deg,
    #7b2ff7 0%,   /* Purple */
    #4facfe 50%,  /* Light Azure */
    #00c6ff 100%  /* Azure */
  );
  color: #ffffff;
  padding: 24px 32px;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: popIn 0.25s ease-out;
}

.winner-banner h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

.winner-banner ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.winner-banner li {
  font-size: 1.1rem;
  margin: 6px 0;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.hidden {
  display: none;
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===============================
   MOBILE LAYOUT
================================ */
@media (max-width: 900px) {
  .player-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .bingo-card {
    grid-template-columns: repeat(5, 64px);
    grid-auto-rows: 64px;
  }

  .bingo-btn {
    width: 100%;
    max-width: 360px;
  }

  .called-numbers {
    width: 100%;
    max-width: 360px;
  }
}
.bingo-letters div {
  background: #1f1f24;
  padding: 0.4rem;
  text-align: center;
  font-weight: bold;
  border-radius: 6px;
}

.bingo-card {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 1.5rem auto;
}

.bingo-cell {
  aspect-ratio: 1 / 1;
  background: #1b1f44;
  color: white;
  border-radius: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cell.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.bingo-cell.header {
  background: transparent;
  cursor: default;
}

.bingo-cell {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Called by host, can now be marked */
.bingo-cell.call-available {
  opacity: 1;
  cursor: pointer;
  outline: 3px solid #facc15;
}

/* Marked by player */
.bingo-cell.marked {
  background: #22c55e;
  color: #022c22;
  opacity: 1;
  outline: none;
}

/* FREE space always enabled */
.bingo-cell.free {
  opacity: 1;
  cursor: default;
}

.hidden {
  display: none;
}






















