/* ═══════════════════════════════════════════════════════════
   outpostbeta — X-Wing Cockpit
═══════════════════════════════════════════════════════════ */

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

:root {
  --space:     #00000a;
  --panel:     #0b0e16;
  --panel-mid: #10141f;
  --frame:     #161b26;
  --edge:      #252c3e;
  --amber:     #e8a020;
  --amber-d:   #6b4a0e;
  --amber-dim: #3d2a06;
  --green:     #39e860;
  --green-dim: rgba(57,232,96,0.25);
  --blue:      #4ab3f4;
  --gold-line: #c8941a;
  --mono: 'Courier New', Courier, monospace;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--mono);
}

/* ════════════════════════════════════════════════════════
   COCKPIT ROOT
════════════════════════════════════════════════════════ */
#cockpit {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--space);
}

/* ════════════════════════════════════════════════════════
   CANOPY — space window
════════════════════════════════════════════════════════ */
#canopy {
  position: relative;
  flex: 0 0 58vh;
  overflow: hidden;
  background: var(--space);
}

/* Star drift canvas */
#star-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}

/* Planet glow at the bottom of the window */
#planet-glow {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 38%;
  background: radial-gradient(
    ellipse 120% 80% at 50% 110%,
    rgba(25, 60, 130, 0.55) 0%,
    rgba(10, 30, 80, 0.30) 45%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

/* ── HUD ─────────────────────────────────────────────── */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.hud-bracket {
  position: absolute;
  width: 36px; height: 36px;
  border: 1.5px solid rgba(74,179,244,0.65);
}
.hud-bracket.tl { top: 22px;    left: 22px;   border-right: none; border-bottom: none; }
.hud-bracket.tr { top: 22px;    right: 22px;  border-left:  none; border-bottom: none; }
.hud-bracket.bl { bottom: 22px; left: 22px;   border-right: none; border-top:    none; }
.hud-bracket.br { bottom: 22px; right: 22px;  border-left:  none; border-top:    none; }

#hud-reticle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
}
.reticle-h, .reticle-v { position: absolute; background: rgba(74,179,244,0.5); }
.reticle-h { top: 50%; left: -10px; right: -10px; height: 1px; margin-top: -0.5px; }
.reticle-v { left: 50%; top: -10px; bottom: -10px; width: 1px; margin-left: -0.5px; }
.reticle-ring {
  position: absolute;
  width: 32px; height: 32px;
  border: 1px solid rgba(74,179,244,0.45);
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

#hud-top-bar, #hud-bottom-bar {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 28px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--blue);
  text-transform: uppercase;
  white-space: nowrap;
}
#hud-top-bar    { top: 14px; }
#hud-bottom-bar { bottom: 14px; }

