/* ==========================================================================
   TAMBOLA NUMBER CALLER - MODERN DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme (Default) */
  --bg-main: #0b0f19;
  --bg-surface: #131b2e;
  --bg-card: rgba(23, 33, 56, 0.85);
  --bg-card-hover: rgba(30, 43, 73, 0.95);
  --bg-elevated: #1e293b;
  --bg-input: #0f172a;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --border-light: rgba(255, 255, 255, 0.15);
  
  /* Accent & Brand Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.45);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.35);
  --danger: #ef4444;
  --warning: #f59e0b;
  
  /* Number Grid States */
  --cell-uncalled-bg: rgba(255, 255, 255, 0.03);
  --cell-uncalled-text: #64748b;
  --cell-uncalled-border: rgba(255, 255, 255, 0.05);
  
  --cell-called-bg: #1e1b4b;
  --cell-called-text: #a5b4fc;
  --cell-called-border: #4338ca;
  
  --cell-latest-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --cell-latest-text: #ffffff;
  --cell-latest-border: #fbbf24;
  --cell-latest-glow: 0 0 16px rgba(245, 158, 11, 0.6);
  
  /* Shadows & Radius */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--primary-glow);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #f8fafc;
  --bg-elevated: #e2e8f0;
  --bg-input: #f8fafc;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #4f46e5;
  --border-light: rgba(0, 0, 0, 0.12);
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #6366f1;
  --primary-glow: rgba(79, 70, 229, 0.25);
  
  --cell-uncalled-bg: #f8fafc;
  --cell-uncalled-text: #94a3b8;
  --cell-uncalled-border: #e2e8f0;
  
  --cell-called-bg: #e0e7ff;
  --cell-called-text: #3730a3;
  --cell-called-border: #a5b4fc;
  
  --cell-latest-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --cell-latest-text: #ffffff;
  --cell-latest-border: #d97706;
  --cell-latest-glow: 0 4px 16px rgba(245, 158, 11, 0.4);
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  outline: none;
  touch-action: manipulation;
}

input, select {
  font-family: inherit;
  color: inherit;
}

/* Focus Visible Accessibility */
button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */

.app-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0.5rem;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.app-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="light"] .brand-text h1 {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.voice-badge-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.voice-badge-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.voice-avatar-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary);
}

.voice-icon-fallback {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary-light);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   AUDIO PREPARATION STATUS BAR & UNLOCK PROMPT
   ========================================================================== */

.audio-status-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.audio-status-banner.hidden {
  display: none;
}

.audio-status-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-light);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-track-mini {
  width: 140px;
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-mini {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: var(--radius-full);
  transition: width 0.15s ease-out;
}

.audio-ready-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--success);
  font-weight: 600;
  font-size: 0.85rem;
}

.audio-unlock-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(245, 158, 11, 0.15));
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: pulseGlow 2s infinite;
}

.audio-unlock-banner.hidden {
  display: none;
}

.btn-unlock {
  background: var(--primary);
  color: #ffffff;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.btn-unlock:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   MAIN GAME LAYOUT (HERO CALLER + BOARD GRID)
   ========================================================================== */

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

/* Left Hero Caller Column */
.caller-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 5.5rem;
}

/* Central Caller Showcase Card */
.caller-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.caller-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #ec4899, var(--accent-gold));
}

.latest-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Huge Number Display Box */
.latest-number-display {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--bg-elevated), var(--bg-surface));
  border: 4px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md), inset 0 2px 6px rgba(255, 255, 255, 0.1);
  position: relative;
  transition: all var(--transition-slow);
}

.latest-number-display.pulse {
  animation: numberPopGlow 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-color: var(--accent-gold);
  box-shadow: 0 0 35px var(--accent-gold-glow), inset 0 2px 8px rgba(245, 158, 11, 0.3);
}

@keyframes numberPopGlow {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.latest-number-text {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-main);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.latest-number-text.empty {
  font-size: 3.5rem;
  color: var(--text-subtle);
  font-weight: 300;
}

/* Previous Numbers List */
.previous-numbers-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.previous-numbers-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.previous-numbers-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 36px;
  flex-wrap: wrap;
}

