/* =============================================================================
 * FROM FIRE TO ORBIT — Phase 2B/2C
 * css/flight.css  ·  the flight / replay telemetry-review screen
 * ===========================================================================*/

.fs-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: #050b18;
  overflow: hidden;
  font-family: var(--bp-font, "Sarabun", system-ui, sans-serif);
  color: var(--bp-ink, #e9f1ff);
}
.fs-overlay[hidden] { display: none; }

#fs-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; cursor: grab; touch-action: none;
}
#fs-canvas:active { cursor: grabbing; }

/* ---- HUD (top-left telemetry stack) ---------------------------------- */
.fs-hud {
  position: absolute; left: 18px; top: 16px;
  pointer-events: none;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 260px;
}
.fs-phase {
  align-self: flex-start;
  font-family: var(--bp-mono, "JetBrains Mono", monospace);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #5bd6ff;
  border: 1px solid rgba(91,214,255,0.4);
  background: rgba(6,16,32,0.72);
  border-radius: 4px; padding: 4px 10px;
}
.fs-readout {
  display: grid; grid-template-columns: 1fr; gap: 1px;
  background: rgba(6,16,32,0.72);
  border: 1px solid rgba(120,180,255,0.18);
  border-left: 2px solid #5bd6ff;
  border-radius: 4px;
  padding: 8px 12px;
  backdrop-filter: blur(3px);
}
.fs-readout > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(120,180,255,0.10);
}
.fs-readout > div:last-child { border-bottom: 0; }
.fs-readout span {
  font-size: 10px; letter-spacing: 0.06em; color: #9db4d8;
  font-family: var(--bp-mono, monospace); text-transform: uppercase;
}
.fs-readout b {
  font-size: 15px; font-family: var(--bp-mono, monospace); font-weight: 700;
  color: #e9f1ff;
}

/* ---- event toast (top-centre) -------------------------------------- */
.fs-toast {
  position: absolute; left: 50%; top: 22px; transform: translate(-50%, -14px);
  font-family: var(--bp-mono, monospace); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffce40;
  background: rgba(6,16,32,0.9);
  border: 1px solid rgba(255,206,64,0.5);
  border-radius: 6px; padding: 8px 18px;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.fs-toast.show { opacity: 1; transform: translate(-50%, 0); }
.fs-toast[hidden] { display: none; }

/* ---- transport bar (bottom-centre) ------------------------------- */
.fs-bar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(6,16,32,0.82);
  border: 1px solid rgba(120,180,255,0.2);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(6px);
  width: min(760px, calc(100vw - 40px));
  box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}
.fs-ic {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: rgba(18,41,79,0.9);
  border: 1px solid rgba(120,180,255,0.24);
  border-radius: 8px;
  color: #e9f1ff; font-size: 14px; cursor: pointer;
  font-family: var(--bp-mono, monospace);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.fs-ic:hover { border-color: #5bd6ff; color: #5bd6ff; }
.fs-ic.fs-txt { width: auto; padding: 0 12px; font-size: 12px; letter-spacing: 0.04em; }
#fs-close { margin-left: 2px; }
#fs-close:hover { border-color: #ff6a5a; color: #ff6a5a; }

/* ---- timeline scrubber + event ticks ---------------------------- */
.fs-timeline { position: relative; flex: 1; height: 34px; display: flex; align-items: center; }
.fs-scrub {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, #5bd6ff var(--fs-pos,0%), rgba(120,180,255,0.18) var(--fs-pos,0%));
  outline: none; cursor: pointer; position: relative; z-index: 2;
}
.fs-scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: #e9f1ff; border: 2px solid #5bd6ff; cursor: grab;
}
.fs-scrub::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: #e9f1ff; border: 2px solid #5bd6ff; cursor: grab;
}
.fs-marks {
  position: absolute; left: 0; right: 0; top: 50%; height: 16px;
  transform: translateY(-50%);
  pointer-events: none; z-index: 1;
}
.fs-mark {
  position: absolute; top: 0; width: 2px; height: 16px;
  transform: translateX(-1px);
  border-radius: 1px; opacity: 0.9;
  box-shadow: 0 0 5px currentColor;
}

