:root {
  --bg-primary: #1f1f28;
  --bg-secondary: #24242e;
  --bg-tertiary: #2c2b35;
  --amber-primary: #ffa968;
  --amber-bright: #ffb77d;
  --amber-dim: #c98252;
  --amber-muted: #996344;
  --text-primary: #ffa968;
  --text-secondary: #d9905d;
  --text-dim: #95674d;
  --border-primary: #ff9c57;
  --border-muted: #9c6746;
  --warning: #ff8c42;
  --critical: #ff674d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  background: transparent;
  border: 1px solid var(--border-muted);
  cursor: pointer;
}

button:hover, button.active {
  border-color: var(--border-primary);
  background: rgba(255, 169, 104, 0.08);
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 72px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  background: linear-gradient(#1f1f28 0%, rgba(31, 31, 40, 0.86) 72%, rgba(31, 31, 40, 0));
  border-bottom: 1px solid rgba(156, 103, 70, 0.3);
}

.topbar strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.topbar strong span {
  display: block;
  color: var(--text-secondary);
  margin-top: 3px;
}

.topbar small, .top-clock span {
  display: block;
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 12px;
}

.top-clock {
  text-align: right;
}

.breadcrumbs {
  position: fixed;
  z-index: 6;
  top: 78px;
  left: 330px;
  right: 330px;
  height: 34px;
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--text-dim);
  font-size: 12px;
}

.breadcrumbs button {
  border: 0;
  padding: 0;
  color: var(--text-secondary);
}

.panel {
  position: fixed;
  z-index: 4;
  top: 96px;
  bottom: 84px;
  width: 292px;
  padding: 16px;
  overflow: auto;
  background: rgba(36, 36, 46, 0.94);
  border: 1px solid rgba(156, 103, 70, 0.75);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.left-panel { left: 18px; }
.right-panel { right: 18px; }

.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--text-secondary);
  background: rgba(31, 31, 40, 0.62);
}

