/* ==========================================================================
   HAPPY DIWALI — LIGHTS & CELEBRATION BINGO
   Aesthetic: Hand-Inked Watercolor Illustration on Warm Handmade Paper
   Inspired by the "Happy Diwali - Lights & Celebration" artwork
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amatic+SC:wght@400;700&family=Kalam:wght@400;700&family=Quicksand:wght@500;600;700&display=swap');

:root {
  /* Paper & Watercolor Surfaces */
  --paper-bg: #FAF5EA;
  --paper-warm: #F5ECD9;
  --paper-card: #FFFDF8;
  --paper-highlight: #FFF7E2;

  /* Watercolor Wash Palette */
  --wash-gold: #FCE092;
  --wash-marigold: #F9B852;
  --wash-amber: #F59342;
  --wash-terracotta: #EC7347;
  --wash-peach: #FDE5C3;

  /* Hand-Inked Line & Typography Palette */
  --ink-dark: #331F17;
  --ink-brown: #4E3227;
  --ink-muted: #7C5A4B;
  --ink-light: #A58574;

  /* Accents & Festive Status */
  --marigold: #F09819;
  --marigold-deep: #D97208;
  --kumkum: #D6492C;
  --kumkum-soft: #FBE4DC;
  --diya-flame: #FFAE19;
  --diya-glow: rgba(255, 178, 36, 0.45);
  --mehendi-green: #2E7D47;
  --mehendi-soft: #E5F5EA;

  /* Sketch Borders & Shadows */
  --border-ink: 2px solid var(--ink-dark);
  --border-ink-thick: 2.5px solid var(--ink-dark);
  --shadow-sketch: 3px 4px 0px rgba(51, 31, 23, 0.85);
  --shadow-sketch-sm: 2px 3px 0px rgba(51, 31, 23, 0.8);
  --shadow-sketch-lg: 5px 6px 0px rgba(51, 31, 23, 0.88);
  --shadow-warm-glow: 0 10px 30px rgba(240, 152, 25, 0.22);

  /* Typography */
  --font-display: 'Amatic SC', cursive, sans-serif;
  --font-hand: 'Kalam', cursive, sans-serif;
  --font-body: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Radii - organic hand-drawn feel */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
}

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

html, body {
  min-height: 100vh;
  background-color: var(--paper-bg);
  color: var(--ink-dark);
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Handmade Watercolor Paper Texture & Wash Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 65% 55% at 50% 28%, rgba(252, 224, 146, 0.65) 0%, rgba(249, 184, 82, 0.35) 38%, rgba(236, 115, 71, 0.16) 65%, transparent 85%),
    radial-gradient(circle at 18% 22%, rgba(245, 147, 66, 0.28) 0%, transparent 45%),
    radial-gradient(circle at 82% 25%, rgba(252, 224, 146, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(249, 184, 82, 0.25) 0%, transparent 55%),
    var(--paper-bg);
}

/* Subtle organic paper grain overlay using SVG noise */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.18'/%3E%3C/svg%3E");
}

/* ==========================================================================
   TYPOGRAPHY matching "HAPPY DIWALI / LIGHTS & CELEBRATION"
   ========================================================================== */

.display-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dark);
  line-height: 0.95;
}

.display-subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-brown);
  line-height: 1.05;
}

.hand-note {
  font-family: var(--font-hand);
  color: var(--ink-brown);
}

/* ==========================================================================
   FLOATING SPARKLES & WATERCOLOR STARS
   ========================================================================== */

.sparkle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sketch-star {
  position: absolute;
  color: var(--ink-dark);
  opacity: 0.75;
  animation: twinkleFloat 5s ease-in-out infinite;
}

@keyframes twinkleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  50% { transform: translateY(-6px) rotate(6deg) scale(1.08); }
}

/* ==========================================================================
   TOP NAVIGATION / HEADER BAR
   ========================================================================== */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.5rem;
  background: rgba(250, 245, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: var(--border-ink);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-diya-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(255, 174, 25, 0.5));
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-titles h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.95;
  color: var(--ink-dark);
}

.brand-titles span {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--kumkum);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Connection Badge */
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  background: var(--paper-card);
  border: var(--border-ink);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 1px 2px 0 var(--ink-dark);
}

.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mehendi-green);
  border: 1.5px solid var(--ink-dark);
}

.conn-pill.disconnected .conn-dot {
  background: var(--kumkum);
}

/* ==========================================================================
   HAND-INKED BUTTONS & CONTROLS
   ========================================================================== */

