:root {
  --primary-bg: #080809;
  --secondary-bg: #12131a;
  --tertiary-bg: #1a1b23;
  --accent-color: #3b82f6;
  --accent-color-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --spacing-unit: 1rem;
  --border-radius: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  line-height: 1.6;
  background-image: radial-gradient(circle at 1px 1px, var(--tertiary-bg) 1px, transparent 0);
  background-size: 40px 40px;
  overflow-y: auto;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 0% 0%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, var(--accent-glow) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

#page {
  display: flex;
  min-height: 100vh;
  padding: calc(var(--spacing-unit) * 3);
  gap: calc(var(--spacing-unit) * 3);
  align-items: stretch;
  max-width: 1800px;
  margin: 0 auto;
  position: relative;
}

#doppler {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(145deg, 
    rgba(26, 27, 35, 0.9),
    rgba(18, 19, 26, 0.95)
  );
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 2);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

#doppler::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    var(--accent-glow),
    transparent 70%
  );
  opacity: 0.5;
  pointer-events: none;
}

#doppler canvas {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--border-radius) - var(--spacing-unit));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#controlsAndDirections {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 2);
  width: 400px;
  min-width: 360px;
}

#controls {
  background: linear-gradient(145deg, 
    var(--secondary-bg),
    var(--tertiary-bg)
  );
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 2);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#controls canvas {
  border-radius: calc(var(--border-radius) - var(--spacing-unit));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 100%;
  height: auto;
  display: block;
}

#controls::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--accent-glow),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#controls:hover::after {
  opacity: 1;
}

#directions {
  background: linear-gradient(145deg,
    var(--secondary-bg),
    var(--tertiary-bg)
  );
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 3);
  user-select: none;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

#directions::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at 0% 0%,
    var(--accent-glow),
    transparent 60%
  );
  opacity: 0.3;
  pointer-events: none;
}

#directions h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, 
    var(--text-primary) 0%,
    var(--accent-color-light) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  display: inline-block;
}

#directions h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, 
    var(--text-primary) 0%, 
    var(--accent-color-light) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: calc(var(--spacing-unit) * 1.5);
  position: relative;
  display: inline-block;
}

#directions h3::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 300%;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--accent-color),
    transparent
  );
  border-radius: 3px;
  margin-top: 8px;
}

#directions p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: calc(var(--spacing-unit) * 1.5);
  line-height: 1.7;
  position: relative;
  padding-left: calc(var(--spacing-unit) * 1.5);
  transition: var(--transition);
}

#directions p:hover {
  color: var(--text-primary);
  transform: translateX(4px);
}

#directions p::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  opacity: 0.7;
  transition: var(--transition);
}

#directions p:hover::before {
  opacity: 1;
  transform: translateX(-4px);
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tertiary-bg);
  color: var(--accent-color-light);
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
  padding: 0.3em 0.8em;
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  margin: 0 0.3em;
  min-width: 1.8em;
  position: relative;
}

.key::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 1px;
  background: linear-gradient(45deg,
    transparent,
    var(--accent-color),
    transparent
  );
  mask: linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
  opacity: 0.5;
}

@media (max-width: 1200px) {
  #page {
    flex-direction: column;
    padding: var(--spacing-unit);
  }

  #controlsAndDirections {
    width: 100%;
    max-width: 800px;
    order: -1;
  }

  #doppler {
    width: 100%;
  }

  #directions {
    padding: calc(var(--spacing-unit) * 2);
  }

  #directions h1 {
    font-size: 2rem;
  }
}

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

#controls:hover, #directions:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--secondary-bg);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    var(--accent-color),
    var(--accent-color-light)
  );
  border-radius: 5px;
  border: 2px solid var(--secondary-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color-light);
}

*:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow),
              0 0 0 1px var(--accent-color);
}

.loading {
  animation: float 3s ease-in-out infinite;
}