:root {
  --bg: #0b0f14;
  --panel: #111820;
  --panel-2: #18212b;
  --line: #26323f;
  --text: #d5dee7;
  --muted: #7d8c9b;
  --live: #35d0ba;
  --stale: #e8b04a;
  --down: #66727f;
  --external: #a78bfa;
  --activity: #f472b6;
  --food: #facc15;
  --adult: #fb923c;
  --cannabis: #4ade80;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template: 42px minmax(0, 1fr) / 290px minmax(0, 1fr);
  grid-template-areas: "top top" "left map";
}

#topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .14em; }
.brand span { color: var(--live); }
#region {
  padding: 4px 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
#region:focus-visible { outline: 2px solid var(--live); outline-offset: 1px; }
.sub, .muted { color: var(--muted); font-weight: 400; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--down); flex: none; }
.dot.external { background: var(--external); }
.dot.activity { background: var(--activity); }
.dot.food { background: var(--food); }
.dot.adult { background: var(--adult); }
.dot.cannabis { background: var(--cannabis); }
#menu { display: none; padding: 4px 10px; font-size: 16px; line-height: 1; }
#scrim { display: none; }
#clock { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: auto; }

#left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
#left section { padding: 12px; border-bottom: 1px solid var(--line); }
#left section.grow { flex: 1 0 280px; min-height: 0; display: flex; flex-direction: column; gap: 8px; border-bottom: 0; }
h2 { margin: 0 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
section.grow h2 { margin-bottom: 0; }

.layer { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.layer .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); }

input[type="search"] {
  width: 100%;
  padding: 7px 9px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
}
input[type="search"]:focus-visible, button:focus-visible, a:focus-visible, li:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 1px;
}

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #1a232d;
  cursor: pointer;
}
.list li:hover { background: var(--panel-2); }
.list li.empty { color: var(--muted); cursor: default; }
.list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .kind { margin-left: auto; color: var(--muted); font-size: 11px; flex: none; }
#activity-list, #food-list, #adult-list, #cannabis-list { max-height: 22vh; }

#map { grid-area: map; min-height: 0; }

#inspector {
  position: fixed;
  top: 54px;
  right: 12px;
  width: 360px;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  padding: 14px;
  background: rgba(17, 24, 32, .97);
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: 5;
}
#inspector h3 { margin: 0 24px 2px 0; font-size: 15px; }
.kicker { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: transparent;
  color: var(--muted);
  border: 0;
  font-size: 18px;
  cursor: pointer;
}
.frame {
  position: relative;
  margin: 10px 0;
  aspect-ratio: 4 / 3;
  background: #05080b;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
dl { display: grid; grid-template-columns: 90px 1fr; gap: 3px 8px; margin: 10px 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
#hotspot-list { margin-top: 0; }
.btn {
  padding: 6px 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--live); }

#banner {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 560px;
  padding: 8px 12px;
  background: rgba(58, 42, 12, .96);
  border: 1px solid var(--stale);
  border-radius: 4px;
  z-index: 3;
  line-height: 1.4;
}

.maplibregl-popup-content { background: var(--panel); color: var(--text); padding: 6px 9px; font-size: 12px; }
.maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-attrib { background: rgba(11, 15, 20, .8) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }

/* Phones: the sidebar becomes a slide-over drawer that starts closed. */
@media (max-width: 760px) {
  body {
    height: 100dvh;
    grid-template: 42px minmax(0, 1fr) / minmax(0, 1fr);
    grid-template-areas: "top" "map";
  }
  #topbar { gap: 8px; padding: 0 8px; }
  #menu { display: block; }
  .sub, #clock { display: none; }
  #region { min-width: 0; flex: 1; max-width: 220px; }

  #left {
    position: fixed;
    top: 42px;
    bottom: 0;
    left: 0;
    width: min(86vw, 340px);
    z-index: 6;
    transform: translateX(-100%);
    transition: transform .2s ease;
    visibility: hidden;
  }
  body.nav-open #left { transform: none; visibility: visible; }
  body.nav-open #scrim {
    display: block;
    position: fixed;
    inset: 42px 0 0 0;
    background: rgba(0, 0, 0, .5);
    z-index: 5;
  }
  #activity-list, #food-list, #adult-list, #cannabis-list { max-height: 30vh; }

  #inspector {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 70dvh;
    border-radius: 10px 10px 0 0;
  }
  #banner { max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  #left { transition: none; }
}
