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

:root {
  --bg: #03060b;
  --bg-secondary: #0a131d;
  --hud: rgba(10, 19, 29, 0.6);
  --accent: #58f49c;
  --accent-dim: rgba(88, 244, 156, 0.3);
  --text: #e0f0ff;
  --text-dim: rgba(224, 240, 255, 0.5);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Orbitron', sans-serif;
  color: var(--text);
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(88, 244, 156, 0.02) 80px, rgba(88, 244, 156, 0.02) 81px),
    repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(88, 244, 156, 0.02) 80px, rgba(88, 244, 156, 0.02) 81px);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
}

.star-field {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.connection-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(3, 6, 11, 0.9);
  backdrop-filter: blur(10px);
}

.connection-panel.hidden {
  display: none;
}

.panel-content {
  background: var(--hud);
  border: 1px solid var(--accent-dim);
  border-radius: 20px;
  padding: 50px 60px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 0 60px rgba(88, 244, 156, 0.1),
    inset 0 0 30px rgba(88, 244, 156, 0.05);
}

.title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 8px;
  margin-bottom: 5px;
  background: linear-gradient(135deg, #58f49c, #22d77f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(88, 244, 156, 0.5);
}

.subtitle {
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--text-dim);
  margin-bottom: 40px;
}

.qr-container {
  position: relative;
  display: inline-block;
  margin-bottom: 25px;
}

.qr-code {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--bg);
  padding: 10px;
}

.qr-glow {
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  border-radius: 20px;
  background: radial-gradient(circle, rgba(88, 244, 156, 0.2), transparent 70%);
  pointer-events: none;
  animation: qrPulse 3s infinite;
}

@keyframes qrPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.room-id {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.waiting-text {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 15px;
  letter-spacing: 2px;
}

.dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.instruction {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.hud-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 50;
}

.hud-overlay.hidden {
  display: none;
}

.status-pill {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--hud);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-dim);
  border-radius: 30px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(88, 244, 156, 0.12);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.color-selector {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: var(--btn-color);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 15px var(--btn-color);
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: white;
  box-shadow: 0 0 25px var(--btn-color), 0 0 5px white;
  transform: scale(1.15);
}

.speed-indicator {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.speed-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.speed-bar {
  width: 200px;
  height: 6px;
  background: rgba(88, 244, 156, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.speed-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #22d77f);
  border-radius: 3px;
  transition: width 0.1s;
  box-shadow: 0 0 15px var(--accent);
}

.instructions-overlay {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
}

.instructions-overlay.hidden {
  display: none;
}

.instructions-content {
  background: var(--hud);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-dim);
  border-radius: 16px;
  padding: 20px 30px;
  text-align: center;
}

.instructions-content p {
  font-size: 14px;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.dismiss-btn {
  background: linear-gradient(135deg, #22d77f, #58f49c);
  border: none;
  color: #000;
  padding: 10px 25px;
  border-radius: 25px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.2s;
}

.dismiss-btn:hover {
  transform: scale(1.05);
}

.audio-prompt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 6, 11, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  cursor: pointer;
}

.audio-prompt.hidden {
  display: none;
}

.audio-content {
  text-align: center;
}

.audio-icon {
  font-size: 60px;
  margin-bottom: 20px;
  animation: audioFloat 2s ease-in-out infinite;
}

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

.audio-content p {
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.footer {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-dim);
  z-index: 10;
  letter-spacing: 1px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--accent);
}

@media (max-width: 768px) {
  .panel-content {
    padding: 30px 25px;
    margin: 20px;
  }
  
  .title {
    font-size: 24px;
    letter-spacing: 4px;
  }
  
  .qr-code {
    width: 160px;
    height: 160px;
  }
  
  .color-selector {
    top: auto;
    bottom: 140px;
    right: 50%;
    transform: translateX(50%);
  }
  
  .status-pill {
    top: 10px;
    left: 10px;
    padding: 8px 15px;
    font-size: 10px;
  }
}