/* ================= live tracker widget (inside #tracker-shell) ================= */

#tracker-shell {
  --panel: rgba(10, 16, 28, 0.82);
  --panel-border: rgba(120, 160, 255, 0.14);
  --text: #e8eefc;
  --muted: #8794ad;
  --accent: #66b3ff;
  color: var(--text);
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}

#tracker-shell * { box-sizing: border-box; }

#globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#globe:active { cursor: grabbing; }

.muted { color: var(--muted); font-size: 0.78rem; }
#tracker-shell .hidden { display: none !important; }

/* ---------- top bar ---------- */
#tracker-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(to bottom, rgba(4, 7, 13, 0.85), transparent);
  z-index: 60;
  overflow: visible;
  pointer-events: none;
}
#tracker-topbar > * { pointer-events: auto; }

.search-wrap { position: relative; flex: 1; max-width: 360px; z-index: 25; }
#search,
#fuel-search {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 0.86rem;
  backdrop-filter: blur(8px);
}
#search:focus,
#fuel-search:focus { border-color: var(--accent); }
#search::placeholder,
#fuel-search::placeholder { color: var(--muted); }
#search-results,
#fuel-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: 280px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  background: rgba(10, 16, 28, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  z-index: 40;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
#search-results li,
#fuel-search-results li {
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-size: 0.84rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--text);
}
#search-results li:hover,
#fuel-search-results li:hover,
#search-results li.is-active,
#fuel-search-results li.is-active {
  background: rgba(102, 179, 255, 0.12);
}
#search-results .cat,
#fuel-search-results .cat { color: var(--muted); font-size: 0.74rem; }
#search-results .search-empty,
#fuel-search-results .search-empty {
  cursor: default;
  color: var(--muted);
  justify-content: flex-start;
}
#search-results .search-empty:hover,
#fuel-search-results .search-empty:hover {
  background: transparent;
}

#clock-time {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* ---------- loading ---------- */
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  background: #04070d;
  z-index: 50;
  transition: opacity 0.6s ease;
}
#loading.fade { opacity: 0; pointer-events: none; }
#loading p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid rgba(102, 179, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: oi-spin 0.9s linear infinite;
}
@keyframes oi-spin { to { transform: rotate(360deg); } }

/* ---------- legend ---------- */
#legend {
  position: absolute;
  left: 0.9rem;
  bottom: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  z-index: 10;
  min-width: 200px;
}
#legend h2 { font-size: 0.86rem; margin: 0 0 0.5rem; font-weight: 600; }
#legend label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.16rem 0;
  cursor: pointer;
  user-select: none;
}
#legend input { accent-color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cat-count { margin-left: auto; color: var(--muted); font-size: 0.74rem; }

.speed-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--panel-border);
}
.speed-controls button {
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  font-family: "IBM Plex Mono", monospace;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.speed-controls button.active {
  background: rgba(102, 179, 255, 0.16);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- info panel ---------- */
#info-panel {
  position: absolute;
  right: 0.9rem;
  top: 3.6rem;
  width: 320px;
  max-height: calc(100% - 4.5rem);
  overflow-y: auto;
  padding: 1.05rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  z-index: 10;
}
#info-panel h2 { font-size: 0.98rem; margin: 0; padding-right: 1.4rem; font-weight: 600; }
#info-panel p { margin: 0.2rem 0 0; }
#info-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.32rem 0.9rem;
  margin: 0.75rem 0 0;
}
#info-panel dt { color: var(--muted); font-size: 0.78rem; }
#info-panel dd {
  margin: 0;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}
#info-panel .hint { margin-top: 0.7rem; }

.info-asset {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--panel-border);
}
.info-asset.hidden { display: none; }
.info-asset-title {
  font: 600 0.68rem "IBM Plex Mono", monospace;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0.85rem 0 0.35rem;
}

.info-site-report.hidden { display: none; }
.info-site-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.info-site-metric {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(252, 61, 33, 0.08);
}
.info-site-metric-label {
  font: 500 0.62rem "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.info-site-metric-value {
  margin-top: 0.2rem;
  font: 600 0.95rem "IBM Plex Mono", monospace;
  color: #fc9a8a;
}
.info-site-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.28rem 0.8rem;
  margin: 0.55rem 0 0;
}
.info-site-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}
.info-site-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  padding: 0.18rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.info-site-list li span:last-child {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}
.info-site-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.info-site-bar-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.72rem;
}
.info-site-bar-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.info-site-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #e6a817, #fc3d21);
}
.info-site-bar-row strong {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
}
#info-close {
  position: absolute;
  top: 0.5rem; right: 0.65rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
#info-close:hover { color: var(--text); }

.search-label {
  display: block;
  font: 600 0.62rem "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

#tracker-topbar .search-wrap { max-width: 220px; }

.view-mode-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--panel-border);
}

.view-mode-controls button {
  padding: 0.22rem 0.55rem;
  font-size: 0.74rem;
  font-family: "IBM Plex Mono", monospace;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-mode-controls button.active {
  background: rgba(102, 179, 255, 0.16);
  color: var(--accent);
  border-color: var(--accent);
}

.legend-note {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.info-fuel-gauge.hidden { display: none !important; }

.fuel-gauge-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0.75rem 0 0.15rem;
  padding: 12px;
  background: rgba(4, 7, 13, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.fuel-gauge-tank {
  position: relative;
  width: 38px;
  height: 96px;
  border: 2px solid rgba(120, 160, 255, 0.35);
  border-radius: 6px 6px 4px 4px;
  background: rgba(8, 14, 28, 0.9);
  overflow: hidden;
}

.fuel-gauge-fill {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 0%;
  border-radius: 2px;
  transition: height 0.35s ease, background 0.25s ease;
}

.fuel-gauge-readout { flex: 1; }

.fuel-gauge-label {
  font: 600 0.62rem "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.fuel-gauge-pct {
  font: 700 24px "Space Grotesk", sans-serif;
  color: var(--text);
  line-height: 1.1;
  margin-top: 4px;
}

.fuel-gauge-status {
  font: 600 0.72rem "IBM Plex Mono", monospace;
  color: var(--accent);
  margin-top: 6px;
}

@media (max-width: 720px) {
  #tracker-shell { height: 520px !important; }
  #legend { min-width: 160px; left: 0.5rem; bottom: 0.5rem; padding: 0.6rem 0.7rem; }
  #info-panel { right: 0.5rem; left: auto; width: 240px; }
  #clock-time { display: none; }
}
