/* ============================================================================
   Mini-Games cohesive theme — a cleaner, less "clunky" look shared by the player
   interfaces and the host display. Visual-only; no layout/JS dependencies.
   ============================================================================ */

/* ---- Player mini-game cards (Simon / Mash / Reaction / Math / Set / Puzzle / Maze) ---- */
#simonGameInterface > .card,
#mashGameInterface > .card,
#reactionGameInterface > .card,
#mathGameInterface > .card,
#setGameInterface > .card,
#puzzleGameInterface > .card,
#mazeGameInterface > .card {
  border: none !important;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.20);
}

#simonGameInterface .card-header,
#mashGameInterface .card-header,
#reactionGameInterface .card-header,
#mathGameInterface .card-header,
#setGameInterface .card-header,
#puzzleGameInterface .card-header,
#mazeGameInterface .card-header {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 50%, #2563eb 100%) !important;
  color: #fff !important;
  border: none !important;
  padding: 16px 18px;
}
#simonGameInterface .card-header h5,
#mashGameInterface .card-header h5,
#reactionGameInterface .card-header h5,
#mathGameInterface .card-header h5,
#setGameInterface .card-header h5,
#puzzleGameInterface .card-header h5,
#mazeGameInterface .card-header h5 {
  font-weight: 800;
  letter-spacing: 0.3px;
  margin: 0;
}
#simonGameInterface .card-body,
#mashGameInterface .card-body,
#reactionGameInterface .card-body,
#mathGameInterface .card-body,
#setGameInterface .card-body,
#puzzleGameInterface .card-body,
#mazeGameInterface .card-body {
  padding: 18px;
}

/* Big, tappable primary actions */
#setBuzzButton, #mashButton, #reactionButton, #mathSubmit,
#setSubmitButton, #setClearButton {
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
#mashButton {
  border-radius: 50% !important;
  width: 190px; height: 190px;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
  background: radial-gradient(circle at 35% 30%, #fbbf24, #f59e0b 60%, #d97706) !important;
  border: none !important;
  color: #1f2937 !important;
}
#mashButton:active { transform: scale(0.94); }

/* Speed Math: the streaming expression is the focal point */
#mathExpression {
  font-size: 2.4rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  padding: 14px 8px;
  min-height: 64px;
}
#mathAnswer {
  font-size: 1.8rem; text-align: center; font-weight: 700; border-radius: 12px;
}
/* Make the Speed Math number pad match the TRIVIA numeric keypad exactly. The keys were rendering at 18px
   (vs the trivia keypad's 28px) — something in the cascade was shrinking them. Force the canonical
   .numeric-key (28px) / .numeric-display (36px) sizes with a high-specificity selector so it wins. */
#mathGameInterface #mathNumpad.numeric-keypad .numeric-key {
  font-size: 28px;
}
#mathGameInterface #mathAnswer.numeric-display {
  font-size: 36px;
  height: 80px;
}

/* Reaction light: a real big circle instead of a bare emoji */
#reactionLight {
  width: 160px; height: 160px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 8px auto; font-size: 3.4rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 -8px 16px rgba(0, 0, 0, 0.25);
}

/* ---- Host display mini-game panels ---- */
/* Sit each panel on a solid light card (like the lobby cards) so its text is always
   high-contrast over the branded/busy body background instead of floating on it. */
.mini-game-display {
  max-width: 1150px;
  margin: 2vh auto;
  padding: 3vh 4vw;
  background: var(--surface-light, #ffffff);
  color: var(--text-dark, #1f2937);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}
.mini-game-display h2 {
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 0.4em;
}
/* Default any otherwise-unstyled panel text to the dark theme ink (accent/muted
   elements keep their own ID-level colors). */
.mini-game-display h3, .mini-game-display h4, .mini-game-display h5,
.mini-game-display p, .mini-game-display small {
  color: var(--text-dark, #1f2937);
}

/* Simon survivor cards on the display get a soft lift + smooth state changes */
.simon-player-card {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
}

/* ── Swipe Direction Panic — D-pad of big arrow buttons ─────────────────── */
#swipePad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 320px;
  margin: 8px auto 0;
}
.swipe-btn {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 16px;
  font-size: clamp(2rem, 11vw, 3rem);
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #6d28d9, #2563eb);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
  transition: transform .07s ease, filter .07s ease;
}
.swipe-btn:active { transform: scale(0.9); filter: brightness(1.15); }

/* ── Whack-a-Cheese — grid of holes; moles pop up and duck back down ─────── */
.whack-grid {
  display: grid;
  grid-template-columns: repeat(var(--whack-cols, 3), 1fr);
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  touch-action: none;
}
.whack-hole {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, #1e293b, #0b1120);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* dirt mound at the bottom of each hole the mole rises out of */
.whack-hole::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 5%;
  height: 22%;
  background: #3b2a1a;
  border-radius: 50%;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.6);
}
.whack-mole {
  position: relative;
  z-index: 2;
  margin-bottom: 6%;
  border: none;
  background: none;
  padding: 0;
  font-size: clamp(2rem, 11vw, 3.4rem);
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  transform: translateY(120%);
  opacity: 0;
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), opacity .1s ease;
}
.whack-mole.up { transform: translateY(0); opacity: 1; }
.whack-mole.whacked {
  transform: translateY(40%) scale(0.6) rotate(-8deg);
  opacity: 0.3;
  transition: transform .16s ease, opacity .16s ease;
}
.whack-mole.whack-trap { filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.85)); }
.whack-mole.whack-golden { filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.9)); }
@media (prefers-reduced-motion: reduce) {
  .whack-mole { transition: opacity .08s ease; transform: none; }
  .whack-mole.up { transform: none; }
  .whack-mole.whacked { transform: scale(0.7); }
}

