/* WeAD RedFlag - Quantum Astrological Mind-Tap Design - COMPLETE & MOBILE OPTIMIZED */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@300;400;500;700;900&family=Space+Grotesk:wght@300;400;500;600;700&family=Cinzel:wght@400;500;600&display=swap');

:root {
/* Cosmic Quantum Color Palette */
--cosmic-void: #000000;
--deep-space: #0a0a0a;
--nebula-purple: #16213e;
--stellar-blue: #0f3460;
--quantum-teal: #00d4aa;
--astral-gold: #ffd700;
--cosmic-silver: #c0c0c0;
--mars-red: #ff4757;
--venus-pink: #ff6b9d;
--jupiter-orange: #ffa502;
--saturn-yellow: #f1c40f;
--neptune-blue: #3742fa;
--pluto-violet: #8e44ad;
--mercury-gray: #7f8c8d;

/* Psychology-inspired colors (keeping original functionality) */
--primary-blue: #2c5282;
--secondary-blue: #3182ce;
--accent-teal: #319795;
--warm-gray: #4a5568;
--light-gray: #f7fafc;
--success-green: #38a169;
--warning-orange: #ed8936;
--danger-red: #e53e3e;
--soft-purple: #805ad5;

/* Quantum Gradients */
--primary-gradient: linear-gradient(135deg, #000000 0%, #1a1a2e 50%, #000000 100%);
--safe-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
--alert-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
--danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
--astral-flow: linear-gradient(45deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
--consciousness-wave: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
--mind-portal: conic-gradient(from 0deg at 50% 50%, #667eea, #764ba2, #f093fb, #f5576c, #4facfe, #667eea);
--chakra-energy: linear-gradient(0deg, #ff0000 0%, #ff8000 14%, #ffff00 28%, #00ff00 42%, #0080ff 57%, #4000ff 71%, #8000ff 85%, #ff0080 100%);
--cosmic-aurora: linear-gradient(90deg, #00c9ff 0%, #92fe9d 35%, #ff9a9e 70%, #fecfef 100%);

/* Sacred Geometry & Quantum Fonts */
--font-cosmic: 'Orbitron', monospace;
--font-astral: 'Space Grotesk', sans-serif;
--font-sacred: 'Cinzel', serif;

/* Quantum Spacing (Golden Ratio Based) */
--quantum-xs: 0.618rem;
--quantum-sm: 1rem;
--quantum-md: 1.618rem;
--quantum-lg: 2.618rem;
--quantum-xl: 4.236rem;
--quantum-xxl: 6.854rem;

/* Cosmic Shadows & Auras */
--aura-glow: 0 0 20px rgba(102, 126, 234, 0.6), 0 0 40px rgba(118, 75, 162, 0.4), 0 0 60px rgba(240, 147, 251, 0.2);
--quantum-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
--astral-shadow: 0 15px 35px rgba(102, 126, 234, 0.3), 0 5px 15px rgba(118, 75, 162, 0.2);
--mind-field: 0 0 50px rgba(0, 212, 170, 0.4), 0 0 100px rgba(255, 215, 0, 0.2);
}

/* Quantum Reset & Cosmic Base */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  /* 🎯 MOBILE SCROLL FIX */
  overflow-y: auto !important;
  touch-action: pan-y pinch-zoom !important;
}

body {
  font-family: var(--font-astral), -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--cosmic-void) !important;
  color: var(--cosmic-silver);
  line-height: 1.618;
  
  /* ✅ MOBILE SCROLL SETTINGS */
  position: relative;
  overflow-x: hidden;
  overflow-y: auto !important;
  min-height: 100vh;
  padding: 20px 0;
  
  /* ✅ MOBILE OPTIMIZATIONS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: rgba(0, 255, 255, 0.2);
  
  /* ✅ TOUCH HANDLING */
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
  
  /* Cosmic Background Effects */
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(240, 147, 251, 0.1) 0%, transparent 50%);
}

/* 🎯 MOBILE DEVICE SPECIFIC OPTIMIZATIONS */
.mobile-device {
  font-size: 16px !important; /* Prevent zoom on iOS */
}

.mobile-device body {
  padding: 10px 0 !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  height: auto !important;
  position: relative !important;
}

/* Container - Cosmic Portal */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--quantum-lg);
  position: relative;
  z-index: 1;
  
  /* ✅ MOBILE SCROLL FIX */
  display: block !important;
  height: auto !important;
}

