/* ==========================================================================
   Setu — FIFA World Cup 2026 Stadium Operations Console
   Sports Broadcast UI & Tactical Control Center
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---------- CSS Custom Variables ---------- */
:root {
  /* Brand Palette */
  --bg-dark:          #0F3D2E;
  --clr-brand:        #0F3D2E;
  --clr-emerald:      #22C55E;
  --clr-gold:         #F4C542;
  --clr-charcoal:     #1B1B1B;
  --clr-white:        #FFFFFF;
  --border-color:     #E5E7EB;
  --text-primary:     #1B1B1B;
  --text-secondary:   #4B5563;
  --text-muted:       #6B7280;
  --bg-hover:         #F9FAFB;
  --clr-accent-secondary: #F97316;

  /* Semantic Signals */
  --clr-success:      #22C55E;
  --clr-warning:      #FFB703;
  --clr-danger:       #D72638;

  /* Density */
  --clr-crowd-low:    #22C55E;
  --clr-crowd-medium: #FFB703;
  --clr-crowd-high:   #D72638;
  --clr-closed:       #64748B;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px -2px rgba(15,61,46,0.06), 0 2px 6px -1px rgba(15,61,46,0.03);
  --shadow-lg: 0 15px 35px -5px rgba(15,61,46,0.1), 0 5px 15px -3px rgba(15,61,46,0.05);
  --shadow-active-green: 0 0 15px rgba(34,197,94,0.15);
  --shadow-active-gold: 0 0 15px rgba(244,197,66,0.15);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;

  /* Layout */
  --sidebar-width: 380px;
  --header-height: 68px;
}

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

body {
  font-family: var(--font-sans);
  background-color: #F3F5F4;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(34,197,94,0.04) 0%, transparent 70%),
    radial-gradient(circle at 50% 50%, transparent 120px, rgba(15,61,46,0.015) 120px, rgba(15,61,46,0.015) 121px, transparent 121px),
    linear-gradient(rgba(15,61,46,0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,61,46,0.01) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  color: var(--clr-charcoal);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
  transition: opacity 0.5s ease;
}

/* Accessibility */
body.accessibility-mode { font-size: 115%; }
body.accessibility-mode button,
body.accessibility-mode input,
body.accessibility-mode select { min-height: 48px; }

.skip-link {
  position: absolute; top: -100%; left: 20px;
  background: var(--bg-dark); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm);
  z-index: 9999; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}

/* Particle Canvas */
#particle-canvas {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0.4;
}

/* ==========================================================================
   CINEMATIC LOADER
   ========================================================================== */
.loader-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg-dark); color: var(--clr-white);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader-overlay::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(34,197,94,0.1) 0%, transparent 80%);
  pointer-events: none;
}
.loader-overlay.hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.loader-inner {
  text-align: center; max-width: 320px; width: 100%;
  position: relative; z-index: 2;
}
.loader-logo {
  font-size: 2.2rem; font-weight: 900;
  letter-spacing: 0.12em; color: var(--clr-white);
}
.loader-subtitle {
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.25em; color: var(--clr-gold);
  text-transform: uppercase; margin-top: 4px;
}
.loader-bar-wrap {
  width: 100%; height: 4px;
  background: rgba(255,255,255,0.12);
  margin: 32px auto 12px; border-radius: var(--radius-full);
  overflow: hidden;
}
.loader-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--clr-emerald), var(--clr-gold));
  transition: width 0.1s ease;
}
.loader-counter {
  font-family: var(--font-mono); font-size: 0.95rem;
  font-weight: 700; color: var(--clr-white);
}
.loader-status {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.15em; color: rgba(255,255,255,0.5);
  margin-top: 6px; text-transform: uppercase;
}
.loader-corner {
  position: absolute; font-family: var(--font-mono);
  font-size: 0.6rem; letter-spacing: 0.15em;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
}
.loader-corner--tl { top: 24px; left: 24px; }
.loader-corner--br { bottom: 24px; right: 24px; }

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: relative; display: flex;
  align-items: center; justify-content: space-between;
  padding: 0 24px; height: var(--header-height);
  background: var(--clr-white);
  border-bottom: 1px solid var(--border-color);
  border-top: 3px solid var(--clr-gold);
  box-shadow: var(--shadow-sm); z-index: 100; flex-shrink: 0;
}
.header-brand {
  display: flex; align-items: center; gap: var(--space-sm);
}
.header-brand .logo-icon {
  width: 36px; height: 36px;
  background: radial-gradient(circle, var(--clr-emerald) 0%, var(--bg-dark) 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-white); font-size: 1.15rem;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.header-brand .logo-icon::before {
  content: ''; position: absolute; width: 100%; height: 100%;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 50%;
}
.header-brand h1 {
  font-size: 1.25rem; font-weight: 900;
  letter-spacing: -0.01em; color: var(--clr-charcoal); line-height: 1.1;
}
.header-brand h1 .subtitle-hindi {
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-muted); margin-left: 4px;
}
.header-brand .subtitle {
  font-family: var(--font-mono); font-size: 0.55rem;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.12em; margin-top: 1px;
}
.header-controls {
  display: flex; align-items: center; gap: var(--space-sm);
}