.btn-sketch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-dark);
  background: var(--paper-card);
  border: var(--border-ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sketch-sm);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.btn-sketch:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-sketch);
  background: var(--paper-highlight);
}

.btn-sketch:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0px 1px 0px var(--ink-dark);
}

.btn-sketch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sketch.btn-toggle-active {
  background: #FFF0BD;
  border-color: var(--marigold);
  box-shadow: 2px 2px 0 var(--marigold);
  color: var(--ink-dark);
}

.disabled-hint {
  opacity: 0.85;
  background: var(--paper-warm);
}

.btn-primary {
  background: linear-gradient(135deg, #FFD269 0%, #F59E2D 100%);
  color: var(--ink-dark);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #FFDC85 0%, #F7AA42 100%);
}

.btn-festive {
  background: linear-gradient(135deg, #F06A43 0%, #D6492C 100%);
  color: #FFFDF8;
}

.btn-festive:hover:not(:disabled) {
  background: linear-gradient(135deg, #F57B56 0%, #DF5538 100%);
  color: #FFFDF8;
}

.btn-lg {
  padding: 0.85rem 1.65rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
  border: var(--border-ink-thick);
  box-shadow: var(--shadow-sketch);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   WATERCOLOR CARDS & CONTAINERS
   ========================================================================== */

.sketch-card {
  position: relative;
  background: var(--paper-card);
  border: var(--border-ink-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sketch);
  padding: 1.35rem;
}

.sketch-card-warm {
  background:
    radial-gradient(circle at top right, rgba(252, 224, 146, 0.4), transparent 60%),
    radial-gradient(circle at bottom left, rgba(249, 184, 82, 0.22), transparent 55%),
    var(--paper-card);
}

/* ==========================================================================
   VIEW 1: LANDING / ROLE SELECTION LOBBY (SEAMLESS WATERCOLOR STAGE)
   ========================================================================== */

.main-container {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.lobby-poster-stage {
  max-width: 960px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poster-title-block {
  text-align: center;
  margin-bottom: -0.6rem;
  position: relative;
  z-index: 2;
}

.poster-main-heading {
  font-family: var(--font-display);
  font-size: clamp(3.6rem, 7vw, 5.4rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 0.9;
  color: var(--ink-dark);
}

.poster-sub-heading {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-brown);
  margin-top: 0.2rem;
}

/* ==========================================================================
   DUAL-MODE ARTWORK STAGE: LIGHTWEIGHT STATIC VS. 3D PARALLAX DEPTH
   ========================================================================== */

.static-scene-stage {
  position: relative;
  width: 100%;
  max-width: 680px;
  aspect-ratio: 800 / 705;
  max-height: 440px;
  margin: -0.25rem auto -1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}

.static-scene-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.parallax-scene-stage {
  position: relative;
  width: 100%;
  max-width: 680px;
  aspect-ratio: 800 / 705;
  max-height: 440px;
  margin: -0.25rem auto -1.35rem;
  isolation: isolate;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}

/* Toggle visibility and GPU layer promotion based on data-depth-mode */
body[data-depth-mode="off"] .parallax-scene-stage,
body[data-depth-mode="off"] .picker-watermark-wash {
  display: none !important;
}

body[data-depth-mode="on"] .static-scene-stage {
  display: none !important;
}

body[data-depth-mode="on"] .parallax-layer {
  will-change: transform;
}

/* ==========================================================================
   LOBBY CENTERPIECE: 3D THREE.JS ROLLER VS. CLASSIC ARTWORK
   ========================================================================== */

.lobby-showcase-bar {
  position: relative;
  z-index: 5;
  margin: 1.15rem auto 1.1rem;
  display: flex;
  justify-content: center;
}

.lobby-mode-pills {
  display: inline-flex;
  padding: 0.3rem 0.35rem;
  background: var(--paper-warm);
  border: 2px solid var(--ink-dark);
  border-radius: var(--radius-pill);
  box-shadow: 2px 3px 0 var(--ink-dark);
  gap: 0.35rem;
}

.lobby-3d-stage {
  width: 100%;
  max-width: 540px;
  margin: 0 auto 1.5rem;
  position: relative;
  z-index: 3;
}

#lobby-roller-wrapper {
  max-width: 540px;
  margin: 0 auto;
}

#lobby-roller-canvas {
  max-width: 520px;
  height: 310px;
}

.lobby-art-stage {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 1.5rem;
  position: relative;
  z-index: 2;
}

/* Active navigation tab highlight */
body[data-view="lobby"] #btn-switch-lobby,
body[data-view="host"] #btn-switch-host,
body[data-view="player"] #btn-switch-player {
  background: var(--paper-highlight) !important;
  border-color: var(--kumkum-red) !important;
  color: var(--ink-dark) !important;
  font-weight: 700;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.08), 2px 2px 0 var(--ink-dark);
}

.scene-mode-bar {
  position: relative;
  z-index: 4;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
}

.scene-depth-pill {
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.95rem;
  font-size: 0.8rem;
  background: var(--paper-card);
}

body[data-depth-mode="on"] .scene-depth-pill {
  background: var(--kumkum-soft);
  border-color: var(--kumkum-red);
  color: var(--kumkum-dark);
}

.parallax-plane {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.layer-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Plane 1: Deep Background Pink & Golden Watercolor Cloud (Soft Depth-of-Field Blur) */
.plane-wash {
  z-index: 1;
}

.layer-wash-img {
  transform: scale(1.06);
  filter: blur(1px) saturate(1.06);
  opacity: 0.96;
}

/* Plane 2: Mid-Background Floating Hand-Inked Stars & Warm Glow Halo */
.plane-mid-stars {
  z-index: 2;
}

.scene-star {
  position: absolute;
  filter: drop-shadow(0 2px 6px rgba(255, 190, 60, 0.55));
  animation: twinkleFloat 4.5s ease-in-out infinite;
}

.cage-warm-halo {
  position: absolute;
  top: 26%;
  left: 34%;
  width: 32%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 130, 0.85) 0%, rgba(255, 165, 45, 0.35) 55%, transparent 75%);
  filter: blur(14px);
}

/* Plane 3: Focal Plane — Crisp Hand-Inked Festive Table & Rotary Bingo Cage */
.plane-table {
  z-index: 3;
}

.layer-table-img {
  filter: drop-shadow(0 12px 24px rgba(51, 31, 23, 0.18));
}

/* Plane 4: Foreground Out-of-Focus Bokeh Sparkles & Floating Petals */
.plane-foreground {
  z-index: 4;
}

.fg-bokeh-sparkle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFFFF 0%, #FFE082 55%, rgba(255, 174, 25, 0) 100%);
  box-shadow: 0 0 14px 3px rgba(255, 200, 70, 0.75);
  filter: blur(0.6px);
  animation: bokehPulse 3.2s ease-in-out infinite alternate;
}