/* 🎯 COSMIC HEADER SECTION */
.cosmic-header {
  text-align: center;
  margin-bottom: var(--quantum-xl);
  position: relative;
  padding: var(--quantum-lg) 0;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--quantum-md);
  margin-bottom: var(--quantum-lg);
}

.quantum-logo {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-core {
  width: 30px;
  height: 30px;
  background: var(--consciousness-wave);
  border-radius: 50%;
  box-shadow: var(--aura-glow);
  animation: pulse-core 2s ease-in-out infinite;
}

.logo-rings {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ring {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: rotate-ring 10s linear infinite;
}

.ring-1 {
  width: 40px;
  height: 40px;
  top: 20px;
  left: 20px;
  border-top-color: var(--quantum-teal);
  animation-duration: 8s;
}

.ring-2 {
  width: 60px;
  height: 60px;
  top: 10px;
  left: 10px;
  border-right-color: var(--astral-gold);
  animation-duration: 12s;
  animation-direction: reverse;
}

.ring-3 {
  width: 80px;
  height: 80px;
  top: 0;
  left: 0;
  border-bottom-color: var(--venus-pink);
  animation-duration: 15s;
}

.brand-text {
  text-align: left;
}

.cosmic-title {
  font-family: var(--font-cosmic);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: var(--aura-glow);
}

.wead-text {
  color: var(--quantum-teal);
  text-shadow: 0 0 20px var(--quantum-teal);
}

.redflag-text {
  color: var(--mars-red);
  text-shadow: 0 0 20px var(--mars-red);
}

.cosmic-subtitle {
  font-family: var(--font-astral);
  font-size: 1.1rem;
  color: var(--cosmic-silver);
  opacity: 0.8;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: center;
  gap: var(--quantum-md);
  margin-top: var(--quantum-lg);
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  font-size: 0.9rem;
}

.status-icon {
  font-size: 1.2rem;
}

/* 🎯 MAIN CONTROL PANEL */
.control-panel {
  display: grid;
  gap: var(--quantum-xl);
}

/* Section Styling */
section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: var(--quantum-lg);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--astral-flow);
  opacity: 0.5;
}

.section-header {
  text-align: center;
  margin-bottom: var(--quantum-lg);
}

.section-header h2 {
  font-family: var(--font-cosmic);
  font-size: 1.8rem;
  color: var(--quantum-teal);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px var(--quantum-teal);
}

.section-description {
  color: var(--cosmic-silver);
  opacity: 0.8;
  font-size: 1rem;
}

/* 🎯 VOICE CONTROLS */
.voice-controls {
  display: flex;
  gap: var(--quantum-sm);
  justify-content: center;
  margin-bottom: var(--quantum-md);
  flex-wrap: wrap;
}

/* ✅ NEW: Language Controls */
.language-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--quantum-sm);
  margin-bottom: var(--quantum-lg);
  padding: var(--quantum-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.language-label {
  color: var(--cosmic-silver);
  font-family: var(--font-astral);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.language-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--cosmic-silver);
  font-family: var(--font-astral);
  font-size: 0.9rem;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
  backdrop-filter: blur(10px);
}

.language-select:focus {
  outline: none;
  border-color: var(--quantum-teal);
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
  color: var(--quantum-teal);
}

.language-select:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--quantum-teal);
}

/* 🎯 ENHANCED BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-astral);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  min-height: 44px; /* Touch-friendly */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--safe-gradient);
  color: white;
  box-shadow: var(--astral-shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--aura-glow), var(--astral-shadow);
}

.btn-secondary {
  background: var(--alert-gradient);
  color: white;
  box-shadow: var(--astral-shadow);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(250, 112, 154, 0.6), var(--astral-shadow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--cosmic-silver);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--quantum-teal);
  color: var(--quantum-teal);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-warning {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  border: 2px solid #ff9800;
  color: white;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #f57c00 0%, #ef6c00 100%);
  border-color: #f57c00;
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-warning.active {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  border-color: #f44336;
  box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
  0% { box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4); }
  50% { box-shadow: 0 6px 20px rgba(244, 67, 54, 0.8); }
  100% { box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4); }
}

.btn-icon {
  font-size: 1.2rem;
}

/* ✅ NEW: System Status Indicator */
.system-status {
  margin: var(--quantum-md) 0;
  padding: var(--quantum-sm);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 212, 170, 0.3);
  backdrop-filter: blur(10px);
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--quantum-sm);
  padding: var(--quantum-sm);
}

.status-icon {
  font-size: 1.5em;
  animation: status-pulse 2s ease-in-out infinite;
}