/* Temperature Pill */
.temp-display {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: #F3F4F6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  color: var(--clr-charcoal); box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}
.temp-display .temp-value { font-family: var(--font-mono); font-weight: 700; }
.temp-display.heat-normal  { border-left: 4px solid var(--clr-success); }
.temp-display.heat-warning { border-left: 4px solid var(--clr-warning); animation: alertPulse 2s infinite; }
.temp-display.heat-danger  { border-left: 4px solid var(--clr-danger);  animation: alertPulse 1.2s infinite; }

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(215,38,56,0.15); }
  50% { box-shadow: 0 0 10px 2px rgba(215,38,56,0.1); }
}

/* Dropdown */
.select-wrap select {
  appearance: none; background: var(--clr-white);
  color: var(--clr-charcoal); border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 28px 6px 12px; font-family: var(--font-sans);
  font-size: 0.75rem; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.select-wrap select:focus { border-color: var(--clr-emerald); }

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-section {
  position: relative; width: 100%;
  height: calc(100vh - var(--header-height));
  display: flex; flex-direction: column;
  justify-content: center; padding: 48px;
  z-index: 2; overflow-y: auto;
}
.hero-content { max-width: 620px; }
.hero-label {
  font-family: var(--font-mono); font-size: 0.7rem;
  font-weight: 700; letter-spacing: 0.18em;
  color: var(--clr-emerald); text-transform: uppercase;
  margin-bottom: var(--space-xs);
}
.hero-title { margin-bottom: 24px; }
.hero-word {
  display: block;
  font-size: clamp(2.8rem, 6.5vw, 4.2rem);
  font-weight: 900; line-height: 1.05;
  letter-spacing: -0.03em; color: var(--clr-charcoal);
}
.hero-word:nth-child(2) { color: var(--bg-dark); }
.hero-word:nth-child(3) { color: var(--clr-emerald); }

.hero-desc {
  font-size: 0.95rem; line-height: 1.6;
  color: var(--text-muted); margin-bottom: 32px;
}
.hero-cta {
  display: inline-flex; align-items: center;
  gap: var(--space-sm); padding: 14px 32px;
  background: var(--bg-dark); border: none;
  border-radius: var(--radius-md); color: var(--clr-white);
  font-size: 0.85rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  cursor: pointer; transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}
.hero-cta:hover {
  background: #154F3C; transform: translateY(-1px);
}

/* Stats */
.hero-stats {
  position: absolute; right: 48px; top: 50%;
  transform: translateY(-50%); display: flex;
  flex-direction: column; gap: 20px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 28px; border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: var(--shadow-lg); width: 260px;
}
.stat-item {
  text-align: right; border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}
.stat-item:last-child { border-bottom: none; padding-bottom: 0; }
.stat-number {
  font-size: 1.9rem; font-weight: 900;
  line-height: 1; color: var(--bg-dark);
}
.stat-label {
  font-family: var(--font-mono); font-size: 0.55rem;
  color: var(--text-muted); text-transform: uppercase; margin-top: 2px;
}
.hero-scroll-hint { display: none; }

/* Reveal Animations */
.anim-reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1),
              transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