.fg-petal {
  position: absolute;
  filter: blur(0.7px) drop-shadow(0 4px 8px rgba(51, 31, 23, 0.16));
}

@keyframes bokehPulse {
  0% { opacity: 0.65; transform: scale(0.88); }
  100% { opacity: 1; transform: scale(1.18); }
}

.lobby-actions-grid {
  position: relative;
  z-index: 3;
  width: 100%;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.35rem;
  align-items: stretch;
}

/* Layered Parallax Watermarks inside Host Number Picker Stage */
.picker-watermark-wash {
  position: absolute;
  top: -18px;
  left: 50%;
  margin-left: -165px;
  width: 330px;
  opacity: 0.25;
  filter: blur(1.5px);
  pointer-events: none;
  z-index: 0;
}

.picker-watermark-art {
  position: absolute;
  top: -12px;
  left: 50%;
  margin-left: -155px;
  width: 310px;
  opacity: 0.13;
  pointer-events: none;
  z-index: 0;
}

.picker-stage > *:not(.picker-watermark-art):not(.picker-watermark-wash) {
  position: relative;
  z-index: 1;
}

.role-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.35rem;
}

.role-box-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: var(--border-ink);
  background: var(--wash-gold);
  box-shadow: 2px 2px 0 var(--ink-dark);
  font-size: 1.35rem;
}

.role-box h3 {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.input-sketch {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-dark);
  background: #FFFFFF;
  border: var(--border-ink);
  border-radius: var(--radius-md);
  box-shadow: inset 1px 2px 4px rgba(51, 31, 23, 0.08);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-sketch:focus {
  border-color: var(--marigold-deep);
  box-shadow: 0 0 0 3px rgba(240, 152, 25, 0.25);
}

/* ==========================================================================
   VIEW 2: CENTRAL HOST ("NUMBER PICKER" SHOWCASE SCREEN)
   ========================================================================== */

.host-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Left Column: Active Number Picker Drum, Callout, Controls & QR Join Card */
.host-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.picker-stage {
  text-align: center;
  padding: 1.5rem 1.25rem;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 224, 130, 0.75) 0%, rgba(249, 184, 82, 0.35) 50%, transparent 78%),
    var(--paper-card);
  position: relative;
  overflow: hidden;
}

