/* === AIM TRAINER — Aim Lab Style === */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@500;700;900&display=swap');

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

:root {
  --bg: #080c14;
  --bg-card: rgba(12, 16, 30, 0.85);
  --cyan: #00d4ff;
  --cyan-glow: rgba(0, 212, 255, 0.5);
  --purple: #7b61ff;
  --purple-glow: rgba(123, 97, 255, 0.4);
  --red: #ff4655;
  --red-glow: rgba(255, 70, 85, 0.5);
  --green: #00e676;
  --gold: #ffd740;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e0e0e0;
  --text-dim: #6a6f80;
  --text-bright: #ffffff;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
}

body {
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  height: 100vh;
  width: 100vw;
  font-weight: 500;
  letter-spacing: 0.5px;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* === Header === */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(8, 12, 20, 0.92);
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header-brand {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 24px var(--cyan-glow);
  text-transform: uppercase;
}
.header-brand span {
  color: var(--text-bright);
  font-weight: 500;
  text-shadow: none;
}
.header-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 3px;
}
.header-tab {
  padding: 7px 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  text-transform: uppercase;
}
.header-tab:hover { color: var(--text); }
.header-tab.active {
  background: rgba(0, 212, 255, 0.15);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

/* Header live stats (Aim Lab style) */
.header-stats {
  display: flex;
  gap: 24px;
  align-items: center;
}
.header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.header-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  font-weight: 600;
}
.header-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  font-family: 'Rajdhani', sans-serif;
  text-shadow: 0 0 8px var(--cyan-glow);
}
.header-stat-value.danger { color: var(--red); text-shadow: 0 0 8px var(--red-glow); }

/* === Mode Selection Screen === */
.mode-select {
  position: fixed;
  inset: 52px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.03) 0%, transparent 70%);
}
.mode-select.hidden { display: none; }

.mode-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px;
}
.mode-card {
  width: 240px;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.04) 0%, rgba(123, 97, 255, 0.04) 100%);
  opacity: 0;
  transition: opacity 0.25s;
}
.mode-card:hover {
  border-color: rgba(0, 212, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 212, 255, 0.08);
}
.mode-card:hover::before { opacity: 1; }
.mode-card:active { transform: scale(0.98); }

.mode-card-icon {
  font-size: 36px;
  margin-bottom: 12px;
  text-align: center;
}
.mode-card-title {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-bright);
  text-align: center;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.mode-card-desc {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  letter-spacing: 0.5px;
}
.mode-card-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.badge-precision { background: rgba(0, 212, 255, 0.12); color: var(--cyan); }
.badge-fps { background: rgba(123, 97, 255, 0.12); color: var(--purple); }
.badge-tracking { background: rgba(255, 215, 64, 0.12); color: var(--gold); }
.badge-flicker { background: rgba(255, 70, 85, 0.12); color: var(--red); }

/* === Canvas === */
#gameCanvas {
  display: block;
  position: absolute;
  top: 52px; left: 0;
  width: 100%;
  height: calc(100% - 52px);
  cursor: none;
}
#gameCanvas.hidden { display: none; }

#canvasContainer {
  position: absolute;
  top: 52px; left: 0;
  width: 100%;
  height: calc(100% - 52px);
}
#canvasContainer.hidden { display: none; }
#canvasContainer canvas { display: block; }

/* === 2D Crosshair === */
.crosshair-2d {
  position: fixed;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: none;
}
.crosshair-2d.visible { display: block; }

.cl {
  position: absolute;
  background: rgba(0, 212, 255, 0.9);
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
  border-radius: 1px;
}
.crosshair-dot {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  transform: translate(-50%, -50%);
}

/* === HUD (2D mode) === */
.hud {
  position: fixed;
  top: 52px; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(8,12,20,0.8) 0%, transparent 100%);
  z-index: 20;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
}
.hud.hidden { display: none; }
.hud-left, .hud-right { display: flex; gap: 22px; }
.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.2);
}

/* Combo display */
.combo-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  pointer-events: none;
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 32px var(--cyan-glow), 0 0 64px rgba(0, 212, 255, 0.3);
  opacity: 0;
  transition: opacity 0.15s;
}
.combo-display.active { opacity: 1; animation: comboPulse 0.3s ease-out; }
.combo-display.fade { opacity: 0; transition: opacity 0.5s; }
@keyframes comboPulse {
  0% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Screen flash for MISS penalty */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  border: 3px solid transparent;
  border-radius: 0;
  opacity: 0;
  transition: none;
}
.screen-flash.miss {
  border-color: rgba(255, 70, 85, 0.6);
  box-shadow: inset 0 0 60px rgba(255, 70, 85, 0.25);
  opacity: 1;
  animation: flashFade 0.35s ease-out forwards;
}
@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* === Right Panel (Settings) === */
.settings-panel {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: rgba(12, 16, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 18px;
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}
.settings-panel.hidden { display: none; }

.settings-panel h3 {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-panel h3:not(:first-child) { margin-top: 6px; }

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.setting-group label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.setting-group select,
.setting-group input[type="color"] {
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 20, 0.8);
  color: var(--text);
  font-size: 13px;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
}
.setting-group select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 8px rgba(0, 212, 255, 0.15); }
.setting-group input[type="color"] { height: 26px; padding: 2px 4px; }
.setting-group input[type="range"] {
  width: 100%; cursor: pointer;
  accent-color: var(--cyan);
}
.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; text-transform: none !important;
  font-size: 12px !important; color: var(--text) !important;
}
.checkbox-label input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--cyan); cursor: pointer;
}

