/* ============================================================
   Family Game Night — shared styles
   Warm, modern, friendly. One file used by every page.
   ============================================================ */

:root {
  --bg: #1b1033;
  --bg-2: #2a1a52;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-solid: #2f2150;
  --text: #f4eefb;
  --muted: #b7a9d6;
  --accent: #ffcb47;
  --accent-2: #ff6b9d;
  --green: #38d39f;
  --red: #ff5a6e;
  --blue: #4aa8ff;
  --yellow: #ffd23f;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, #3a2170 0%, transparent 55%),
    radial-gradient(1000px 700px at 110% 10%, #5a2a6b 0%, transparent 50%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.3px;
}
.brand .logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a1340; font-size: 20px;
  box-shadow: var(--shadow);
}
.backlink {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  transition: background .15s, color .15s;
}
.backlink:hover { background: rgba(255,255,255,.14); color: var(--text); }

/* ---- Hero ---- */
.hero { text-align: center; padding: 30px 10px 10px; }
.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  margin: 10px 0 8px;
  line-height: 1.05;
  background: linear-gradient(120deg, #fff, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto; max-width: 560px; }

/* ---- Game cards grid (home) ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 38px;
}
.card {
  position: relative;
  border-radius: var(--radius);
  padding: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-6px); border-color: rgba(255,255,255,.28); }
.card .emoji { font-size: 46px; }
.card h3 { font-size: 24px; margin: 14px 0 6px; }
.card p { color: var(--muted); margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.btn {
  display: inline-block;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 15px;
  color: #2a1340;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(255,107,157,.35);
  transition: transform .12s, filter .12s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  color: var(--text);
  background: var(--panel);
  box-shadow: none;
  border: 1px solid rgba(255,255,255,.18);
}
.btn.ghost {
  color: var(--text); background: transparent;
  border: 1px solid rgba(255,255,255,.22); box-shadow: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- Generic panel ---- */
.panel {
  border-radius: var(--radius);
  padding: 22px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
}

.tip {
  margin-top: 30px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(74,168,255,.12);
  border: 1px solid rgba(74,168,255,.3);
  color: #dbe9ff;
  font-size: 14.5px;
  line-height: 1.55;
}
.tip strong { color: #fff; }

.footer-note { text-align: center; color: var(--muted); margin-top: 40px; font-size: 13px; }

/* ============================================================
   BINGO
   ============================================================ */
.bingo-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; margin-top: 24px; }
@media (max-width: 820px) { .bingo-layout { grid-template-columns: 1fr; } }

.caller-board { text-align: center; }
.called-big {
  font-size: 88px;
  font-weight: 800;
  line-height: 1;
  margin: 6px 0 4px;
  min-height: 96px;
  display: grid; place-items: center;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.called-letter { color: var(--accent); font-weight: 800; }
.called-history {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin-top: 14px; max-height: 200px; overflow-y: auto;
}
.chip {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
}
.chip.latest { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color:#2a1340; }

.bingo-card { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 460px; margin: 0 auto; }
.bingo-card .head {
  font-weight: 800; font-size: 28px; text-align: center; padding: 8px 0;
  color: #2a1340; border-radius: 12px;
}
.bingo-card .head.B { background: var(--accent); }
.bingo-card .head.I { background: var(--accent-2); }
.bingo-card .head.N { background: var(--green); }
.bingo-card .head.G { background: var(--blue); }
.bingo-card .head.O { background: var(--yellow); }
.bingo-card .cell {
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  font-weight: 700; font-size: clamp(16px, 4.4vw, 26px);
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 2px solid rgba(255,255,255,.10);
  cursor: pointer;
  user-select: none;
  transition: transform .1s, background .15s, border-color .15s;
}
.bingo-card .cell:hover { border-color: rgba(255,255,255,.4); }
.bingo-card .cell.marked {
  background: linear-gradient(135deg, var(--green), #2bb888);
  border-color: #2bb888; color: #08251c;
  transform: scale(.97);
}
.bingo-card .cell.free {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a1340; cursor: default; font-size: 13px;
}
.bingo-card .cell.winline { box-shadow: 0 0 0 3px var(--accent), 0 0 18px var(--accent); }

.controls-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

.win-banner {
  margin-top: 18px; padding: 16px; text-align: center;
  border-radius: 14px; font-weight: 800; font-size: 22px;
  background: linear-gradient(120deg, var(--green), var(--accent));
  color: #08251c; display: none;
}
.win-banner.show { display: block; animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.subhead { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 10px; font-weight: 700; }

/* ============================================================
   UNO
   ============================================================ */
.uno-table { margin-top: 20px; display: grid; gap: 18px; }
.players-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pchip {
  padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--panel); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; gap: 8px;
}
.pchip.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a1340; border-color: transparent; }
.pchip .count { background: rgba(0,0,0,.18); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.pchip.active .count { background: rgba(0,0,0,.18); }

.center-area { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; padding: 18px 0; }
.deck-pile {
  width: 90px; height: 130px; border-radius: 14px; cursor: pointer;
  background: repeating-linear-gradient(45deg, #2a1340, #2a1340 8px, #3a1c5a 8px, #3a1c5a 16px);
  border: 3px solid rgba(255,255,255,.18);
  display: grid; place-items: center; font-weight: 800; color: var(--muted);
  box-shadow: var(--shadow); transition: transform .12s;
}
.deck-pile:hover { transform: translateY(-4px); }

.uno-card {
  width: 90px; height: 130px; border-radius: 14px;
  display: grid; place-items: center; position: relative;
  font-weight: 900; color: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.3);
  border: 3px solid rgba(255,255,255,.85);
}
.uno-card .big { font-size: 40px; text-shadow: 0 2px 4px rgba(0,0,0,.3); }
.uno-card .corner { position: absolute; font-size: 15px; }
.uno-card .corner.tl { top: 7px; left: 9px; }
.uno-card .corner.br { bottom: 7px; right: 9px; transform: rotate(180deg); }
.uno-card.red { background: linear-gradient(160deg, #ff6273, #d6283c); }
.uno-card.blue { background: linear-gradient(160deg, #5cb3ff, #1f6fd6); }
.uno-card.green { background: linear-gradient(160deg, #4fdca6, #1f9e6e); }
.uno-card.yellow { background: linear-gradient(160deg, #ffd95c, #e0a91f); color: #5a3d00; }
.uno-card.wild { background: conic-gradient(from 45deg, #d6283c, #e0a91f, #1f9e6e, #1f6fd6, #d6283c); }

.hand { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 16px; min-height: 150px;
  background: var(--panel); border-radius: var(--radius); border: 1px solid rgba(255,255,255,.10); }
.hand .uno-card { cursor: pointer; transition: transform .12s; }
.hand .uno-card.playable:hover { transform: translateY(-12px); }
.hand .uno-card.disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.3); }

.uno-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.handoff {
  text-align: center; padding: 40px 20px;
  background: var(--panel); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.10);
}
.handoff h2 { font-size: 30px; margin: 6px 0 14px; }
.handoff p { color: var(--muted); margin: 0 0 22px; }

.status-line { text-align: center; color: var(--muted); min-height: 22px; font-size: 15px; }

/* setup form */
.setup { max-width: 460px; margin: 24px auto 0; }
.setup label { display: block; font-weight: 600; margin: 16px 0 8px; }
.setup input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.2);
  color: var(--text); font-family: var(--font); font-size: 15px;
}
.player-rows { display: grid; gap: 10px; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 12px; font-size: 22px; font-weight: 800;
  border: 1px solid rgba(255,255,255,.18); background: var(--panel); color: var(--text); cursor: pointer;
}
.stepper .num { font-size: 26px; font-weight: 800; min-width: 30px; text-align: center; }

.color-picker { display: none; gap: 14px; justify-content: center; margin-top: 8px; }
.color-picker.show { display: flex; }
.color-picker button {
  width: 60px; height: 60px; border-radius: 14px; border: 3px solid #fff; cursor: pointer;
}
.color-picker .red { background: #d6283c; }
.color-picker .blue { background: #1f6fd6; }
.color-picker .green { background: #1f9e6e; }
.color-picker .yellow { background: #e0a91f; }

.overlay {
  position: fixed; inset: 0; background: rgba(10,4,24,.78);
  display: none; place-items: center; z-index: 50; padding: 20px;
}
.overlay.show { display: grid; }
.overlay .box { text-align: center; max-width: 420px; }
.overlay h2 { font-size: 34px; margin: 0 0 10px; }

/* ============================================================
   MULTIPLAYER ADDITIONS
   ============================================================ */
/* 75-number bingo board (everyone can check called balls) */
.bingo-board {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin-top: 8px;
}
@media (max-width: 820px) { .bingo-board { grid-template-columns: repeat(10, 1fr); } }
.bingo-board .ball {
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  transition: background .2s, transform .2s;
}
.bingo-board .ball.on {
  background: linear-gradient(135deg, var(--green), #2bb888);
  color: #08251c; border-color: transparent;
}
.bingo-board .ball.last {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a1340; transform: scale(1.15);
  box-shadow: 0 0 10px var(--accent);
}

/* ---- Webcam bar ---- */
.video-bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(15, 8, 33, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 10px 14px;
}
.video-tiles { display: flex; gap: 10px; overflow-x: auto; justify-content: center; }
.vtile {
  position: relative; flex: 0 0 auto;
  width: 150px; height: 112px;
  border-radius: 12px; overflow: hidden;
  background: #000; border: 2px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow);
}
.vtile video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.vtile .vname {
  position: absolute; bottom: 4px; left: 6px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.5); padding: 2px 8px; border-radius: 999px;
}

/* ---- Trivia ---- */
.trivia-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .trivia-choices { grid-template-columns: 1fr; } }
.trivia-choice {
  display: flex; align-items: center; gap: 12px;
  text-align: left; font-family: var(--font); font-size: 16px; font-weight: 600;
  color: var(--text); cursor: pointer;
  padding: 16px 18px; border-radius: 14px;
  background: var(--panel); border: 2px solid rgba(255,255,255,.12);
  transition: transform .1s, border-color .15s, background .15s;
}
.trivia-choice:hover { border-color: rgba(255,255,255,.4); transform: translateY(-2px); }
.trivia-choice .opt {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: rgba(255,255,255,.12); font-weight: 800; font-size: 15px;
}
.trivia-choice.picked { border-color: var(--accent); background: rgba(255,203,71,.12); }
.trivia-choice.locked { cursor: default; }
.trivia-choice.locked:hover { transform: none; }
.trivia-choice.correct {
  background: linear-gradient(135deg, var(--green), #2bb888); color: #08251c; border-color: transparent;
}
.trivia-choice.correct .opt { background: rgba(0,0,0,.18); }
.trivia-choice.wrong {
  background: linear-gradient(135deg, var(--red), #d6283c); color: #fff; border-color: transparent;
}
.trivia-choice.wrong .opt { background: rgba(0,0,0,.2); }

/* ---- Leaderboard ---- */
.leaderboard { display: grid; gap: 8px; }
.lb-row {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid rgba(255,255,255,.10);
}
.lb-row.me { border-color: var(--accent); background: rgba(255,203,71,.1); }
.lb-rank { font-weight: 800; color: var(--muted); text-align: center; }
.lb-name { font-weight: 600; }
.lb-tick { color: var(--green); font-weight: 800; }
.lb-score { font-weight: 800; font-size: 18px; color: var(--accent); }