.anim-reveal.revealed { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   APP MAIN GRID
   ========================================================================== */
.app-main { display: none; flex: 1; overflow: hidden; }
.app-main.active { display: flex; }

/* ==========================================================================
   CHAT PANEL
   ========================================================================== */
.chat-panel {
  display: flex; flex-direction: column;
  flex: 1; min-width: 0; background: transparent;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(15,61,46,0.15); border-radius: var(--radius-full);
}

/* Welcome Screen */
.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: 24px;
}
.welcome-icon {
  font-size: 2.5rem; margin-bottom: 12px; color: var(--bg-dark);
}
.welcome-screen h2 {
  font-size: 1.45rem; font-weight: 800;
  margin-bottom: 6px; color: var(--clr-charcoal);
}
.welcome-screen p {
  color: var(--text-muted); font-size: 0.88rem;
  max-width: 400px; margin-bottom: 32px;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm); max-width: 580px; width: 100%;
}
.quick-action-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--clr-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); color: var(--clr-charcoal);
  font-family: var(--font-sans); font-size: 0.78rem;
  font-weight: 600; cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.quick-action-btn:hover {
  background: var(--bg-hover); border-color: var(--clr-emerald);
  transform: translateY(-1px);
}
.quick-action-btn .qa-icon { font-size: 1.15rem; }

/* Chat Messages */
.message {
  display: flex; gap: 12px; margin-bottom: 20px;
  width: 100%; max-width: 820px;
}
.message-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-dark); color: var(--clr-gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
  margin-top: 4px; flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.message-content {
  flex: 1; background: var(--clr-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-md); color: var(--clr-charcoal);
  font-size: 0.88rem; transition: all 0.3s ease;
}
.message.assistant .message-content {
  box-shadow: var(--shadow-md), var(--shadow-active-green);
  border-left: 3px solid var(--clr-emerald);
}
.message.user {
  margin-left: auto; max-width: 600px; justify-content: flex-end;
}
.message.user .message-avatar {
  background: var(--clr-charcoal); color: var(--clr-gold); order: 2;
}
.message.user .message-content {
  background: #EFEFEF; border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md), var(--shadow-active-gold);
  border-right: 3px solid var(--clr-gold); order: 1;
}
.message.emergency .message-content {
  border-left: 4px solid var(--clr-danger); background: #FFF5F5;
  box-shadow: var(--shadow-md), 0 0 15px rgba(215,38,56,0.15);
}
.message-text { line-height: 1.65; }

/* Message markdown rendering */
.message-text strong { font-weight: 700; color: var(--clr-charcoal); }
.message-text em { font-style: italic; color: var(--text-secondary); }
.message-text ul { margin: 8px 0; padding-left: 18px; }
.message-text ul li { margin-bottom: 4px; line-height: 1.5; }
.message-text code.inline-code {
  font-family: var(--font-mono); font-size: 0.8em;
  background: #F3F4F6; padding: 1px 5px;
  border-radius: 4px; color: var(--bg-dark);
}

/* Typing Indicator */
.message .typing-indicator { display: inline-flex; gap: 4px; }
.message .typing-indicator span {
  width: 6px; height: 6px; background: var(--bg-dark);
  border-radius: 50%; animation: blink 1.4s infinite both;
}
.message .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.message .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(215,38,56,0.3); }
  50% { box-shadow: 0 0 12px 4px rgba(215,38,56,0.15); }
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px 24px; border-top: 1px solid var(--border-color);
  background: var(--clr-white); position: relative;
}
.input-row {
  display: flex; align-items: center; gap: var(--space-sm);
  background: rgba(243,244,246,0.8);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 6px 14px;
  transition: all 0.3s ease;
}
.input-row:focus-within {
  border-color: var(--clr-emerald);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.12);
  background: var(--clr-white);
}
.input-row input {
  flex: 1; background: transparent; border: none;
  color: var(--clr-charcoal); font-family: var(--font-sans);
  font-size: 0.88rem; padding: 10px 4px; outline: none;
}
.input-row input::placeholder { color: var(--text-muted); }