/* ── Mini-game-specific results scoreboard (toggleable, host display + players) ── */
.mg-scoreboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 9700;                 /* under the winner popup (9800), over game UI */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 24, 0.78);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.mg-scoreboard-overlay.d-none { display: none !important; }
.mg-scoreboard-card {
  width: min(96vw, 720px);
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(180deg, #16203a, #0d1426);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  color: #e2e8f0;
}
.mg-scoreboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.mg-scoreboard-title { font-size: clamp(1.1rem, 3.4vw, 1.6rem); font-weight: 800; }
.mg-scoreboard-close {
  border: none;
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}
.mg-scoreboard-close:hover { background: rgba(148, 163, 184, 0.35); }
.mg-scoreboard-body { padding: 8px 14px 4px; }
.mg-scoreboard-table { width: 100%; border-collapse: collapse; font-size: clamp(0.9rem, 2.6vw, 1.15rem); }
.mg-scoreboard-table th, .mg-scoreboard-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  white-space: nowrap;
}
.mg-scoreboard-table th { color: #94a3b8; font-weight: 700; font-size: 0.82em; text-transform: uppercase; letter-spacing: .03em; }
.mg-scoreboard-table tbody tr.mg-row-winner { background: rgba(250, 204, 21, 0.16); }
.mg-scoreboard-table tbody tr.mg-row-winner td { color: #fde68a; font-weight: 700; }
.mg-scoreboard-table tbody tr.mg-row-you { outline: 2px solid #38bdf8; outline-offset: -2px; }
.mg-you {
  background: #38bdf8; color: #0b1120; font-size: 0.66em; font-weight: 800;
  padding: 1px 6px; border-radius: 8px; vertical-align: middle;
}
.mg-scoreboard-foot { padding: 8px 18px 14px; color: #94a3b8; font-size: 0.82rem; }

/* Inline host-side results panel (#minigamePerfPanel on the host control page). Reuses
   the table styling but sits inline in the Mini-Games tab instead of as an overlay. */
#minigamePerfPanel .mg-panel-title { font-weight: 800; margin-bottom: 6px; }
#minigamePerfPanel .mg-scoreboard-table { color: inherit; }
#minigamePerfPanel .mg-scoreboard-table th { color: #64748b; }
#minigamePerfPanel .mg-scoreboard-table th,
#minigamePerfPanel .mg-scoreboard-table td { border-bottom-color: rgba(100, 116, 139, 0.2); }
#minigamePerfPanel .mg-row-winner { background: rgba(250, 204, 21, 0.18); }
#minigamePerfPanel .mg-row-winner td { color: #92702a; font-weight: 700; }
#minigamePerfPanel .mg-panel-hint { color: #94a3b8; font-size: 0.78rem; margin-top: 6px; }

/* ── 🚪 Monty Hall: BIG artistic doors (owner 2026-06-11: "doors very small, not artistic") ──
   Authoritative styling lives HERE (cache-busted ?v=timestamp) with !important so it beats the
   stale inline <style> block in browser-cached player.html. Door anatomy comes from _montyDoor():
   .monty-door > .monty-door-plate + .monty-door-panel (.panel-top/.panel-bot/.knob/.content). */
/* The interface is a FULL-SCREEN overlay (like the arcade games) so nothing else on the player
   page shows and there's no page scroll — everything must fit the visible viewport. */
#montyGameInterface { position: fixed !important; inset: 0 !important; z-index: 60 !important;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  background: #0b1120 !important; padding: 10px !important; margin: 0 !important; overflow: hidden !important; }
#montyGameInterface.d-none { display: none !important; }   /* id+class beats the bare-id rule above */
#montyGameInterface .monty-wrap { width: 100%; max-width: 680px; max-height: 100%;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; overflow: hidden; }
/* Doors: 3 across by default (3 doors → ONE row); `1fr` lets them shrink to fit any phone width
   so 3 never wrap. Only >3 doors wrap to extra rows. */
#montyGameInterface .monty-grid { display: grid !important; gap: 12px !important; width: 100%;
  grid-template-columns: repeat(3, 1fr) !important; }
#montyGameInterface .monty-grid.grid-medium { grid-template-columns: repeat(4, 1fr) !important; }  /* 5–7 doors */
#montyGameInterface .monty-grid.grid-large  { grid-template-columns: repeat(5, 1fr) !important; }  /* 8–10 doors */
#montyGameInterface .monty-door {
  position: relative !important; min-height: clamp(120px, 28vh, 260px) !important;
  border: none !important; border-radius: 12px 12px 6px 6px !important; padding: 0 !important;
  background: linear-gradient(180deg, #3b2510, #241505) !important;   /* door frame */
  box-shadow: 0 10px 24px rgba(0,0,0,.55), inset 0 0 0 4px #1a0f04 !important;
  cursor: pointer; touch-action: manipulation; overflow: hidden !important;
  perspective: 700px;
}
#montyGameInterface .monty-door-plate {
  position: absolute !important; top: 8px !important; left: 50% !important; transform: translateX(-50%);
  z-index: 3; background: linear-gradient(180deg, #fde047, #b45309) !important; color: #1f2937 !important;
  font-weight: 900 !important; font-size: 1.15rem !important; padding: 2px 14px !important;
  border-radius: 7px !important; box-shadow: 0 2px 5px rgba(0,0,0,.5) !important;
}
#montyGameInterface .monty-door-panel {
  position: absolute !important; inset: 10px !important; border-radius: 9px !important;
  background: repeating-linear-gradient(90deg, #8a5a2b 0 18px, #7c4f24 18px 36px),
              linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.3)) !important;
  background-blend-mode: overlay;
  box-shadow: inset 0 0 0 3px #5c3a17, inset 0 -12px 24px rgba(0,0,0,.35) !important;
  transform-origin: left center; transition: transform .8s cubic-bezier(.6,.05,.3,1) !important;
  z-index: 2;
}
#montyGameInterface .monty-door-panel-top, #montyGameInterface .monty-door-panel-bot {
  position: absolute !important; left: 14% !important; right: 14% !important; height: 26% !important;
  border-radius: 6px !important; box-shadow: inset 0 0 0 3px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.12) !important;
}
#montyGameInterface .monty-door-panel-top { top: 12% !important; }
#montyGameInterface .monty-door-panel-bot { bottom: 12% !important; }
#montyGameInterface .monty-door-knob {
  position: absolute !important; right: 9% !important; top: 50% !important;
  width: 16px !important; height: 16px !important; border-radius: 50% !important;
  background: radial-gradient(circle at 35% 30%, #fff7c2, #d4af37 55%, #7a5b14) !important;
  box-shadow: 0 0 8px rgba(253,224,71,.6) !important;
}
#montyGameInterface .monty-door-content {
  position: absolute !important; inset: 0 !important; display: flex !important;
  align-items: center !important; justify-content: center !important;
  font-size: clamp(3rem, 9vw, 5rem) !important; z-index: 1;
  background: radial-gradient(circle, #0f172a 30%, #020617 100%) !important; border-radius: 9px;
  color: #fde047;
}
/* The "?" sits ON the closed panel */
#montyGameInterface .monty-door-content.closed { z-index: 3; background: transparent !important;
  text-shadow: 0 2px 8px rgba(0,0,0,.8); font-weight: 900; }