.mode-pill-selector {
  display: inline-flex;
  background: var(--paper-warm);
  border: var(--border-ink);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-bottom: 1rem;
  box-shadow: 1px 2px 0 var(--ink-dark);
}

.mode-tab {
  border: none;
  background: transparent;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-brown);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-tab.active {
  background: var(--wash-gold);
  color: var(--ink-dark);
  border: 1.5px solid var(--ink-dark);
  box-shadow: 1px 1px 0 var(--ink-dark);
}

/* ==========================================================================
   3D ROTARY BINGO CAGE & BALL SELECTION STAGE
   ========================================================================== */
.roller-3d-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0.1rem auto 0.9rem;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 32%, #FFFDF7 0%, #FDF4DE 58%, #F7E5BC 100%);
  border: 2px solid var(--ink-dark);
  box-shadow: inset 0 2px 8px rgba(51, 31, 23, 0.08), 2px 3px 0 var(--ink-dark);
  padding: 0.35rem 0.4rem 0.6rem;
  cursor: grab;
  user-select: none;
  overflow: hidden;
}

.roller-3d-stage:active {
  cursor: grabbing;
}

.roller-3d-canvas {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 290px;
  margin: 0 auto;
  touch-action: none;
}

.roller-stage-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.25rem 0.45rem 0.1rem;
  margin-top: -0.35rem;
  position: relative;
  z-index: 3;
}

.roller-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.7rem;
  background: var(--paper-highlight);
  border: 2px solid var(--ink-dark);
  border-radius: var(--radius-pill);
  box-shadow: 1px 2px 0 var(--ink-dark);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-brown);
  text-align: left;
  max-width: 175px;
  line-height: 1.2;
}

.roller-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--marigold);
  border: 1.5px solid var(--ink-dark);
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.roller-status-pill.is-rolling .roller-status-dot {
  background: var(--kumkum);
  animation: pulseDot 0.45s ease-in-out infinite alternate;
}

.roller-status-pill.is-reading .roller-status-dot {
  background: #22A06B;
  transform: scale(1.2);
}

@keyframes pulseDot {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.3); opacity: 1; }
}

/* Picked-Up 3D Ball Presentation Medallion */
.drawn-ball-medallion {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #FFFFFF 0%, #FFF9E6 24%, var(--ball-accent-band, #FFE082) 64%, var(--ball-accent-dark, #E68A1E) 100%);
  border: 3.5px solid var(--ink-dark);
  box-shadow:
    3px 4px 0 var(--ink-dark),
    inset -6px -8px 14px rgba(122, 58, 12, 0.28),
    0 0 24px var(--ball-accent-glow, rgba(255, 174, 25, 0.5));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background 0.3s ease;
}

.ball-3d-shine {
  position: absolute;
  top: 10px;
  left: 16px;
  width: 28px;
  height: 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  transform: rotate(-28deg);
  pointer-events: none;
}

.drawn-ball-medallion.rolling {
  animation: drumRollBounce 0.32s ease-in-out infinite alternate;
}

.drawn-ball-medallion.pickup-lift {
  animation: ballPickedUpAndRead 0.78s cubic-bezier(0.22, 1.35, 0.5, 1);
}

.drawn-ball-medallion.pop {
  animation: ballPopIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes drumRollBounce {
  0% { transform: scale(0.92) rotate(-8deg) translateY(2px); }
  100% { transform: scale(0.98) rotate(8deg) translateY(-2px); }
}

@keyframes ballPickedUpAndRead {
  0% {
    transform: translate(-55px, -38px) scale(0.32) rotate(-220deg);
    opacity: 0.35;
  }
  58% {
    transform: translate(0px, -8px) scale(1.18) rotate(8deg);
    opacity: 1;
    box-shadow:
      4px 8px 0 var(--ink-dark),
      0 0 42px rgba(255, 196, 37, 0.9);
  }
  82% {
    transform: translate(0px, 2px) scale(0.96) rotate(-3deg);
  }
  100% {
    transform: translate(0px, 0px) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes ballPopIn {
  0% { transform: scale(0.45) rotate(-25deg); opacity: 0.4; }
  65% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.drawn-letter-badge {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--kumkum);
  line-height: 1;
  margin-bottom: -2px;
  position: relative;
  z-index: 1;
}

.drawn-number-value {
  font-family: var(--font-body);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--ink-dark);
  line-height: 1;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.drawn-ball-sub {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.callout-banner {
  min-height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  background: var(--paper-highlight);
  border: var(--border-ink);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 #fff;
}

.callout-title {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--kumkum);
  line-height: 1.2;
}

.callout-desc {
  font-size: 0.86rem;
  color: var(--ink-brown);
  margin-top: 0.15rem;
}

.picker-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.picker-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

/* Recent History Strip */
.recent-strip {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1.5px dashed var(--ink-light);
}

.recent-strip-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.recent-balls-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-height: 40px;
}

.mini-ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--paper-warm);
  border: 2px solid var(--ink-dark);
  box-shadow: 1px 2px 0 var(--ink-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-dark);
}

