/* WARDOGS Range Bands — UI theme (auto / light / dark) */
:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-2: #0a1019;
  --panel: #0d1522;
  --panel-2: #111b2b;
  --line: #1e2a3d;
  --line-soft: #172132;
  --text: #e9f0fa;
  --muted: #9cabc0;
  --muted-2: #7b8ba1;
  --accent: #3ddc97;
  --accent-ink: #04130d;
  --cyan: #4cc9f0;
  --danger: #f6607d;
  --note-warn: #e3b341;
  --input-bg: #070d16;
  --item-bg: #0a111c;
  --item-hover: #0e1725;
  --hover: rgba(255, 255, 255, .06);
  --stage-bg: #04070c;
  --shadow: rgba(0, 0, 0, .45);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: var(--sans);
  --radius: 10px;
  --sidebar-w: 384px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-2: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f2f6fb;
  --line: #d9e2ee;
  --line-soft: #e7eef7;
  --text: #101a2b;
  --muted: #4a5b72;
  --muted-2: #6a7a90;
  --accent: #0e9f6e;
  --accent-ink: #03261b;
  --cyan: #0b84c7;
  --danger: #dc2f55;
  --note-warn: #8a5a00;
  --input-bg: #ffffff;
  --item-bg: #f6f9fd;
  --item-hover: #eef4fb;
  --hover: rgba(15, 23, 42, .06);
  --stage-bg: #dbe4ee;
  --shadow: rgba(15, 23, 42, .14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef2f7;
    --bg-2: #f8fafc;
    --panel: #ffffff;
    --panel-2: #f2f6fb;
    --line: #d9e2ee;
    --line-soft: #e7eef7;
    --text: #101a2b;
    --muted: #4a5b72;
    --muted-2: #6a7a90;
    --accent: #0e9f6e;
    --accent-ink: #03261b;
    --cyan: #0b84c7;
    --danger: #dc2f55;
    --note-warn: #8a5a00;
    --input-bg: #ffffff;
    --item-bg: #f6f9fd;
    --item-hover: #eef4fb;
    --hover: rgba(15, 23, 42, .06);
    --stage-bg: #dbe4ee;
    --shadow: rgba(15, 23, 42, .14);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

.app { position: relative; display: flex; height: 100dvh; width: 100%; overflow: hidden; }

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--line);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand-mark { color: var(--accent); display: flex; }
.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
}
.brand-text h1 span { color: var(--accent); }
.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted-2);
  letter-spacing: .04em;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 9px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--bg); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow: 0 1px 0 var(--hover) inset;
}
.panel[hidden] { display: none !important; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .035em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.head-actions { display: flex; gap: 2px; }
.theme-btn { margin-left: auto; flex: 0 0 auto; color: var(--muted); width: 34px; height: 34px; border: 1px solid var(--line); background: var(--item-bg); }
.theme-btn:hover { color: var(--text); background: var(--item-hover); }

.count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: rgba(61,220,151,.1);
  border-radius: 20px;
  padding: 1px 7px;
  letter-spacing: 0;
}

/* segmented control */
.seg {
  display: flex;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 2px var(--shadow); }

.map-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.map-chips button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--muted);
  border-radius: 5px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, border-color .12s, background .12s;
}
.map-chips button:hover { color: var(--text); border-color: var(--muted-2); }
.map-chips button.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  margin-top: 10px;
}

.intro h2 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  line-height: 1.35;
}
.intro p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

/* selected-reading inspector (map top right) */
.inspector {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 306px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  z-index: 5;
  background: var(--panel);
  box-shadow: 0 18px 44px var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.inspector .panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 8px;
  background: var(--panel);
}

/* FAQ */
.faq summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .035em;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-size: 17px;
  line-height: 1;
  color: var(--muted-2);
}
.faq[open] summary::after { content: '\2212'; }
.faq-body { margin-top: 11px; }
.faq-body h3 {
  margin: 12px 0 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}
.faq-body h3:first-child { margin-top: 0; }
.faq-body p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.faq-body ol {
  margin: 6px 0 0;
  padding-left: 19px;
}
.faq-body li {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.faq-body li::marker {
  color: var(--accent);
  font-weight: 700;
}

.band-note {
  margin: -3px 0 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--note-warn);
}
.band-note[hidden] { display: none; }
.band-note.exact { color: var(--muted-2); }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