/* OPEN: the wooden panel swings away to show what's behind */
#montyGameInterface .monty-door.revealed-goat .monty-door-panel,
#montyGameInterface .monty-door.final-cheese .monty-door-panel { transform: rotateY(-108deg) !important; }
#montyGameInterface .monty-door.revealed-goat .monty-door-content.closed,
#montyGameInterface .monty-door.final-cheese .monty-door-content.closed { display: none !important; }
#montyGameInterface .monty-door.final-cheese { box-shadow: 0 0 30px rgba(253,224,71,.85), 0 10px 24px rgba(0,0,0,.55) !important; }
#montyGameInterface .monty-door.picked { outline: 4px solid #fde047 !important; outline-offset: 2px;
  animation: montyPickedPulse 1.1s ease-in-out infinite; }
@keyframes montyPickedPulse { 0%,100% { box-shadow: 0 0 14px rgba(253,224,71,.5); } 50% { box-shadow: 0 0 34px rgba(253,224,71,.95); } }
#montyGameInterface .monty-door.dim { opacity: .45 !important; filter: grayscale(.4); }
#montyGameInterface .monty-door.size-huge { min-height: clamp(150px, 34vh, 300px) !important; }
#montyGameInterface .monty-door:not(:disabled):active { transform: scale(.97); }

/* 🏓 Breakout paddle slider: big grabbable control, clearly separated from the canvas */
#breakoutSlider { height: 34px !important; -webkit-appearance: none; appearance: none;
  background: transparent; }
#breakoutSlider::-webkit-slider-runnable-track { height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #0ea5e9, #f59e0b); }
#breakoutSlider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; margin-top: -11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7c2, #fde047 55%, #b45309);
  border: 3px solid #0b1120; box-shadow: 0 2px 10px rgba(253, 224, 71, .65); }
#breakoutSlider::-moz-range-track { height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #0ea5e9, #f59e0b); }
#breakoutSlider::-moz-range-thumb { width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7c2, #fde047 55%, #b45309);
  border: 3px solid #0b1120; box-shadow: 0 2px 10px rgba(253, 224, 71, .65); }