.mic-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
}
.mic-btn:hover { background: rgba(0,0,0,0.05); color: var(--clr-charcoal); }
.mic-btn.recording {
  color: var(--clr-danger); background: #FFF5F5;
  animation: pulseRecording 1s infinite alternate;
}
@keyframes pulseRecording {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  border: none; background: var(--bg-dark); color: var(--clr-white);
  cursor: pointer; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.send-btn:hover { background: #154F3C; transform: scale(1.05); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.input-info {
  display: flex; justify-content: space-between;
  align-items: center; margin-top: 6px; padding: 0 4px;
}
.input-info span { font-size: 0.65rem; color: var(--text-muted); }
.status-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 4px;
}
.status-dot.online { background: var(--clr-emerald); }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width); background: var(--clr-white);
  border-left: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border-color);
  background: #F9FAFB;
}
.sidebar-tab {
  flex: 1; padding: 12px var(--space-md);
  background: transparent; border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted); font-family: var(--font-sans);
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer; transition: all 0.3s ease;
}
.sidebar-tab:hover { color: var(--clr-charcoal); }
.sidebar-tab.active {
  color: var(--bg-dark); border-bottom-color: var(--clr-emerald);
}
.sidebar-content {
  flex: 1; overflow-y: auto; padding: 16px;
}