/* ---- Physics Autopsy report card ------------------------------- */
.fs-autopsy {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  width: min(380px, calc(100vw - 40px));
  max-height: calc(100vh - 120px); overflow-y: auto;
  background: rgba(8,18,36,0.94);
  border: 1px solid rgba(91,214,255,0.35);
  border-radius: 12px;
  padding: 16px 18px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}
.fs-autopsy[hidden] { display: none; }
.fs-ap-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.fs-ap-head h2 {
  margin: 0; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #5bd6ff;
}
.fs-ap-x {
  background: none; border: 1px solid rgba(120,180,255,0.3); color: #9db4d8;
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 13px;
}
.fs-ap-x:hover { color: #ff6a5a; border-color: #ff6a5a; }
.fs-ap-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px;
}
.fs-ap-stat {
  background: rgba(18,41,79,0.7); border: 1px solid rgba(120,180,255,0.16);
  border-radius: 8px; padding: 8px 10px;
}
.fs-ap-stat span {
  display: block; font-size: 9.5px; letter-spacing: 0.05em; color: #9db4d8;
  font-family: var(--bp-mono, monospace); text-transform: uppercase;
}
.fs-ap-stat b { font-size: 16px; font-family: var(--bp-mono, monospace); }
.fs-ap-diaglist { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fs-ap-diag {
  display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start;
  font-size: 12px;
}
.fs-ap-diag > span:first-child { font-weight: 700; text-align: center; }
.fs-ap-diag b { font-weight: 600; display: block; }
.fs-ap-diag i { font-style: normal; font-size: 10.5px; color: #9db4d8; font-family: var(--bp-mono, monospace); }
.fs-ap-diag.OK   > span:first-child { color: #5fe0a8; }
.fs-ap-diag.WARN > span:first-child { color: #ffce40; }
.fs-ap-diag.FAIL > span:first-child { color: #ff6a5a; }
.fs-ap-actions { display: flex; gap: 8px; }
.fs-ap-btn {
  flex: 1; padding: 9px; border-radius: 8px; cursor: pointer;
  font-family: var(--bp-font, sans-serif); font-weight: 700; font-size: 12.5px;
  border: 1px solid rgba(120,180,255,0.3);
  background: rgba(18,41,79,0.9); color: #e9f1ff;
}
.fs-ap-btn.primary {
  background: linear-gradient(180deg, #2a7d5c, #1d5f45);
  border-color: rgba(95,224,168,0.5); color: #eafff5;
}
.fs-ap-btn:hover { filter: brightness(1.12); }
.fs-ap-btn.fs-why {
  background: linear-gradient(180deg, #7b5cc4, #543a92);
  border-color: rgba(180,150,255,0.55); color: #f2ecff;
  box-shadow: 0 0 22px rgba(140,110,230,0.35);
}

.fs-hint {
  position: absolute; right: 18px; bottom: 78px;
  font-family: var(--bp-mono, monospace); font-size: 10px; color: #6f86ad;
  text-align: right; line-height: 1.5; pointer-events: none;
}

/* ---- Era 3 · V-2 launch sequence — azimuth aim + T-10 countdown ------- */
.fs-launchseq {
  position: absolute; left: 50%; bottom: calc(15% + 74px); transform: translateX(-50%);
  z-index: 4; width: min(420px, 82vw);
  padding: 14px 20px 16px; border-radius: 14px;
  color: #dce8ff;
  border: 1px solid rgba(120,180,255,0.4);
  background: linear-gradient(180deg, rgba(12,22,42,0.92), rgba(8,14,28,0.9));
  box-shadow: 0 12px 44px rgba(0,0,0,0.5), inset 0 0 22px rgba(90,150,240,0.08);
  font-family: var(--bp-font, "Sarabun", system-ui, sans-serif);
  transition: opacity .45s ease, transform .45s ease;
}
.fs-launchseq[hidden] { display: none; }
.fs-aim-row { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.fs-aim-row > span:first-child { font-weight: 700; letter-spacing: 0.02em; }
.fs-aim-row b { color: #8fd0ff; font-variant-numeric: tabular-nums; }
.fs-aim-hint { font-size: 11px; color: #90a6c8; }
#fs-aim { width: 100%; accent-color: #ff6a4a; cursor: pointer; }

.fs-countdown {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  z-index: 6; pointer-events: none;
  font-family: "Barlow Condensed", var(--bp-font, system-ui), sans-serif;
  font-size: clamp(90px, 20vw, 230px); font-weight: 800; line-height: 1;
  color: #fff2e2; letter-spacing: 0.02em;
  text-shadow: 0 0 44px rgba(255,140,60,0.6), 0 0 14px rgba(255,90,50,0.7);
  animation: fs-cd-pulse 1s ease-out;
}
.fs-countdown[hidden] { display: none; }
.fs-countdown.go { color: #7bffb0; text-shadow: 0 0 54px rgba(90,255,170,0.7); }
@keyframes fs-cd-pulse {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.92); }
}

/* ---- Era 0 · manual two-step ignition button (centre-lower) ----------- */
.fs-ignite {
  position: absolute; left: 50%; bottom: 15%; transform: translateX(-50%);
  z-index: 4;
  font-family: var(--bp-font, "Sarabun", system-ui, sans-serif);
  font-size: 17px; font-weight: 700; letter-spacing: 0.03em;
  color: #ffe6c4;
  padding: 15px 34px; border-radius: 999px;
  border: 1px solid rgba(255,150,70,0.55);
  background: radial-gradient(120% 160% at 50% 0%, rgba(255,138,58,0.34), rgba(10,16,32,0.86));
  box-shadow: 0 0 34px rgba(255,130,50,0.28), inset 0 0 22px rgba(255,150,70,0.12);
  cursor: pointer;
  transition: opacity .5s ease, transform .35s ease, box-shadow .5s ease, background .5s ease;
  animation: fs-ignite-breathe 3.4s ease-in-out infinite;
}
.fs-ignite[hidden] { display: none; }
.fs-ignite:hover { transform: translateX(-50%) scale(1.04); }
.fs-ignite:disabled {
  cursor: default; opacity: 0.5; animation: none;
  color: #cdb79a; border-color: rgba(180,150,120,0.4);
  box-shadow: none;
}
.fs-ignite.ready {
  color: #fff4e2;
  border-color: rgba(120,220,180,0.65);
  background: radial-gradient(120% 160% at 50% 0%, rgba(80,210,160,0.32), rgba(10,20,26,0.88));
  box-shadow: 0 0 40px rgba(90,220,170,0.4), inset 0 0 22px rgba(120,220,180,0.16);
  animation: fs-ignite-ready 1.9s ease-in-out infinite;
}
@keyframes fs-ignite-breathe {
  0%, 100% { box-shadow: 0 0 26px rgba(255,130,50,0.22), inset 0 0 20px rgba(255,150,70,0.10); }
  50%      { box-shadow: 0 0 40px rgba(255,150,70,0.4),  inset 0 0 26px rgba(255,170,90,0.18); }
}
@keyframes fs-ignite-ready {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.045); }
}

/* ---- Era 1 · "launch next" — rapid-fire festival (lower-right) -------- */
.fs-launch-next {
  position: absolute; right: 20px; bottom: 88px; z-index: 5;
  font-family: var(--bp-font, "Sarabun", system-ui, sans-serif);
  font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  color: #1a0e04;
  padding: 12px 22px; border-radius: 12px;
  border: 1px solid rgba(255,205,130,0.6);
  background: linear-gradient(180deg, #ffab5a, #e8631f);
  box-shadow: 0 8px 30px rgba(232,99,31,0.4);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.fs-launch-next[hidden] { display: none; }
.fs-launch-next:hover { transform: translateY(-2px); box-shadow: 0 12px 42px rgba(232,99,31,0.55); }
.fs-launch-next:active { transform: translateY(0); filter: brightness(0.94); }

#fs-focus { color: #ffce40; border-color: rgba(255,206,64,0.4); }
#fs-focus:hover { border-color: #ffce40; color: #ffe08a; }

/* ---- the poetry — philosophical haiku, lower third, very slow fade ---- */
.fs-haiku {
  position: absolute; left: 50%; bottom: 20%; transform: translate(-50%, 12px);
  z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  font-family: var(--bp-font, "Sarabun", serif);
  font-size: clamp(17px, 2.5vw, 25px); font-weight: 400; line-height: 1.5;
  letter-spacing: 0.04em;
  color: #f2e6d6;
  text-shadow: 0 2px 24px rgba(0,0,0,0.85), 0 0 40px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 2.6s ease, transform 2.6s ease;
}
.fs-haiku[hidden] { display: none; }
.fs-haiku.show { opacity: 0.96; transform: translate(-50%, 0); }
.fs-haiku span { display: block; }
.fs-haiku span:nth-child(2) { color: #e7d4bd; }
.fs-haiku span:nth-child(3) { color: #d8c3a8; font-style: italic; }

@media (max-width: 720px) {
  .fs-autopsy { right: 10px; left: 10px; width: auto; }
  .fs-hint { display: none; }
  .fs-bar { gap: 7px; padding: 8px 10px; }
  .fs-ignite { font-size: 15px; padding: 13px 26px; bottom: 17%; }
  .fs-launch-next { font-size: 13px; padding: 10px 16px; bottom: 74px; right: 12px; }
  .fs-haiku { font-size: 16px; bottom: 24%; }
}

/* builder: the "watch flight" button variant */
.bp-btn.bp-btn-alt {
  background: linear-gradient(180deg, #21507f, #16375c);
  border-color: rgba(91,214,255,0.5); color: #eaf6ff;
}

/* ===========================================================================
 *  3D PREVIEW MODAL  (Phase 5 — off the 2D drafting board)
 * ===========================================================================*/
.pv-modal {
  position: fixed; inset: 0; z-index: 88;
  display: grid; place-items: center; padding: 24px;
  background: rgba(4,9,20,0.72);
  backdrop-filter: blur(7px);
  animation: pv-fade .22s ease;
}
.pv-modal[hidden] { display: none; }
@keyframes pv-fade { from { opacity: 0; } to { opacity: 1; } }

.pv-panel {
  width: min(880px, 100%); height: min(78vh, 720px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(12,24,44,0.97), rgba(6,12,24,0.98));
  border: 1px solid rgba(91,214,255,0.4);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.7),
              inset 0 1px 0 rgba(120,200,255,0.08);
}
.pv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px;
  background: linear-gradient(180deg, rgba(30,60,100,0.35), rgba(30,60,100,0));
  border-bottom: 1px solid rgba(120,180,255,0.16);
}
.pv-tag {
  font-family: var(--bp-mono, monospace); font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--bp-accent, #5bd6ff);
  text-shadow: 0 0 14px rgba(91,214,255,0.4);
}
.pv-canvas-wrap::after {   /* a soft vignette to frame the studio shot */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px 20px rgba(0,0,0,0.55);
}
.pv-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px 11px; border-radius: 9px;
  background: rgba(6,12,24,0.62);
  border: 1px solid rgba(120,180,255,0.18);
  backdrop-filter: blur(6px);
  font-family: var(--bp-mono, monospace); font-size: 10.5px; color: #cfe0f5;
  pointer-events: none;
}
.pv-legend .pv-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 7px; vertical-align: -2px;
  background-size: 5px 5px; background-position: 0 0, 2.5px 2.5px;
  box-shadow: 0 0 6px -1px currentColor;
}
.pv-dot-com {
  background-color: #ffcf3f; color: #ffcf3f;
  background-image:
    linear-gradient(45deg, #161616 25%, transparent 25% 75%, #161616 75%),
    linear-gradient(45deg, #161616 25%, transparent 25% 75%, #161616 75%);
}
.pv-dot-cop {
  background-color: #eef6ff; color: #5bb8ff;
  background-image:
    linear-gradient(45deg, #3a8fd0 25%, transparent 25% 75%, #3a8fd0 75%),
    linear-gradient(45deg, #3a8fd0 25%, transparent 25% 75%, #3a8fd0 75%);
}
.pv-legend .pv-rule { color: #9fb6d6; margin-top: 2px; }
.pv-legend .pv-rule b { color: #54e39a; }
.pv-legend .pv-rule b.bad { color: #ff5d5d; }
.pv-legend .pv-rule2 { color: #7f96b6; font-size: 9.5px; }
.pv-close {
  background: rgba(18,41,79,0.9); border: 1px solid rgba(120,180,255,0.3);
  color: var(--bp-ink, #e9f1ff); border-radius: 7px; padding: 5px 12px;
  font-family: var(--bp-mono, monospace); font-size: 12px; cursor: pointer;
}
.pv-close:hover { border-color: #ff6a5a; color: #ff6a5a; }
.pv-canvas-wrap { position: relative; flex: 1; min-height: 0; }
#preview-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#preview-canvas:active { cursor: grabbing; }
.pv-hint {
  padding: 8px 14px; text-align: center;
  font-family: var(--bp-mono, monospace); font-size: 10px; color: #6f86ad;
  border-top: 1px solid rgba(120,180,255,0.1);
}

/* ===========================================================================
 *  LAUNCH TRANSITION  (Phase 5 — 2D board → 3D pad)
 * ===========================================================================*/
.lt-overlay {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center;
  background: #04070f;
  opacity: 0; transition: opacity .3s ease;
}
.lt-overlay[hidden] { display: none; }
.lt-overlay.show { opacity: 1; }

.lt-inner {
  position: relative; width: min(420px, 80vw);
  text-align: center;
  font-family: var(--bp-mono, "JetBrains Mono", monospace);
  color: var(--bp-accent, #5bd6ff);
}
.lt-scan {
  position: absolute; left: -40px; right: -40px; top: -30px; height: 2px;
  background: linear-gradient(90deg, transparent, #5bd6ff, transparent);
  animation: lt-scan 1.4s ease-in-out infinite;
}
@keyframes lt-scan {
  0%, 100% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(64px); opacity: 1; }
}
.lt-label { margin: 0 0 14px; font-size: 15px; letter-spacing: 0.18em; }
.lt-dots { display: inline-block; width: 1.6em; text-align: left; animation: lt-dots 1.2s steps(4) infinite; }
@keyframes lt-dots { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0 0 0); } }
.lt-bar {
  height: 4px; border-radius: 2px; overflow: hidden;
  background: rgba(91,214,255,0.15);
}
.lt-bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, #5bd6ff);
  animation: lt-bar 1.1s ease-in-out infinite;
}
@keyframes lt-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
.lt-sub { margin: 12px 0 0; font-size: 10px; color: #4f6a8f; letter-spacing: 0.08em; }

/* ---- cinematic reveal: replay chrome hidden until interaction ------- */
.fs-hud, .fs-bar, .fs-hint { transition: opacity .45s ease; }
.fs-overlay.fs-cinematic .fs-hud,
.fs-overlay.fs-cinematic .fs-bar,
.fs-overlay.fs-cinematic .fs-hint { opacity: 0; pointer-events: none; }
