/* CSS Design System for Real-Time Spirit Bomb Web App */

:root {
  --bg-dark: #05060f;
  --bg-panel: rgba(13, 17, 34, 0.65);
  --bg-panel-solid: #0d1122;
  --border-glow: rgba(0, 255, 128, 0.2);
  --border-glass: rgba(255, 255, 255, 0.07);
  
  /* Sci-fi Neon Color Palette */
  --neon-green: #00ffd2; /* Cute electric teal/cyan */
  --neon-orange: #fff600; /* Bright electric yellow */
  --neon-red: #ff00a0; /* Cute hot pink for electric burst */
  --neon-blue: #00d8ff; /* Vivid electric blue */
  
  /* Text Colors */
  --text-main: #f3f4f9;
  --text-muted: #858da8;
  --text-glow: rgba(0, 255, 102, 0.5);
  
  /* Gradients */
  --grad-spirit-bomb: linear-gradient(135deg, var(--neon-green), var(--neon-orange), var(--neon-red));
  --grad-panel: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.2) 100%);
  
  /* Fonts */
  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 42, 75, 0.05) 0%, transparent 40%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-green);
}

/* Utility Glassmorphism Class */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border-radius: 12px;
}

/* Overlay & Intro Card */
.overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 4, 10, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.start-card {
  width: 90%;
  max-width: 500px;
  padding: 40px;
  text-align: center;
  border-top: 3px solid var(--neon-green);
  animation: cardGlow 3s infinite alternate;
}

.glow-logo {
  margin-bottom: 25px;
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: var(--grad-spirit-bomb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(0, 255, 102, 0.3));
}

.logo-subtitle {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  letter-spacing: 6px;
  color: var(--neon-blue);
  margin-top: 5px;
}

.intro-text {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 25px;
  font-size: 1.05rem;
}

.requirements {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.02);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.req-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
}

.req-item .icon {
  font-size: 1.2rem;
}

/* Neon Start Button */
.btn-neon {
  position: relative;
  background: transparent;
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-family: var(--font-heading);
  padding: 15px 35px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-neon:hover {
  background: var(--neon-green);
  color: var(--bg-dark);
  box-shadow: 0 0 25px var(--neon-green);
}

/* System Loading Page */
.system-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.spinner-container {
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(0, 240, 255, 0.1);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s infinite linear;
}

.loading-status {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: var(--neon-blue);
}

/* Main Dashboard UI */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  gap: 20px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo h2 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  letter-spacing: 1px;
}

#status-text {
  color: var(--neon-blue);
  text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-indicator.online {
  background-color: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue);
  animation: blink 1.5s infinite;
}

.header-title-main {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: var(--grad-spirit-bomb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px rgba(0, 255, 102, 0.2));
}

.system-stats {
  display: flex;
  gap: 15px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 5px 12px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-family: var(--font-heading);
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  color: var(--neon-green);
  font-weight: bold;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  flex: 1;
  min-height: 0; /* Important for grid layout scroll within container */
}

/* Left Column: Canvas */
.canvas-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.canvas-container-outer {
  position: relative;
  width: 100%;
  height: 100%;
  background: #020205;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
  z-index: 2;
}

#render-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gesture-hint-overlay {
  position: absolute;
  bottom: 25px;
  background: rgba(5, 6, 15, 0.85);
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue);
  padding: 10px 25px;
  border-radius: 30px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
  pointer-events: none;
  z-index: 10;
  animation: hintPulse 2s infinite ease-in-out;
}

/* Right Column: Controls Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
}

.panel-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 18px;
}

.panel-section h3 {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 2px;
  color: var(--neon-blue);
  margin-bottom: 15px;
  border-left: 2px solid var(--neon-blue);
  padding-left: 8px;
}

/* Control Group UI (Slider, Toggle) */
.control-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.control-group label span:last-child {
  color: var(--text-main);
}

/* Styled Neon Slider */
.neon-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.neon-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.neon-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease;
}

.neon-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Toggle Switch */
.toggle-group {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 20px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-main);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--neon-green);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
}

input:checked + .slider-round:before {
  transform: translateX(18px);
}

/* Core Telemetry (Energy Bar / State Boxes) */
.telemetry-item {
  margin-bottom: 15px;
}

.telemetry-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.bar-container {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  padding: 2px;
}

.bar-fill {
  width: 0%;
  height: 100%;
  background: var(--grad-spirit-bomb);
  border-radius: 2px;
  transition: width 0.1s linear, box-shadow 0.2s ease;
  box-shadow: 0 0 5px var(--neon-green);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.telemetry-box {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.box-label {
  font-size: 0.6rem;
  font-family: var(--font-heading);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.box-status {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: bold;
}

.status-off {
  color: var(--text-muted);
}

#box-fist.active-charge {
  border-color: var(--neon-green);
  background: rgba(0, 255, 102, 0.05);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.15);
}
#box-fist.active-charge #fist-status {
  color: var(--neon-green);
  text-shadow: 0 0 5px var(--neon-green);
}

#box-open.active-fire {
  border-color: var(--neon-red);
  background: rgba(255, 42, 75, 0.05);
  box-shadow: 0 0 10px rgba(255, 42, 75, 0.15);
}
#box-open.active-fire #open-status {
  color: var(--neon-red);
  text-shadow: 0 0 5px var(--neon-red);
}

/* Gesture Guides */
.gesture-guide {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.01);
}

.gesture-icon {
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.03);
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.fist-icon {
  color: var(--neon-green);
  border-color: rgba(0, 255, 102, 0.2);
}

.open-icon {
  color: var(--neon-red);
  border-color: rgba(255, 42, 75, 0.2);
}

.guide-desc strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.guide-desc p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

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

/* Canvas Shake Animation */
.shake-screen {
  animation: shake 0.15s infinite;
}

/* Keyframes */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes cardGlow {
  from {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 255, 102, 0.1);
    border-color: rgba(0, 255, 102, 0.4);
  }
  to {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 25px rgba(0, 255, 102, 0.35);
    border-color: var(--neon-green);
  }
}

@keyframes hintPulse {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.85;
  }
  50% {
    transform: translateY(-5px);
    opacity: 1;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.35);
  }
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Media Queries for Responsiveness */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
    height: auto;
  }
  
  .app-container {
    height: auto;
    min-height: 100vh;
  }
  
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .canvas-container-outer {
    height: 450px;
  }
  
  .control-panel {
    overflow-y: visible;
    height: auto;
  }
}