.mini-ball:first-child {
  background: var(--wash-gold);
  transform: scale(1.08);
}

/* QR Code & Cloudflare Tunnel Card on Host Sidebar */
.qr-tunnel-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.qr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qr-card-header h3 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: 0.05em;
}

.qr-display-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.qr-svg-box {
  width: 116px;
  height: 116px;
  flex-shrink: 0;
  background: #FFFFFF;
  border: var(--border-ink);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-sketch-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-svg-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.join-url-box {
  font-size: 0.78rem;
  font-family: monospace;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  word-break: break-all;
  color: var(--ink-dark);
}

/* Right Column: Master Caller Board & Connected Players / Claims */
.host-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.board-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.board-header-row h2 {
  font-family: var(--font-display);
  font-size: 2.35rem;
  letter-spacing: 0.05em;
}

.board-stats {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.stat-badge {
  padding: 0.35rem 0.85rem;
  background: var(--paper-warm);
  border: var(--border-ink);
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 1px 2px 0 var(--ink-dark);
}

/* 75-Ball B-I-N-G-O Master Board (5 rows x 16 cols with letter header) */
.master-board-75 {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bingo-master-row {
  display: grid;
  grid-template-columns: 48px repeat(15, minmax(0, 1fr));
  gap: 0.38rem;
  align-items: center;
}

.bingo-row-letter {
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--kumkum);
  color: #FFFDF8;
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 90-Ball Tambola Master Grid (9 rows x 10 cols) */
.master-board-90 {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.42rem;
}

.board-cell {
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--paper-bg);
  border: 1.5px solid rgba(51, 31, 23, 0.35);
  color: var(--ink-muted);
  font-size: 0.96rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.board-cell.called {
  background: linear-gradient(135deg, #FFE082 0%, #F59E2D 100%);
  border: 2px solid var(--ink-dark);
  color: var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark);
  transform: scale(1.03);
}

.board-cell.latest {
  background: linear-gradient(135deg, #FF7043 0%, #D6492C 100%);
  color: #FFFDF8;
  transform: scale(1.12);
  box-shadow: 2px 3px 0 var(--ink-dark), 0 0 14px rgba(214, 73, 44, 0.6);
  z-index: 2;
}

/* Prizes & Connected Players Panel */
.host-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.prizes-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.prize-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--paper-bg);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.prize-item.claimed {
  background: var(--wash-gold);
  box-shadow: 2px 2px 0 var(--ink-dark);
}

.prize-winner-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--kumkum);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  background: var(--paper-highlight);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 1px 2px 0 var(--ink-dark);
}

/* ==========================================================================
   VIEW 3: PLAYER BINGO CARD VIEW (MOBILE-FIRST ERGONOMIC DESIGN)
   ========================================================================== */

.player-layout {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Live Caller Banner on Player Screen */
.player-caller-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1.05rem;
  background:
    radial-gradient(circle at left center, rgba(252, 224, 146, 0.78), transparent 68%),
    var(--paper-card);
}

.player-caller-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.player-live-ball {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.player-ball-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #FFFFFF 0%, var(--ball-accent-band, #FFE082) 58%, var(--ball-accent-dark, #F59E2D) 100%);
  border: 2.5px solid var(--ink-dark);
  box-shadow:
    var(--shadow-sketch-sm),
    0 0 16px var(--ball-accent-glow, rgba(255, 174, 25, 0.4));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease, box-shadow 0.3s ease;
}

.player-ball-circle.pop {
  animation: ballPopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.player-ball-circle .letter {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--kumkum);
  line-height: 0.9;
}

.player-ball-circle .num {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
}

.player-callout-text {
  min-width: 0;
  flex: 1;
}

.player-caller-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.player-callout-text .callout-title {
  font-size: 1.08rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-caller-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}

.player-lit-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-dark);
}