.prev-num-chip {
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: slideInPrev 0.3s ease-out;
}

.prev-num-chip:first-child {
  background: var(--cell-called-bg);
  border-color: var(--primary);
  color: var(--primary-light);
}

@keyframes slideInPrev {
  from { opacity: 0; transform: translateX(-10px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.prev-empty-msg {
  font-size: 0.85rem;
  color: var(--text-subtle);
  font-style: italic;
}

/* Primary Call Button */
.btn-call-main {
  width: 100%;
  padding: 1.15rem 1.5rem;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-call-main:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 50%, #3730a3 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.5);
}

.btn-call-main:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-call-main:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: none;
}

.btn-call-main .key-hint {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Secondary Quick Controls Bar */
.quick-controls {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.btn-secondary-action {
  padding: 0.65rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: var(--transition-fast);
}

.btn-secondary-action:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary-light);
}

.btn-secondary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary-action.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.btn-secondary-action.btn-danger-action:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-secondary-action svg {
  width: 16px;
  height: 16px;
}

/* Auto-call Timer Visual Badge */
.autocall-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--primary-light);
}

.autocall-indicator.hidden {
  display: none;
}

.autocall-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulseDot 1.2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   STATISTICS PANEL
   ========================================================================== */

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  font-feature-settings: 'tnum';
}

.stat-value.called {
  color: var(--primary-light);
}

.stat-value.remaining {
  color: var(--text-main);
}

.stat-value.percent {
  color: var(--accent-gold);
}

.game-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.game-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #ec4899, var(--accent-gold));
  border-radius: var(--radius-full);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TAMBOLA NUMBER BOARD / GRID
   ========================================================================== */

.board-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.board-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.board-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.board-range-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--primary-light);
}

.board-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.uncalled {
  background: var(--cell-uncalled-border);
  border: 1px solid var(--border-color);
}

.legend-dot.called {
  background: var(--primary);
}

.legend-dot.latest {
  background: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold-glow);
}

/* Number Grid Cells */
.number-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.5rem;
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 700;
  position: relative;
  transition: all var(--transition-fast);
  user-select: none;
  border: 1px solid transparent;
}

/* State: Uncalled */
.grid-cell.uncalled {
  background: var(--cell-uncalled-bg);
  color: var(--cell-uncalled-text);
  border-color: var(--cell-uncalled-border);
}

/* State: Called */
.grid-cell.called {
  background: var(--cell-called-bg);
  color: var(--cell-called-text);
  border-color: var(--cell-called-border);
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* State: Latest Called */
.grid-cell.latest {
  background: var(--cell-latest-bg) !important;
  color: var(--cell-latest-text) !important;
  border-color: var(--cell-latest-border) !important;
  box-shadow: var(--cell-latest-glow);
  font-weight: 900;
  transform: scale(1.06);
  z-index: 2;
  animation: cellGlow 1.8s infinite alternate;
}

@keyframes cellGlow {
  from { box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
  to { box-shadow: 0 0 20px rgba(245, 158, 11, 0.8); }
}

/* Floating Exit Fullscreen Button */
.btn-exit-projector {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 1500;
  padding: 0.5rem 1rem;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  align-items: center;
  gap: 0.45rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: var(--transition-fast);
}

.btn-exit-projector:hover {
  background: var(--danger);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

body.projector-mode .btn-exit-projector {
  display: flex !important;
}

/* ==========================================================================
   FULLSCREEN / PROJECTOR MODE
   ========================================================================== */

body.projector-mode {
  background: #050811;
  padding: 0;
  margin: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

body.projector-mode .app-container {
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 0.6rem 1rem;
  gap: 0.6rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.projector-mode .app-header,
body.projector-mode .seo-content-section,
body.projector-mode .app-footer,
body.projector-mode .audio-status-banner,
body.projector-mode .audio-unlock-banner {
  display: none !important;
}

body.projector-mode .game-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  max-height: 100%;
  gap: 0.75rem;
  align-items: stretch;
  overflow: hidden;
}

body.projector-mode .caller-column {
  position: static;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
}

body.projector-mode .caller-card {
  height: 100%;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
}

body.projector-mode .latest-number-display {
  width: clamp(100px, 16vh, 160px);
  height: clamp(100px, 16vh, 160px);
}

body.projector-mode .latest-number-text {
  font-size: clamp(3.5rem, 9vh, 5.5rem);
}

body.projector-mode .btn-call-main {
  padding: clamp(0.6rem, 1.5vh, 1rem) 1rem;
  font-size: clamp(1rem, 2.2vh, 1.35rem);
}

body.projector-mode .stats-card {
  padding: 0.5rem 0.75rem;
  gap: 0.35rem;
}

body.projector-mode .stat-value {
  font-size: 1.1rem;
}

body.projector-mode .board-column {
  height: 100%;
  overflow: hidden;
}

body.projector-mode .board-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
  overflow: hidden;
}

body.projector-mode .board-header {
  padding-bottom: 0.4rem;
}

body.projector-mode .number-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 0.3rem;
  flex: 1;
  height: 100%;
}

body.projector-mode .grid-cell {
  height: 100%;
  width: 100%;
  aspect-ratio: auto;
  font-size: clamp(0.95rem, 2.3vh, 1.5rem);
  font-weight: 800;
}

/* ==========================================================================
   MODALS & BOTTOM SHEETS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

#confirm-modal {
  z-index: 1100;
}

#completion-modal {
  z-index: 1200;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: all var(--transition-slow);
  overflow: hidden;
}

.modal-backdrop.active .modal-dialog {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-input);
}

/* Settings Sections */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Range Presets & Custom */
.preset-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.6rem 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition-fast);
  text-align: center;
}

