* { box-sizing: border-box }
:root {
  color-scheme: dark;
  --bg: #090c0d;
  --panel: #0e1315;
  --line: #293337;
  --text: #ebf2f1;
  --dim: #9fafb1;
  --red: #ff6a5a;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font: 16px/1.45 system-ui, sans-serif;
}
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text) }
button, a, input { touch-action: manipulation }
button {
  background: #10181b;
  border: 1px solid var(--line);
  padding: .48rem .7rem;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}
button:hover { border-color: var(--red); color: var(--red) }
button:disabled { opacity: .43; cursor: default }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px }
a { color: var(--dim); text-decoration-color: #46585d; text-underline-offset: .2em }
a:hover { color: var(--text) }
[hidden] { display: none !important }
.masthead {
  min-height: 62px;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #0a0e10;
}
.brand { display: flex; align-items: center; gap: .85rem; letter-spacing: .14em; font-size: 1.18rem }
.brand strong span { color: var(--red) }
.symbol {
  position: relative; display: grid; place-items: center;
  width: 29px; height: 22px; color: var(--red);
  border: 1px solid currentColor; border-radius: 65% 12%;
  transform: rotate(45deg);
}
.symbol i { width: 11px; height: 11px; border-radius: 100%; background: currentColor; box-shadow: 0 0 14px #ff6a5a6f }
.mast-label, .clock, h2, .readout, .coords, .globe-help, #frame, .frame-ticks button {
  font: 500 .875rem/1.25 var(--mono);
  letter-spacing: .055em;
}
.mast-label { color: var(--dim) }
.clock { justify-self: end; display: flex; gap: .7rem; white-space: nowrap; font-variant-numeric: tabular-nums }
.clock span { color: var(--red) }
.console, footer { width: min(100% - clamp(1.25rem, 4vw, 4rem), 1710px); margin-inline: auto }
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(230px, 22vw, 292px);
  grid-template-areas: "view panel" "history panel";
  grid-template-rows: max(660px, calc(100svh - 244px)) auto;
  gap: .65rem;
  padding-top: .75rem;
}
.viewport {
  grid-area: view; min-width: 0; position: relative; overflow: hidden; isolation: isolate;
  border: 1px solid #334247; background: #091013;
}
canvas, #flat { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: contain }
canvas { touch-action: none; cursor: grab }
canvas:active { cursor: grabbing }
canvas:focus-visible { outline-offset: -3px }
.stage-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, #0a1012a0, transparent 26% 74%, #0a1012a0),
    repeating-linear-gradient(90deg, #a5bcbc14 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, #a5bcbc14 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, #080a0b22 0 1px, transparent 1px 4px);
}
.view-head, .coords, .globe-help { position: absolute; pointer-events: none }
.view-head { top: 1.2rem; left: 1.4rem; max-width: calc(100% - 2.8rem) }
h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.3rem); line-height: 1.06; letter-spacing: -.035em; font-weight: 630 }
.readout {
  display: flex; align-items: center; gap: .5rem; margin-top: .58rem; width: fit-content;
  padding: .3rem .47rem; background: #0a1012dd; color: #d3dbdb; border-left: 1px solid #566467;
  letter-spacing: 0;
}
.dot { width: .43rem; height: .43rem; border-radius: 50%; background: #a4b0b1; flex: none }
[data-signal="latest"] .dot { background: var(--red); box-shadow: 0 0 9px #ff6a5aaf }
[data-signal="archive"] .dot { background: #f3bb75 }
.coords, .globe-help { bottom: 1.15rem; background: #0a1012db; padding: .42rem .6rem; border: 1px solid #354145 }
.coords { left: 1.25rem; display: flex; gap: .7rem; color: var(--text); white-space: nowrap }
.coords span + span { color: var(--red); border-left: 1px solid #546165; padding-left: .7rem }
.globe-help { right: 1.25rem; color: var(--dim); text-transform: uppercase; font-size: .75rem }
.optic, .target-reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none }
.optic {
  height: 94%; max-width: 94%; aspect-ratio: 1; border: 1px solid #90a6a944; border-radius: 50%;
  box-shadow: 0 0 0 10px #0e202444, inset 0 0 0 8px #0d191b28;
}
.optic i, .optic b, .optic span { position: absolute; inset: -4px; border: 2px solid transparent; border-radius: 50% }
.optic i { border-top-color: #ff6a5aa3; border-bottom-color: #ff6a5aa3; transform: rotate(-32deg) }
.optic b { inset: 10px; border-left-color: #afc4c155; border-right-color: #afc4c155; transform: rotate(17deg) }
.optic span { inset: -9px; border: 1px dashed #9aafac43 }
.target-reticle { width: 48px; height: 48px; color: var(--red); opacity: .85 }
.target-reticle i { width: 12px; height: 12px; position: absolute; border: 1px solid currentColor }
.target-reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0 }
.target-reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0 }
.target-reticle i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0 }
.target-reticle i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0 }
.target-reticle b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 100%; background: currentColor; transform: translate(-50%, -50%); box-shadow: 0 0 8px currentColor }
.viewport.acquiring .target-reticle { animation: acquire .4s ease-out }
@keyframes acquire { from { scale: 1.75; opacity: .3 } to { scale: 1; opacity: .85 } }
.zoom { position: absolute; right: 1.25rem; bottom: 3.65rem; display: grid; gap: 4px }
.zoom button { width: 38px; height: 38px; padding: 0; font-size: 1.25rem; background: #0b1215f0 }
.panel { grid-area: panel; min-width: 0; background: var(--panel); border: 1px solid var(--line) }
.block { padding: .95rem 1rem; border-bottom: 1px solid var(--line) }
.block:last-child { border-bottom: 0 }
h2 { margin: 0 0 .65rem; text-transform: uppercase; color: #c4cfce }
.layers, .regions { display: grid; gap: 4px }
.layers button, .regions button { text-align: left; min-height: 32px }
.layers button { display: flex; align-items: center; gap: .55rem }
.layers .selected, .regions [aria-pressed="true"] { color: #ffd1ca; border-color: #8a4943; background: #301b1c; box-shadow: inset 2px 0 var(--red) }
.layer-icon { width: 12px; height: 12px; flex: none; border: 1px solid currentColor }
.layer-icon.thermal { border-radius: 50%; background: radial-gradient(circle, currentColor 28%, transparent 34%) }
.layer-icon.daylight { border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%) }
.layer-icon.terrain { transform: rotate(45deg) scale(.8) }
.overview { position: relative; overflow: hidden; height: 88px; border: 1px solid #293638; margin-bottom: .55rem; background: #11191b }
.overview img { display: block; width: 100%; height: 100%; filter: grayscale(1) brightness(.66) contrast(1.2) }
.overview::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, #0a1012aa 0 1px, transparent 1px 5px) }
.overview i {
  position: absolute; z-index: 1; width: 8px; height: 8px; transform: translate(-50%, -50%);
  left: 54%; top: 37%; border: 1px solid var(--red); border-radius: 50%; box-shadow: 0 0 8px #ff6a5a70;
}
.regions button { padding: .32rem .55rem; background: #101619 }
.regions button[aria-pressed="true"] { background: #301b1c }
dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .26rem .65rem; font-size: .875rem }
dt { color: var(--dim) }
dd { margin: 0; overflow-wrap: anywhere }
#capture, #age { font-variant-numeric: tabular-nums }
#details { margin: .65rem 0 0; color: var(--dim); font-size: .875rem }
.timeline { grid-area: history; min-width: 0; background: var(--panel); border: 1px solid var(--line); padding: .8rem 1rem }
.timeline-top, .transport { display: flex; align-items: center; gap: .8rem }
.timeline-top { justify-content: space-between; margin-bottom: .65rem }
.timeline h2 { margin: 0 }
.timeline h2 span { color: var(--dim); margin-left: .42rem; font-size: .75rem }
#frame { color: #f0aca5; white-space: nowrap }
#play, #latest { align-self: flex-start }
#play { min-width: 4.65rem }
#latest { border-color: #79433e; color: #ffc2ba; white-space: nowrap }
.track { min-width: 0; flex: 1 }
.track input { display: block; width: 100%; margin: 0; accent-color: var(--red) }
.frame-ticks { display: flex; justify-content: space-between; gap: 2px; min-height: 22px }
.frame-ticks button {
  padding: .1rem .15rem; min-width: 0; border-color: transparent; background: transparent;
  color: var(--dim); font-size: .75rem; white-space: nowrap; letter-spacing: 0;
}
.frame-ticks button[aria-current="true"] { color: var(--red); border-bottom-color: var(--red) }
.frame-ticks button:hover { color: var(--text) }
footer { display: flex; gap: .5rem 1.25rem; flex-wrap: wrap; padding: .75rem 0 1rem; font-size: .8125rem }
@media (max-width: 780px) {
  .console { grid-template-columns: minmax(0, 1fr); grid-template-areas: "view" "history" "panel"; grid-template-rows: max(360px, 54svh) auto auto }
  .masthead { grid-template-columns: 1fr auto }
  .mast-label { display: none }
  .panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .block { padding: .85rem .75rem }
  .sector-block { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid var(--line); border-bottom: 0 }
  .overview { height: 70px }
  .telemetry dl { grid-template-columns: 1fr; gap: .15rem }
  .telemetry dd + dt { margin-top: .22rem }
  .view-head, .coords { left: .65rem }
  .zoom, .globe-help { right: .65rem }
  .timeline { padding: .65rem }
  .transport { gap: .45rem }
}
@media (max-width: 475px) {
  .frame-ticks button:nth-child(even) { display: none }
  #latest { padding-inline: .45rem }
  .globe-help { display: none }
  .zoom { bottom: .75rem }
  .coords { bottom: .75rem; font-size: .75rem }
}
@media (pointer: coarse) { .globe-help { display: none } }
@media (prefers-reduced-motion: reduce) { .viewport.acquiring .target-reticle { animation: none } }
.viewport.flat :is(.optic, .target-reticle, .globe-help, #zoom-value) { display: none }
.viewport::after {
  content: ""; pointer-events: none; position: absolute; inset: 9px;
  background:
    linear-gradient(var(--red), var(--red)) left top / 18px 1px,
    linear-gradient(var(--red), var(--red)) left top / 1px 18px,
    linear-gradient(#829295, #829295) right top / 18px 1px,
    linear-gradient(#829295, #829295) right top / 1px 18px,
    linear-gradient(#829295, #829295) left bottom / 18px 1px,
    linear-gradient(#829295, #829295) left bottom / 1px 18px,
    linear-gradient(var(--red), var(--red)) right bottom / 18px 1px,
    linear-gradient(var(--red), var(--red)) right bottom / 1px 18px;
  background-repeat: no-repeat;
  opacity: .7;
}
.console {
  grid-template-areas: "search search" "view panel" "history panel";
  grid-template-rows: auto max(600px, calc(100svh - 334px)) auto;
}
.coordinate-search {
  grid-area: search;
  display: grid;
  gap: .38rem;
  padding: .62rem .85rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.coordinate-entry { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.coordinate-entry label { color: #c4cfce; font: 500 .875rem/1.25 var(--mono); text-transform: uppercase; }
.coordinate-entry input {
  flex: 1;
  min-width: 8rem;
  max-width: 28rem;
  border: 1px solid #49595d;
  padding: .43rem .62rem;
  background: #080e10;
  color: var(--text);
  font: 1rem/1.3 var(--mono);
  border-radius: 0;
}
.coordinate-entry input::placeholder { color: #839599; opacity: 1; }
.coordinate-entry input[aria-invalid="true"], #locate { border-color: #96615a; }
#locate { background: #301b1c; color: #ffd1ca; }
#locate:hover { border-color: var(--red); }
#coordinate-hint { margin: 0; color: var(--dim); font-size: .8125rem; }
#coordinate-search[data-invalid="true"] #coordinate-hint { color: #ffaaa1; }
.overview { cursor: crosshair; }
.overview:hover { border-color: var(--red); }
.overview img { pointer-events: none; user-select: none; }
@media (max-width: 780px) {
  .console { grid-template-areas: "search" "view" "history" "panel"; grid-template-rows: auto max(360px, 54svh) auto auto; }
}
@media (max-width: 475px) {
  .coordinate-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
  .coordinate-entry label { grid-column: 1 / -1; }
  .coordinate-entry input { width: 100%; }
  #copy-coordinates { justify-self: start; }
}
.detail-presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.detail-presets button { padding: .3rem .6rem; }
#open-detail { border-color: #96615a; color: #ffd1ca; }
.viewport.detail-open > :not(.detail) { visibility: hidden; }
.viewport.detail-open::after { display: none; }
.detail { position: absolute; inset: 0; overflow: hidden; background: #10191c; }
#detail-map { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#detail-map:active { cursor: grabbing; }
#detail-map:focus-visible { outline-offset: -3px; z-index: 1; }
.detail-tile { position: absolute; top: 0; left: 0; width: 256px; height: 256px; user-select: none; pointer-events: none; color: transparent; }
.detail-header, .detail-data, .detail-controls, .detail-credit { position: absolute; z-index: 2; }
.detail-header { inset: .65rem .65rem auto; display: flex; align-items: flex-start; justify-content: space-between; gap: .4rem; pointer-events: none; }
.detail-header h2, .detail-data, .detail-credit { background: #0a1012ed; border: 1px solid #49595d; padding: .45rem .55rem; }
.detail-header h2 { margin: 0; color: #ffd1ca; }
.detail-header button { pointer-events: auto; }
.detail-controls { right: .65rem; bottom: 3.5rem; display: grid; gap: .3rem; }
.detail-controls button { width: 42px; height: 42px; padding: 0; font-size: 1.35rem; }
.detail-data { left: .65rem; bottom: 3.5rem; display: grid; gap: .15rem; pointer-events: none; font-size: .875rem; max-width: calc(100% - 4.7rem); }
.detail-data strong { font-family: var(--mono); color: #ffd1ca; }
.detail-data span { color: #d3dbdb; }
.detail-credit { bottom: .45rem; right: .65rem; left: .65rem; margin: 0; font-size: .6875rem; pointer-events: none; }
.detail::after { content: "+"; color: #ffd1ca; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); pointer-events: none; z-index: 2; text-shadow: 1px 1px 2px #111, -1px -1px 2px #111; font: 28px/1 var(--mono); }
@media (max-width: 475px) { #open-detail { justify-self: end; } }
