:root {
  color-scheme: dark;
  --base: #080d0f;
  --panel: #0d1518;
  --panel-dark: #0b1215;
  --border: #213336;
  --muted: #8a9c9b;
  --quiet: #6f8685;
  --ivory: #eaf0eb;
  --teal: #8de8d1;
  --amber: #f7bd77;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --body: Inter, Arial, sans-serif;
  --display: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--base);
  color: var(--ivory);
  font-family: var(--body);
}

button, input { font: inherit; }

button {
  cursor: pointer;
  color: inherit;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

[hidden] { display: none !important; }

.simulation {
  height: 100svh;
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  isolation: isolate;
}

.topbar {
  position: relative;
  z-index: 2;
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 auto;
  padding: 1px;
  color: var(--teal);
}

.brand strong, .brand span { display: block; }

.brand strong {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 600;
}

.brand span {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .17em;
  color: var(--muted);
}

.data-source {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #99b3af;
  font: 500 9px/1.3 var(--mono);
  letter-spacing: .15em;
}

.signal, .radar-dot, .sector-live {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--teal);
  box-shadow: 0 0 8px #8de8d188;
}

.toolbar {
  display: flex;
  justify-self: end;
  gap: 8px;
}

.utility-button {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #142023;
  color: #d0dfdc;
  font: 500 10px/1 var(--mono);
  transition: color .15s, background .15s, border-color .15s;
}

.utility-button:hover, .utility-button[aria-pressed="true"] {
  background: #1b3334;
  border-color: #4b7a75;
  color: #b5f7e8;
}

.sound-on, [data-sound="true"] .sound-off { display: none; }
[data-sound="true"] .sound-on { display: block; }

.viewport {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 71% 47%, #244944, #172c2e 41%, #0f1b20 73%, #0a1014);
}

#scene, .scene-veil {
  position: absolute;
  inset: 0;
}

#scene > canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

[data-view="orbit"] #scene { cursor: grab; touch-action: none; }
[data-view="orbit"] #scene:active { cursor: grabbing; }

.scene-veil {
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, #090e12ef 0%, #0a1014d9 15%, #0b101481 34%, #0b10141a 54%, transparent 69%),
    linear-gradient(0deg, #080d10b5 0%, transparent 22%, transparent 79%, #080d1054 100%);
}

.instrument-frame {
  position: absolute;
  z-index: 1;
  inset: 15px 17px;
  pointer-events: none;
}

.instrument-frame i {
  position: absolute;
  display: block;
  width: 14px;
  height: 14px;
  border: solid #a3ded45e;
  border-width: 0;
}

.instrument-frame i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.instrument-frame i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.instrument-frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.instrument-frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

.sector {
  position: absolute;
  z-index: 2;
  top: 32px;
  right: 35px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #4662609c;
  border-radius: 2px;
  background: #0b151bd6;
  pointer-events: none;
  color: #a7bbb8;
  font: 500 10px/1.2 var(--mono);
  letter-spacing: .06em;
  white-space: nowrap;
}

.sector-live { background: var(--amber); box-shadow: 0 0 10px #f7bd7788; }
.sector-text { display: flex; align-items: center; gap: 7px; }
.sector strong { color: var(--ivory); font-weight: 500; text-transform: uppercase; }

.hero {
  position: absolute;
  z-index: 2;
  inset: 0 auto 0 clamp(34px, 4.6vw, 82px);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.hero-inner { margin-top: -4px; }

.hero-overline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--teal);
  font: 500 10px/1.3 var(--mono);
  letter-spacing: .16em;
}

.hero-overline::before {
  width: 19px;
  height: 1px;
  content: "";
  background: var(--teal);
}

.hero h1 {
  margin: 0;
  color: #f0f2e8;
  font: 800 clamp(78px, min(8.6vw, 15vh), 164px)/.77 var(--display);
  letter-spacing: -.024em;
}

.hero h1 span {
  display: block;
  margin-top: .095em;
  color: transparent;
  -webkit-text-stroke: 1.3px #d4e0d5;
}

.hero p {
  max-width: 320px;
  margin: 30px 0 22px;
  color: #bdcdca;
  font-size: 13px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.play-button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 17px;
  pointer-events: auto;
  border: 1px solid #aeffe8;
  border-radius: 3px;
  background: var(--teal);
  color: #06221e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .18s, border-color .18s, box-shadow .18s;
}

.play-button:hover {
  border-color: #d6fff2;
  background: #aaf7e2;
  box-shadow: 0 0 25px #7af8d93b;
}

#play-icon {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
}

