:root {
  --neon-primary: #00ffaa;
  --neon-secondary: #ff00ff;
  --neon-blue: #00aaff;
  --dark-bg: #050505;
}

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

body {
  background: radial-gradient(circle at 20% 30%, #0a0f0a 0%, #000000 100%);
  font-family: 'Space Grotesk', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Particle Network Background */
.particle-network {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: 
    radial-gradient(circle at 20% 40%, rgba(0, 255, 170, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(0, 255, 170, 0.02) 1px, transparent 1px);
  background-size: 50px 50px, 80px 80px;
}

/* Cyber Grid Floor */
.cyber-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: 
    linear-gradient(var(--neon-primary) 1px, transparent 1px),
    linear-gradient(90deg, var(--neon-primary) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.08;
  transform: perspective(800px) rotateX(65deg) translateY(-20%);
  animation: gridShift 15s linear infinite;
}

@keyframes gridShift {
  0% { transform: perspective(800px) rotateX(65deg) translateY(-20%); }
  100% { transform: perspective(800px) rotateX(65deg) translateY(40%); }
}

/* Main Chassis with Aggressive Cuts */
.chassis {
  position: relative;
  background: linear-gradient(135deg, #0a0f0a, #050505);
  clip-path: polygon(
    0 30px, 30px 0, 
    calc(100% - 30px) 0, 100% 30px, 
    100% calc(100% - 30px), calc(100% - 30px) 100%, 
    30px 100%, 0 calc(100% - 30px)
  );
  padding: 3px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chassis:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 255, 170, 0.2);
}

/* Rotating Energy Ring */
.chassis::before {
  content: '';
  position: absolute;
  inset: -3px;
  background: conic-gradient(from 0deg, transparent, var(--neon-primary), transparent 60%);
  clip-path: polygon(
    0 30px, 30px 0, 
    calc(100% - 30px) 0, 100% 30px, 
    100% calc(100% - 30px), calc(100% - 30px) 100%, 
    30px 100%, 0 calc(100% - 30px)
  );
  animation: rotateRing 3s linear infinite;
  z-index: -1;
}

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

.inner-panel {
  background: rgba(8, 12, 8, 0.95);
  backdrop-filter: blur(20px);
  clip-path: polygon(
    0 28px, 28px 0, 
    calc(100% - 28px) 0, 100% 28px, 
    100% calc(100% - 28px), calc(100% - 28px) 100%, 
    28px 100%, 0 calc(100% - 28px)
  );
  padding: 2.5rem 2rem;
}

/* Glitch Title */
.glitch-title {
  font-family: 'Orbitron', monospace;
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-primary), var(--neon-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0%, 90%, 100% { transform: skew(0); text-shadow: none; }
  91% { transform: skew(5deg); text-shadow: -3px 0 var(--neon-secondary); }
  93% { transform: skew(-5deg); text-shadow: 3px 0 var(--neon-primary); }
}

/* Input Module */
.input-module {
  position: relative;
  background: #001a11;
  border: 1px solid #00ffaa30;
  clip-path: polygon(15px 0, 100% 0, 100% 70%, calc(100% - 15px) 100%, 0 100%, 0 15px);
  transition: all 0.3s;
}

.input-module:focus-within {
  border-color: var(--neon-primary);
  box-shadow: 0 0 20px rgba(0, 255, 170, 0.3);
}

.input-module input {
  background: #000000;
  width: 100%;
  padding: 1.25rem;
  color: var(--neon-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  outline: none;
  clip-path: inherit;
}

/* Warp Button */
.btn-warp {
  background: linear-gradient(95deg, #00cc77, #009955);
  color: black;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  width: 100%;
  padding: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  clip-path: polygon(0 0, 85% 0, 100% 30%, 100% 100%, 15% 100%, 0 70%);
  transition: all 0.3s;
  cursor: pointer;
  border: none;
}

.btn-warp:hover:not(:disabled) {
  filter: brightness(1.2) drop-shadow(0 0 15px var(--neon-primary));
  letter-spacing: 4px;
  transform: translateY(-2px);
}

.btn-warp:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Code Display */
.code-display {
  background: linear-gradient(135deg, var(--neon-primary), var(--neon-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(0, 255, 170, 0.5);
  word-break: break-all;
}

/* Module Grid */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 1.5rem;
}

.module-btn {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #00ffaa30;
  padding: 12px 8px;
  color: var(--neon-primary);
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  transition: all 0.3s;
  text-decoration: none;
  display: block;
}

.module-btn:hover {
  background: var(--neon-primary);
  color: black;
  border-color: var(--neon-primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 255, 170, 0.3);
}

.module-btn i {
  font-size: 1.2rem;
  display: block;
  margin-bottom: 6px;
}

/* Audio Bracket */
.audio-bracket {
  margin-top: 2rem;
  background: rgba(0, 0, 0, 0.8);
  padding: 1rem;
  border-left: 3px solid var(--neon-primary);
  border-right: 3px solid var(--neon-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-btn {
  width: 40px;
  height: 40px;
  background: rgba(0, 255, 170, 0.1);
  border: 1px solid var(--neon-primary);
  color: var(--neon-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}

.audio-btn:hover {
  background: var(--neon-primary);
  color: black;
  transform: scale(1.05);
}

.volume-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  background: #1f9a6e;
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 0;
  background: var(--neon-primary);
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* Error Modal */
.error-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.error-modal.show {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Utility Classes */
.hidden {
  display: none;
}

.text-neon {
  color: var(--neon-primary);
}

.border-neon {
  border-color: var(--neon-primary);
}

/* Pairing method selector active state */
.pair-method-active {
  border-color: var(--neon-primary) !important;
  background: rgba(0, 255, 170, 0.1) !important;
  color: var(--neon-primary) !important;
}
