:root {
  color-scheme: dark;
  --cyan: #88f0ed;
  --amber: #ffad74;
  --muted: #b6cdd6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #081622;
  color: #f0f7fa;
  font:
    16px/1.45 system-ui,
    sans-serif;
}
main {
  height: 100vh;
  display: grid;
  grid-template-rows: 42px minmax(90px, 1fr) auto auto;
  overflow: hidden;
}
header,
footer,
.weights,
.case-id {
  display: flex;
  align-items: center;
}
header,
footer {
  justify-content: space-between;
  padding: 0 16px;
}
header {
  border-bottom: 1px solid #345061;
}
header b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
header i {
  width: 9px;
  height: 9px;
  background: var(--cyan);
  transform: skewX(-22deg);
  box-shadow: 4px 0 0 #387982;
}
header span,
.territory,
.case-id,
small,
.weights {
  font-family: ui-monospace, monospace;
}
header span {
  font-size: 11px;
  color: var(--muted);
}
.map {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, #154357, #061420 78%);
}
svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
svg image {
  opacity: 0.78;
}
.territory {
  fill: #9ab6c5;
  font-size: 5px;
  letter-spacing: 1px;
}
.cities {
  fill: #edffff;
  paint-order: stroke;
  stroke: #082435;
  stroke-width: 2px;
  font-size: 8px;
  font-weight: 650;
}
.planned,
.trace {
  fill: none;
  stroke-linecap: round;
}
.planned {
  stroke: #85a6b6;
  stroke-width: 1.3;
  stroke-dasharray: 2 3;
}
.trace {
  stroke: var(--cyan);
  stroke-width: 1.8;
  stroke-dasharray: 1;
  filter: drop-shadow(0 0 2px #20d7e8);
}
.origin,
.dest {
  fill: #e5ffff;
  stroke: #0798a9;
  stroke-width: 1.5;
}
.halo {
  fill: none;
  stroke: var(--cyan);
  transform-origin: 255px 328px;
}
body[data-step="2"] .origin {
  fill: var(--amber);
  stroke: #f0863f;
}
body[data-step="2"] .halo {
  stroke: var(--amber);
}
.case-id {
  position: absolute;
  left: 16px;
  top: 10px;
  gap: 6px;
  background: #091925e8;
  padding: 4px 8px;
  border: 1px solid #39525c;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
}
.case-id strong {
  color: white;
}
.readout {
  position: relative;
  background: #0b1c2b;
  border-top: 1px solid #2d4858;
  padding: 14px 18px;
  min-height: 112px;
}
.readout article {
  display: grid;
  align-content: center;
  gap: 5px;
}
.readout article[hidden] {
  display: none;
}
small {
  color: var(--cyan);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.11em;
}
.readout h1 {
  font-size: clamp(21px, 4.2vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 3px 0;
  font-weight: 640;
}
h1 span {
  color: var(--cyan);
}
.readout p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.readout b {
  color: white;
}
.readout article:last-child small,
.readout article:last-child h1 b {
  color: var(--amber);
}
.weights {
  flex-wrap: wrap;
  gap: 5px 18px;
  font-size: 12px;
  color: var(--muted);
}
footer {
  border-top: 1px solid #233c4c;
  gap: 5px;
  min-height: 44px;
}
nav {
  display: flex;
  gap: 4px;
}
button {
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: 600 12px system-ui;
  padding: 8px;
}
button[aria-pressed="true"] {
  color: var(--cyan);
  border-bottom: 2px solid currentColor;
}
#play {
  border: 1px solid #506775;
  border-radius: 5px;
  padding: 5px 9px;
}
button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}
@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes beacon {
  from {
    transform: scale(0.55);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0.15;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .trace {
    animation: draw 2.6s ease-in-out both;
  }
  .halo {
    animation: beacon 1.8s ease-out infinite;
  }
  .readout article:not([hidden]) {
    animation: rise 0.4s ease both;
  }
  body[data-running="false"] :is(.trace, .halo) {
    animation-play-state: paused;
  }
}
@media (max-width: 380px) {
  header,
  footer {
    padding-inline: 10px;
  }
  .readout {
    padding: 12px;
    min-height: 113px;
  }
  button {
    padding: 7px;
  }
  .case-id {
    font-size: 10px;
    left: 8px;
    top: 6px;
  }
}

.hold {
  opacity: 0;
}
body[data-step="2"] .hold {
  opacity: 1;
}
.weights span {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 3px 7px;
}
.weights span::after {
  content: "";
  grid-column: 1 / -1;
  height: 3px;
  background: var(--cyan);
  transform-origin: left;
}
.weights span:nth-child(2)::after {
  background: #c5d7db;
}
@media (prefers-reduced-motion: no-preference) {
  body[data-running="true"] .weights span::after {
    animation: weigh 1.5s ease-out both;
  }
  body[data-running="true"][data-step="2"] .hold {
    animation: rise 0.5s ease-out;
  }
  @keyframes weigh {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }
}
