/* ==========================================================================
   Embodied 3D AI World - White / Clean-Room Daylight Edition Stylesheet
   Modern High-Contrast Frosted Glassmorphism Design
   ========================================================================== */

:root {
  --bg-primary: #f8fafc;
  --bg-panel: rgba(255, 255, 255, 0.88);
  --bg-card: rgba(241, 245, 249, 0.95);
  --accent-cyan: #0284c7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.35);
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-purple-glow: rgba(124, 58, 237, 0.35);
  --accent-gold: #d97706;
  --accent-gold-glow: rgba(217, 119, 6, 0.35);
  --accent-green: #059669;
  --accent-red: #dc2626;
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;
  --border-subtle: rgba(15, 23, 42, 0.12);
  --border-highlight: rgba(2, 132, 199, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* 3D Canvas */
#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* First-Person Crosshair */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 6px var(--accent-cyan);
  pointer-events: none;
  z-index: 5;
  display: none;
}

#crosshair::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(2, 132, 199, 0.6);
  box-sizing: border-box;
}

/* ==========================================================================
   Teleoperation Active Banner
   ========================================================================== */

#teleop-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7c3aed 0%, #c026d3 100%);
  color: #ffffff;
  padding: 8px 24px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 20px var(--accent-purple-glow);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 25;
  transition: all 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#teleop-banner.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
}

.teleop-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  animation: pulse 1s infinite alternate;
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.82) 100%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 8px var(--accent-cyan-glow));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #0f172a;
}

.brand-sub {
  font-size: 10px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Stat Badges */
.stat-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.badge-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
}

.badge-value {
  color: var(--text-main);
  font-weight: 700;
}

.badge-value.highlight {
  color: var(--accent-cyan);
}

.status-badge {
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.12);
  color: var(--accent-green);
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Top Right Controls Group */
.top-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-btn:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: var(--border-highlight);
}

.audio-btn.muted {
  color: var(--text-dim);
  opacity: 0.6;
}

/* Camera Switcher */
.camera-switch {
  display: flex;
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
}

.cam-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cam-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

.cam-btn.active {
  background: var(--accent-cyan);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--accent-cyan-glow);
}

/* ==========================================================================
   Side Panels (HUD)
   ========================================================================== */

.hud-panel {
  position: fixed;
  top: 76px;
  width: 310px;
  max-height: calc(100vh - 136px);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  z-index: 10;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.hud-panel::-webkit-scrollbar {
  width: 4px;
}

.hud-panel::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 4px;
}

#left-panel {
  left: 16px;
}

#right-panel {
  right: 16px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.panel-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mission-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  background: rgba(241, 245, 249, 0.8);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-cyan);
}

/* Buttons and Controls */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-grid.full-width {
  grid-template-columns: 1fr;
}

.hud-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hud-btn:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: var(--border-highlight);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.hud-btn:active {
  transform: translateY(0);
}

.hud-btn.primary {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.2) 0%, rgba(37, 99, 235, 0.2) 100%);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.hud-btn.primary:hover {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.hud-btn.purple {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(192, 38, 211, 0.15) 100%);
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.hud-btn.purple:hover {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #c026d3 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-purple-glow);
}

.hud-btn.purple.active {
  background: var(--accent-purple);
  color: #ffffff;
}

.hud-btn.gold {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.hud-btn.gold:hover {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #f59e0b 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-gold-glow);
}

.hud-btn.small {
  padding: 5px 8px;
  font-size: 11px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.control-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.speed-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.speed-btn.active {
  background: var(--accent-cyan);
  color: #ffffff;
}

/* Mission & Map Selectors */
.hud-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  outline: none;
}

.hud-select option {
  background: #ffffff;
  color: #0f172a;
}

/* Tool Selector */
.tool-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.tool-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 4px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  white-space: nowrap;
}

.tool-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.15);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ==========================================================================
   Right Panel: Charts, Neural Vis, Q-Values
   ========================================================================== */

.chart-container, .net-container {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

#reward-chart, #neural-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend, .net-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.cyan { background: var(--accent-cyan); }
.dot.gold { background: var(--accent-gold); }

/* Q-Value Bars (7 Actions) */
.q-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.q-row {
  display: grid;
  grid-template-columns: 88px 1fr 38px;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

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

.q-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.q-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
  border-radius: 4px;
  transition: width 0.08s ease;
}

.q-row.active .q-label {
  color: var(--accent-cyan);
  font-weight: 700;
}

.q-row.active .q-bar-fill {
  background: linear-gradient(90deg, var(--accent-gold) 0%, #f59e0b 100%);
}

.q-val {
  text-align: right;
  color: var(--text-main);
  font-size: 9px;
  font-weight: 600;
}

/* LiDAR Mini Meters */
.lidar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.lidar-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
}

.lidar-cell .meter {
  width: 100%;
  height: 4px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.lidar-cell .fill {
  width: 100%;
  height: 100%;
  background: var(--accent-green);
  transition: width 0.1s, background-color 0.15s;
}

/* ==========================================================================
   Bottom Bar
   ========================================================================== */

#bottom-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 8px 24px;
  z-index: 15;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.controls-guide {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.key-pill {
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 1px;
}

/* ==========================================================================
   Welcome Modal Overlay
   ========================================================================== */

#welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}

#welcome-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-box {
  width: 90%;
  max-width: 580px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  text-align: center;
}

.modal-badge {
  display: inline-block;
  align-self: center;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
}

.modal-box h2 {
  font-size: 25px;
  font-weight: 700;
  color: #0f172a;
}

.modal-box p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.feature-item strong {
  color: #0f172a;
}

.feature-item .icon {
  font-size: 20px;
}

.modal-btn {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 18px var(--accent-cyan-glow);
  transition: all 0.2s ease;
  margin-top: 6px;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(2, 132, 199, 0.5);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1100px) {
  .hud-panel { width: 260px; }
  .brand-sub { display: none; }
}

@media (max-width: 900px) {
  #right-panel { display: none; }
  .stat-badges .badge:nth-child(n+4) { display: none; }
  #bottom-bar { display: none; }
}
