/* ============================================
   F-14 TOMCAT TACTICAL COMPUTER — MAIN CSS
   ============================================ */

:root {
  --bg-deep:        #00020a;
  --bg-mid:         #000d1a;
  --bg-panel:       #020f1f;
  --accent-blue:    #00d4ff;
  --accent-cyan:    #00ffe5;
  --accent-ice:     #80f0ff;
  --accent-glow:    #0088cc;
  --accent-warn:    #ff6b00;
  --accent-ok:      #00ff88;
  --accent-danger:  #ff2244;
  --text-primary:   #cceeff;
  --text-secondary: #5599bb;
  --text-dim:       #224455;
  --glass-bg:       rgba(0, 18, 40, 0.55);
  --glass-border:   rgba(0, 212, 255, 0.18);
  --glass-shine:    rgba(0, 212, 255, 0.06);
  --glass-shadow:   rgba(0, 0, 0, 0.6);
  --font-hud:       'Orbitron', monospace;
  --font-mono:      'Share Tech Mono', monospace;
  --font-body:      'Exo 2', sans-serif;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  cursor: crosshair;
}

/* -------- BACKGROUND LAYER -------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#particleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.6;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridShift 40s linear infinite;
}
@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}
.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0.3;
  animation: scanDown 8s linear infinite;
  box-shadow: 0 0 20px var(--accent-blue);
}
@keyframes scanDown {
  0%   { top: -2px; }
  100% { top: 100vh; }
}

/* -------- RADAR RINGS -------- */
.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,212,255,0.12);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: radarPulse 4s ease-out infinite;
}
.r1 { width: 300px; height: 300px; animation-delay: 0s; }
.r2 { width: 600px; height: 600px; animation-delay: 1s; }
.r3 { width: 900px; height: 900px; animation-delay: 2s; }
.r4 { width: 1200px; height: 1200px; animation-delay: 3s; }
@keyframes radarPulse {
  0%   { opacity: 0.3; transform: translate(-50%,-50%) scale(0.95); }
  50%  { opacity: 0.1; }
  100% { opacity: 0;   transform: translate(-50%,-50%) scale(1.05); }
}

/* -------- HUD CORNERS -------- */
.hud-corner {
  position: fixed;
  width: 50px; height: 50px;
  z-index: 10;
  pointer-events: none;
}
.hud-corner::before,
.hud-corner::after {
  content: '';
  position: absolute;
  background: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
}
.hud-corner::before { width: 2px; height: 30px; }
.hud-corner::after  { width: 30px; height: 2px; }
.top-left    { top: 10px; left: 10px; }
.top-right   { top: 10px; right: 10px; }
.bottom-left { bottom: 10px; left: 10px; }
.bottom-right{ bottom: 10px; right: 10px; }
.top-right::before, .top-right::after     { right: 0; }
.bottom-left::before, .bottom-left::after { bottom: 0; }
.bottom-right::before, .bottom-right::after { right: 0; bottom: 0; }
.top-left::before  { top: 0; left: 0; }
.top-left::after   { top: 0; left: 0; }
.top-right::before { top: 0; right: 0; }
.top-right::after  { top: 0; right: 0; }
.bottom-left::before  { bottom: 0; left: 0; }
.bottom-left::after   { bottom: 0; left: 0; }
.bottom-right::before { bottom: 0; right: 0; }
.bottom-right::after  { bottom: 0; right: 0; }

/* -------- HEADER -------- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 12px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.aircraft-icon svg {
  width: 60px;
  height: 30px;
  filter: drop-shadow(0 0 8px var(--accent-blue));
  animation: planeFloat 3s ease-in-out infinite;
}
@keyframes planeFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-4px); }
}
.title-block { display: flex; flex-direction: column; gap: 2px; }
.label-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent-blue);
  letter-spacing: 4px;
  opacity: 0.7;
}
.main-title {
  font-family: var(--font-hud);
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px var(--accent-blue), 0 0 40px rgba(0,212,255,0.3);
  letter-spacing: 3px;
}
.subtitle-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.status-indicators {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}
.status-dot.active { color: var(--accent-ok); }
.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-ok);
  box-shadow: 0 0 8px var(--accent-ok);
  animation: pulseGlow 1.5s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-ok); }
  50%       { opacity: 0.4; box-shadow: 0 0 20px var(--accent-ok); }
}
.clock {
  font-family: var(--font-hud);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan);
  letter-spacing: 3px;
}

/* -------- NAV TABS -------- */
.nav-tabs {
  display: flex;
  gap: 6px;
}
.nav-btn {
  background: rgba(0,20,40,0.6);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-hud);
  font-size: 0.55rem;
  letter-spacing: 2px;
  padding: 6px 14px;
  cursor: pointer;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(0,212,255,0.08));
  opacity: 0;
  transition: opacity 0.3s;
}
.nav-btn:hover { 
  color: var(--accent-blue); 
  border-color: rgba(0,212,255,0.5); 
  background: rgba(0,40,80,0.7);
}
.nav-btn:hover::before { opacity: 1; }
.nav-btn.active {
  background: rgba(0,100,180,0.3);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(0,212,255,0.3), inset 0 0 12px rgba(0,212,255,0.1);
}

/* -------- MAIN CONTENT -------- */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
}

