:root {
  --primary-color: #4A6CF7;
  --secondary-color: #2EC5CE;
  --quantum-purple: #8B5CF6;
  --quantum-blue: #3B82F6;
  --quantum-cyan: #06B6D4;
  --dark-color: #121212;
  --light-color: #f4f7ff;
  --text-color: #27272E;
  --text-light: #767676;
  --bg-color: #ffffff;
  --bg-secondary: #f8f9ff;
  --bg-dark: #1a1a2e;
  --border-color: #e9ebf0;
  --success-color: #00c07f;
  --warning-color: #f7c32e;
  --error-color: #fc5757;
  --transition: all 0.3s ease;
  --shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  --quantum-glow: 0 0 20px rgba(139, 92, 246, 0.3);
  --font-primary: 'Roboto', sans-serif;
  --font-mono: 'Roboto Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  color: var(--text-color);
  line-height: 1.6;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navigation */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 8px 16px;
  border-radius: 5px;
}

.nav-link:hover {
  color: var(--primary-color);
  background: var(--bg-secondary);
}

/* Hero Section */
.hero-section {
  padding: 120px 0 60px;
  text-align: center;
  color: white;
}

.hero-content h1 {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  background: linear-gradient(45deg, #fff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 1.3rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

.realm-subtitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.1rem;
  opacity: 0.8;
}

.realm-subtitle i {
  font-size: 1.5rem;
  color: var(--quantum-cyan);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Visualization Section */
.visualization-section {
  padding: 60px 0;
  background: var(--bg-color);
  border-radius: 30px 30px 0 0;
  margin-top: -30px;
  position: relative;
  z-index: 1;
}

.viz-header {
  text-align: center;
  margin-bottom: 50px;
}

.viz-header h2 {
  font-size: 2.5rem;
  color: var(--text-color);
  margin-bottom: 15px;
}

.viz-header p {
  font-size: 1.1rem;
  color: var(--text-light);
}

/* Bloch Container */
.bloch-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  margin-bottom: 50px;
}

.bloch-visualization {
  position: relative;
  background: var(--bg-dark);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 600px;
}

#bloch-sphere-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 10;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(139, 92, 246, 0.3);
  border-top: 3px solid var(--quantum-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Controls Panel */
.controls-panel {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--shadow);
  height: fit-content;
}

.control-section {
  margin-bottom: 30px;
}

.control-section h3 {
  font-size: 1.2rem;
  color: var(--text-color);
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 5px;
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-color);
}

.control-group input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  margin-bottom: 5px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group span {
  font-weight: 500;
  color: var(--primary-color);
  font-family: var(--font-mono);
}

/* Buttons */
.gate-buttons, .preset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gate-btn, .preset-btn {
  padding: 10px 15px;
  border: 2px solid var(--primary-color);
  background: white;
  color: var(--primary-color);
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-mono);
}

.gate-btn:hover, .preset-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

.preset-btn {
  border-color: var(--quantum-purple);
  color: var(--quantum-purple);
}

.preset-btn:hover {
  background: var(--quantum-purple);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* State Info */
.state-info {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid var(--quantum-purple);
}

.state-info h3 {
  color: var(--text-color);
  margin-bottom: 15px;
}

.state-vector {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: white;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
}

.state-coords {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Explanation Section */
.explanation-section {
  margin-top: 50px;
}

.explanation-card {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.explanation-card h3 {
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 20px;
}

.explanation-card p {
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.7;
}

.explanation-card ul {
  list-style: none;
  padding-left: 0;
}

.explanation-card li {
  padding: 8px 0;
  color: var(--text-light);
  border-bottom: 1px solid var(--border-color);
}

.explanation-card li:last-child {
  border-bottom: none;
}

.explanation-card strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* Footer */
.footer {
  background: var(--bg-dark);
  color: white;
  text-align: center;
  padding: 30px 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .bloch-container {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .hero-content h1 {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  
  .controls-panel {
    padding: 20px;
  }
  
  .gate-buttons, .preset-buttons {
    grid-template-columns: 1fr;
  }
  
  .nav-actions {
    gap: 10px;
  }
  
  .nav-link {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1.1rem;
  }
  
  .viz-header h2 {
    font-size: 2rem;
  }
}