#play-icon:empty::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

[data-playing="true"] #play-icon:empty::before {
  width: 4px;
  height: 10px;
  margin-left: 0;
  border: solid currentColor;
  border-width: 0 2px;
}

.space-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #93a8a6;
  font: 400 9px/1 var(--mono);
  white-space: nowrap;
}

.space-hint kbd {
  padding: 4px 5px;
  border: 1px solid #637575;
  border-radius: 2px;
  font: inherit;
}

.radar-panel {
  position: absolute;
  z-index: 2;
  right: 35px;
  bottom: 31px;
  width: 194px;
  padding: 9px;
  border: 1px solid #456660;
  border-radius: 3px;
  background: #0b1619ed;
  box-shadow: 0 5px 24px #080e13a0;
  pointer-events: none;
}

.radar-heading, .radar-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #adc4be;
  font: 500 9px/1.2 var(--mono);
  letter-spacing: .09em;
}

.radar-heading { padding: 1px 1px 8px; }

.radar-dot {
  width: 4px;
  height: 4px;
}

.radar-body {
  overflow: hidden;
  position: relative;
  border: 1px solid #243e3e;
  background-color: #102023;
  background-image: linear-gradient(90deg, #3a65532b 1px, transparent 1px), linear-gradient(0deg, #3a65532b 1px, transparent 1px);
  background-size: 16px 16px;
}

#radar {
  display: block;
  width: 100%;
  height: 124px;
}

.radar-footer {
  padding: 8px 1px 1px;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.view-hint {
  display: none;
  position: absolute;
  z-index: 2;
  left: clamp(34px, 4.6vw, 82px);
  bottom: 30px;
  color: #e0eee9;
  background: #0c171bd9;
  padding: 6px 8px;
  border: 1px solid #344e4d;
  border-radius: 2px;
  font: 400 10px/1.2 var(--mono);
  pointer-events: none;
}

[data-view="orbit"] .view-hint { display: block; }

.view-hint span { color: var(--teal); }

#loading {
  position: absolute;
  z-index: 3;
  left: 67%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  white-space: nowrap;
  background: #0c171bee;
  border: 1px solid #52716d;
  border-radius: 2px;
  color: #d8ebe6;
  font: 500 10px/1.3 var(--mono);
  pointer-events: none;
}

.loading-indicator {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid #3a5c58;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: loading-spin .8s linear infinite;
}

@keyframes loading-spin { to { transform: rotate(360deg); } }

.playback {
  position: relative;
  display: grid;
  gap: 13px;
  padding: 12px 30px 11px;
  border-top: 1px solid #2d4445;
  background: linear-gradient(180deg, #10191c, #0d1518);
}

.track {
  display: grid;
  grid-template-columns: auto minmax(40px, 1fr) auto;
  min-height: 27px;
  align-items: center;
  gap: 14px;
}

.track-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b6c8c4;
  font: 500 9px/1.2 var(--mono);
  letter-spacing: .13em;
}

.restart-button {
  display: grid;
  width: 30px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: #c9dcda;
  background: #172427;
  transition: color .15s, border-color .15s;
}

.restart-button:hover {
  color: var(--teal);
  border-color: #4b7a75;
}

.timeline-label { display: flex; align-items: center; }

#timeline {
  --progress: 0%;
  appearance: none;
  width: 100%;
  height: 24px;
  display: block;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--teal);
}

#timeline::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 1px;
  background: linear-gradient(to right, var(--teal) var(--progress), #334748 var(--progress));
}

#timeline::-moz-range-track {
  height: 3px;
  border-radius: 1px;
  background: linear-gradient(to right, var(--teal) var(--progress), #334748 var(--progress));
}

#timeline::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border: 1px solid #b1ffeb;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 9px #8de8d16b;
}

#timeline::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 1px solid #b1ffeb;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 9px #8de8d16b;
}