/* -------- MODULE PANEL -------- */
.module-panel {
  animation: panelIn 0.5s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.module-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--glass-border);
}
.module-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px var(--accent-blue));
  animation: iconPulse 2.5s ease-in-out infinite;
}
@keyframes iconPulse {
  0%, 100% { filter: drop-shadow(0 0 12px var(--accent-blue)); }
  50%       { filter: drop-shadow(0 0 22px var(--accent-cyan)); }
}
.module-title {
  font-family: var(--font-hud);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 0 0 15px var(--accent-blue);
}
.module-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 4px;
  letter-spacing: 1px;
}
.formula-badge {
  margin-left: auto;
  background: rgba(0,50,100,0.4);
  border: 1px solid rgba(0,212,255,0.3);
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 5px 12px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  white-space: nowrap;
}
.formula-badge:hover {
  background: rgba(0,80,160,0.5);
  box-shadow: 0 0 10px rgba(0,212,255,0.3);
}
.formula-box {
  margin-bottom: 20px;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  line-height: 1.9;
  animation: fadeIn 0.3s ease;
}
.formula-label {
  color: var(--text-secondary);
  margin-right: 6px;
}
code {
  background: rgba(0,212,255,0.08);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-ice);
  font-size: 0.78rem;
}

/* -------- INPUT GRID -------- */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.missile-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.input-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.input-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,212,255,0.15);
}
.input-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-secondary);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hud-input {
  flex: 1;
  background: rgba(0,10,25,0.8);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 4px;
  color: var(--accent-blue);
  font-family: var(--font-hud);
  font-size: 1.1rem;
  padding: 8px 12px;
  outline: none;
  transition: all 0.25s;
  width: 100%;
  text-align: right;
  cursor: text;
}
.hud-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 15px rgba(0,212,255,0.25), inset 0 0 8px rgba(0,212,255,0.08);
  background: rgba(0,20,50,0.9);
  color: var(--accent-cyan);
}
.hud-input::-webkit-inner-spin-button,
.hud-input::-webkit-outer-spin-button { opacity: 0.3; }
.input-unit {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  min-width: 32px;
}
.input-bar {
  height: 2px;
  background: rgba(0,212,255,0.08);
  border-radius: 1px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-glow), var(--accent-blue));
  border-radius: 1px;
  transition: width 0.4s ease;
  box-shadow: 0 0 6px var(--accent-blue);
}

/* -------- RESULT BLOCK -------- */
.result-block {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.result-block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-cyan), var(--accent-blue), transparent);
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.result-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 5px;
}
.result-value {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.result-number {
  font-family: var(--font-hud);
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--accent-blue);
  text-shadow: 0 0 30px var(--accent-blue), 0 0 60px rgba(0,212,255,0.4);
  line-height: 1;
  animation: numGlow 2s ease-in-out infinite;
  transition: all 0.3s;
}
@keyframes numGlow {
  0%, 100% { text-shadow: 0 0 30px var(--accent-blue), 0 0 60px rgba(0,212,255,0.3); }
  50%       { text-shadow: 0 0 50px var(--accent-cyan), 0 0 80px rgba(0,212,255,0.5); }
}
.result-unit {
  font-family: var(--font-hud);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.result-bar-track {
  width: 80%;
  height: 4px;
  background: rgba(0,212,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.result-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-glow), var(--accent-blue), var(--accent-cyan));
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 0 10px var(--accent-blue);
  width: 50%;
}
.result-hint {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

/* -------- MISSILE SELECT -------- */
.missile-select-row {
  margin-bottom: 20px;
}
.missile-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.missile-btn {
  background: rgba(0,20,40,0.6);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 7px 14px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
  clip-path: polygon(4px 0%, 100% 0%, calc(100% - 4px) 100%, 0% 100%);
}
.missile-btn:hover {
  color: var(--accent-blue);
  border-color: rgba(0,212,255,0.5);
  background: rgba(0,40,80,0.7);
}
.missile-btn.active-sel {
  background: rgba(0,100,200,0.4);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 0 10px rgba(0,212,255,0.3);
}

/* -------- MISSILE RESULTS -------- */
.missile-results-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}
.result-block.half { margin: 0; }
.pk-number {
  color: var(--accent-ok) !important;
  text-shadow: 0 0 30px var(--accent-ok), 0 0 60px rgba(0,255,136,0.4) !important;
}
.pk-bar-wrap { width: 80%; }
.pk-bar-track {
  height: 10px;
  background: rgba(0,255,136,0.08);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.pk-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #004422, var(--accent-ok));
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 0 12px var(--accent-ok);
  width: 0%;
}
.pk-markers {
  position: absolute;
  top: 0; left: 0; right: 0; height: 100%;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: rgba(255,255,255,0.2);
}
.pk-markers span {
  position: absolute;
  top: -14px;
  transform: translateX(-50%);
}

/* -------- FUEL GAUGE + ANGLE VIS -------- */
.fuel-gauge-wrap,
.angle-vis-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* -------- FOOTER -------- */
.main-footer {
  position: sticky;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 28px;
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 2px;
}
.footer-status {
  color: var(--accent-ok);
  font-family: var(--font-hud);
  font-size: 0.65rem;
  letter-spacing: 3px;
}

/* -------- UTILS -------- */
.blink {
  animation: blink 1.2s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------- SCROLLBAR -------- */
::-webkit-scrollbar { width: 6px; background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,212,255,0.4); }

/* -------- RESPONSIVE -------- */
@media (max-width: 768px) {
  .main-title { font-size: 1rem; }
  .nav-btn { font-size: 0.48rem; padding: 5px 8px; }
  .result-number { font-size: 2.5rem; }
  .missile-results-row { grid-template-columns: 1fr; }
  .main-content { margin: 20px auto; padding: 0 12px; }
}
