:root {
  --hud-bg: #030712;
  --hud-panel-bg: rgba(15, 23, 42, 0.75);
  --hud-border: rgba(0, 229, 255, 0.25);
  --hud-glow: rgba(0, 229, 255, 0.5);
  --neon-cyan: #00e5ff;
  --neon-amber: #ff9100;
  --neon-green: #00e676;
  --neon-purple: #b388ff;
  --text-muted: #94a3b8;
  --text-bright: #f8fafc;
  --font-mono: "SF Mono", "Courier New", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background: var(--hud-bg);
  color: var(--text-bright);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 50% 40%, rgba(0, 229, 255, 0.08) 0%, transparent 60%),
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Header */
.hud-app-wrapper {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.hud-header {
  height: 50px;
  border-bottom: 1px solid var(--hud-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
}

.brand-title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--hud-glow);
}

.header-status {
  display: flex;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.status-pill {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green);
}

/* Main Grid */
.hud-main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

/* Side Panels */
.hud-panel {
  background: var(--hud-panel-bg);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 16px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.05);
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--neon-cyan);
  border-bottom: 1px dashed var(--hud-border);
  padding-bottom: 8px;
  text-transform: uppercase;
}

.metric-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 12px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--neon-cyan);
}

.metric-trend {
  font-size: 10px;
  color: var(--neon-green);
  margin-top: 4px;
}

/* Center Stage: The Arc-Reactor Core */
.hud-core-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.arc-reactor-container {
  width: 260px;
  height: 260px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.ring-outer {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(0, 229, 255, 0.4);
  border-radius: 50%;
  animation: rotateClockwise 20s linear infinite;
}

.ring-middle {
  position: absolute;
  width: 80%;
  height: 80%;
  border: 2px solid rgba(0, 229, 255, 0.3);
  border-top-color: var(--neon-cyan);
  border-bottom-color: var(--neon-amber);
  border-radius: 50%;
  animation: rotateCounter 12s linear infinite;
}

.neural-orb {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #00e5ff 0%, #007799 60%, #030712 100%);
  box-shadow: 0 0 45px var(--neon-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.neural-orb:hover {
  transform: scale(1.05);
  box-shadow: 0 0 65px var(--neon-cyan);
}

.neural-orb.listening {
  background: radial-gradient(circle, #ff9100 0%, #d84315 60%, #030712 100%);
  box-shadow: 0 0 65px var(--neon-amber);
  animation: pulsePulse 1.2s infinite ease-in-out;
}

.neural-orb.speaking {
  background: radial-gradient(circle, #b388ff 0%, #6200ea 60%, #030712 100%);
  box-shadow: 0 0 65px var(--neon-purple);
  animation: pulsePulse 0.8s infinite ease-in-out;
}

.agent-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--text-bright);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Waveform Equalizer */
.waveform-bars {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 24px;
  margin-bottom: 12px;
}

.wave-bar {
  width: 3px;
  height: 6px;
  background: var(--neon-cyan);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.voice-status-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--neon-cyan);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.voice-trigger-btn {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 10px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.voice-trigger-btn:hover {
  background: var(--neon-cyan);
  color: #030712;
  box-shadow: 0 0 20px var(--hud-glow);
}

.voice-trigger-btn.active {
  background: rgba(255, 23, 68, 0.18);
  border-color: #ff1744;
  color: #ff5252;
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.35);
  animation: pulsePulse 1.8s infinite ease-in-out;
}

.voice-trigger-btn.active:hover {
  background: #ff1744;
  color: #ffffff;
  box-shadow: 0 0 25px rgba(255, 23, 68, 0.75);
}

/* Voice Profile Controls */
.voice-engine-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.voice-engine-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--neon-cyan);
  white-space: nowrap;
}

.voice-select-dropdown {
  background: #030712;
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  max-width: 220px;
}

.voice-select-dropdown:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.test-voice-btn {
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.test-voice-btn:hover {
  background: var(--neon-cyan);
  color: #030712;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* Bottom Terminal Console */
.hud-terminal {
  height: 140px;
  background: rgba(3, 7, 18, 0.95);
  border-top: 1px solid var(--hud-border);
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-y: auto;
  line-height: 1.6;
}

.terminal-line {
  color: var(--text-muted);
}

.terminal-line.agent {
  color: var(--neon-cyan);
}

.terminal-line.success {
  color: var(--neon-green);
}

.terminal-line.system {
  color: var(--neon-amber);
}

/* Animations */
@keyframes rotateClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotateCounter {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes pulsePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ==========================================================================
   PIN SECURITY GATE OVERLAY (rudhra.kooothu.com)
   ========================================================================== */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  background: var(--hud-bg);
  background-image: 
    radial-gradient(circle at 50% 35%, rgba(0, 229, 255, 0.12) 0%, transparent 65%),
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  backdrop-filter: blur(20px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.pin-lock-card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--hud-border);
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.2), inset 0 0 25px rgba(0, 229, 255, 0.05);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  backdrop-filter: blur(16px);
}

.lock-icon-container {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--neon-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.4);
}

.lock-ring-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 229, 255, 0.4);
  animation: rotateClockwise 15s linear infinite;
}

