/* radar.upsa.org.ua — UPSA Radar.
   Light instrument chrome in the UPSA family: IBM Plex, square corners,
   navy ink on paper, yellow reserved for live/selection marks.
   The dark surface is the globe viewport itself; the flat map is a light
   paper chart. Panels float over the viewport like chart-table bezels. */

:root {
  --paper: #FAFBFD;
  --panel: #FFFFFF;
  --ink: #0B1526;
  --navy: #0B2050;
  --muted: #5A6B85;
  --dim: #8A97AC;
  --line: #D8DEE9;
  --line-strong: #AEB9CC;
  --accent: #FFD400;
  --live: #1F9D5B;
  --space: #02060F;
  --pay: #E6A500;
  --pay-idle: #3D6FD6;
  --rb: #E0561F;
  --deb: #75808F;
  --unk: #9AA7BC;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}
.mono { font-family: var(--mono); }
a { color: var(--navy); }
a:hover { background: var(--accent); color: var(--ink); text-decoration: none; }
button {
  font: inherit; color: var(--navy); background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; border-radius: 0;
}
button:hover { border-color: var(--line-strong); }

#globe { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ── top bar ─────────────────────────────────────────── */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand:hover { background: none; }
.brand .dot {
  width: 10px; height: 10px; background: var(--accent);
  outline: 1px solid var(--ink);
}
.brand .mark { font-size: 15px; letter-spacing: 0.14em; font-weight: 400; white-space: nowrap; color: var(--ink); }
.brand .mark b { font-weight: 600; color: var(--navy); }

.view-toggle { display: flex; }
.view-toggle button {
  padding: 5px 13px; font: 12px var(--mono); letter-spacing: 0.06em;
}
.view-toggle button + button { border-left: 0; }
.view-toggle button.on { color: var(--ink); background: var(--accent); border-color: var(--ink); }

.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; padding: 7px 12px;
  font: 13px var(--mono); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line);
  outline: none; border-radius: 0; appearance: none;
}
.search input:focus { border-color: var(--navy); }
.search input::placeholder { color: var(--dim); }
.q-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--line-strong);
  max-height: 320px; overflow: auto;
  box-shadow: 0 8px 24px rgba(11, 21, 38, 0.12);
}
.q-list button {
  display: flex; gap: 10px; align-items: baseline; width: 100%;
  padding: 7px 12px; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; font-size: 13px; color: var(--ink); background: none;
}
.q-list button:hover, .q-list button.sel { background: rgba(255, 212, 0, 0.25); }
.q-list .t { width: 8px; height: 8px; flex: none; align-self: center; }
.q-list .id { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.clock { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.clock .mono { font-size: 13px; color: var(--navy); }
.live {
  font: 600 11px var(--mono); letter-spacing: 0.12em; color: #fff;
  background: var(--live); padding: 2px 7px; display: none;
}
.live.on { display: inline-block; }

/* ── left console panel ──────────────────────────────── */
.panel-toggle {
  position: fixed; left: 16px; top: 56px; z-index: 21;
  padding: 5px 12px; font: 12px var(--mono); letter-spacing: 0.08em;
  color: var(--muted);
}
.panel {
  position: fixed; left: 16px; top: 94px; z-index: 20; width: 252px;
  max-height: calc(100dvh - 140px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(11, 21, 38, 0.14);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.panel.hidden { display: none; }
.sect { padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.sect:last-of-type { border-bottom: 1px solid var(--line); }
.sect h2 {
  font: 500 10.5px var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.total .mono { font-size: 26px; font-weight: 500; letter-spacing: 0.02em; color: var(--navy); }
.total .lbl { color: var(--muted); font-size: 12.5px; }

.legend { display: grid; gap: 2px; }
.legend button {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 7px; border: 0; font-size: 13px; color: var(--ink); text-align: left;
  background: none;
}
.legend button .sw { width: 9px; height: 9px; flex: none; outline: 1px solid rgba(11,21,38,0.35); }
.legend button .n { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.legend button.off { color: var(--dim); }
.legend button.off .sw { background: transparent !important; outline: 1px solid var(--dim); }
.legend button.off .n { color: var(--dim); }
.legend button:hover { background: var(--paper); }

.shown {
  margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--navy);
}
.shown b { color: var(--ink); }

.owner-select {
  width: 100%; padding: 6px 8px; margin-bottom: 8px;
  font: 12px var(--mono); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
  outline: none; appearance: auto;
}
.owner-select:focus { border-color: var(--navy); }
.owner-chips button {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
}
.owner-chips button .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 168px;
}
.owner-chips button .x2 { font-size: 13px; line-height: 1; opacity: 0.75; }
.owner-chips button:hover .x2 { opacity: 1; }

.wide-btn {
  width: 100%; padding: 6px 10px; font: 12px var(--mono); letter-spacing: 0.05em;
}
.wide-btn.on { color: var(--ink); background: var(--accent); border-color: var(--ink); }
.hint { margin-top: 7px; font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.hint.err { color: #B5432E; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  padding: 4px 10px; font: 12px var(--mono); letter-spacing: 0.03em;
  color: var(--muted);
}
.chips button:hover { color: var(--ink); }
.chips button.on { color: var(--ink); background: var(--accent); border-color: var(--ink); }

.age { padding: 11px 14px; font: 11.5px var(--mono); color: var(--muted); line-height: 1.6; }

/* ── object card ─────────────────────────────────────── */
.card {
  position: fixed; right: 16px; top: 94px; z-index: 20; width: 296px;
  background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  padding: 14px 16px 16px;
  box-shadow: 0 10px 30px rgba(11, 21, 38, 0.14);
}
.card .x, dialog .x {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; font-size: 17px; line-height: 1; color: var(--muted); background: none;
}
.card .x:hover, dialog .x:hover { color: var(--ink); }
.card .type { font-size: 11px; letter-spacing: 0.14em; margin-bottom: 6px; font-weight: 600; }
.card h2 { font-size: 18px; font-weight: 600; line-height: 1.2; margin-bottom: 4px; padding-right: 18px; color: var(--navy); }
.card .ids { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.cardbtns { display: flex; gap: 6px; margin-bottom: 11px; }
.cardbtns button { padding: 4px 10px; font: 12px var(--mono); letter-spacing: 0.03em; }
.cardbtns button.on { color: var(--ink); background: var(--accent); border-color: var(--ink); }
.card .meta { display: grid; gap: 6px; margin-bottom: 12px; }
.card .meta div { display: flex; justify-content: space-between; gap: 12px; }
.card .meta dt { color: var(--muted); font-size: 12.5px; }
.card .meta dd { font-size: 12.5px; text-align: right; }
.card .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
}
.card .grid > div {
  background: var(--paper); padding: 7px 9px 6px;
  display: flex; flex-direction: column; gap: 1px;
}
.card .grid .lbl { font-size: 9.5px; letter-spacing: 0.12em; color: var(--muted); }
.card .grid span:last-child { font-size: 14.5px; color: var(--navy); }
.card .note { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ── tooltip, attribution, about ─────────────────────── */
.tip {
  position: fixed; z-index: 25; pointer-events: none;
  font-size: 12px; color: var(--ink);
  background: var(--accent); border: 1px solid var(--ink);
  padding: 3px 8px; transform: translate(12px, -50%);
  white-space: nowrap;
}

.attrib {
  position: fixed; right: 16px; bottom: 12px; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  font: 11.5px var(--mono); color: var(--muted);
  background: var(--paper); border: 1px solid var(--line);
  padding: 5px 10px;
}
.attrib a { color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.attrib a:hover { background: var(--accent); }
.attrib button { border: 0; font: inherit; color: var(--navy); text-decoration: underline; background: none; }

dialog#about {
  margin: auto; width: min(560px, calc(100vw - 32px));
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-top: 3px solid var(--accent);
  padding: 26px 30px; position: relative;
}
dialog#about::backdrop { background: rgba(11, 21, 38, 0.45); }
dialog#about h2 { font-size: 20px; margin-bottom: 12px; color: var(--navy); }
dialog#about h3 {
  font: 500 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 6px;
}
dialog#about p { font-size: 13.5px; color: var(--ink); margin-bottom: 8px; }
dialog#about .upsa { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ── loading ─────────────────────────────────────────── */
.loading {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--paper); transition: opacity 0.5s;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading .ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--line-strong); border-top-color: var(--navy);
  animation: spin 1.1s linear infinite;
}
.loading .mono { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── small screens ───────────────────────────────────── */
@media (max-width: 760px) {
  .bar { gap: 10px; padding: 8px 10px; flex-wrap: wrap; }
  .brand .mark { font-size: 13px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .clock .mono { font-size: 11px; }
  .panel-toggle { top: auto; bottom: 12px; left: 10px; z-index: 22; }
  .panel {
    left: 10px; right: 10px; top: auto; bottom: 46px; width: auto;
    max-height: 46dvh;
  }
  .panel:not(.hidden) ~ .attrib { display: none; }
  .card { left: 10px; right: 10px; top: auto; bottom: 46px; width: auto; z-index: 23; }
  .attrib { left: auto; right: 10px; }
  .attrib span { display: none; } /* full credits live in About */
}