/* Stadium Map */
.map-container {
  background: var(--bg-dark); border-radius: var(--radius-lg);
  border: 2px solid var(--clr-charcoal);
  overflow: hidden; margin-bottom: var(--space-md);
  box-shadow: var(--shadow-md); position: relative;
}
.map-container::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 50%, transparent 50%);
  background-size: 20px 100%; pointer-events: none;
}
.map-canvas-wrap {
  position: relative; width: 100%; padding-bottom: 100%;
}
.map-canvas-wrap svg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.map-legend {
  display: flex; gap: 12px; padding: 12px;
  background: var(--clr-white);
  border-top: 1px solid var(--border-color); justify-content: center;
}
.legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.65rem; font-weight: 700; color: var(--clr-charcoal);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Fan Profiles */
.fan-profile-selector h4,
.control-section h4 {
  font-size: 0.72rem; font-weight: 800;
  color: var(--clr-charcoal); margin-bottom: 8px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.fan-cards {
  display: flex; flex-direction: column;
  gap: var(--space-sm); margin-bottom: 24px;
}
.fan-card {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 12px var(--space-md); background: var(--clr-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: all 0.2s ease; box-shadow: var(--shadow-sm);
}
.fan-card:hover {
  background: var(--bg-hover); transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.fan-card.active {
  border-color: var(--clr-emerald); border-width: 2px;
  background: #F0FAF5;
  box-shadow: var(--shadow-md), var(--shadow-active-green);
}
.fan-emoji { font-size: 1.15rem; }
.fan-info { flex: 1; min-width: 0; }
.fan-name { font-size: 0.8rem; font-weight: 800; color: var(--clr-charcoal); }
.fan-desc { font-size: 0.65rem; color: var(--text-muted); }
.fan-badge {
  display: inline-block; padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.55rem; font-weight: 800;
}
.fan-badge.wheelchair { background: #E0F2FE; color: #0284C7; }
.fan-badge.lang { background: #FEF3C7; color: #D97706; }

/* Control Panel */
.control-panel { display: none; }
.control-panel.visible { display: block; }
.control-section { margin-bottom: 24px; }
.gate-control {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 8px 12px; background: var(--clr-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md); margin-bottom: 6px;
}
.gate-control .gate-name {
  font-family: var(--font-mono); font-size: 0.72rem;
  font-weight: 700; min-width: 60px; color: var(--clr-charcoal);
}
.gate-control input[type="range"] {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: #E5E7EB; border-radius: var(--radius-full);
  outline: none; cursor: pointer;
}
.gate-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg-dark); cursor: pointer;
}
.gate-control .density-value {
  font-family: var(--font-mono); font-size: 0.72rem;
  font-weight: 700; min-width: 32px; text-align: right;
}

/* Toggle Switch */
.toggle-switch {
  position: relative; width: 34px; height: 18px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #D1D5DB; border-radius: var(--radius-full);
  transition: all 0.2s ease;
}
.toggle-switch .slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 2px; bottom: 2px;
  background: var(--clr-white); border-radius: 50%;
  box-shadow: var(--shadow-sm); transition: all 0.2s ease;
}
.toggle-switch input:checked + .slider { background: var(--clr-emerald); }
.toggle-switch input:checked + .slider::before { transform: translateX(16px); }

/* Trace Logger */
.trace-entry {
  padding: 12px; background: var(--clr-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs); box-shadow: var(--shadow-sm);
}
.trace-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 6px;
}
.trace-intent {
  font-family: var(--font-mono); font-size: 0.6rem;
  font-weight: 700; padding: 2px 6px;
  background: #F3F4F6; border-radius: var(--radius-sm);
  color: var(--clr-charcoal);
}
.trace-time {
  font-family: var(--font-mono); font-size: 0.55rem;
  color: var(--text-muted);
}
.trace-pipeline {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.trace-step { font-size: 0.6rem; color: var(--text-muted); }
.trace-arrow { color: var(--border-color); font-size: 0.6rem; }
.trace-latency {
  font-family: var(--font-mono); font-size: 0.6rem;
  font-weight: 700; color: var(--clr-emerald);
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; background-color: var(--bg-dark);
  color: var(--clr-white); border: 1px solid transparent;
  border-radius: var(--radius-md); font-family: var(--font-sans);
  font-size: 0.8rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition-fast);
}
.btn:hover { background-color: #154F3C; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--radius-full); background-color: #F3F4F6;
  color: var(--clr-charcoal); border: 1px solid var(--border-color);
  font-size: 1rem; display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition-fast);
}
.btn-icon:hover {
  background-color: var(--bg-hover); border-color: var(--clr-emerald);
  color: var(--clr-emerald);
}
.btn-danger { background-color: var(--clr-danger); color: var(--clr-white); }
.btn-danger:hover { background-color: #be1c2c; }

/* Sidebar Close (mobile) */
.sidebar-close-btn {
  display: none; background: transparent; border: none;
  color: var(--text-muted); font-size: 1.1rem;
  padding: 0 16px; cursor: pointer;
  align-items: center; justify-content: center;
  transition: color var(--transition-fast);
}
.sidebar-close-btn:hover { color: var(--clr-danger); }

/* ==========================================================================
   TELEMETRY CARD
   ========================================================================== */
.telemetry-card {
  background: var(--clr-white); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-md); margin-top: 16px;
}
.telemetry-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color); padding-bottom: 8px;
}
.telemetry-title {
  font-size: 0.72rem; font-weight: 800;
  color: var(--clr-charcoal); letter-spacing: 0.05em;
  text-transform: uppercase;
}
.telemetry-status {
  font-family: var(--font-mono); font-size: 0.6rem;
  font-weight: 700; color: var(--clr-emerald);
  display: flex; align-items: center; gap: 4px;
}
.telemetry-status::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; background: var(--clr-emerald);
  border-radius: 50%; animation: alertPulse 1.5s infinite;
}
.telemetry-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.telemetry-item { display: flex; flex-direction: column; }
.telemetry-label {
  font-size: 0.6rem; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600;
}
.telemetry-value {
  font-size: 0.82rem; font-weight: 800;
  color: var(--clr-charcoal); margin-top: 2px;
}
.telemetry-value.recommend { color: var(--bg-dark); }

/* ==========================================================================
   MAP HOVER
   ========================================================================== */
