:root {
  color-scheme: dark;
  --bg: #0a1012;
  --street: #1b2d31;
  --street-soft: #21373b;
  --panel: rgba(9, 17, 19, 0.88);
  --panel-strong: rgba(14, 26, 29, 0.95);
  --line: rgba(174, 207, 196, 0.22);
  --line-strong: rgba(174, 207, 196, 0.42);
  --text: #f5f8f2;
  --muted: #b9c7bd;
  --green: #7df0b1;
  --gold: #f7c95c;
  --blue: #79b7ff;
  --red: #ff766b;
  --violet: #c9a8ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
a {
  font: inherit;
}

button,
select,
input {
  border-radius: 8px;
}

button {
  border: 1px solid var(--line);
  background: rgba(17, 32, 35, 0.86);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

button:hover,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  border-color: var(--green);
  outline: none;
}

.tracker-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(135deg, rgba(125, 240, 177, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(121, 183, 255, 0.08), transparent 38%),
    var(--bg);
}

.map-stage {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--line);
  isolation: isolate;
}

#tracker-map {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #0d1618;
}

.stage-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(6, 9, 10, 0.62), transparent 24%, transparent 68%, rgba(6, 9, 10, 0.5)),
    linear-gradient(0deg, rgba(6, 9, 10, 0.52), transparent 28%, rgba(6, 9, 10, 0.42));
}

.hud-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.brand {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(7, 12, 13, 0.76);
  font-size: 0.82rem;
  font-weight: 950;
  pointer-events: auto;
}

.hud-title,
.hud-chips span,
.target-card,
.ops-ribbon,
.map-tools,
.control-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hud-title {
  border-radius: 8px;
  padding: 8px 12px;
}

.hud-title span,
.panel-kicker,
.target-card > span,
.ops-ribbon span,
.map-footer span {
  display: block;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-title strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.hud-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-chips span {
  border-radius: 999px;
  padding: 8px 10px;
  color: #ecfff4;
  font-size: 0.72rem;
  font-weight: 950;
  white-space: nowrap;
}

.hud-bar button {
  min-height: 42px;
  padding: 0 13px;
  font-weight: 900;
  pointer-events: auto;
}

.map-tools {
  position: absolute;
  right: 18px;
  top: 86px;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px 44px minmax(78px, auto);
  gap: 8px;
  border-radius: 8px;
  padding: 8px;
}

.map-tools button {
  min-height: 42px;
  font-weight: 950;
}

.target-card {
  position: absolute;
  left: 18px;
  bottom: 132px;
  z-index: 5;
  width: min(500px, calc(100% - 36px));
  border-color: var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(145deg, rgba(34, 66, 66, 0.92), rgba(8, 15, 17, 0.95) 62%, rgba(43, 35, 66, 0.82)),
    var(--panel);
}

.target-card h1 {
  margin: 7px 0 8px;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1;
}

.target-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.target-stats,
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.target-stats b,
.status-grid b {
  min-width: 0;
  border: 1px solid rgba(174, 207, 196, 0.18);
  border-radius: 8px;
  padding: 9px;
  background: rgba(21, 38, 41, 0.75);
}

.target-stats span,
.status-grid span {
  display: block;
  font-size: 1.05rem;
  color: #ffffff;
}

.target-stats em,
.status-grid em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  text-transform: uppercase;
}

.timeline {
  margin-top: 12px;
}

.timeline strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--gold);
}

#trail-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

#trail-steps i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  opacity: 0.55;
}

.ops-ribbon {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 78px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border-radius: 8px;
  padding: 10px;
}

.ops-ribbon b {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
}

.map-footer {
  position: absolute;
  right: 18px;
  bottom: 150px;
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(540px, calc(100% - 560px));
  color: var(--muted);
  font-size: 0.78rem;
}

.map-footer span {
  border: 1px solid rgba(174, 207, 196, 0.18);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(7, 12, 13, 0.72);
  white-space: nowrap;
}

.control-panel {
  height: 100vh;
  overflow-y: auto;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(23, 39, 42, 0.96), rgba(8, 13, 15, 0.98)),
    var(--panel-strong);
}

.panel-block {
  padding: 13px 0;
  border-bottom: 1px solid rgba(174, 207, 196, 0.14);
}

.panel-block:first-child {
  padding-top: 0;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.scope-grid button {
  min-height: 40px;
  font-weight: 900;
}

.scope-grid button.active {
  border-color: rgba(125, 240, 177, 0.78);
  background: rgba(48, 98, 75, 0.82);
}

.search-box {
  display: block;
  margin-top: 10px;
}

.search-box input,
.select-row select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(9, 17, 19, 0.94);
  color: var(--text);
}

.search-box input {
  height: 42px;
  padding: 0 12px;
}

.mini-readout {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-readout b {
  color: var(--text);
}

.select-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.select-row select {
  max-width: 170px;
  height: 38px;
  padding: 0 8px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.list-block {
  border-bottom: 0;
}

.target-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.target-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  text-align: left;
}

.target-row.active {
  border-color: rgba(125, 240, 177, 0.78);
  background: rgba(42, 77, 64, 0.84);
}

.target-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(121, 183, 255, 0.16);
  color: var(--blue);
  font-weight: 950;
}

.target-row[data-kind="person"] .target-icon {
  background: rgba(201, 168, 255, 0.16);
  color: var(--violet);
}

.target-row strong,
.target-row span,
.target-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-row strong {
  display: block;
  font-size: 0.9rem;
}

.target-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.target-row em {
  color: var(--gold);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

@media (max-width: 1050px) {
  html,
  body {
    overflow: auto;
  }

  .tracker-shell {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .map-stage {
    height: 76vh;
    min-height: 640px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-panel {
    height: auto;
    min-height: 32vh;
  }

  .map-footer {
    display: none;
  }
}

@media (max-width: 720px) {
  .hud-bar {
    grid-template-columns: 1fr auto auto;
    align-items: start;
  }

  .brand,
  .hud-chips {
    display: none;
  }

  .hud-title {
    min-width: 0;
  }

  .map-tools {
    top: 78px;
    right: 12px;
    grid-template-columns: 42px 42px;
  }

  #center-selected {
    grid-column: 1 / -1;
  }

  .target-card {
    left: 12px;
    right: 12px;
    bottom: 220px;
    width: auto;
    padding: 10px;
  }

  .target-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .target-card h1 {
    margin: 4px 0 5px;
    font-size: 1.55rem;
  }

  .target-card p {
    font-size: 0.82rem;
    line-height: 1.32;
  }

  .target-stats span {
    font-size: 0.9rem;
  }

  .target-stats b {
    padding: 7px;
  }

  .timeline {
    margin-top: 8px;
  }

  .timeline strong {
    margin-bottom: 5px;
  }

  #trail-steps {
    gap: 4px;
  }

  .ops-ribbon {
    left: 12px;
    right: 12px;
    bottom: 80px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
