@font-face {
  font-family: "Michroma";
  src: url("michroma.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("martian-mono.woff2") format("woff2");
  font-weight: 200 600;
  font-display: swap;
}

:root {
  --void: #030714;
  --glass: #06112b;
  --grid: #16305e;
  --phosphor: #7db4f5;
  --ice: #ddebff;
  --signal: #ffc83a;
  --display: "Michroma", "Helvetica Neue", Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  background: radial-gradient(ellipse 120% 70% at 50% -10%, #0c2050 0%, var(--void) 62%) fixed, var(--void);
  color: var(--phosphor);
  font: 300 13px/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
}

.console {
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) clamp(16px, 4vw, 40px);
  display: grid;
  align-content: center;
  gap: 28px;
}

/* ---------- Screen ---------- */

.screen {
  position: relative;
  background: linear-gradient(180deg, #091a40 0%, var(--glass) 40%);
  border: 1px solid var(--grid);
  border-radius: 4px;
  box-shadow:
    inset 0 0 80px rgba(60, 130, 255, 0.07),
    0 40px 90px -40px rgba(30, 90, 220, 0.55);
  overflow: hidden;
}

/* Signal-yellow corner brackets. */
.screen::before {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 2;
  --c: var(--signal);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 2px,
    linear-gradient(var(--c), var(--c)) top left / 2px 16px,
    linear-gradient(var(--c), var(--c)) top right / 16px 2px,
    linear-gradient(var(--c), var(--c)) top right / 2px 16px,
    linear-gradient(var(--c), var(--c)) bottom left / 16px 2px,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 16px,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 2px,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 16px;
  background-repeat: no-repeat;
  opacity: 0.85;
}

/* Faint scanlines. */
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(125, 180, 245, 0.035) 0 1px, transparent 1px 3px);
}

.screen-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px 40px;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--grid);
}

.ship {
  margin: 0;
  font: 400 clamp(17px, 2.3vw, 24px)/1 var(--display);
  letter-spacing: 0.2em;
  color: var(--ice);
}

.sub, .readouts dt, .now, .eta {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sub { margin: 10px 0 0; opacity: 0.65; }

.readouts { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.readouts dt { opacity: 0.55; }
.readouts dd {
  margin: 4px 0 0;
  color: var(--ice);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#link::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}
#link[data-state="live"]::before { box-shadow: 0 0 8px var(--phosphor); }
#link[data-state="connecting"], #link[data-state="lost"] { color: var(--signal); }
#link[data-state="lost"]::before { animation: blink 1s steps(1) infinite; }

/* ---------- Log ---------- */

.log {
  list-style: none;
  margin: 0;
  padding: 18px 28px 22px;
  height: clamp(300px, 56vh, 600px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 40%);
}

.log li {
  display: grid;
  grid-template-columns: 7.5ch 4.5ch minmax(0, 1fr) 5ch;
  gap: 0 16px;
  padding: 1px 0;
  animation: line-in 0.22s ease-out;
}

.log .t { opacity: 0.5; font-variant-numeric: tabular-nums; }
.log .code { font-weight: 500; opacity: 0.75; }
.log .status { text-align: right; font-weight: 600; letter-spacing: 0.08em; }

.log li.ok .status { color: var(--phosphor); }
.log li.warn, .log li.halt { color: var(--signal); }
.log li.done { color: var(--ice); font-weight: 500; }
.log li.done .status { color: var(--signal); }
.log li:last-child:not(.warn, .halt, .phase) { color: var(--ice); }

.log li.phase {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 6px;
  font: 400 10.5px/1.6 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--signal);
}
.log li.phase::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 200, 58, 0.6), transparent);
}

/* Cursor under the newest line. */
.log::after {
  content: "";
  flex: none;
  width: 0.65em;
  height: 1.1em;
  margin-top: 4px;
  background: var(--phosphor);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- Progress ---------- */

.boot { display: grid; gap: 14px; }

.boot-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.now { margin: 0; color: rgba(125, 180, 245, 0.6); }
#phase {
  display: block;
  margin-top: 8px;
  font: 400 clamp(14px, 2vw, 20px)/1.2 var(--display);
  letter-spacing: 0.14em;
  text-transform: none;
  color: var(--ice);
}

.pct {
  margin: 0;
  font: 200 clamp(38px, 7vw, 72px)/0.9 var(--mono);
  letter-spacing: -0.03em;
  color: var(--signal);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 28px rgba(255, 200, 58, 0.35);
}
.pct small { font-size: 0.36em; margin-left: 6px; letter-spacing: 0; }

.bar { display: flex; gap: 5px; }

.seg { flex: 1 1 0; min-width: 0; display: grid; gap: 9px; }

.track {
  height: 30px;
  background: rgba(125, 180, 245, 0.13);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
  mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
}
.fill { height: 100%; width: 0; background: var(--phosphor); }

.seg .code {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0.4;
}

.seg.done { filter: drop-shadow(0 0 5px rgba(125, 180, 245, 0.45)); }
.seg.done .code { opacity: 0.85; }

.seg.active { filter: drop-shadow(0 0 7px rgba(255, 200, 58, 0.6)); }
.seg.active .code { color: var(--signal); opacity: 1; }
.seg.active .track { animation: idle-pulse 1.8s ease-in-out infinite; }
.seg.active .fill { background: linear-gradient(90deg, rgba(255, 200, 58, 0.55), var(--signal) 75%, #fff3c8); }

.ready .seg { filter: drop-shadow(0 0 8px rgba(255, 200, 58, 0.7)); }
.ready .seg .fill { background: var(--signal); }
.ready .seg .code { color: var(--signal); }
.ready #phase { color: var(--signal); }

/* Link lost: everything freezes, glow drains, the reading blinks like a paused display. */
.halted .seg { filter: none; }
.halted .seg.active .track { animation: none; }
.halted .seg.active .fill { background: rgba(255, 200, 58, 0.45); }
.halted .pct { animation: blink 1.4s steps(1) infinite; text-shadow: none; }
.halted #phase { color: var(--signal); }
.halted .log::after { animation: none; opacity: 0.25; }

.eta {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(125, 180, 245, 0.6);
}
.eta b { color: var(--ice); font-weight: 500; font-variant-numeric: tabular-nums; }

@keyframes line-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes idle-pulse { 50% { background-color: rgba(255, 200, 58, 0.2); } }

@media (max-width: 640px) {
  .screen-head { padding: 18px 18px 14px; }
  .log { padding: 14px 18px 18px; font-size: 11.5px; }
  .log li { grid-template-columns: 7.5ch minmax(0, 1fr); gap: 0 12px; }
  .log .code, .log .status { display: none; }
  .seg .code { display: none; }
  .bar { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