.preset-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.preset-btn.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.custom-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field {
  padding: 0.55rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.input-field:focus {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

/* Voice Selection Grid */
.voice-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.voice-card {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  transition: var(--transition-fast);
  cursor: pointer;
}

.voice-card:hover {
  border-color: var(--primary-light);
  background: var(--bg-card-hover);
}

.voice-card.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 12px var(--primary-glow);
}

.voice-card-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.voice-card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-color);
}

.voice-card.active .voice-card-avatar {
  border-color: var(--primary);
}

.voice-card-meta {
  display: flex;
  flex-direction: column;
}

.voice-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.voice-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.voice-preview-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.voice-preview-btn:hover {
  color: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.1);
}

.voice-preview-btn svg {
  width: 14px;
  height: 14px;
}

/* Audio Controls (Volume & Mute) */
.audio-controls-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-elevated);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.volume-slider {
  flex: 1;
  height: 6px;
  accent-color: var(--primary);
  cursor: pointer;
}

.volume-percent {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
  color: var(--text-muted);
}

/* Auto-call Interval Presets */
.interval-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.interval-btn {
  padding: 0.5rem 0.3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  text-align: center;
  transition: var(--transition-fast);
}

.interval-btn:hover {
  border-color: var(--primary);
}

.interval-btn.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #ffffff;
}

/* Theme Switcher in Settings */
.theme-switch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.theme-choice-btn {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.theme-choice-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}

