/* Pad Sim — SpaceX aerospace theme (match SpaceXBytes monochrome + highlights) */
:root {
  --bg: #000000;
  --panel: #000000;
  --elevated: #0a0a0a;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #ffffff;
  --muted: #8e8e8e;
  --dim: #555555;
  --hi: #ff5a1f;
  --hi-text: #ffb08a;
  --ok: #b8f0c8;
  --steel: #c8c8c8;
  --font: "Titillium Web", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.void {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 55% at 50% 110%, rgba(30, 45, 80, 0.25), transparent 55%),
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 0.5px, transparent 1px),
    radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,0.3) 0.5px, transparent 1px),
    radial-gradient(1px 1px at 45% 60%, rgba(255,255,255,0.25) 0.4px, transparent 1px),
    radial-gradient(1px 1px at 85% 45%, rgba(255,255,255,0.35) 0.5px, transparent 1px);
}
#app { position: relative; z-index: 1; height: 100%; }
.hidden { display: none !important; }

/* SpaceX-style buttons: outline white + plume primary */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  padding: 0.65rem 1.15rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
button.primary {
  background: var(--hi);
  border-color: var(--hi);
  color: #fff;
}
button.primary:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}
button.ghost {
  border-color: var(--line-strong);
  background: transparent;
}
button.ghost:hover { border-color: #fff; }
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#app, .screen { height: 100%; }

/* Logo mark */
.logo, .hud-brand {
  text-decoration: none;
  color: #fff;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.logo-bytes {
  font-weight: 300;
  opacity: 0.45;
  margin-left: 0.1em;
  letter-spacing: 0.22em;
}

/* ── Assembly (VAB) ── */
#build {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: auto;
}
.top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top-mid {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.mode-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hi-text);
}
.top h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.top-actions { display: flex; gap: 0.5rem; }

.build-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  flex: 1;
  min-height: 0;
}
.palette, .brief {
  padding: 1.25rem 1.1rem;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.65);
  border-right: 1px solid var(--line);
}
.brief {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.panel-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.palette .panel-label:not(:first-child),
.brief .panel-label:not(:first-child) {
  margin-top: 1.5rem;
}
.hint {
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 1rem;
  line-height: 1.45;
  font-weight: 300;
}

.parts { display: grid; gap: 0.4rem; }
.part-btn {
  text-align: left;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem 0.65rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.88rem;
  border-color: var(--line);
  background: transparent;
}
.part-btn:hover {
  border-color: var(--hi);
  background: rgba(255, 90, 31, 0.06);
}
.part-swatch {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #f0f0f0, #9a9a9a);
}
.part-btn small {
  display: block;
  color: var(--dim);
  font-size: 0.68rem;
  font-family: var(--mono);
  margin-top: 0.15rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 400;
}
.presets { display: grid; gap: 0.4rem; }
.presets button { width: 100%; border-color: var(--line-strong); }

.bay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.25rem;
  gap: 0.85rem;
  background:
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(255, 90, 31, 0.1), transparent 55%),
    #000;
  overflow: auto;
}
.bay-label {
  align-self: stretch;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}
#build-canvas {
  background: #050505;
  border: 1px solid var(--line);
  max-width: 100%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03);
}
.stats-panel {
  width: min(100%, 420px);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.7);
  letter-spacing: 0.04em;
}
.stats-panel strong { color: #fff; font-weight: 500; }
.stats-panel .warn { color: var(--hi-text); }
.stats-panel .ok { color: var(--ok); }

.goals {
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 300;
  margin-bottom: 0.25rem;
}
.goals li { margin-bottom: 0.5rem; }
.goals span {
  display: inline-block;
  min-width: 3.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--hi-text);
  margin-right: 0.4rem;
  letter-spacing: 0.04em;
}
.controls { font-size: 0.88rem; }
.controls div {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-weight: 300;
}
.controls dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #fff;
  font-weight: 500;
}
.fine {
  margin-top: 1.5rem;
  font-size: 0.72rem;
  color: var(--dim);
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.legal-box {
  margin-top: 1.25rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--hi);
  background: rgba(255, 90, 31, 0.05);
}
.legal-box strong {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hi-text);
  margin-bottom: 0.4rem;
}
.legal-box p {
  font-size: 0.72rem;
  color: var(--dim);
  line-height: 1.45;
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
}
.legal-box a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-box a:hover { color: #fff; }
.records {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.65;
  letter-spacing: 0.03em;
}
.records strong { color: var(--hi-text); font-weight: 500; }

/* ── Flight ── */
#flight {
  position: relative;
  background: #000;
}
#flight-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.85rem 1.15rem 2rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 100%);
}
.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
}
.hud-mode {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--hi-text);
  border: 1px solid rgba(255, 90, 31, 0.45);
  padding: 0.2rem 0.5rem;
}
.hud-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}
.hud-left, .hud-right { display: grid; gap: 0.3rem; }
.hud-right { text-align: right; }
.hud-row {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.hud-row strong {
  display: inline-block;
  min-width: 5.5rem;
  color: #fff;
  font-weight: 500;
  margin-left: 0.55rem;
}
.hud-right .hud-row strong {
  margin-left: 0;
  margin-right: 0.55rem;
}
.hud-center { text-align: center; min-width: 150px; }
.status {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hi-text);
  margin-bottom: 0.45rem;
}
.throttle-wrap {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.throttle-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  margin-bottom: 0.3rem;
  overflow: hidden;
}
.throttle-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--hi);
}

.flight-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem calc(0.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0,0,0,0.92), transparent);
  pointer-events: none;
}
.flight-bar > * { pointer-events: auto; }
.touch-pad {
  display: none;
  margin-left: auto;
  gap: 0.35rem;
}
.touch-pad button {
  min-width: 48px;
  min-height: 44px;
  font-size: 0.65rem;
  border-color: var(--line-strong);
}

.flight-msg {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.94);
  border: 1px solid var(--line);
  padding: 1.5rem 1.6rem;
  text-align: center;
  max-width: 92vw;
  width: 340px;
  z-index: 10;
}
.flight-msg h2 {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  color: var(--hi-text);
  font-weight: 700;
}
.flight-msg h2.win { color: var(--ok); }
.flight-msg p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.15rem;
  line-height: 1.5;
  font-weight: 300;
}
.flight-msg button { margin: 0 0.25rem; }

@media (max-width: 960px) {
  .build-layout { grid-template-columns: 1fr; }
  .palette, .brief {
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .touch-pad { display: flex; }
  .top {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
  }
  .top-mid { order: 3; flex: 1 1 100%; }
  .hud-grid { gap: 0.5rem; }
  .hud-row strong { min-width: 4.2rem; }
}
