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

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070b14;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #f8fafc;
}

body.game-mode-active {
  cursor: none;
}

.hidden {
  display: none !important;
}

.hidden-view {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

#game-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  transition: opacity 0.2s ease;
}

/* =========================================================
   Top HUD & Mode Switcher Bar
   ========================================================= */
#hud-top {
  position: fixed;
  top: 10px;
  left: 14px;
  right: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.mode-tabs {
  pointer-events: auto;
  display: flex;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.mode-tab {
  background: transparent;
  color: #94a3b8;
  font-weight: 800;
  font-size: 12.5px;
  border: none;
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mode-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.mode-tab.active {
  background: linear-gradient(135deg, #00f5d4 0%, #00bbf9 100%);
  color: #05101e;
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.35);
}

.hud-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-stats {
  display: flex;
  gap: 8px;
}

.stat-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 9px;
  padding: 5px 12px;
  min-width: 86px;
  backdrop-filter: blur(8px);
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #94a3b8;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.stat-value.accent {
  color: #00f5d4;
}

.hud-center-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 6px 18px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.status-pill {
  font-size: 12.5px;
  font-weight: 700;
  color: #00f5d4;
}

.controls-hint {
  font-size: 11px;
  color: #cbd5e1;
  display: flex;
  gap: 7px;
}

.controls-hint strong {
  color: #ffd166;
}

.hud-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
}

.btn-wizard {
  background: linear-gradient(135deg, #ffd166 0%, #f59e0b 100%);
  color: #0f172a;
  font-weight: 800;
  font-size: 12.5px;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.38);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.btn-wizard:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.65);
}

.btn-wizard.running {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.75);
}

.btn-secondary {
  background: rgba(255, 42, 109, 0.18);
  color: #ff6b9d;
  font-weight: 800;
  font-size: 12.5px;
  border: 1px solid rgba(255, 42, 109, 0.55);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(255, 42, 109, 0.32);
  transform: translateY(-1px);
}

.btn-secondary.recording {
  background: #ff2a6d;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(255, 42, 109, 0.8);
}

.btn-primary {
  background: linear-gradient(135deg, #00f5d4 0%, #00bbf9 100%);
  color: #06101e;
  font-weight: 800;
  font-size: 12.5px;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(0, 245, 212, 0.65);
}

/* =========================================================
   Simulator & Calibration Lab Layout
   ========================================================= */
#simulator-view {
  position: fixed;
  top: 66px;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 14px;
}

.sim-main-stage {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.sim-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(10, 15, 28, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sim-toolbar-left,
.sim-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-stage-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.7px;
  color: #00f5d4;
}

.sim-toggle-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.75);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  cursor: pointer;
}

.sim-toggle-pill input {
  accent-color: #00f5d4;
  cursor: pointer;
}

.btn-mini {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-mini:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #00f5d4;
}

.sim-canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#sim-range-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Interactive Step-by-Step Coach Dock inside Simulator Canvas */
.wizard-coach {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 94%);
  background: rgba(10, 15, 28, 0.95);
  border: 2px solid #00f5d4;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.8);
  z-index: 20;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.wizard-coach.capturing {
  border-color: #ffd166;
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.45);
}

.wiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.wiz-badge {
  font-size: 13px;
  font-weight: 900;
  color: #00f5d4;
  letter-spacing: 0.5px;
}

.wiz-hand-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.wiz-hand-pill.no-hand {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
}

.wiz-step-dots {
  display: flex;
  gap: 5px;
}

.step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.3);
}

.step-dot.done {
  background: #00f5d4;
}

.step-dot.active {
  background: #ffd166;
  box-shadow: 0 0 8px #ffd166;
  transform: scale(1.2);
}

.wiz-instruction {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.4;
  margin-bottom: 10px;
}

.wiz-instruction strong {
  color: #ffd166;
}

.wiz-progress-wrap {
  width: 100%;
  height: 10px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.wiz-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f5d4 0%, #ffd166 100%);
  transition: width 0.06s linear;
}

.wiz-last-result {
  font-size: 11.5px;
  font-weight: 700;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 7px;
  padding: 5px 10px;
  margin-bottom: 10px;
}

.wiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.wiz-btn-confirm {
  background: linear-gradient(135deg, #ffd166 0%, #f59e0b 100%);
  color: #0b101b;
  font-weight: 900;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.wiz-btn-confirm:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.75);
}

.wiz-btn-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wiz-sub-actions {
  display: flex;
  gap: 6px;
}

/* Right Inspector Column */
.sim-inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.inspector-card {
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(10, 15, 28, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 11px;
  font-weight: 800;
  color: #00f5d4;
  letter-spacing: 0.5px;
}

.card-sub {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
}

#sim-hand-canvas,
#sim-scope-canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Report Card */
.report-card-wrap {
  flex: 1;
  min-height: 165px;
}

.report-card-body {
  padding: 10px 12px;
  font-size: 11.5px;
  color: #cbd5e1;
  overflow-y: auto;
}

.report-empty-title {
  font-weight: 800;
  color: #ffd166;
  margin-bottom: 5px;
  font-size: 12.5px;
}

.diag-checklist {
  margin-top: 7px;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #94a3b8;
}

.diag-checklist strong {
  color: #e2e8f0;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.report-metric {
  background: rgba(7, 11, 20, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 7px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rm-label {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 700;
}

.rm-val {
  font-size: 11.5px;
  font-weight: 800;
  color: #f8fafc;
}

.rm-val.accent {
  color: #00f5d4;
}

.badge-good {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
}

.report-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11px;
  color: #00f5d4;
}

/* =========================================================
   Tuning Panel (Bottom Left)
   ========================================================= */
#tuning-panel {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 280px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 11px 13px;
  z-index: 35;
  backdrop-filter: blur(10px);
  cursor: default;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  color: #00f5d4;
  margin-bottom: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-weight: bold;
}

#panel-body.collapsed {
  display: none;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
  font-size: 11.5px;
}

.row-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: #e2e8f0;
}

.control-select {
  background: #0b1324;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.control-row input[type='range'] {
  width: 100%;
  accent-color: #00f5d4;
  cursor: pointer;
}

.control-row small {
  font-size: 10px;
  color: #94a3b8;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  margin-bottom: 2px;
  cursor: pointer;
}

/* =========================================================
   Webcam PIP (Shown in 3D Game Mode)
   ========================================================= */
#pip-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 260px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(0, 245, 212, 0.5);
  background: #050811;
  z-index: 25;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}

#webcam-video {
  display: none;
}

#pip-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pip-caption {
  font-size: 11px;
  text-align: center;
  padding: 4px 6px;
  background: rgba(10, 15, 28, 0.92);
  color: #cbd5e1;
  font-weight: 600;
}

/* =========================================================
   High-Speed Gun Crosshair Reticle
   ========================================================= */
#reticle {
  position: fixed;
  top: 0;
  left: 0;
  width: 52px;
  height: 52px;
  margin-left: -26px;
  margin-top: -26px;
  pointer-events: none;
  z-index: 30;
  will-change: transform;
}

.reticle-ring {
  position: absolute;
  inset: 4px;
  border: 2.5px solid #00f5d4;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.7);
  transition: transform 0.08s ease, border-color 0.08s ease;
}

.reticle-crosshair {
  position: absolute;
  background: #00f5d4;
}

.reticle-crosshair.h {
  top: 50%;
  left: -4px;
  right: -4px;
  height: 2px;
  margin-top: -1px;
}

.reticle-crosshair.v {
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
}

.reticle-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  background: #ff2a85;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff2a85;
}

#reticle.target-lock .reticle-ring {
  border-color: #ff2a85;
  box-shadow: 0 0 16px rgba(255, 42, 133, 0.9);
  transform: scale(0.82);
}

#reticle.target-lock .reticle-crosshair {
  background: #ff2a85;
}

#reticle.recoil .reticle-ring {
  transform: scale(1.45);
  border-color: #ffd166;
}

/* =========================================================
   Floating Score Popups
   ========================================================= */
#popups-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 28;
}

.score-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 22px;
  color: #00f5d4;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  animation: floatUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.score-popup.headshot {
  font-size: 28px;
  color: #ffd166;
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.8);
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.7);
  }
  25% {
    transform: translate(-50%, -85%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(0.95);
  }
}