.player-recent-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1.5px dashed rgba(51, 31, 23, 0.2);
  overflow-x: auto;
  scrollbar-width: none;
}

.player-recent-bar::-webkit-scrollbar {
  display: none;
}

.player-recent-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.player-recent-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.recent-num-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--paper-warm);
  border: 1.5px solid var(--ink-dark);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-dark);
  flex-shrink: 0;
}

.recent-num-chip:first-child {
  background: var(--wash-gold);
}

/* Player Bingo Card Ticket */
.bingo-ticket-card {
  padding: 1.15rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(252, 224, 146, 0.45), transparent 65%),
    var(--paper-card);
  border: 3px solid var(--ink-dark);
  border-radius: 22px;
  box-shadow: var(--shadow-sketch-lg);
}

.ticket-top-ornament {
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px dashed rgba(51, 31, 23, 0.22);
}

.ticket-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-top-ornament h2 {
  font-family: var(--font-display);
  font-size: 2.35rem;
  letter-spacing: 0.07em;
  line-height: 0.95;
}

.ticket-subtitle-tag {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--kumkum);
}

.ticket-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-brown);
  margin-top: 0.25rem;
}

/* 5x5 Classic 75-Ball Player Grid */
.ticket-grid-75 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.ticket-grid-headers {
  margin-bottom: 0.4rem;
}