/* Crosshair preview */
.crosshair-preview {
  width: 100%; height: 60px;
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* Start Button */
.btn-start {
  padding: 10px 0;
  border: 1px solid rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.btn-start:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  color: var(--cyan);
}
.btn-start:active { transform: scale(0.97); }

/* === Difficulty Select === */
.difficulty-bar {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  display: flex;
  gap: 2px;
  background: rgba(8, 12, 20, 0.7);
  border-radius: 4px;
  padding: 2px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.difficulty-bar.hidden { display: none; }
.diff-btn {
  padding: 5px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  border-radius: 3px;
}
.diff-btn:hover { color: var(--text); }
.diff-btn.active {
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.25);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.1);
}

/* === Flick mode selector === */
.submode-bar {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  display: flex;
  gap: 2px;
  background: rgba(8, 12, 20, 0.7);
  border-radius: 4px;
  padding: 2px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.submode-bar.hidden { display: none; }
.submode-btn {
  padding: 5px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  border-radius: 3px;
}
.submode-btn:hover { color: var(--text); }
.submode-btn.active {
  background: rgba(123, 97, 255, 0.12);
  border-color: rgba(123, 97, 255, 0.25);
  color: var(--purple);
  box-shadow: 0 0 8px rgba(123, 97, 255, 0.1);
}

/* === Countdown === */
.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
  z-index: 30;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.countdown-overlay.hidden { display: none; }
#countdownText {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 140px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 80px var(--cyan-glow), 0 0 160px rgba(0, 212, 255, 0.3);
  animation: countPulse 0.5s ease-out;
}
@keyframes countPulse {
  0% { transform: scale(1.8); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* === Results Screen === */
.results-screen {
  position: fixed;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.82);
  z-index: 30;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.results-screen.hidden { display: none; }

.results-card {
  background: rgba(12, 16, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 36px 44px;
  text-align: center;
  min-width: 420px;
  max-width: 500px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Rating badge */
.results-rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 12px;
  letter-spacing: 0;
}
.rating-S { color: #ffd740; border: 3px solid #ffd740; box-shadow: 0 0 32px rgba(255, 215, 64, 0.5); background: rgba(255, 215, 64, 0.06); }
.rating-A { color: #00e676; border: 3px solid #00e676; box-shadow: 0 0 24px rgba(0, 230, 118, 0.4); background: rgba(0, 230, 118, 0.05); }
.rating-B { color: #00d4ff; border: 3px solid #00d4ff; box-shadow: 0 0 20px rgba(0, 212, 255, 0.3); background: rgba(0, 212, 255, 0.05); }
.rating-C { color: #ff9100; border: 3px solid #ff9100; box-shadow: 0 0 16px rgba(255, 145, 0, 0.3); background: rgba(255, 145, 0, 0.05); }

.results-card h2 {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 20px;
  color: var(--text-bright);
  text-transform: uppercase;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.result-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}
.result-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}
.result-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--cyan);
  font-family: 'Rajdhani', sans-serif;
  text-shadow: 0 0 6px var(--cyan-glow);
}
.result-value.highlight { color: var(--gold); text-shadow: 0 0 8px rgba(255, 215, 64, 0.4); }

.trend-section {
  margin-bottom: 16px; text-align: left;
}
.trend-section h4 {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
#trendCanvas {
  width: 100%; border-radius: 6px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.04);
}

/* === 3D Start Overlay === */
.start-overlay {
  position: fixed;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.78);
  z-index: 28;
  cursor: pointer;
}
.start-overlay.hidden { display: none; }
.start-overlay-text {
  font-family: 'Orbitron', 'Rajdhani', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--cyan);
  text-shadow: 0 0 40px var(--cyan-glow);
  text-transform: uppercase;
  animation: pulseText 1.5s ease-in-out infinite;
}
@keyframes pulseText {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* === 3D HUD Elements === */
.weapon-icon {
  position: fixed;
  left: 30px;
  bottom: 30px;
  z-index: 6;
  pointer-events: none;
}
.weapon-icon svg { display: block; }

.ammo-display {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 6;
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-bright);
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
  pointer-events: none;
}

/* Kill reaction time popup */
.kill-rt {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  pointer-events: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 16px var(--cyan-glow);
  animation: killRtFade 0.9s ease-out forwards;
}
@keyframes killRtFade {
  0% { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-40px); }
}

.hit-marker {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  animation: hitFade 0.8s ease-out forwards;
}
@keyframes hitFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.3); }
}

.miss-text {
  position: fixed;
  pointer-events: none;
  z-index: 6;
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #888;
  letter-spacing: 2px;
  animation: missFade 0.5s ease-out forwards;
}
@keyframes missFade {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* === Back to Home Button === */
.btn-back {
  position: fixed;
  top: 60px;
  left: 16px;
  z-index: 45;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(12, 16, 30, 0.75);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-back:hover {
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.1);
}
.btn-back-arrow { font-size: 14px; margin-right: 2px; }

/* Sensitivity slider */
.setting-group input[type="range"].sens-slider {
  accent-color: var(--purple);
}

/* Grid mode bar */
#gridModeBar {
  top: 96px;
}

/* Classic 3D container */
#classic3dContainer {
  position: absolute;
  top: 52px; left: 0;
  width: 100%;
  height: calc(100% - 52px);
}
#classic3dContainer canvas { display: block; }

/* === General === */
.hidden { display: none !important; }

/* === Responsive === */
@media (max-width: 768px) {
  .settings-panel { right: 4px; width: 180px; padding: 12px; gap: 6px; }
  .hud { padding: 8px 12px; }
  .header { padding: 0 12px; }
  .header-brand { font-size: 16px; }
  .header-stats { gap: 12px; }
  .header-stat-value { font-size: 14px; }
  .results-card { min-width: 320px; padding: 24px 20px; }
  .results-rating { width: 56px; height: 56px; font-size: 28px; }
  .mode-card { width: 200px; padding: 20px 16px; }
}
