/* ==========================================================================
   HUXLEY BINGO MACHINE DESIGN SYSTEM (VANILLA CSS)
   ========================================================================== */

/* 1. Global Imports & Font Declarations */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Light Theme Variables */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;   /* Slate-50 */
  --bg-tertiary: #f1f5f9;    /* Slate-100 */
  --bg-card: #ffffff;
  --bg-nav: rgba(255, 255, 255, 0.88);
  
  --primary: #4f46e5;       /* Vibrant Indigo */
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.08);
  --secondary: #10b981;     /* Emerald Green */
  --secondary-hover: #059669;
  --secondary-light: rgba(16, 185, 129, 0.08);
  
  /* Bonus Ball Styling - Warm Coral/Gold */
  --accent: #f97316;        /* Warm Coral */
  --accent-hover: #ea580c;
  --accent-light: rgba(249, 115, 22, 0.08);
  
  --text-main: #0f172a;     /* Slate-900 */
  --text-muted: #475569;    /* Slate-600 */
  --text-dim: #64748b;      /* Slate-500 */
  --text-white: #ffffff;
  
  --border-light: rgba(15, 23, 42, 0.08);
  --border-focus: #4f46e5;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(79, 70, 229, 0.05), 0 4px 6px -2px rgba(79, 70, 229, 0.03);
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-full: 9999px;

  --grid-color: rgba(15, 23, 42, 0.04);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-primary: #0b0f19;    /* Deep Slate-950 */
  --bg-secondary: #0f172a;  /* Slate-900 */
  --bg-tertiary: #1e293b;   /* Slate-800 */
  --bg-card: #131c31;       /* Dark card background */
  --bg-nav: rgba(11, 15, 25, 0.88);
  
  --primary: #6366f1;       /* Lightened Indigo for contrast */
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --secondary: #34d399;     /* Lightened Emerald */
  --secondary-hover: #10b981;
  --secondary-light: rgba(52, 211, 153, 0.15);
  
  --accent: #fb923c;        /* Lightened Coral */
  --accent-hover: #f97316;
  --accent-light: rgba(251, 146, 60, 0.15);
  
  --text-main: #f8fafc;     /* Slate-50 */
  --text-muted: #cbd5e1;    /* Slate-300 */
  --text-dim: #94a3b8;      /* Slate-400 */
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  
  --grid-color: rgba(255, 255, 255, 0.03);
}

/* 2. CSS Resets & Base Elements */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Dotted grid canvas overlay background */
.background-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
  background-image: radial-gradient(var(--grid-color) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
}

.background-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

.background-glow-left {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--secondary-light) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  z-index: -1;
  pointer-events: none;
  filter: blur(60px);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 3. Header & Navigation */
.header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: var(--bg-nav);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 38px;
  width: auto;
  transition: var(--transition-smooth);
}

/* Make white brand logos visible on light theme backgrounds */
html:not([data-theme="dark"]) .logo-img,
html:not([data-theme="dark"]) .footer-logo {
  filter: brightness(0.15);
}

[data-theme="dark"] .logo-img,
[data-theme="dark"] .footer-logo {
  filter: none;
}

.site-title {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Navigation Button Links in Header */
.nav-link-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0 1.2rem;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.nav-link-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Hamburger & Mobile Nav Drawer Default states (hidden on desktop) */
#menuToggleBtn {
  display: none !important;
}
.mobile-nav-drawer {
  display: none !important;
}

/* Theme Toggle Button */
.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Sun and Moon Icons */
.theme-icon-sun { display: block; }
.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }

/* 4. Main Layout & Page Wrapper */
.main-content {
  flex: 1;
  padding: 2.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Intro Hero card style */
.intro-card {
  text-align: center;
  margin-bottom: 2.5rem;
}
.intro-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 0.75rem;
}
.intro-title {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
}
.intro-desc {
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* 5. App Grid Layout */
.app-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 992px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphism Cards */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  position: relative;
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* 6. Machine & Cage Visualizer (Left Panel) */
.machine-column {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.cage-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 320px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1.5rem;
}

#bingoCageCanvas {
  max-width: 100%;
  aspect-ratio: 4 / 3;
  width: 420px;
  height: auto;
  display: block;
}

/* Ball rollout display */
.rollout-chute {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  position: relative;
  height: 60px;
}

