/* launch-control + launch-observer: rocket scene, controls, timeline, event log. */

body.launch-page {
  justify-content: flex-start;
  padding: 2rem 16px 3rem;
}

/* ── Resume banner ── */
.banner {
  width: min(640px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #f59e0b;
  border-radius: 12px;
  background: rgba(245,158,11,.08);
  font-size: 0.8rem;
  color: #fcd34d;
}

.banner[hidden] { display: none; }

.banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.banner .button { padding: 0.45rem 1rem; font-size: 0.65rem; }

/* ── Scene ── */
.scene > * { position: absolute; }

.readout {
  top: 18px;
  left: 24px;
}

.readout-main {
  font-family: 'Courier New', monospace;
  font-size: 2.2rem;
  font-weight: 700;
  color: #a5b4fc;
  text-shadow: 0 0 18px rgba(99,102,241,.55);
  transition: color 0.2s;
}

.readout-main.good { color: #34d399; text-shadow: 0 0 18px rgba(52,211,153,.5); }
.readout-main.warn { color: #f59e0b; text-shadow: 0 0 18px rgba(245,158,11,.5); }
.readout-main.bad  { color: #ef4444; text-shadow: 0 0 18px rgba(239,68,68,.55); }

.readout-sub {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
}

/* fuel gauge */
.gauge {
  left: 24px;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gauge-track {
  position: relative;
  width: 16px;
  height: 200px;
  border: 1px solid #1e293b;
  border-radius: 999px;
  background: #0f1117;
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(0deg, #6366f1, #8b5cf6);
  box-shadow: 0 0 16px rgba(99,102,241,.6);
  transition: height 0.2s ease;
}

.gauge-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
}

.gauge-label span { color: #a5b4fc; font-family: 'Courier New', monospace; }

/* systems lights */
.systems {
  top: 20px;
  right: 24px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.system {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #64748b;
}

.light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1e293b;
  transition: background 0.2s, box-shadow 0.2s;
}

.system.checking .light { background: #60a5fa; box-shadow: 0 0 10px #60a5fa; animation: blink 0.5s ease-in-out infinite; }
.system.go .light       { background: #34d399; box-shadow: 0 0 10px rgba(52,211,153,.8); }
.system.fail .light     { background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,.8); }
.system.go, .system.checking { color: #a5b4fc; }
.system.fail { color: #ef4444; }

.weather {
  top: 136px;
  right: 24px;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
}

.weather span {
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1e2d45;
  color: #60a5fa;
  font-family: monospace;
}

.weather span.windy { background: rgba(245,158,11,.15); color: #f59e0b; }
.weather span.storm { background: rgba(239,68,68,.15); color: #ef4444; }

/* ground + tower */
.ground {
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: #0f1117;
  border-top: 1px solid #1e293b;
}

.tower {
  left: 262px;
  bottom: 56px;
  width: 14px;
  height: 170px;
  border: 2px solid #1e293b;
  border-bottom: none;
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, #1e293b 8px 10px);
}

/* rocket */
.rocket {
  left: calc(50% - 18px);
  bottom: 56px;
  width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0) scale(1);
  transform-origin: 50% 100%;
  transition: transform 0.3s linear;
}

.rocket.orbit { transition: transform 1.4s cubic-bezier(.3,.1,.3,1); }

.nose {
  width: 24px;
  height: 30px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.body {
  position: relative;
  width: 24px;
  height: 56px;
  background: linear-gradient(90deg, #94a3b8, #e2e8f0 45%, #94a3b8);
}

.porthole {
  position: absolute;
  top: 14px;
  left: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #13192a;
  border: 2px solid #6366f1;
}

.stage-booster {
  position: relative;
  width: 24px;
  height: 52px;
  background: linear-gradient(90deg, #64748b, #cbd5e1 45%, #64748b);
  border-top: 2px solid #6366f1;
  transition: transform 1.4s ease-in, opacity 1.4s ease-in;
}

.stage-booster.detached {
  transform: translateY(160px) rotate(18deg);
  opacity: 0;
}

.fin {
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 22px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.fin-left  { left: -12px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.fin-right { right: -12px; clip-path: polygon(0 0, 100% 100%, 0 100%); }

.flame {
  position: absolute;
  top: 100%;
  left: 3px;
  width: 18px;
  height: 0;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, #fde68a, #f59e0b 40%, #ef4444);
  box-shadow: 0 0 24px rgba(239,68,68,.8);
  transition: height 0.3s ease;
}

.flame.on {
  height: 38px;
  animation: flicker 0.12s ease-in-out infinite alternate;
}

.rocket.shake { animation: shake 0.12s linear infinite; }

/* stars (visible in orbit) */
.stars {
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #e2e8f0, transparent),
    radial-gradient(1.5px 1.5px at 31% 64%, #a5b4fc, transparent),
    radial-gradient(1.5px 1.5px at 47% 12%, #e2e8f0, transparent),
    radial-gradient(1.5px 1.5px at 58% 41%, #e2e8f0, transparent),
    radial-gradient(1.5px 1.5px at 71% 18%, #a5b4fc, transparent),
    radial-gradient(1.5px 1.5px at 83% 58%, #e2e8f0, transparent),
    radial-gradient(1.5px 1.5px at 22% 44%, #e2e8f0, transparent),
    radial-gradient(1.5px 1.5px at 90% 30%, #e2e8f0, transparent);
}

.stars.on { opacity: 1; }

@keyframes flicker { from { transform: scaleY(0.85); } to { transform: scaleY(1.1); } }
@keyframes shake {
  0%   { translate: 0 0; }
  25%  { translate: -1.5px 0; }
  75%  { translate: 1.5px 0; }
  100% { translate: 0 0; }
}
@keyframes blink { 50% { opacity: 0.35; } }

/* ── Controls ── */
.controls {
  width: min(640px, 100%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin: 1rem 0;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.control-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.control input[type="range"] { width: 110px; accent-color: #6366f1; }
.control input[type="checkbox"] { accent-color: #6366f1; }

.control select {
  font: inherit;
  font-size: 0.75rem;
  padding: 3px 6px;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #13192a;
  color: #a5b4fc;
}

.observer-link {
  margin-left: auto;
  font-size: 0.75rem;
  color: #60a5fa;
  text-decoration: none;
}

.observer-link:hover { text-decoration: underline; }

/* ── Timeline + log panels ── */
.panels {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel {
  border: 1px solid #1e293b;
  border-radius: 12px;
  background: #13192a;
  padding: 0.8rem 0.9rem;
  min-width: 0;
}

.panel h2 {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  margin-bottom: 0.6rem;
}

.timeline, .log {
  list-style: none;
  height: 300px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1e293b transparent;
}

.timeline-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #1a2236;
}

.timeline-label { display: flex; flex-direction: column; min-width: 0; }

.timeline-name {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  color: #a5b4fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-type, .timeline-meta {
  font-size: 0.58rem;
  color: #475569;
}

.chip {
  font-size: 0.58rem;
  font-family: monospace;
  padding: 1px 7px;
  border-radius: 999px;
  background: #1e293b;
  color: #64748b;
  white-space: nowrap;
}

.chip-running  { background: #1e2d45; color: #60a5fa; animation: blink 0.8s ease-in-out infinite; }
.chip-complete { background: rgba(52,211,153,.12); color: #34d399; }
.chip-failed   { background: rgba(239,68,68,.15); color: #ef4444; }
.chip-skipped  { background: rgba(245,158,11,.12); color: #f59e0b; }
.chip-not-run  { background: transparent; color: #334155; border: 1px dashed #334155; }

.log-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 6px;
  padding: 2px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.64rem;
  line-height: 1.35;
}

.log-time    { color: #334155; grid-row: span 2; }
.log-event   { color: #60a5fa; }
.log-subject { color: #a5b4fc; overflow-wrap: anywhere; }

.log-entry.nested { padding-left: 12px; opacity: 0.75; }
.log-entry.warn .log-event { color: #f59e0b; }
.log-entry.bad  .log-event { color: #ef4444; }
.log-entry.good .log-event { color: #34d399; }

/* ── Observer ── */
.observer-note {
  width: min(640px, 100%);
  margin-bottom: 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #64748b;
}

.observer-note.live { color: #34d399; }
.observer-note code { color: #a5b4fc; font-size: 0.75rem; }
.observer-note a { color: #60a5fa; }

@media (max-width: 700px) {
  .panels { grid-template-columns: minmax(0, 1fr); }
  .timeline, .log { height: 220px; }
  .banner { flex-wrap: wrap; }
  .observer-link { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rocket, .rocket.orbit, .stage-booster, .gauge-fill { transition: none; }
  .rocket.shake, .flame.on, .chip-running, .system.checking .light { animation: none; }
}
