:root {
  color-scheme: dark;
  --bg: #050707;
  --panel: #111819;
  --panel-line: #254246;
  --text: #d8f7e2;
  --muted: #7fa393;
  --radar: #55ff7a;
  --radar-dim: rgba(85, 255, 122, 0.22);
  --target: #73dcff;
  --caution: #ffd84d;
  --warn: #ff7247;
  --own: #ffe66d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 300px;
  height: 100vh;
}

.radar-stage {
  min-width: 0;
  display: grid;
  place-items: center;
  background: #000;
}

.radar-svg {
  width: min(100vw, calc(100vh - 16px));
  height: min(100vw, calc(100vh - 16px));
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  display: block;
}

.radar-bg {
  fill: #020504;
}

.range-ring,
.bearing-line,
.cross-line {
  fill: none;
  stroke: var(--radar-dim);
  vector-effect: non-scaling-stroke;
}

.range-ring {
  stroke-width: 1;
}

.alarm-ring {
  fill: none;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.warning-ring {
  stroke: rgba(255, 216, 77, 0.45);
}

.danger-ring {
  stroke: rgba(255, 114, 71, 0.58);
}

.bearing-line,
.cross-line {
  stroke-width: 1;
}

.bearing-tick {
  stroke: rgba(216, 247, 226, 0.45);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.true-north-line {
  stroke: rgba(216, 247, 226, 0.7);
  stroke-width: 1.4;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.heading-guide-line {
  stroke: rgba(255, 230, 109, 0.65);
  stroke-dasharray: 8 8;
  stroke-width: 1.4;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.land-echo {
  fill: rgba(235, 241, 226, 0.38);
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.land-echo-layer {
  filter: url(#softGlow);
  pointer-events: none;
}

.bearing-label {
  fill: rgba(216, 247, 226, 0.8);
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: middle;
  user-select: none;
}

.own-ship {
  fill: var(--own);
  stroke: #fff7b0;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.target-symbol {
  fill: var(--target);
  stroke: rgba(210, 249, 255, 0.9);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.target-symbol.alarm.warning {
  fill: var(--caution);
  stroke: rgba(255, 244, 179, 0.95);
  filter: url(#softGlow);
}

.target-symbol.alarm.danger {
  fill: var(--warn);
  stroke: rgba(255, 190, 170, 0.95);
  filter: url(#softGlow);
}

.vector-line {
  stroke: var(--target);
  stroke-width: 2;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.own-vector {
  stroke: var(--own);
}

.true-vector {
  stroke: #b79cff;
}

.sweep-line {
  stroke: rgba(85, 255, 122, 0.55);
  stroke-linecap: round;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}

.dynamic-sweep-layer {
  filter: url(#softGlow);
  pointer-events: none;
}

.target-symbol.target-lit {
  filter: url(#softGlow);
  stroke: rgba(255, 255, 255, 0.98);
  stroke-width: 2;
}

.target-echo-core {
  fill: rgba(248, 255, 245, 0.95);
  stroke: rgba(248, 255, 245, 0.72);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.target-echo-halo {
  fill: rgba(235, 255, 232, 0.2);
  stroke: rgba(248, 255, 245, 0.72);
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.target-echo-ring {
  fill: none;
  stroke: rgba(210, 255, 220, 0.55);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.target-flash {
  fill: rgba(210, 255, 220, 0.22);
  stroke: rgba(230, 255, 236, 0.95);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ebl-line,
.vrm-ring {
  stroke: #ff7a42;
  stroke-width: 1.5;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.control-panel,
.side-panel {
  background: var(--panel);
  overflow: auto;
  padding: 16px;
}

.side-panel {
  padding: 10px;
}

.control-panel {
  border-right: 1px solid var(--panel-line);
  align-content: start;
  display: grid;
  gap: 9px 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.side-panel {
  border-left: 1px solid var(--panel-line);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel-heading {
  grid-column: 1 / -1;
  padding-top: 0;
}

.panel-block {
  border-top: 1px solid var(--panel-line);
  display: grid;
  gap: 6px;
  margin-top: 0;
  padding-top: 9px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
}

h2 {
  color: var(--radar);
  font-size: 13px;
  margin-bottom: 2px;
}

p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

select {
  min-height: 28px;
  border: 1px solid var(--panel-line);
  background: #071011;
  color: var(--text);
  padding: 3px 7px;
}

label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.toggle-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 7px;
  min-height: 22px;
}

.toggle-row input {
  accent-color: var(--radar);
}

label:has(:disabled) {
  opacity: 0.55;
}

.readout,
.targets-panel {
  border-top: 1px solid var(--panel-line);
  padding-top: 10px;
  margin-top: 10px;
}

dl {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 4px 7px;
  margin: 0;
  font-size: 11px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

th,
td {
  border-bottom: 1px solid rgba(127, 163, 147, 0.22);
  padding: 4px 2px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  white-space: normal;
}

.target-position {
  color: var(--muted);
  display: block;
  font-size: 9px;
  line-height: 1.2;
  margin-top: 2px;
}

tr.alarm.warning td {
  color: #ffe991;
}

tr.alarm.danger td {
  color: #ffb59d;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .radar-stage {
    min-height: 100vw;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--panel-line);
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--panel-line);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
  }

  .panel-heading {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .control-panel {
    grid-template-columns: 1fr;
  }
}
