:root {
  color-scheme: dark;
  --paper: #07120d;
  --panel: #0b1811;
  --panel-2: #102219;
  --line: rgba(123, 255, 172, 0.24);
  --line-bright: rgba(154, 255, 190, 0.72);
  --green: #7cff9f;
  --amber: #ffd06a;
  --red: #ff6b6b;
  --text: #d7ffe1;
  --muted: #76a889;
  --shadow: rgba(0, 0, 0, 0.52);
  font-family: "Consolas", "Lucida Console", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 28% 32%, rgba(124, 255, 159, 0.12), transparent 31rem),
    linear-gradient(135deg, #030604 0%, #0d1713 46%, #11100a 100%);
  color: var(--text);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  min-height: 100vh;
  align-items: start;
  padding: 18px;
}

.radar-panel,
.control-panel {
  border: 1px solid rgba(124, 255, 159, 0.22);
  background: linear-gradient(180deg, rgba(9, 24, 16, 0.94), rgba(3, 9, 6, 0.96));
  box-shadow: 0 22px 70px var(--shadow), inset 0 0 55px rgba(124, 255, 159, 0.05);
}

.radar-panel {
  display: grid;
  position: sticky;
  top: 18px;
  min-height: calc(100vh - 36px);
  place-items: center;
  padding: 16px;
}

.crt-frame {
  position: relative;
  width: min(100%, calc(100vh - 68px));
  max-width: 980px;
  aspect-ratio: 1;
  border: 12px solid #101711;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(45, 98, 62, 0.38), rgba(2, 8, 5, 0.98) 72%),
    #020705;
  box-shadow:
    inset 0 0 42px rgba(0, 0, 0, 0.84),
    inset 0 0 110px rgba(124, 255, 159, 0.13),
    0 10px 38px rgba(0, 0, 0, 0.65);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
  opacity: 0.36;
}

.radar-hud {
  position: absolute;
  inset: 16px 18px auto 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  pointer-events: none;
}

.radar-hud div,
.readouts div {
  border: 1px solid rgba(124, 255, 159, 0.16);
  background: rgba(2, 10, 6, 0.58);
  padding: 8px 10px;
}

.radar-hud span,
.readouts span,
label span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.radar-hud strong,
.readouts strong {
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.map-attribution {
  position: absolute;
  right: 14px;
  bottom: 11px;
  color: rgba(215, 255, 225, 0.62);
  font-size: 0.68rem;
  pointer-events: none;
}

.control-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 36px);
  padding: 20px;
}

header {
  border-bottom: 1px solid rgba(124, 255, 159, 0.2);
  padding-bottom: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  color: #f0fff4;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.place-name {
  margin: 6px 0 0;
  color: var(--green);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

h2 {
  color: var(--text);
  font-size: 1rem;
}

.controls {
  display: grid;
  gap: 14px;
  padding: 18px 0;
}

label {
  display: grid;
  gap: 7px;
}

input[type="number"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(124, 255, 159, 0.34);
  border-radius: 4px;
  background: #030906;
  color: var(--green);
  padding: 8px 10px;
  outline: none;
}

input[type="number"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124, 255, 159, 0.12);
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  accent-color: var(--green);
  width: 100%;
}

input[type="checkbox"] {
  accent-color: var(--green);
}

.switch-row {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(124, 255, 159, 0.18);
  border-radius: 4px;
  background: rgba(3, 9, 6, 0.44);
  padding: 7px 9px;
}

.switch-row span {
  color: var(--text);
}

.map-strength {
  opacity: 1;
  transition: opacity 160ms ease;
}

.map-strength.is-disabled {
  opacity: 0.46;
}

output {
  color: var(--amber);
  text-align: right;
}

.button-row {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr;
  gap: 8px;
}

button {
  min-height: 40px;
  border: 1px solid rgba(124, 255, 159, 0.36);
  border-radius: 4px;
  background: linear-gradient(180deg, #183324, #0b1910);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
}

button:hover {
  border-color: var(--green);
  color: #ffffff;
}

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.field-panel {
  border-top: 1px solid rgba(124, 255, 159, 0.2);
  padding: 14px 0 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-grid label {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(124, 255, 159, 0.16);
  border-radius: 4px;
  background: rgba(3, 9, 6, 0.56);
  color: var(--text);
  font-size: 0.82rem;
  padding: 6px 8px;
}

.field-grid .disabled-field {
  color: rgba(118, 168, 137, 0.58);
  border-style: dashed;
}

.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.targets {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid rgba(124, 255, 159, 0.2);
  padding-top: 14px;
}

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

#loadingPulse {
  color: var(--green);
  font-size: 0.82rem;
}

#loadingPulse.busy {
  color: var(--amber);
}

#targetList {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.target {
  border: 1px solid rgba(124, 255, 159, 0.18);
  border-radius: 6px;
  background: rgba(5, 17, 10, 0.74);
  padding: 10px;
}

.target.selected {
  border-color: var(--amber);
  box-shadow: inset 0 0 18px rgba(255, 208, 106, 0.08);
}

.target button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  width: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  text-transform: none;
}

.target-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.target b {
  color: var(--green);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.target em {
  color: var(--amber);
  font-style: normal;
}

.target span {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.message {
  border: 1px dashed rgba(124, 255, 159, 0.24);
  color: var(--muted);
  padding: 12px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .radar-panel,
  .control-panel {
    min-height: auto;
  }

  .radar-panel {
    position: sticky;
    top: 10px;
    z-index: 3;
  }

  .control-panel {
    max-height: none;
  }

  .crt-frame {
    width: min(100%, 88vh);
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 10px;
  }

  .radar-panel,
  .control-panel {
    padding: 12px;
  }

  .crt-frame {
    border-width: 7px;
  }

  .radar-hud {
    inset: 9px;
    grid-template-columns: 1fr;
  }

  .button-row,
  .field-grid,
  .target-fields,
  .readouts {
    grid-template-columns: 1fr;
  }
}