.sequence-time {
  color: #91a5a1;
  text-align: right;
  font: 500 10px/1.2 var(--mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#time-current { color: var(--teal); }
.time-divider { margin: 0 2px; color: #728983; }

.phases {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.phase {
  min-height: 57px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  padding: 7px 11px;
  border: 1px solid #273a3d;
  border-radius: 3px;
  background: #111c20;
  color: #b8c7c5;
  text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}

.phase:hover { background: #192b2e; color: var(--ivory); }

.phase[aria-current], .phase.is-active, .phase.active {
  border-color: #56897e;
  color: #def7ef;
  background: linear-gradient(90deg, #1c3937, #17282b);
}

.phase-index {
  grid-row: 1 / 3;
  padding: 4px;
  border: 1px solid #385252;
  border-radius: 2px;
  color: #a3b7b5;
  font: 500 9px/1 var(--mono);
}

.phase[aria-current] .phase-index, .phase.is-active .phase-index, .phase.active .phase-index {
  color: var(--teal);
  border-color: #54867c;
}

.phase-name { font-size: 12px; font-weight: 600; }

.phase-detail {
  grid-column: 2;
  overflow: hidden;
  color: #9badab;
  font: 400 9px/1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 30px;
  padding: 4px 30px;
  border-top: 1px solid #203136;
  background: var(--panel-dark);
  color: #90a39f;
  font: 400 9px/1.35 var(--mono);
}

.footer-engine { letter-spacing: .14em; }

.attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 5px;
  justify-content: flex-end;
}

.attribution a { color: inherit; text-decoration: none; }
.attribution a:hover { color: var(--teal); text-decoration: underline; }

.sr-only {
  clip: rect(0, 0, 0, 0);
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  white-space: nowrap;
}

@media (max-width: 930px) {
  .topbar, .playback, .footer { padding-inline: 19px; }
  .hero h1 { font-size: clamp(68px, 11.1vw, 108px); }
  .hero p { margin-top: 24px; }
  .radar-panel { width: 161px; right: 28px; bottom: 26px; }
  #radar { height: 105px; }
  .sector { right: 28px; top: 26px; }
}

@media (max-width: 650px) {
  .simulation { min-height: 650px; }
  .topbar {
    min-height: 54px;
    grid-template-columns: 1fr auto;
    padding-inline: 12px;
  }
  .brand { gap: 6px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand strong { font-size: 10px; }
  .brand span { font-size: 8px; }
  .data-source, .space-hint { display: none; }
  .toolbar { gap: 5px; }
  .utility-button { gap: 5px; padding: 0 6px; font-size: 9px; }
  .utility-button svg { width: 14px; height: 14px; }
  .scene-veil {
    background:
      linear-gradient(0deg, #090e12f2 0%, #090e12c2 25%, #0b101434 49%, transparent 71%),
      linear-gradient(90deg, #090e1247 0%, transparent 39%);
  }
  .instrument-frame { inset: 10px; }
  .sector { top: 19px; right: 16px; }
  .hero { inset: auto auto 25px 20px; }
  .hero-inner { margin: 0; }
  .hero-overline { font-size: 8px; letter-spacing: .1em; margin-bottom: 9px; }
  .hero-overline::before { width: 12px; }
  .hero h1 { font-size: clamp(49px, 12.1vw, 72px); }
  .hero h1 span { -webkit-text-stroke-width: 1px; }
  .hero p { max-width: 246px; margin: 15px 0; font-size: 11px; line-height: 1.5; }
  .play-button { min-height: 39px; gap: 8px; padding-inline: 12px; font-size: 11px; }
  .radar-panel { bottom: 19px; right: 16px; width: 114px; padding: 5px; }
  .radar-heading { padding: 2px 1px 5px; font-size: 7px; gap: 4px; }
  #radar { height: 74px; }
  .radar-footer { display: none; }
  .view-hint { bottom: auto; left: 16px; top: 21px; font-size: 8px; }
  #loading { top: 32%; left: 54%; }
  .playback { gap: 8px; padding: 8px 12px; }
  .track { gap: 8px; }
  .track-label { gap: 6px; font-size: 8px; }
  .restart-button { width: 26px; height: 26px; }
  .restart-button svg { width: 15px; height: 15px; }
  .phases { gap: 4px; }
  .phase { min-height: 42px; grid-template-columns: minmax(0, 1fr); gap: 3px; padding: 4px 5px; }
  .phase-index { grid-row: auto; padding: 0; border: 0; font-size: 8px; }
  .phase-name { font-size: 10px; }
  .phase-detail, .footer-engine { display: none; }
  .footer { justify-content: center; min-height: 27px; padding-inline: 8px; font-size: 8px; }
  .attribution { justify-content: center; }
}

@media (max-width: 390px) {
  .hero p { max-width: 195px; }
  .radar-panel { right: 15px; width: 86px; }
  #radar { height: 57px; }
}

@media (max-height: 745px) and (min-width: 651px) {
  .hero-overline { margin-bottom: 9px; }
  .hero h1 { font-size: clamp(76px, min(9.5vw, 14vh), 135px); }
  .hero p { margin: 22px 0 17px; }
  .radar-panel { width: 154px; }
  #radar { height: 97px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
  .loading-indicator { animation: none; }
}