/* fields */
.field { display: block; margin-bottom: 10px; }
.field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .035em;
  color: var(--muted-2);
  margin-bottom: 5px;
}
.field > span em {
  font-style: normal;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: none;
  font-size: 11.5px;
  color: var(--muted-2);
}
.field input {
  width: 100%;
  height: 38px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 14.5px;
  padding: 0 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: rgba(61,220,151,.6);
  box-shadow: 0 0 0 3px rgba(61,220,151,.1);
}
.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 3px 0 11px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(61,220,151,.7), rgba(76,201,240,.55));
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #eafff7;
  border: 2px solid var(--accent);
  cursor: grab;
  box-shadow: 0 0 6px rgba(61,220,151,.6);
}
.range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #eafff7; border: 2px solid var(--accent); cursor: grab;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--item-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--item-hover); border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, #3fe3a0, #2ec98a);
  border-color: #2ec98a;
  color: var(--accent-ink);
  font-weight: 700;
}
.btn.primary:hover { background: linear-gradient(180deg, #4cebaa, #35d295); }
.btn.danger { color: var(--danger); border-color: rgba(246,96,125,.35); background: rgba(246,96,125,.08); }
.btn.danger:hover { background: rgba(246,96,125,.15); border-color: rgba(246,96,125,.55); }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }

.hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted-2);
}
.hint code {
  font-family: var(--sans);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--muted);
}

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  background: var(--accent);
  box-shadow: 0 0 6px currentColor;
}

.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.swatches button {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5) inset;
  transition: transform .1s, border-color .1s;
}
.swatches button:hover { transform: scale(1.12); }
.swatches button.active { border-color: var(--text); transform: scale(1.12); }

/* circle list */
.circle-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.circle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--item-bg);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.circle-item:hover { background: var(--item-hover); border-color: var(--line); }
.circle-item.selected { border-color: rgba(61,220,151,.45); background: rgba(61,220,151,.06); }
.circle-swatch {
  width: 10px; height: 10px; border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 7px currentColor;
}
.circle-info { min-width: 0; flex: 1 1 auto; }
.circle-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.circle-meta {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.circle-range {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  flex: 0 0 auto;
  margin-right: 1px;
}
.circle-actions { display: flex; gap: 1px; flex: 0 0 auto; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .12s, background .12s;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn.on { color: var(--accent); }
.icon-btn.danger:hover { color: var(--danger); }

.empty-note {
  margin: 2px 1px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-2);
}

.sidebar-footer { padding: 0 1px; display: flex; flex-direction: column; gap: 9px; }
.credit { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted-2); }
.credit a { color: var(--muted); text-decoration: none; }
.credit a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ stage */

.stage { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; background: var(--stage-bg); overflow: hidden; }
#map { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.coords-badge {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 4;
  display: flex;
  align-items: baseline;
  gap: 1px;
  padding: 5px 10px;
  background: rgba(6,10,17,.93);
  border: 1px solid #34455d;
  border-radius: 6px;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
  backdrop-filter: blur(6px);
}
.coords-badge.visible { opacity: 1; }
.coords-badge .cx, .coords-badge .xv { color: #34d399; }
.coords-badge .cy, .coords-badge .yv { color: #38bdf8; }
.coords-badge .sep { color: #41526a; margin: 0 3px; }
.coords-badge .dist { color: #fbbf24; margin-left: 6px; }

.zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  padding: 3px;
  gap: 2px;
  background: rgba(9,15,24,.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  z-index: 3;
}
.zoom-controls button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9cabc0;
  width: 38px; height: 38px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.zoom-controls button:hover { color: #e9f0fa; background: rgba(255,255,255,.07); }

.scalebar {
  position: absolute;
  left: 14px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px 7px;
  border-radius: 7px;
  background: rgba(6,10,17,.72);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(6px);
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 3px #000;
}
.scalebar-line {
  height: 6px;
  width: 100px;
  border: 2px solid rgba(230,237,247,.85);
  border-top: 0;
  border-radius: 0 0 2px 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
  transition: width .12s;
}
.scalebar span {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(230,237,247,.88);
  letter-spacing: .04em;
}

.hud-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 11px;
  border-radius: 20px;
  background: rgba(6,10,17,.8);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: #9cabc0;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 220px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-hint.accent { color: var(--accent); border-color: rgba(61,220,151,.35); background: rgba(6,20,14,.85); }

.live-chip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(6,10,17,.94);
  border: 1px solid rgba(61,220,151,.45);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: #3ddc97;
  white-space: nowrap;
  transform: translate(14px, 14px);
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.live-chip[hidden] { display: none; }

/* ------------------------------------------------------------------ small */

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; min-height: 100dvh; overflow: visible; }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    order: 3;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .sidebar-scroll { overflow: visible; }
  .stage { order: 1; height: 52dvh; min-height: 320px; flex: 0 0 auto; }
  .hud-hint { display: none; }
  .coords-badge { font-size: 11.5px; }
  .inspector {
    position: static;
    order: 2;
    width: auto;
    max-height: none;
    margin: 12px 12px 0;
  }
}