.lock-icon {
  font-size: 24px;
}

.lock-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--neon-amber);
  border: 1px solid rgba(255, 145, 0, 0.4);
  background: rgba(255, 145, 0, 0.1);
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 6px;
}

.lock-title {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 1.5px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--hud-glow);
  margin-bottom: 4px;
}

.lock-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.pin-prompt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  min-height: 18px;
  transition: all 0.3s ease;
}

.pin-prompt.granted {
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green);
  font-weight: bold;
}

.pin-prompt.denied {
  color: #ff1744;
  text-shadow: 0 0 10px #ff1744;
  font-weight: bold;
}

/* 6 PIN Digit Input Boxes */
.pin-inputs-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 12px 0;
}

.pin-digit {
  width: 44px;
  height: 52px;
  background: rgba(3, 7, 18, 0.95);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  -webkit-text-security: disc;
}

.pin-digit:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.6);
  transform: scale(1.05);
}

.pin-inputs-container.granted .pin-digit {
  border-color: var(--neon-green);
  color: var(--neon-green);
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.6);
}

.pin-inputs-container.denied {
  animation: accessDeniedShake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

.pin-inputs-container.denied .pin-digit {
  border-color: #ff1744;
  color: #ff1744;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.6);
}

@keyframes accessDeniedShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* On-Screen Keypad */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 260px;
}

.keypad-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-btn:active, .keypad-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
  transform: scale(0.97);
}

.keypad-btn.key-clear {
  color: var(--neon-amber);
  font-size: 12px;
  letter-spacing: 1px;
}

.keypad-btn.key-backspace {
  color: var(--neon-purple);
  font-size: 16px;
}

.lock-footer-info {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Header Lock Button */
.lock-hud-btn {
  background: rgba(255, 145, 0, 0.15);
  border: 1px solid var(--neon-amber);
  color: var(--neon-amber);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 100;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lock-hud-btn:hover {
  background: var(--neon-amber);
  color: #030712;
  box-shadow: 0 0 8px rgba(255, 145, 0, 0.6);
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .hud-header {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .brand-title {
    font-size: 11px;
    letter-spacing: 1.2px;
  }

  .header-status {
    flex-wrap: wrap;
    gap: 10px;
    font-size: 10px;
  }

  .hud-main {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 16px;
    overflow: visible;
  }

  /* Center the Orb at the very top for instant thumb access */
  .hud-core-stage {
    order: 1;
    padding: 24px 0 16px 0;
  }

  .hud-panel {
    order: 2;
  }

  .hud-panel ~ .hud-panel {
    order: 3;
  }

  .arc-reactor-container {
    width: 220px;
    height: 220px;
    margin-bottom: 16px;
  }

  .neural-orb {
    width: 95px;
    height: 95px;
  }

  .voice-trigger-btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-size: 12px;
  }

  .voice-engine-controls {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 320px;
    width: 100%;
  }

  .voice-select-dropdown {
    max-width: 170px;
  }

  .hud-terminal {
    height: 180px;
    padding: 12px 16px;
  }
}