.status-text {
  font-family: var(--font-cosmic);
  font-size: 0.9em;
  font-weight: 500;
  color: var(--quantum-teal);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Status animations */
@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* Status states */
.status-listening .status-icon {
  color: var(--quantum-teal);
  animation: listening-pulse 1s ease-in-out infinite;
}

.status-analyzing .status-icon {
  color: var(--astral-gold);
  animation: analyzing-spin 1.5s linear infinite;
}

.status-ready .status-icon {
  color: var(--cosmic-silver);
  animation: none;
}

@keyframes listening-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes analyzing-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 🎯 TRANSCRIPT CONTAINER */
.transcript-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  overflow: hidden;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.transcript-header h3 {
  font-family: var(--font-cosmic);
  color: var(--quantum-teal);
  font-size: 1.2rem;
}

.transcript-status {
  padding: 0.25rem 0.75rem;
  background: var(--safe-gradient);
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
  color: white;
}

.transcript-display {
  padding: 1.5rem;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font-astral);
  line-height: 1.6;
  color: var(--cosmic-silver);
  display: block;
  visibility: visible;
  opacity: 1;
}

.placeholder-text {
  color: var(--cosmic-silver);
  opacity: 0.6;
  font-style: italic;
  text-align: center;
}

/* 🎯 ANALYSIS SECTION */
.safety-score-container {
  margin-bottom: var(--quantum-lg);
}

.score-display {
  display: flex;
  align-items: center;
  gap: var(--quantum-lg);
  justify-content: center;
  flex-wrap: wrap;
}

.score-circle {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--mind-portal);
  border-radius: 50%;
  box-shadow: var(--aura-glow);
  animation: rotate-slow 20s linear infinite;
}

.score-value {
  font-family: var(--font-cosmic);
  font-size: 2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.score-label {
  font-size: 0.8rem;
  color: white;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid var(--quantum-teal);
  min-width: 250px;
}

.score-metric {
  font-weight: 500;
  color: var(--cosmic-silver);
}

.score-result {
  font-weight: 600;
  color: var(--quantum-teal);
}

/* 🎯 ANALYSIS RESULTS */
.analysis-results {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  overflow: hidden;
}

.result-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  color: var(--cosmic-silver);
  font-family: var(--font-astral);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.tab-btn.active {
  color: var(--quantum-teal);
  background: rgba(0, 212, 170, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--quantum-teal);
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.tab-content {
  position: relative;
}

.tab-panel {
  display: none;
  padding: 1.5rem;
  min-height: 200px;
}

.tab-panel.active {
  display: block;
}

.analysis-display {
  font-family: var(--font-astral);
  line-height: 1.6;
  color: var(--cosmic-silver);
}

/* 🎯 SETTINGS SECTION */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--quantum-md);
  margin-bottom: var(--quantum-lg);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-group label {
  font-weight: 500;
  color: var(--cosmic-silver);
  font-size: 0.9rem;
}

.setting-select {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--cosmic-silver);
  font-family: var(--font-astral);
  font-size: 0.9rem;
}

.setting-select:focus {
  outline: none;
  border-color: var(--quantum-teal);
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-label::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .toggle-label {
  background: var(--safe-gradient);
}

input:checked + .toggle-label::before {
  transform: translateX(26px);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: var(--quantum-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* 🎯 COSMIC FOOTER */
.cosmic-footer {
  margin-top: var(--quantum-xl);
  padding: var(--quantum-lg) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--quantum-md);
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-cosmic);
  color: var(--cosmic-silver);
}

.footer-logo {
  font-size: 1.5rem;
}

.footer-links {
  display: flex;
  gap: var(--quantum-md);
}

.footer-link {
  color: var(--cosmic-silver);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--quantum-teal);
}