/* 7. Current Ball Display Card */
.display-card-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  margin-top: 1rem;
}

@media (max-width: 576px) {
  .display-card-wrapper {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
}

.ball-display-outer {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

/* Sphere styling */
.ball-sphere {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  color: var(--text-white);
  box-shadow: inset -10px -10px 25px rgba(0,0,0,0.35), 
              0 12px 20px -8px rgba(0,0,0,0.3);
  position: relative;
  user-select: none;
}

.ball-sphere::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  width: 45%;
  height: 25%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
  border-radius: var(--radius-full);
}

.ball-inner-white {
  width: 55%;
  height: 55%;
  background: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  box-shadow: inset 1px 1px 5px rgba(0,0,0,0.2);
}

/* Normal Ball Colors (Indigo gradient) */
.ball-normal {
  background: radial-gradient(circle at 35% 35%, #818cf8 0%, #4f46e5 60%, #312e81 100%);
  border: 1px solid #6366f1;
}
.ball-normal .ball-inner-white {
  color: #312e81;
}

/* Bonus Ball Colors (Warm Coral/Orange gradient) */
.ball-bonus {
  background: radial-gradient(circle at 35% 35%, #fb923c 0%, #f97316 60%, #7c2d12 100%);
  border: 1px solid #fb923c;
  animation: bonusGlowPulse 2s infinite ease-in-out;
}
.ball-bonus .ball-inner-white {
  color: #7c2d12;
}

@keyframes bonusGlowPulse {
  0%, 100% {
    box-shadow: inset -10px -10px 25px rgba(0,0,0,0.35), 
                0 12px 20px -8px rgba(249, 115, 22, 0.4),
                0 0 15px rgba(249, 115, 22, 0.2);
  }
  50% {
    box-shadow: inset -10px -10px 25px rgba(0,0,0,0.35), 
                0 12px 28px -4px rgba(249, 115, 22, 0.7),
                0 0 25px rgba(249, 115, 22, 0.5);
    transform: scale(1.03);
  }
}

/* Large Called Text Display details */
.ball-info-panel {
  flex-grow: 1;
}

.ball-status-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  color: var(--text-dim);
}

.ball-status-label.is-bonus {
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ball-status-label.is-bonus::before {
  content: '✦';
  font-size: 1.1rem;
}

.ball-number-text {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.15rem;
  color: var(--text-main);
}

.ball-speech-nickname {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  min-height: 1.5rem;
}

/* Rolling out animations */
.pop-animation {
  animation: ballDrawPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes ballDrawPop {
  0% {
    transform: scale(0.2) rotate(-90deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.1) rotate(10deg);
    opacity: 0.9;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* Horizontal Drawn History list strip */
.recent-strip-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
}

.recent-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.5rem 0.25rem;
  min-height: 64px;
  list-style: none;
}

.recent-strip-item {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-white);
  box-shadow: inset -2px -2px 6px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.15);
  position: relative;
  flex-shrink: 0;
}
.recent-strip-item::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  width: 45%;
  height: 25%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
  border-radius: var(--radius-full);
}

.recent-strip-item.item-normal {
  background: radial-gradient(circle at 35% 35%, #818cf8 0%, #4f46e5 60%, #312e81 100%);
}
.recent-strip-item.item-bonus {
  background: radial-gradient(circle at 35% 35%, #fb923c 0%, #f97316 60%, #7c2d12 100%);
  border: 1px solid #fb923c;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: inset -2px -2px 6px rgba(0,0,0,0.35), 0 0 4px rgba(249, 115, 22, 0.4); }
  50% { box-shadow: inset -2px -2px 6px rgba(0,0,0,0.35), 0 0 10px rgba(249, 115, 22, 0.8); }
}

/* 8. Controls and Stats Panel (Right Panel) */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.stat-item {
  text-align: center;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-val.val-bonus {
  color: var(--accent);
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 0.15rem;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setting-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.setting-help {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-group-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.btn-toggle {
  background: transparent;
  border: none;
  padding: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-toggle:hover {
  color: var(--text-main);
}
.btn-toggle.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* Form controls */
.select-input, .text-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}
.select-input:focus, .text-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Switch control */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.switch-label-block {
  display: flex;
  flex-direction: column;
}

.switch-el {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}
.switch-el input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  transition: .3s;
  border-radius: var(--radius-full);
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-dim);
  transition: .3s;
  border-radius: var(--radius-full);
}
input:checked + .switch-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}
input:checked + .switch-slider:before {
  transform: translateX(24px);
  background-color: var(--bg-card);
}

/* Actions buttons styling */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-main {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.95rem 1.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  font-size: 1.05rem;
  transition: var(--transition-smooth);
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
  user-select: none;
}

.btn-draw {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
}
.btn-draw:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -4px rgba(79, 70, 229, 0.4);
}
.btn-draw:active {
  transform: translateY(0);
}

.btn-bonus-draw {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
}
.btn-bonus-draw:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -4px rgba(249, 115, 22, 0.4);
}
.btn-bonus-draw:active {
  transform: translateY(0);
}
.btn-bonus-draw:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.75rem;
}

