/* CHASERMAP_V1 */
:root {
  --bg: #0b1016;
  --panel: rgba(14, 20, 28, 0.92);
  --panel-solid: #0f161f;
  --line: rgba(160, 190, 215, 0.16);
  --text: #e8eef3;
  --muted: #9aabba;
  --faint: #6b7d8d;
  --accent: #ffb000;
  --accent-ink: #1a1200;
  --live: #ff3b4e;
  --ok: #39d98a;
  --stale: #8696a5;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --side-w: 330px;
  --detail-w: 400px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); }
body { overflow: hidden; }
#map { position: fixed; inset: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* brand */
.brand { position: fixed; top: 12px; left: 12px; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 8px 14px 8px 10px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 700 22px/1 var(--font-head); letter-spacing: .3px; }
.logo svg { width: 30px; height: 30px; color: #7fb3d5; }
.logo b { color: var(--accent); font-weight: 700; }
.counts { color: var(--muted); font-size: 13px; white-space: nowrap; }
.counts .n { color: var(--text); font-weight: 600; }
.counts .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); margin: 0 4px 1px 0; animation: pulse 1.6s infinite; }

/* chaser list */
.side { position: fixed; top: 70px; left: 12px; bottom: 12px; width: var(--side-w); z-index: 4; display: flex; flex-direction: column; overflow: hidden; }
.sheet-handle { display: none; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; border-radius: 9px; padding: 8px 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
.tab.on { background: rgba(255, 176, 0, 0.13); color: var(--accent); }
.list { overflow-y: auto; padding: 6px; flex: 1; }
.group { font: 600 12px/1 var(--font); text-transform: uppercase; letter-spacing: .8px; color: var(--faint); padding: 12px 10px 6px; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.row:hover, .row:focus-visible { background: rgba(255, 255, 255, 0.05); outline: none; }
.row.sel { background: rgba(255, 176, 0, 0.1); }
.row .meta { flex: 1; min-width: 0; }
.row .name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { display: flex; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); padding: 18px 12px; font-size: 14px; }

.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 15px/1 var(--font-head); color: #0b1016; background: var(--c, var(--accent)); background-size: cover; background-position: center; border: 2px solid rgba(255, 255, 255, 0.85); }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.status { display: inline-flex; align-items: center; gap: 5px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--stale); }
.status.live::before { background: var(--ok); }
.status.streaming::before { background: var(--live); }
.status.offline::before { background: #3c4a57; }
.pill { display: inline-block; font: 700 11px/1 var(--font); letter-spacing: .6px; padding: 4px 6px; border-radius: 5px; background: var(--live); color: #fff; }
.pill.yt { background: #c4302b; }
.thumb { flex: none; width: 96px; aspect-ratio: 16/9; border-radius: 7px; background: #1b2530 center/cover; position: relative; }
.thumb .pill { position: absolute; left: 5px; top: 5px; }

/* detail */
.detail { position: fixed; top: 12px; right: 12px; width: var(--detail-w); max-height: calc(100% - 24px); z-index: 6; overflow-y: auto; padding: 16px; }
.detail .close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.d-head { display: flex; gap: 12px; align-items: center; padding-right: 30px; }
.d-head h2 { margin: 0; font: 700 24px/1.1 var(--font-head); }
.d-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.warn-chip { margin-top: 12px; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 14px; border: 1px solid; }
.player { margin-top: 14px; position: relative; aspect-ratio: 16/9; background: #05080b; border-radius: 10px; overflow: hidden; }
.player video, .player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 16px; font-size: 14px; }
.player .unmute { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.65); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.player.audio { aspect-ratio: auto; height: 86px; display: flex; align-items: center; gap: 12px; padding: 0 14px; }
.cams { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.cams button { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.cams button.on { border-color: var(--accent); color: var(--accent); }
.cams button .pill { margin-left: 6px; padding: 2px 4px; font-size: 9px; }
.bio { color: #c7d3dd; margin: 14px 0 0; white-space: pre-line; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 10px 14px; font-weight: 700; text-decoration: none; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); flex: 1 1 100%; font-size: 16px; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.fine { color: var(--faint); font-size: 12px; margin-top: 6px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.links a { font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.links a:hover { color: var(--text); }

/* map controls */
.layers { position: fixed; right: 12px; bottom: 36px; z-index: 4; display: flex; gap: 12px; align-items: center; padding: 8px 12px; font-size: 14px; }
.layers label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.layers input { accent-color: var(--accent); }
.radar-time { color: var(--faint); font-size: 12px; }
.about-btn { position: fixed; left: calc(var(--side-w) + 24px); bottom: 36px; z-index: 4; padding: 7px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
dialog { max-width: min(520px, calc(100% - 32px)); color: var(--text); padding: 20px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog h2 { font: 700 24px var(--font-head); margin: 0 0 8px; }
dialog p { margin: 10px 0; }
.small { font-size: 13px; color: var(--muted); }

/* markers */
.cm-marker { position: relative; width: 34px; height: 34px; cursor: pointer; }
.cm-marker .avatar { width: 34px; height: 34px; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.cm-marker.stale .avatar { filter: grayscale(0.8) brightness(0.75); }
.cm-marker.live::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--c); opacity: 0; animation: ring 2.2s infinite; }
.cm-marker .hdg { position: absolute; inset: 0; }   /* rotated inline around the marker centre */
.cm-marker .hdg::after { content: ""; position: absolute; left: 50%; top: -14px; margin-left: -7px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid var(--c); filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)); }
.cm-marker .tag { position: absolute; top: 37px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 12px/1 var(--font); padding: 3px 6px; border-radius: 5px; background: rgba(11, 16, 22, 0.85); border: 1px solid var(--line); pointer-events: none; }
.cm-marker .tag .pill { padding: 2px 4px; font-size: 9px; margin-left: 4px; }
.cm-marker.sel .avatar { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 176, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.6); }
.cm-yt { width: 26px; height: 26px; border-radius: 7px; background: #c4302b; display: grid; place-items: center; cursor: pointer; border: 2px solid #fff; }
.cm-yt::after { content: ""; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }

.maplibregl-popup-content { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 14px/1.35 var(--font); max-width: 300px; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; }
.maplibregl-ctrl-attrib { background: rgba(11, 16, 22, 0.7) !important; color: var(--faint); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.wpop b { display: block; font-size: 15px; margin-bottom: 4px; }
.wpop .k { color: var(--muted); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes ring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .counts .dot, .cm-marker.live::before { animation: none; } }

/* phones: list becomes a bottom sheet, detail a full-width card */
@media (max-width: 760px) {
  .brand { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; justify-content: space-between; }
  .side { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46vh; border-radius: 16px 16px 0 0; transform: translateY(calc(100% - 54px)); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom); }
  .side.open { transform: none; }
  .sheet-handle { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 0 10px; font-weight: 600; cursor: pointer; }
  .sheet-handle .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--faint); }
  .detail { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 78vh; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .layers { bottom: 66px; right: 8px; gap: 8px; padding: 6px 10px; font-size: 13px; }
  .radar-time { display: none; }
  .about-btn { left: 8px; bottom: 66px; }
}