/* Debug Section */
.debug-section {
  margin-top: var(--quantum-lg);
  padding: var(--quantum-md);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-section h3 {
  color: var(--quantum-teal);
  margin-bottom: 1rem;
  font-family: var(--font-cosmic);
}

.debug-log {
  width: 100%;
  height: 200px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 1rem;
  color: var(--cosmic-silver);
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
}

/* 🎯 ANIMATIONS */
@keyframes pulse-core {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes rotate-ring {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: var(--aura-glow); }
  50% { box-shadow: var(--mind-field); }
}

/* 🎯 MOBILE RESPONSIVE DESIGN */
@media (max-width: 768px) {
  html, body {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    height: auto !important;
    position: relative !important;
  }
  
  body {
    font-size: 14px;
    padding: 10px 0;
    touch-action: pan-y pinch-zoom !important;
    overscroll-behavior: contain;
  }
  
  .container {
    padding: 1rem !important;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  .cosmic-title {
    font-size: 2rem;
  }
  
  .logo-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .brand-text {
    text-align: center;
  }
  
  .status-bar {
    flex-direction: column;
    align-items: center;
  }
  
  .voice-controls {
    flex-direction: column;
  }
  
  .voice-controls .btn {
    width: 100%;
    margin-bottom: 10px;
  }
  
  /* ✅ Mobile Language Controls */
  .language-controls {
    flex-direction: column;
    gap: var(--quantum-sm);
    padding: var(--quantum-md);
    margin: 0 var(--quantum-sm);
  }
  
  .language-label {
    font-size: 0.9rem;
  }
  
  .language-select {
    min-width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 1rem;
  }
  
  .btn {
    padding: 14px 24px;
    font-size: 16px;
    min-height: 48px;
    width: 100%;
    margin-bottom: 10px;
    touch-action: manipulation !important;
  }
  
  .score-display {
    flex-direction: column;
    text-align: center;
  }
  
  .score-item {
    min-width: auto;
    width: 100%;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    gap: 1rem;
  }
  
  .footer-brand {
    justify-content: center;
    text-align: center;
  }
  
  .footer-links {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .result-tabs {
    flex-direction: column;
  }
  
  .tab-btn {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .tab-btn:last-child {
    border-bottom: none;
  }
  
  /* 🎯 MOBILE PERFORMANCE OPTIMIZATIONS */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Re-enable essential animations */
  .loading-spinner {
    animation: spin 1s linear infinite !important;
  }
  
  /* Loading text styles */
  .loading-text {
    color: var(--quantum-teal);
    font-size: 1.1rem;
    text-align: center;
    font-family: var(--font-astral);
  }
  
  /* Transcript text styles */
  .interim-text {
    color: var(--astral-gold);
    font-style: italic;
    margin-bottom: 0.5rem;
    min-height: 1.2em;
    display: block;
    visibility: visible;
    opacity: 1;
  }
  
  .final-text {
    color: var(--success-green);
    font-weight: 600;
    margin-bottom: 0.5rem;
    min-height: 1.2em;
    display: block;
    visibility: visible;
    opacity: 1;
  }
  
  .score-circle {
    animation: none !important;
  }
}

/* 🎯 TABLET RESPONSIVE */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 1.5rem;
  }
  
  .cosmic-title {
    font-size: 2.2rem;
  }
  
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 🎯 LARGE DESKTOP */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
  
  .control-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "voice analysis"
      "settings settings";
  }
  
  .voice-section {
    grid-area: voice;
  }
  
  .analysis-section {
    grid-area: analysis;
  }
  
  .settings-section {
    grid-area: settings;
  }
}

/* 🎯 HIGH DPI DISPLAYS */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .cosmic-title {
    text-shadow: var(--aura-glow), 0 0 5px rgba(255, 255, 255, 0.5);
  }
  
  .btn {
    box-shadow: var(--quantum-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* 🎯 DARK MODE ENHANCEMENTS */
@media (prefers-color-scheme: dark) {
  :root {
    --cosmic-void: #000000;
    --deep-space: #050505;
  }
  
  body {
    background: var(--cosmic-void) !important;
  }
}

/* 🎯 REDUCED MOTION ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .quantum-logo .logo-core {
    animation: none;
  }
  
  .ring {
    animation: none;
  }
  
  .score-circle {
    animation: none;
  }
}

/* 🎯 HIGH CONTRAST MODE */
@media (prefers-contrast: high) {
  :root {
    --cosmic-silver: #ffffff;
    --quantum-teal: #00ffff;
    --mars-red: #ff0000;
    --astral-gold: #ffff00;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
  
  .section {
    border: 2px solid rgba(255, 255, 255, 0.3);
  }
}

/* 🎯 PRINT STYLES */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  .cosmic-header,
  .voice-controls,
  .action-buttons,
  .debug-section {
    display: none;
  }
  
  .analysis-display,
  .transcript-display {
    background: white;
    border: 1px solid black;
    padding: 1rem;
  }
}

/* 🎯 FOCUS ACCESSIBILITY */
.btn:focus,
.setting-select:focus,
.toggle-switch input:focus + .toggle-label {
  outline: 2px solid var(--quantum-teal);
  outline-offset: 2px;
}

/* 🎯 LOADING STATES */
.loading-state {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--quantum-teal);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* 🎯 ERROR STATES */
.error-state {
  border-color: var(--mars-red);
  background: rgba(255, 71, 87, 0.1);
}

.error-message {
  color: var(--mars-red);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-message::before {
  content: '⚠️';
}

/* 🎯 SUCCESS STATES */
.success-state {
  border-color: var(--success-green);
  background: rgba(56, 161, 105, 0.1);
}

.success-message {
  color: var(--success-green);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.success-message::before {
  content: '✅';
}

/* 🎯 CUSTOM SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--quantum-teal);
  border-radius: 4px;
  opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--astral-gold);
  opacity: 1;
}

/* 🎯 SELECTION STYLING */
::selection {
  background: var(--quantum-teal);
  color: var(--cosmic-void);
}

::-moz-selection {
  background: var(--quantum-teal);
  color: var(--cosmic-void);
}

/* 🎯 PLACEHOLDER STYLING */
::placeholder {
  color: var(--cosmic-silver);
  opacity: 0.6;
}

::-webkit-input-placeholder {
  color: var(--cosmic-silver);
  opacity: 0.6;
}

::-moz-placeholder {
  color: var(--cosmic-silver);
  opacity: 0.6;
}

/* 🎯 UTILITY CLASSES */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-sm { margin-bottom: var(--quantum-sm); }
.mb-md { margin-bottom: var(--quantum-md); }
.mb-lg { margin-bottom: var(--quantum-lg); }

.mt-sm { margin-top: var(--quantum-sm); }
.mt-md { margin-top: var(--quantum-md); }
.mt-lg { margin-top: var(--quantum-lg); }

.p-sm { padding: var(--quantum-sm); }
.p-md { padding: var(--quantum-md); }
.p-lg { padding: var(--quantum-lg); }

.hidden { display: none; }
.visible { display: block; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* 🎯 COMPONENT STATES */
.is-active {
  background: var(--safe-gradient);
  color: white;
  box-shadow: var(--aura-glow);
}

.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.is-loading {
  position: relative;
  color: transparent;
}

.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--quantum-teal);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* 🎯 FINAL SPIN ANIMATION */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 🎯 MOBILE DEVICE FINAL OPTIMIZATIONS */
@media (max-width: 480px) {
  .cosmic-title {
    font-size: 1.8rem;
  }
  
  .quantum-logo {
    width: 60px;
    height: 60px;
  }
  
  .logo-core {
    width: 20px;
    height: 20px;
  }
  
  .ring-1 {
    width: 30px;
    height: 30px;
    top: 15px;
    left: 15px;
  }
  
  .ring-2 {
    width: 45px;
    height: 45px;
    top: 7.5px;
    left: 7.5px;
  }
  
  .ring-3 {
    width: 60px;
    height: 60px;
    top: 0;
    left: 0;
  }
  
  .score-circle {
    width: 100px;
    height: 100px;
  }
  
  .score-value {
    font-size: 1.5rem;
  }
  
  .section {
    padding: 1rem;
  }
  
  .transcript-display {
    min-height: 100px;
    max-height: 200px;
  }
  
  .debug-log {
    height: 150px;
  }
}

/* 🎯 VERY SMALL SCREENS */
@media (max-width: 320px) {
  .container {
    padding: 0.5rem !important;
  }
  
  .cosmic-title {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .section {
    padding: 0.75rem;
  }
}

/* 🎯 LANDSCAPE MOBILE */
@media (max-width: 768px) and (orientation: landscape) {
  .logo-container {
    flex-direction: row;
    gap: 1rem;
  }
  
  .brand-text {
    text-align: left;
  }
  
  .cosmic-title {
    font-size: 1.8rem;
  }
  
  .status-bar {
    flex-direction: row;
    justify-content: center;
  }
}

/* 🎯 SAFE AREA INSETS (iPhone X+) */
@supports (padding: max(0px)) {
  body {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* 🎯 FINAL MOBILE SCROLL ENFORCEMENT */
@media (max-width: 768px) {
  html {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  body {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  
  .container {
    position: relative !important;
    height: auto !important;
    display: block !important;
  }
}

/* Mobile Error Popups */
.mobile-error-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.error-content {
  background: var(--cosmic-void);
  border: 2px solid var(--quantum-red);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  max-width: 300px;
}

.mobile-recording {
  background: radial-gradient(circle, rgba(255,68,68,0.1) 0%, var(--cosmic-void) 100%);
}