#stadium-map circle {
  transition: r var(--transition-fast), fill var(--transition-fast);
}
.chat-link {
  color: var(--clr-emerald); text-decoration: underline; font-weight: 600;
}
.chat-link:hover { color: var(--bg-dark); }

/* ==========================================================================
   EMERGENCY OVERLAY
   ========================================================================== */
.emergency-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(27,27,27,0.4);
  display: flex; align-items: center; justify-content: center;
}
.emergency-box {
  background: var(--clr-white); border-top: 6px solid var(--clr-danger);
  border-radius: var(--radius-xl); padding: 32px;
  max-width: 460px; text-align: center; box-shadow: var(--shadow-lg);
}
.emergency-box h2 {
  font-size: 1.35rem; font-weight: 900;
  color: var(--clr-danger); margin-bottom: 12px; letter-spacing: 0.05em;
}
.emergency-box p {
  color: var(--clr-charcoal); font-size: 0.88rem; line-height: 1.6;
}

/* ==========================================================================
   MOBILE & RESPONSIVE
   ========================================================================== */

/* --- Tablet / Small Desktop --- */
@media (max-width: 900px) {
  .hero-stats { display: none; }
  .sidebar {
    position: fixed; right: -100%;
    top: var(--header-height); bottom: 0;
    width: 85vw; max-width: var(--sidebar-width);
    z-index: 200;
    transition: right 0.35s cubic-bezier(0.16,1,0.3,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { right: 0; }
  .sidebar-toggle-btn { display: flex !important; }
  .sidebar-close-btn { display: flex; }
  .hero-word { font-size: clamp(2rem, 10vw, 3.2rem); }
  .hero-section {
    padding: 24px;
    height: calc(100vh - var(--header-height));
    justify-content: flex-start; padding-top: 48px;
  }
}

@media (min-width: 901px) {
  .sidebar-toggle-btn { display: none !important; }
}

/* --- Phone --- */
@media (max-width: 600px) {
  :root { --header-height: 56px; }
  .app-header { padding: 0 12px; height: 56px; }
  .header-brand .logo-icon { width: 28px; height: 28px; font-size: 0.9rem; }
  .header-brand h1 { font-size: 1rem; }
  .header-brand .subtitle { display: none; }
  .temp-display { padding: 4px 8px; font-size: 0.7rem; }
  .temp-display .temp-icon { display: none; }
  .select-wrap select { padding: 4px 20px 4px 8px; font-size: 0.7rem; }
  .btn-icon { width: 32px; height: 32px; font-size: 0.9rem; }

  .hero-section { padding: 20px; padding-top: 32px; }
  .hero-word { font-size: clamp(1.8rem, 9vw, 2.8rem); }
  .hero-desc { font-size: 0.85rem; margin-bottom: 20px; }
  .hero-cta { padding: 12px 24px; font-size: 0.8rem; }

  .message { margin-bottom: 12px; gap: 8px; }
  .message-avatar { width: 28px; height: 28px; font-size: 0.75rem; }
  .message-content {
    padding: 12px 14px; font-size: 0.82rem;
    border-radius: var(--radius-md);
  }
  .chat-input-area { padding: 10px 12px; }
  .input-row { padding: 4px 10px; border-radius: var(--radius-md); }
  .input-row input { font-size: 0.8rem; padding: 8px 2px; }
  .mic-btn, .send-btn { width: 32px; height: 32px; font-size: 0.95rem; }

  .welcome-screen { padding: 12px; }
  .welcome-screen h2 { font-size: 1.2rem; }
  .welcome-screen p { margin-bottom: 16px; font-size: 0.8rem; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 6px; }
  .quick-action-btn { padding: 8px 10px; font-size: 0.7rem; gap: 6px; }
  .quick-action-btn .qa-icon { font-size: 0.95rem; }

  .sidebar-tab { font-size: 0.65rem; padding: 10px 6px; }
  .fan-card { padding: 10px; }
  .fan-name { font-size: 0.75rem; }
  .fan-desc { font-size: 0.6rem; }
  .telemetry-grid { grid-template-columns: 1fr; gap: 8px; }
}