.ticket-col-header {
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--kumkum);
  color: #FFFDF8;
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ticket-cell,
.tambola-cell,
.btn-sketch {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ticket-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 56px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 2.5px solid var(--ink-dark);
  box-shadow: 2px 3px 0 var(--ink-dark);
  font-family: var(--font-body);
  font-size: clamp(1.2rem, 4.8vw, 1.55rem);
  font-weight: 700;
  color: var(--ink-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.1s ease;
  overflow: hidden;
  padding: 0;
}

.ticket-cell:active {
  transform: scale(0.94) translate(1px, 2px);
  box-shadow: 1px 1px 0 var(--ink-dark);
}

/* Marked with Festive Diya / Watercolor Kumkum Stamp */
.ticket-cell.marked {
  background:
    radial-gradient(circle at 50% 50%, #FFE596 0%, #F7A73B 100%);
  color: var(--ink-dark);
  border-color: var(--ink-dark);
}

.ticket-cell.marked::after {
  content: '🪔';
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: clamp(0.75rem, 2.8vw, 0.95rem);
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Subtle shimmer ring when a number has been called by Host (if assist enabled) */
.ticket-cell.called-hint:not(.marked) {
  background: #FFF9E6;
  box-shadow: 2px 3px 0 var(--ink-dark), inset 0 0 0 2.5px var(--marigold);
}

.ticket-cell.free-space {
  background: linear-gradient(135deg, #FCE092 0%, #F59342 100%);
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  letter-spacing: 0.05em;
}

/* 3x9 Tambola Player Grid (90-Ball Mode) — Fits 100% width with NO horizontal scroll */
.ticket-grid-90-wrap {
  width: 100%;
}

.tambola-col-guides {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0.28rem;
  margin-bottom: 0.3rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.ticket-grid-90 {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0.32rem;
  width: 100%;
}

.tambola-cell {
  position: relative;
  height: 56px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 2px solid var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark);
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 3.8vw, 1.25rem);
  font-weight: 700;
  color: var(--ink-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, background-color 0.15s ease;
  padding: 0;
}

.tambola-cell:active:not(.empty) {
  transform: scale(0.93);
}

.tambola-cell.empty {
  background: var(--paper-warm);
  border-style: dashed;
  border-color: rgba(51, 31, 23, 0.3);
  box-shadow: none;
  cursor: default;
}

.tambola-cell.empty::before {
  content: '✦';
  color: rgba(51, 31, 23, 0.18);
  font-size: 0.75rem;
}

.tambola-cell.marked {
  background: radial-gradient(circle, #FFE596 0%, #F7A73B 100%);
}

.tambola-cell.marked::after {
  content: '🪔';
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 0.68rem;
  line-height: 1;
}

.tambola-cell.called-hint:not(.marked) {
  background: #FFF9E6;
  box-shadow: 2px 2px 0 var(--ink-dark), inset 0 0 0 2px var(--marigold);
}

/* Player Action Bar & Claim Section */
.player-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.95rem;
}

.claim-buttons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.player-Claim-Main {
  width: 100%;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 6vw, 2.05rem);
  letter-spacing: 0.08em;
  padding: 0.65rem 1rem;
}

.ticket-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.15rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ticket-tap-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   CELEBRATION OVERLAY & MODAL (DIWALI FIREWORKS & WINNER ANNOUNCEMENT)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(51, 31, 23, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.hidden,
.hidden {
  display: none !important;
}

.celebration-modal {
  max-width: 520px;
  width: 100%;
  text-align: center;
  padding: 1.75rem 1.4rem;
  background:
    radial-gradient(circle at 50% 25%, #FFE082 0%, rgba(249, 184, 82, 0.35) 55%, var(--paper-card) 85%);
  border: 3px solid var(--ink-dark);
  border-radius: 26px;
  box-shadow: var(--shadow-sketch-lg), 0 0 60px rgba(255, 174, 25, 0.55);
  animation: ballPopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-modal h2 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  color: var(--kumkum);
  letter-spacing: 0.06em;
  line-height: 0.95;
  margin: 0.4rem 0;
}

.celebration-winner-name {
  font-family: var(--font-hand);
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--ink-dark);
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   TOAST NOTIFICATION ENGINE (Fixes N7)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: min(92vw, 480px);
  width: max-content;
  pointer-events: none;
}

.toast-bubble,
.sketch-toast {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1.25rem;
  background-color: #FFFDF8;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 238, 204, 0.45) 0%, transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #FFFDF8 100%);
  border: 2px solid #331F17;
  border-radius: 14px;
  box-shadow:
    0 10px 25px -4px rgba(51, 31, 23, 0.28),
    0 4px 10px -2px rgba(51, 31, 23, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: #331F17;
  line-height: 1.35;
  text-align: center;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: toastSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-bubble.toast-error,
.sketch-toast.toast-error {
  background-color: #FFF5F5;
  background-image: linear-gradient(180deg, #FFF9F9 0%, #FFF2F2 100%);
  border-color: #B71C1C;
  color: #900C0C;
  box-shadow:
    0 10px 25px -4px rgba(183, 28, 28, 0.25),
    0 4px 10px -2px rgba(183, 28, 28, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.toast-bubble.toast-success,
.sketch-toast.toast-success {
  background-color: #F4FBF4;
  background-image: linear-gradient(180deg, #FAFFFA 0%, #EEF9EE 100%);
  border-color: #1B5E20;
  color: #145A1A;
  box-shadow:
    0 10px 25px -4px rgba(27, 94, 32, 0.22),
    0 4px 10px -2px rgba(27, 94, 32, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.toast-bubble.toast-info,
.sketch-toast.toast-info {
  background-color: #FFFDF8;
  border-color: #331F17;
  color: #331F17;
}

/* Host Mode Authentication Pill & Dimmed Button */
.host-auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.26rem 0.65rem;
  background: var(--marigold-soft);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-dark);
}

.host-logout-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.76rem;
  color: var(--kumkum);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}
.host-logout-link:hover {
  color: #B71C1C;
}

.btn-dimmed,
.disabled-hint {
  opacity: 0.65;
  cursor: not-allowed !important;
  background: var(--paper-warm) !important;
  color: var(--ink-muted) !important;
  border-style: dashed !important;
}

.host-auth-error {
  animation: shakeX 0.3s ease-in-out;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================================================
   RESPONSIVE & MOBILE-FIRST OPTIMIZATIONS
   ========================================================================== */

@media (max-width: 1080px) {
  .host-layout {
    grid-template-columns: 1fr;
  }
  .host-Bottom-grid, .host-bottom-grid {
    grid-template-columns: 1fr;
  }
  .lobby-actions-grid {
    grid-template-columns: 1fr;
    max-width: 540px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  /* Streamlined Mobile Top Bar */
  .top-bar {
    padding: 0.45rem 0.75rem;
    gap: 0.4rem;
  }

  .brand-diya-icon {
    width: 30px;
    height: 30px;
  }

  .brand-titles h1 {
    font-size: 1.4rem;
  }

  .brand-titles span {
    font-size: 0.82rem;
  }

  /* On mobile player view, hide the Host Screen switcher and connection text label to keep top bar ultra-clean */
  body[data-view="player"] #btn-switch-host,
  body[data-view="player"] #btn-switch-player,
  #connection-text,
  #sound-label {
    display: none;
  }

  .conn-pill {
    padding: 0.3rem 0.45rem;
  }

  .main-container {
    padding: 0.55rem 0.6rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  /* Compact Scene on Mobile so "Join on Your Phone" is immediately accessible */
  .static-scene-stage,
  .parallax-scene-stage {
    max-width: 340px;
    max-height: 235px;
    margin: -0.15rem auto -0.65rem;
  }

  .role-box {
    padding: 1rem;
  }

  /* Prevent iOS Safari zoom on input focus */
  .input-sketch {
    font-size: 16px;
    padding: 0.65rem 0.85rem;
  }

  /* Mobile Player View Ergonomics */
  .player-layout {
    gap: 0.6rem;
  }

  .player-caller-bar {
    padding: 0.65rem 0.75rem;
    gap: 0.45rem;
    border-radius: 16px;
  }

  .player-ball-circle {
    width: 50px;
    height: 50px;
  }

  .player-ball-circle .letter {
    font-size: 0.8rem;
  }

  .player-ball-circle .num {
    font-size: 1.4rem;
  }

  .player-callout-text .callout-title {
    font-size: 0.96rem;
  }

  .bingo-ticket-card {
    padding: 0.75rem 0.65rem 0.85rem;
    border-radius: 18px;
  }

  .ticket-top-ornament {
    margin-bottom: 0.55rem;
    padding-bottom: 0.4rem;
  }

  .ticket-top-ornament h2 {
    font-size: 1.95rem;
  }

  .ticket-subtitle-tag {
    font-size: 1.15rem;
  }

  /* 5x5 Classic Grid on Phone */
  .ticket-grid-75 {
    gap: 0.32rem;
  }

  .ticket-col-header {
    height: 34px;
    font-size: 1.55rem;
  }

  .ticket-cell {
    min-height: 52px;
    border-width: 2px;
    border-radius: 10px;
    box-shadow: 1.5px 2px 0 var(--ink-dark);
  }

  /* 3x9 Tambola Grid on Phone — All 9 columns visible with zero horizontal scroll! */
  .ticket-grid-90 {
    gap: 3px;
  }

  .tambola-col-guides {
    gap: 2px;
    font-size: 0.58rem;
  }

  .tambola-cell {
    height: 46px;
    border-width: 1.5px;
    border-radius: 6px;
    box-shadow: 1px 1.5px 0 var(--ink-dark);
    font-size: 0.95rem;
  }

  .tambola-cell.marked::after {
    font-size: 0.58rem;
    bottom: 1px;
    right: 1px;
  }

  /* Responsive 2-column prize grid on mobile so all chips are visible without sideways scrolling */
  .claim-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    overflow-x: visible;
    width: 100%;
  }

  .claim-buttons-grid .btn-sketch {
    width: 100%;
    padding: 0.42rem 0.35rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Place Toast notifications near the top on mobile so they never block the thumb-zone Claim button */
  .toast-container {
    top: 3.6rem;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: 92vw;
    width: max-content;
  }

  .bingo-master-row {
    grid-template-columns: 34px repeat(5, 1fr);
  }
  .bingo-row-letter {
    grid-row: span 3;
    height: 100%;
  }
}

/* ==========================================================================
   ENHANCEMENTS: LOCALHOST WARNING, ALL-CALLED MODAL & PLAY PAGE
   ========================================================================== */

.localhost-warning-badge {
  margin-top: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: #FFF3CD;
  color: #856404;
  border: 1.5px solid #FFEEBA;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 600;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.05);
}

.all-called-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.all-called-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.all-called-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.55rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink-dark);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-dark);
  background: var(--paper-warm);
  box-shadow: 2px 2px 0 var(--ink-dark);
}

.all-called-ball.latest {
  background: var(--kumkum);
  color: #FFFFFF;
  border-color: var(--ink-dark);
  box-shadow: 2px 2px 0 var(--ink-dark), 0 0 10px rgba(184, 29, 19, 0.35);
}

.all-called-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink-dark);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
}

/* Dedicated mobile player page ergonomics */
.play-page {
  padding-bottom: 2.5rem;
}

.play-top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper-warm);
  border-bottom: 2px solid var(--ink-dark);
  padding: 0.45rem 0.85rem;
}

.play-main-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0.75rem 0.65rem;
}

.play-section {
  width: 100%;
}

.play-join-card {
  margin: 0.5rem auto;
  max-width: 480px;
}

.play-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.play-avatar-grid .avatar-opt {
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