/* Button Variants in Dialogs */
.btn-primary {
  padding: 0.65rem 1.25rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  padding: 0.65rem 1.25rem;
  background: var(--danger);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.btn-outline:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

/* ==========================================================================
   GAME COMPLETION MODAL (ALL NUMBERS CALLED)
   ========================================================================== */

.completion-dialog {
  text-align: center;
  padding: 2.5rem 2rem;
  max-width: 480px;
}

.celebration-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.completion-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.completion-desc {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.toast.toast-info {
  border-left: 4px solid var(--primary);
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast.toast-danger {
  border-left: 4px solid var(--danger);
}

@keyframes toastSlideIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
  animation: toastSlideOut 0.25s forwards;
}

@keyframes toastSlideOut {
  to { transform: translateX(50px); opacity: 0; }
}

/* ==========================================================================
   SEO CONTENT & HOW TO PLAY SECTION
   ========================================================================== */

.seo-content-section {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.seo-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.seo-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.seo-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.feature-box {
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feature-box h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.how-to-play-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.how-to-play-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.how-to-play-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  counter-reset: step-counter;
}

.how-to-play-steps li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.how-to-play-steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
  }
  
  .latest-number-display {
    width: 150px;
    height: 150px;
  }
  
  .latest-number-text {
    font-size: 4.25rem;
  }
}

@media (max-width: 860px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  
  .caller-column {
    position: static;
  }
  
  .caller-card {
    padding: 1.5rem 1.25rem;
  }
  
  .number-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 0.35rem;
  }
  
  .grid-cell {
    font-size: 1rem;
    border-radius: 6px;
  }
  
  /* Modal as Bottom Sheet on Mobile */
  .modal-dialog {
    max-width: 100%;
    margin-top: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 85vh;
  }
  
  .voice-cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-container {
    padding: 0.6rem 0.75rem 2.5rem;
    gap: 1rem;
  }
  
  .app-header {
    padding: 0.6rem 0.85rem;
  }
  
  .app-logo {
    width: 36px;
    height: 36px;
  }
  
  .brand-text h1 {
    font-size: 1.05rem;
  }
  
  .brand-subtitle {
    display: none;
  }
  
  .latest-number-display {
    width: 130px;
    height: 130px;
  }
  
  .latest-number-text {
    font-size: 3.75rem;
  }
  
  .btn-call-main {
    font-size: 1.15rem;
    padding: 1rem;
  }
  
  .number-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 0.25rem;
  }
  
  .grid-cell {
    font-size: 0.82rem;
    font-weight: 700;
  }
  
  .preset-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

/* ==========================================================================
   MOBILE & TABLET LANDSCAPE MODE (NO SCROLLING FIT)
   ========================================================================== */

@media (max-height: 560px) and (orientation: landscape) {
  body {
    overflow-x: hidden;
  }

  .app-container {
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
    max-width: 100vw;
  }

  .seo-content-section,
  .app-footer,
  .brand-subtitle,
  .audio-status-banner {
    display: none !important;
  }

  .app-header {
    padding: 0.25rem 0.65rem;
    position: static;
  }

  .app-logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }

  .brand-text h1 {
    font-size: 0.9rem;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  .voice-badge-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.35rem;
  }

  .voice-avatar-thumb {
    width: 18px;
    height: 18px;
  }

  .game-layout {
    grid-template-columns: 205px 1fr;
    gap: 0.5rem;
    align-items: stretch;
  }

  .caller-column {
    position: static;
    gap: 0.35rem;
  }

  .caller-card {
    padding: 0.5rem 0.65rem;
    gap: 0.3rem;
  }

  .latest-label {
    font-size: 0.65rem;
  }

  .latest-number-display {
    width: 72px;
    height: 72px;
    border-width: 2px;
  }

  .latest-number-text {
    font-size: 2.35rem;
  }

  .latest-number-text.empty {
    font-size: 1.6rem;
  }

  .previous-numbers-label {
    display: none;
  }

  .previous-numbers-list {
    min-height: 24px;
    gap: 0.2rem;
  }

  .prev-num-chip {
    min-width: 24px;
    height: 24px;
    font-size: 0.75rem;
    border-radius: 4px;
  }

  .btn-call-main {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    gap: 0.4rem;
  }

  .btn-call-main .key-hint {
    display: none;
  }

  .quick-controls {
    gap: 0.25rem;
  }

  .btn-secondary-action {
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
    gap: 0.25rem;
  }

  .btn-secondary-action svg {
    width: 13px;
    height: 13px;
  }

  .stats-card {
    padding: 0.35rem 0.55rem;
    gap: 0.25rem;
  }

  .stat-label {
    font-size: 0.62rem;
  }

  .stat-value {
    font-size: 0.95rem;
  }

  .board-card {
    padding: 0.5rem 0.65rem;
    gap: 0.3rem;
  }

  .board-header {
    padding-bottom: 0.25rem;
  }

  .board-title {
    font-size: 0.95rem;
  }

  .board-range-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
  }

  .board-legend {
    font-size: 0.68rem;
    gap: 0.4rem;
  }

  .legend-dot {
    width: 7px;
    height: 7px;
  }

  .number-grid {
    gap: 0.18rem;
  }

  .grid-cell {
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 4px;
  }
}