.hud-tag  { opacity: 0.65; }
.hud-val  { color: #c8e8ff; font-weight: bold; opacity: 1; }
.blink    { animation: blink 1.2s step-end infinite; }

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

/* ── Cockpit structural frame ────────────────────────── */
#canopy-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* The large dark side panels that create the cockpit surround */
.frame-surround {
  position: absolute;
}

/* Top header bar */
.frame-top {
  top: 0; left: 0; right: 0;
  height: 22px;
  background: linear-gradient(to bottom, #1a1f2e 0%, #0c1018 60%, transparent 100%);
}

/* Left cockpit wall — angled inner edge via clip-path */
.frame-left {
  top: 0; left: 0; bottom: 0;
  width: 26%;
  background: linear-gradient(to right, #0e121b 20%, #0d111a 60%, transparent 100%);
  clip-path: polygon(0 0, 100% 0, 62% 100%, 0 100%);
}

/* Right cockpit wall — mirror */
.frame-right {
  top: 0; right: 0; bottom: 0;
  width: 26%;
  background: linear-gradient(to left, #0e121b 20%, #0d111a 60%, transparent 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 38% 100%);
}

/* Thin structural struts on top of the frame panels */
.strut {
  position: absolute;
  background: #1c2133;
}

.strut-center-v {
  top: 0; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 7px;
  background: linear-gradient(to right, #111520, #1e2438, #111520);
  box-shadow: 0 0 8px rgba(0,0,0,0.9);
}

/* Angled struts running from the top-centre toward the lower sides */
.strut-diagonal-l,
.strut-diagonal-r {
  top: 22px;
  height: 5px;
  width: 28%;
  background: #161b28;
}
.strut-diagonal-l {
  left: 24%;
  transform-origin: left center;
  transform: rotate(12deg);
}
.strut-diagonal-r {
  right: 24%;
  transform-origin: right center;
  transform: rotate(-12deg);
}

/* Curved arch struts along the side panels */
.strut-arch-l {
  top: 0; left: 22%;
  width: 6px; height: 100%;
  background: linear-gradient(to right, transparent, #1a2030, transparent);
  transform: rotate(-4deg);
}
.strut-arch-r {
  top: 0; right: 22%;
  width: 6px; height: 100%;
  background: linear-gradient(to right, transparent, #1a2030, transparent);
  transform: rotate(4deg);
}

/* ════════════════════════════════════════════════════════
   DASHBOARD
════════════════════════════════════════════════════════ */
#dashboard {
  flex: 1;
  background: var(--panel);
  border-top: 2px solid #2a3040;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* Subtle gradient to give depth */
  background: linear-gradient(to bottom, #0d1018 0%, #0b0e15 100%);
}

/* Top edge detail — vent slots */
#dash-top-edge {
  flex: 0 0 12px;
  background: #090c12;
  border-bottom: 1px solid #1e2434;
  display: flex;
  align-items: center;
  padding: 0 60px;
  gap: 8px;
}
.edge-vent {
  flex: 1;
  height: 3px;
  background: #060810;
  border-radius: 1px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.9);
}

/* Three-column grid */
#dash-inner {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 2.2fr 1fr;
  gap: 10px;
  padding: 12px 14px 14px;
  align-items: start;
}

/* ── Instrument clusters ─────────────────────────────── */
.instrument-cluster {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instr-panel {
  background: #080b11;
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 7px 9px;
  /* gold outline accent line (like panel artwork in the reference) */
  box-shadow: inset 0 0 0 1px rgba(180,130,20,0.08);
}

.instr-label {
  font-size: 7px;
  letter-spacing: 0.2em;
  color: var(--amber-d);
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid #181e2e;
}

/* Shield diagram */
.shield-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
}
.shield-arc {
  width: 38px; height: 10px;
  border-radius: 50%;
  border: 2px solid;
}
.shield-arc.front { border-color: var(--green); box-shadow: 0 0 6px var(--green); }
.shield-arc.rear  { border-color: var(--amber-d); }
.ship-icon { font-size: 13px; color: #8896b0; line-height: 1; }

/* Power cell grid */
.cell-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}
.cell {
  height: 9px;
  border-radius: 2px;
}
.cell.on  { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.cell.dim { background: var(--amber-dim); }

/* Digit readout */
.digit-readout {
  font-size: 16px;
  letter-spacing: 0.05em;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(232,160,32,0.7);
  text-align: center;
  padding: 2px 0;
}
.dim-text { color: var(--amber-d); text-shadow: none; font-size: 16px; text-align: center; padding: 2px 0; }

/* Radar */
.radar {
  position: relative;
  width: 100%;
  padding-top: 100%;
}
.radar > * { position: absolute; }
.radar-ring {
  border-radius: 50%;
  border: 1px solid var(--green-dim);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.radar-ring.r1 { width: 38%; height: 38%; }
.radar-ring.r2 { width: 76%; height: 76%; }

.radar-cross-h { top: 50%; left: 6%; right: 6%; height: 1px; background: var(--green-dim); margin-top: -0.5px; }
.radar-cross-v { left: 50%; top: 6%; bottom: 6%; width: 1px; background: var(--green-dim); margin-left: -0.5px; }

.radar-sweep {
  top: 50%; left: 50%;
  width: 50%; height: 1px;
  background: linear-gradient(to right, var(--green), transparent);
  transform-origin: left center;
  animation: sweep 3s linear infinite;
}
@keyframes sweep { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

.radar-blip {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  top: var(--by); left: var(--bx);
  transform: translate(-50%,-50%);
  animation: blip-pulse 2.5s ease-in-out infinite;
}
.radar-blip.dim { background: var(--amber-d); box-shadow: none; animation-duration: 3.5s; }
@keyframes blip-pulse { 0%,100%{opacity:1} 50%{opacity:0.25} }

/* ════════════════════════════════════════════════════════
   CENTRE NAV PANEL
════════════════════════════════════════════════════════ */
#nav-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* CRT screen */
#nav-screen {
  background: #020407;
  border: 1px solid #163018;
  border-radius: 4px;
  padding: 12px 16px 14px;
  position: relative;
  overflow: hidden;
}
/* Scanlines */
#nav-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 2px,
    rgba(0,0,0,0.12) 2px, rgba(0,0,0,0.12) 4px
  );
  pointer-events: none;
  z-index: 2;
}
/* Subtle screen glow */
#nav-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(57,232,96,0.04) 0%, transparent 70%);
}
#nav-screen-inner {
  position: relative; z-index: 1;
  text-align: center;
}
#nav-title {
  font-size: clamp(16px, 2.5vw, 26px);
  letter-spacing: 0.35em;
  color: var(--green);
  text-shadow: 0 0 12px var(--green), 0 0 28px rgba(57,232,96,0.35);
  text-transform: uppercase;
}
#nav-subtitle {
  font-size: 8px;
  letter-spacing: 0.22em;
  color: rgba(57,232,96,0.5);
  margin-top: 5px;
  text-transform: uppercase;
}
#nav-coords {
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(57,232,96,0.28);
  margin-top: 7px;
}

/* ── Nav buttons ─────────────────────────────────────── */
#nav-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #0a0d15;
  border: 1px solid var(--amber-d);
  border-radius: 3px;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  /* Gold line accent (like the instrument outlines in the reference) */
  box-shadow: inset 0 0 0 1px rgba(180,130,20,0.06);
}

/* LED dot */
.nav-btn-led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 5px var(--amber);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

/* Hover */
.nav-btn:hover {
  background: #14192a;
  border-color: var(--amber);
  box-shadow:
    0 0 14px rgba(232,160,32,0.2),
    inset 0 0 8px rgba(232,160,32,0.05);
  color: #f5c860;
}
.nav-btn:hover .nav-btn-led {
  background: #f5c860;
  box-shadow: 0 0 10px #f5c860;
}

/* Active */
.nav-btn:active {
  background: #0c1020;
  box-shadow: none;
}

/* Sweep shine on hover */
.nav-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -120%; bottom: 0;
  width: 60%;
  background: linear-gradient(to right, transparent, rgba(232,160,32,0.08), transparent);
  transition: left 0.35s ease;
}
.nav-btn:hover::before { left: 160%; }

/* ════════════════════════════════════════════════════════
   UTILITY
════════════════════════════════════════════════════════ */
::-webkit-scrollbar { display: none; }