.btn-action-small {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-autoplay {
  background: var(--bg-tertiary);
  color: var(--text-main);
}
.btn-autoplay:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-autoplay.active {
  background: var(--secondary-light);
  border-color: var(--secondary);
  color: var(--secondary);
  animation: pulseAutoplay 2s infinite ease-in-out;
}

@keyframes pulseAutoplay {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.4); }
}

.btn-reset {
  background: transparent;
  color: var(--text-dim);
}
.btn-reset:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* 9. Called Numbers History Board (Grid) */
.board-section {
  grid-column: 1 / -1;
  margin-top: 1rem;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.board-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.45rem;
}

.board-number-cell {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  user-select: none;
}

.board-number-cell.is-called {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-white);
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
  animation: cellPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.board-number-cell.is-called-bonus {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-white);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
  animation: cellPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cellPop {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* 10. Footer Section */
.footer {
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  padding: 1.5rem 1.5rem;
  text-align: center;
  margin-top: 3rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.footer-logo {
  height: 24px;
  width: auto;
  opacity: 0.7;
  margin-bottom: 0.25rem;
  transition: var(--transition-fast);
}
.footer-logo:hover {
  opacity: 1;
}

/* 11. Embed Settings (Query Param trigger overrides) */
body.is-embedded {
  background-color: transparent !important;
}

body.is-embedded .background-grid,
body.is-embedded .background-glow,
body.is-embedded .background-glow-left,
body.is-embedded .header,
body.is-embedded .intro-card,
body.is-embedded .footer {
  display: none !important;
}

body.is-embedded .main-content {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

body.is-embedded .glass-panel {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.75rem !important;
}

/* Embed layout adjustment: flex column to suit small widget embeds */
body.is-embedded .app-grid {
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

body.is-embedded .board-grid {
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 0.35rem;
}

/* 12. Helper Classes */
.hidden {
  display: none !important;
}
.text-accent {
  color: var(--accent);
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Header Adaptations */
@media (max-width: 640px) {
  .logo-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
  .logo-img {
    height: 24px;
  }
  .logo-link .site-title {
    display: block !important;
    font-size: 0.8rem;
    line-height: 1.1;
  }
  .header-controls {
    gap: 0.35rem;
  }
  .nav-link-btn {
    display: none !important; /* Hide desktop header links */
  }
  #menuToggleBtn {
    display: inline-flex !important; /* Show mobile menu button */
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  
  /* Mobile Nav Drawer Styles */
  .mobile-nav-drawer {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    z-index: 99;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .mobile-nav-drawer.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .mobile-nav-link {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    text-align: center;
    transition: var(--transition-fast);
  }
  .mobile-nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
  }
}

/* 13. Embed Code Modal & Built-by Tagline Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 90%;
  max-width: 480px;
  animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  position: relative;
}

@keyframes modalSlideUp {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.25rem;
  color: var(--text-main);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-fast);
}
.modal-close-btn:hover {
  color: var(--text-main);
}

.built-by-tagline {
  text-align: center;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 500;
  transition: var(--transition-smooth);
}

.built-by-tagline a {
  color: var(--primary);
  font-weight: 600;
  border-bottom: 1px dashed var(--primary-light);
  transition: var(--transition-fast);
}

.built-by-tagline a:hover {
  color: var(--primary-hover);
  border-bottom-style: solid;
}

/* Ensure the tagline stays visible and properly padded in embed mode */
body.is-embedded .built-by-tagline {
  display: block !important;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
}