.panel-close:hover {
  color: var(--amber-bright);
  border-color: var(--border-primary);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.panel h2 span {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

.panel h3 {
  margin: 19px 0 9px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.metrics {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 5px 9px;
  padding: 12px 0;
  border-top: 1px solid rgba(156, 103, 70, 0.5);
  border-bottom: 1px solid rgba(156, 103, 70, 0.5);
}

.metrics b {
  color: var(--amber-bright);
  font-size: 17px;
}

.metrics span, .network {
  color: var(--text-secondary);
  font-size: 12px;
}

.network {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
}

.pod-list-item, .node-row, .event {
  width: 100%;
  margin: 0 0 7px;
  padding: 9px 10px;
  text-align: left;
  border-color: rgba(156, 103, 70, 0.48);
}

.pod-list-item b, .pod-list-item span,
.node-row b, .node-row span,
.event b, .event span, .event strong {
  display: block;
}

.pod-list-item span, .node-row span, .event span {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.node-row span {
  margin: 0;
}

.node-row.active {
  border-color: var(--border-primary);
  background: rgba(255, 169, 104, 0.09);
}

.back {
  width: 100%;
  margin-bottom: 15px;
  padding: 8px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.feed-head h2 {
  margin: 0;
}

.feed-head button {
  padding: 6px;
  font-size: 11px;
}

.event strong {
  margin-top: 5px;
  color: var(--amber-bright);
  font-size: 12px;
  font-weight: 500;
}

.map-stage {
  position: fixed;
  inset: 72px 0 64px;
  background: #181820;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-stage:active {
  cursor: grabbing;
}

.map-stage.panning,
.map-stage.panning * {
  cursor: grabbing !important;
}

.world {
  width: 100%;
  height: 100%;
  display: block;
}

.camera {
  transform-origin: 0 0;
  transition: transform 1000ms cubic-bezier(0.22, 0.84, 0.22, 1);
}

.ocean { fill: #17171f; }
.land { fill: #343642; stroke: rgba(201, 130, 82, 0.44); stroke-width: 0.35; vector-effect: non-scaling-stroke; }
.graticule {
  pointer-events: none;
}

.grid-line {
  fill: none;
  stroke: rgba(153, 99, 68, 0.16);
  stroke-width: 0.45;
  vector-effect: non-scaling-stroke;
}

.grid-line.major {
  stroke: rgba(201, 130, 82, 0.24);
  stroke-width: 0.6;
}

.ocean-label, .map-loading { fill: rgba(153, 99, 68, 0.58); font-size: 11px; }

.aor {
  fill: rgba(255, 169, 104, 0.025);
  stroke: rgba(255, 156, 87, 0.38);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
  cursor: grab;
  pointer-events: visiblePainted;
  transition: fill 250ms, stroke 250ms;
}

.aor[data-aor-enter] {
  cursor: pointer;
}

.aor.active-regional,
.aor.active-regional:hover {
  cursor: grab;
}

.aor:hover, .aor.selected {
  fill: rgba(255, 169, 104, 0.08);
  stroke: rgba(255, 183, 125, 0.92);
}

.aor.global-hit,
.aor.global-hit:hover,
.aor.global-hit.selected {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.pod-marker circle {
  fill: none;
  stroke: var(--amber-primary);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}

.pod-marker .hover-ring {
  display: none;
  pointer-events: none;
  stroke: var(--amber-bright);
}

.pod-marker {
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 180ms;
}

.pod-marker:hover {
  opacity: 1;
}

.pod-marker:hover .hover-ring {
  display: block;
  opacity: 0.72;
}

.pod-marker .hit-target {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.pod-marker text, .node-marker text, .base-marker text {
  fill: var(--text-primary);
  font-size: 12px;
  pointer-events: none;
}

.pod-marker .minor, .node-marker .minor {
  fill: var(--text-dim);
  font-size: 10px;
}

.pod-marker text {
  pointer-events: all;
}

.base-marker circle, .base-marker path {
  fill: none;
  stroke: var(--amber-dim);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.base-marker {
  cursor: pointer;
}

.base-marker:hover circle,
.base-marker:hover path,
.base-marker.selected circle,
.base-marker.selected path {
  stroke: var(--amber-bright);
}

.base-marker .hit-target {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.base-marker .selection-ring {
  fill: none;
  stroke: rgba(255, 183, 125, 0.62);
  stroke-width: 0.95;
  vector-effect: non-scaling-stroke;
}

.global-base {
  opacity: 0;
  pointer-events: none;
}

.node-marker path {
  fill: none;
  stroke: var(--amber-primary);
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.node-marker {
  cursor: pointer;
}

.node-marker .hit-target {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.node-marker .selection-ring {
  fill: none;
  stroke: rgba(255, 183, 125, 0.72);
  stroke-width: 0.95;
  vector-effect: non-scaling-stroke;
}

.node-marker.selected path {
  stroke: var(--amber-bright);
  stroke-width: 1.55;
}

.node-marker.reserve {
  opacity: 0.55;
}

.node-marker .heading {
  stroke: var(--amber-bright);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.route {
  fill: none;
  stroke: rgba(255, 169, 104, 0.55);
  stroke-width: 0.8;
  stroke-dasharray: 5 5;
  vector-effect: non-scaling-stroke;
}

.track {
  fill: none;
  stroke: rgba(153, 99, 68, 0.68);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.route.dimmed, .track.dimmed {
  opacity: 0.34;
}

.route.selected-route {
  stroke: var(--amber-bright);
  stroke-width: 1.6;
  opacity: 1;
}

.track.selected-track {
  stroke: var(--amber-bright);
  stroke-width: 1.55;
  opacity: 1;
}

.track.mission-track {
  stroke: rgba(201, 130, 82, 0.78);
  stroke-width: 1.05;
}

.controls {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px;
  background: rgba(36, 36, 46, 0.94);
  border: 1px solid rgba(156, 103, 70, 0.75);
}

.controls button {
  position: relative;
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.control-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.controls button[data-zoom-out],
.controls button[data-zoom-in] {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.controls button:disabled {
  cursor: default;
  opacity: 0.38;
}

.controls button:disabled:hover {
  background: transparent;
  border-color: var(--border-muted);
}

.controls button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 10;
  transform: translateX(-50%);
  width: max-content;
  max-width: 230px;
  padding: 5px 7px;
  color: var(--amber-bright);
  background: rgba(31, 31, 40, 0.98);
  border: 1px solid rgba(255, 156, 87, 0.58);
  font-size: 10px;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms;
}

.controls button[data-tooltip]:hover::after {
  opacity: 1;
}

.divider {
  width: 1px;
  height: 24px;
  background: rgba(156, 103, 70, 0.55);
}

.divider.strong {
  width: 2px;
  background: rgba(255, 156, 87, 0.74);
}

.floating-card {
  position: fixed;
  z-index: 8;
  right: 330px;
  top: 132px;
  width: 348px;
  max-height: min(430px, calc(100vh - 154px));
  background: rgba(36, 36, 46, 0.98);
  border: 1px solid var(--border-primary);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.32);
}

.base-card {
  top: 154px;
}

.floating-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(156, 103, 70, 0.65);
}

.draggable-card header[data-card-drag] {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.draggable-card.dragging,
.draggable-card.dragging header[data-card-drag] {
  cursor: grabbing;
}

.floating-card header span {
  color: var(--text-secondary);
  font-size: 12px;
}

.floating-card header button {
  position: relative;
  border: 1px solid rgba(156, 103, 70, 0.85);
  min-width: 28px;
  height: 28px;
  margin: -6px -8px -6px 0;
  color: var(--text-secondary);
  background: rgba(31, 31, 40, 0.72);
  font-size: 13px;
  cursor: pointer;
}

.floating-card header button:hover {
  color: var(--amber-bright);
  border-color: var(--border-primary);
  background: rgba(255, 169, 104, 0.08);
}

.floating-card dl {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 8px 12px;
  margin: 0;
  padding: 14px 12px;
  font-size: 12px;
}

.floating-card dt {
  color: var(--text-dim);
}

.floating-card dd {
  margin: 0;
  color: var(--amber-bright);
}

.base-card dd {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.floating-card footer {
  display: flex;
  border-top: 1px solid rgba(156, 103, 70, 0.65);
}

.floating-card footer button {
  flex: 1;
  border-width: 0 1px 0 0;
  padding: 9px;
  color: var(--text-dim);
  font-size: 11px;
}

.floating-card footer button.active {
  color: var(--amber-bright);
  background: rgba(255, 169, 104, 0.1);
}

.node-card-body {
  max-height: 318px;
  overflow: hidden;
}

.card-tab-content h3 {
  margin: 0;
  padding: 14px 12px 0;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.card-tab-content > strong {
  display: block;
  padding: 6px 12px 0;
  color: var(--amber-bright);
  font-size: 12px;
  font-weight: 500;
}

.card-empty {
  padding: 24px 12px;
  color: var(--text-dim);
  font-size: 12px;
}

.history-list {
  max-height: 286px;
  overflow-y: auto;
  padding: 10px 12px;
  scrollbar-color: rgba(255, 169, 104, 0.42) rgba(31, 31, 40, 0.8);
}

.history-event {
  display: block;
  width: 100%;
  margin: 0 0 7px;
  padding: 9px 10px;
  text-align: left;
  border-color: rgba(156, 103, 70, 0.48);
}

.history-event b,
.history-event span {
  display: block;
}

.history-event span {
  margin-top: 4px;
  color: var(--amber-bright);
  font-size: 12px;
}

.layers-card {
  left: 330px;
  right: auto;
  top: 130px;
  width: 250px;
}

.layers-card label {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.search {
  position: fixed;
  z-index: 10;
  top: 110px;
  left: 50%;
  width: min(520px, calc(100vw - 40px));
  transform: translateX(-50%);
  background: rgba(36, 36, 46, 0.98);
  border: 1px solid var(--border-primary);
}

.search input {
  width: 100%;
  padding: 14px;
  background: #1b1b23;
  border: 0;
  border-bottom: 1px solid rgba(156, 103, 70, 0.75);
  outline: 0;
}

.search button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  border-width: 0 0 1px;
}

.startup {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  background: var(--bg-primary);
  opacity: 1;
  transition: opacity 260ms ease;
}

.startup.exiting {
  opacity: 0;
  pointer-events: none;
}

.startup h1, .startup h2, .startup p {
  margin: 0;
}

.startup h1 {
  font-size: 24px;
  font-weight: 600;
}

.startup h2, .startup p {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
}

.startup-sequence {
  margin-top: 18px;
  display: grid;
  gap: 11px;
  width: min(520px, calc(100vw - 48px));
}

.startup-row {
  display: grid;
  gap: 5px;
}

.startup-row-head {
  display: grid;
  grid-template-columns: 1fr 42px 74px;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.startup-row-head b,
.startup-row-head strong {
  opacity: 0;
  color: var(--amber-primary);
  font-size: 11px;
  font-weight: 500;
  animation: startupStatus 120ms linear forwards;
  animation-delay: calc(var(--delay) + var(--duration));
}

.startup-bar {
  height: 11px;
  border: 1px solid rgba(255, 169, 104, 0.62);
  background: rgba(255, 169, 104, 0.035);
  overflow: hidden;
}

.startup-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--amber-primary);
  transform: scaleX(0);
  transform-origin: left center;
  animation: startupProgress var(--duration) ease-out forwards;
  animation-delay: var(--delay);
}

.startup-ready {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 12px;
  opacity: 0;
  animation: startupStatus 160ms linear forwards;
  animation-delay: 3500ms;
}

.sim-dev-toggle {
  position: fixed;
  z-index: 11;
  right: 18px;
  bottom: 132px;
  min-width: 72px;
  height: 30px;
  padding: 0 10px;
  background: rgba(31, 31, 40, 0.88);
  border-color: rgba(255, 169, 104, 0.65);
  color: var(--text-secondary);
  font-size: 11px;
}

.sim-dev-panel {
  position: fixed;
  z-index: 12;
  right: 18px;
  bottom: 170px;
  width: 310px;
  padding: 12px;
  background: rgba(31, 31, 40, 0.96);
  border: 1px solid rgba(255, 169, 104, 0.72);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
  color: var(--text-secondary);
  font-size: 11px;
}

.sim-dev-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.sim-dev-panel header b {
  font-size: 13px;
  font-weight: 600;
}

.sim-dev-panel header button {
  width: 24px;
  height: 24px;
  padding: 0;
}

.sim-dev-panel dl,
.sim-dev-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 0 0 12px;
}

.sim-dev-panel dt,
.sim-dev-summary span {
  margin: 0;
  color: var(--text-dim);
}

.sim-dev-panel dd,
.sim-dev-summary b {
  margin: 0;
  color: var(--text-primary);
  text-align: right;
  font-weight: 500;
}

.sim-dev-panel .pass { color: var(--amber-bright); }
.sim-dev-panel .fail { color: var(--critical); }

.sim-dev-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.sim-dev-actions button,
.sim-dev-panel > button,
.sim-dev-confirm button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.sim-dev-actions button:disabled {
  opacity: 0.42;
  cursor: default;
}

.sim-dev-note,
.sim-dev-status {
  margin: 8px 0;
  color: var(--warning);
}

.sim-dev-confirm {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.sim-dev-confirm span {
  color: var(--warning);
}

.sim-dev-summary {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(156, 103, 70, 0.55);
}

@keyframes startupProgress {
  to { transform: scaleX(1); }
}

@keyframes startupStatus {
  to { opacity: 1; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .topbar, .panel, .map-stage, .controls, .breadcrumbs { position: static; }
  .topbar { height: auto; }
  .breadcrumbs { padding: 8px 16px; }
  .map-stage { height: 58vh; min-height: 360px; }
  .panel { width: auto; margin: 10px 16px; max-height: none; }
  .controls { transform: none; margin: 10px auto; width: max-content; max-width: calc(100vw - 32px); }
  .controls button { padding: 0 7px; }
  .floating-card { left: 16px; right: 16px; top: 90px; width: auto; }
  .sim-dev-toggle, .sim-dev-panel { position: static; margin: 10px 16px; width: auto; }
}
