:root {
  --ink: #070b1c;
  --panel: rgba(12, 17, 40, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --dim: #9aa6c7;
  --pink: #ff4fa3;
  --orange: #ffb02e;
  --teal: #35e0d0;
  --good: #3ddc84;
  --bad: #ff5d5d;
  --gap: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

#map { position: fixed; inset: 0; background: var(--ink); z-index: 0; }
#map.placing, #map.placing .leaflet-interactive { cursor: crosshair; }
.leaflet-container { font: inherit; background: var(--ink); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- brand ---------- */

.brand { position: fixed; z-index: 500; top: var(--gap); left: var(--gap); width: 300px; padding: 14px 16px 12px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand h1 {
  margin: 0; font-size: 26px; line-height: 1; font-weight: 900; font-style: italic; letter-spacing: -0.5px; text-transform: uppercase;
  background: linear-gradient(95deg, var(--pink), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand h1 span { -webkit-text-stroke: 1px var(--teal); color: transparent; background: none; }
.tagline { margin: 4px 0 10px; color: var(--dim); font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase; }

.live { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--good); display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; }
.live.off { color: var(--dim); }
.live.off::before { animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.countdown { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.countdown .unit { display: inline-flex; flex-direction: column; align-items: center; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.countdown .unit b { font-size: 22px; line-height: 1.1; color: var(--text); font-weight: 800; }
.countdown .until { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.countdown .out { font-weight: 700; color: var(--orange); }

/* ---------- panels ---------- */

.panel { position: fixed; z-index: 500; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
#filters { left: var(--gap); top: 168px; width: 300px; max-height: calc(100vh - 168px - var(--gap)); overflow: auto; }
#feed { right: var(--gap); top: var(--gap); width: 330px; bottom: 96px; }
.panel h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--dim); }
.tabs { display: none; }

input[type="search"], input[type="text"], input[type="password"], select, textarea {
  width: 100%; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
}
textarea { resize: vertical; }
select option { background: #101632; }

.category-list { display: flex; flex-direction: column; gap: 2px; }
.cat { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.cat:hover { background: rgba(255, 255, 255, 0.05); }
.cat input { accent-color: var(--c); width: 15px; height: 15px; margin: 0; }
.cat .glyph { width: 20px; text-align: center; }
.cat .name { flex: 1; }
.cat .count { min-width: 26px; text-align: center; font-size: 12px; font-weight: 700; border-radius: 20px; padding: 1px 7px; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.cat:has(input:not(:checked)) .name, .cat:has(input:not(:checked)) .glyph { opacity: 0.45; }

.switch { display: flex; align-items: center; gap: 9px; padding: 0 8px; cursor: pointer; }
.switch input { accent-color: var(--good); width: 15px; height: 15px; margin: 0; }

.legend { display: flex; flex-direction: column; gap: 5px; padding: 10px 8px 0; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 9px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.dot.verified { background: var(--pink); border: 2px solid #fff; }
.dot.reported { border: 2px dashed var(--pink); }
.dot.group { border: 2px solid #fff; background: #0e1430; color: #fff; font-size: 8px; font-weight: 800; font-style: normal; line-height: 10px; text-align: center; }

.note { margin: 0; padding: 9px 10px; border-radius: 9px; background: rgba(255, 176, 46, 0.1); border: 1px solid rgba(255, 176, 46, 0.3); color: #ffd58a; font-size: 12px; }
.note:empty { display: none; }
.fine { margin: 0; color: var(--dim); font-size: 11px; }

/* ---------- feed ---------- */

.feed-tabs { display: flex; gap: 6px; }
.feed-tabs button, .tabs button { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; font-size: 12px; }
.feed-tabs button.on, .tabs button.on { background: var(--pink); border-color: var(--pink); color: #14051c; font-weight: 700; }
.feed-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.feed-item { padding: 10px 11px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.feed-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); }
.tag { color: var(--c, var(--dim)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.feed-title { margin: 5px 0 7px; font-weight: 600; overflow-wrap: anywhere; }
.feed-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.feed-foot button { background: none; border: 1px solid var(--teal); color: var(--teal); border-radius: 20px; padding: 2px 10px; font-size: 12px; }
.feed-foot button:hover { background: var(--teal); color: #05201d; }
.empty { color: var(--dim); padding: 18px 6px; text-align: center; list-style: none; }
#feed-badge:not(:empty) { background: var(--pink); color: #14051c; border-radius: 20px; padding: 0 6px; margin-left: 4px; font-size: 11px; }

/* ---------- map marks ---------- */

.region-label span {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: none;
  font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: #fff; opacity: 0.85;
  text-shadow: 0 1px 6px #000, 0 0 2px #000;
}
.pin {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; position: relative; font-size: 16px;
  background: color-mix(in srgb, var(--c) 30%, #0b1026); border: 2px dashed var(--c);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); transition: transform 0.12s;
}
.pin:hover { transform: scale(1.15); }
.pin.verified { border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent), 0 3px 10px rgba(0, 0, 0, 0.6); }
.pin.reported { opacity: 0.92; }
.pin.pending { opacity: 0.6; filter: grayscale(0.7); border-style: dotted; }
.pin b { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: #fff; color: #111; font-size: 10px; line-height: 16px; text-align: center; }

.cluster {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  font-size: 15px; font-weight: 800; color: #fff; background: #0e1430; border: 2px solid var(--c);
  /* The outer rings read as a stack of pins. */
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 0 0 8px color-mix(in srgb, var(--c) 14%, transparent), 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: transform 0.12s;
}
.cluster:hover { transform: scale(1.1); }
.find-popup .leaflet-popup-content-wrapper { background: #0e1430; color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.find-popup .leaflet-popup-tip { background: #0e1430; }
.find-popup .leaflet-popup-content { margin: 14px; font-size: 13px; line-height: 1.45; }
.find-popup a.leaflet-popup-close-button { color: var(--dim); }
.find h3 { margin: 8px 0 4px; font-size: 16px; overflow-wrap: anywhere; }
.find p { margin: 0 0 8px; overflow-wrap: anywhere; }
.find-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.chip, .status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; border-radius: 20px; padding: 2px 8px; }
.chip { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.status.verified { background: rgba(61, 220, 132, 0.18); color: var(--good); }
.status.reported { background: rgba(255, 176, 46, 0.16); color: var(--orange); }
.status.pending { background: rgba(255, 255, 255, 0.1); color: var(--dim); }
.status.rejected { background: rgba(255, 93, 93, 0.16); color: var(--bad); }
.status.claim { background: rgba(255, 255, 255, 0.08); color: var(--dim); }
.status.claim.speculation { background: rgba(255, 176, 46, 0.16); color: #ffb02e; border: 1px dashed rgba(255, 176, 46, 0.6); }
.find .where { color: var(--dim); font-size: 12px; }
.media { display: flex; gap: 6px; margin-bottom: 8px; }
.media img { flex: 1; min-width: 0; height: 96px; object-fit: cover; border-radius: 8px; }
.sources { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--dim); }

.share { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; }
.share button { background: var(--teal); color: #05201d; border: 0; border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.share button:hover { filter: brightness(1.1); }

/* ---------- live streams ---------- */

.feed-list .stream { list-style: none; }
.stream-row { display: flex; gap: 10px; width: 100%; padding: 8px; text-align: left; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 11px; }
.stream-row:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--teal); }
.stream-row img, .stream-row .no-thumb { flex: none; width: 112px; height: 63px; border-radius: 7px; object-fit: cover; background: #05081a; }
.stream-row .no-thumb { display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--bad); }
.stream-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.stream-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stream-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewers { flex: none; font-size: 11px; font-weight: 700; color: var(--bad); }
.viewers::before { content: "● "; }
.stream-title { font-size: 12px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* The player sits in the gap between the two side panels, clear of the map's centre. */
.player { position: fixed; z-index: 540; left: 330px; bottom: var(--gap); width: min(520px, calc(100vw - 330px - 360px)); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.player-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.player-head strong { font-size: 14px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head button { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.player-head #player-report { border-color: var(--pink); color: var(--pink); }
.player-frame { aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 8px; overflow: hidden; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- before launch ---------- */

.prelaunch {
  position: fixed; z-index: 520; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto;
  padding: 26px 28px 20px; display: flex; flex-direction: column; gap: 14px; text-align: center;
  background: rgba(12, 17, 40, 0.94);
}
.prelaunch .kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--teal); }
.prelaunch h2 {
  margin: 0; font-size: 30px; line-height: 1.12; font-weight: 900; letter-spacing: -0.4px;
  background: linear-gradient(95deg, var(--pink), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.prelaunch .lead { margin: 0; font-size: 15px; color: #dfe6ff; }
.countdown.big { justify-content: center; gap: 22px; padding: 6px 0; }
.countdown.big .unit { font-size: 11px; }
.countdown.big .unit b { font-size: 44px; }
.prelaunch .points { list-style: none; margin: 0; padding: 12px 0; display: flex; flex-direction: column; gap: 7px; text-align: left; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--dim); font-size: 13px; }
.prelaunch .points b { color: var(--text); }
.prelaunch .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.act { display: inline-block; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 700; color: var(--text); text-decoration: none; }
.act:hover { background: rgba(255, 255, 255, 0.14); }
.act.main { background: var(--pink); border-color: var(--pink); color: #14051c; flex-basis: 100%; padding: 12px 14px; font-size: 15px; }
.act.main:hover { filter: brightness(1.08); background: var(--pink); }
#prelaunch-close { align-self: center; background: none; border: 0; padding: 4px 8px; font-size: 13px; text-decoration: underline; }
/* The map sits back while the page is up, and comes forward when it is closed. */
body.prelaunch-on #map { filter: brightness(0.45) saturate(0.8); }

/* ---------- report a find ---------- */

button.primary { background: var(--pink); color: #14051c; border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 800; }
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: 0.5; cursor: wait; }
dialog.report { width: min(460px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; padding: 18px; color: var(--text); background: #0e1430; }
dialog.report::backdrop { background: rgba(4, 6, 16, 0.65); }
.report form { display: flex; flex-direction: column; gap: 11px; }
.report h2 { margin: 0; font-size: 18px; }
.report label { display: block; font-size: 12px; font-weight: 600; color: var(--dim); }
.report label .fine { display: inline; font-weight: 400; margin-left: 4px; }
.report label input, .report label select, .report label textarea { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; color: var(--text); }
.report .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.report .row { align-items: center; }
.report .row.end { justify-content: flex-end; margin-top: 4px; }
.report .row button:not(.primary) { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 12px; }
.report .error { margin: 0; padding: 8px 10px; border-radius: 9px; background: rgba(255, 93, 93, 0.12); border: 1px solid rgba(255, 93, 93, 0.45); color: #ffb3b3; font-size: 13px; }
/* Off-screen, not display:none: bots that skip hidden fields still fill this one. */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- admin ---------- */

.admin { position: fixed; z-index: 600; left: 50%; bottom: var(--gap); transform: translateX(-50%); width: min(720px, calc(100vw - 2 * var(--gap))); padding: 10px 12px; max-height: 32vh; display: flex; flex-direction: column; }
.admin[hidden], [hidden] { display: none !important; }
#admin-login { display: flex; align-items: center; gap: 10px; }
#admin-tools { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.admin-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } /* wraps, so the buttons stay reachable on a phone */
.feed-foot button.drop { border-color: var(--bad); color: var(--bad); }
.feed-foot button.drop:hover { background: var(--bad); color: #1c0505; }
.admin-head .fine { flex: 1; }
#queue-toggle { font-weight: 700; border-color: transparent; background: none; padding-left: 2px; font-size: 13px; }
.hint { margin: 0; padding: 7px 10px; border-radius: 9px; background: rgba(53, 224, 208, 0.12); border: 1px solid rgba(53, 224, 208, 0.4); color: var(--teal); }
.queue { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.queue li:not(.empty) { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); }
.q-text { display: flex; flex-direction: column; min-width: 0; }
.q-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue .row { flex-wrap: nowrap; flex: none; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.admin button, .admin-form button { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; font-size: 12px; white-space: nowrap; }
.admin button:disabled { opacity: 0.4; cursor: not-allowed; }
button.good { border-color: var(--good); color: var(--good); }
button.bad { border-color: var(--bad); color: var(--bad); }
button.quiet { border-color: transparent; color: var(--dim); }
/* Map setup needs the whole map in view, so its panel takes the left column and the other panels step aside. */
body.setup-mode #filters, body.setup-mode #feed, body.setup-mode .tabs { display: none !important; }
body.setup-mode .admin { left: var(--gap); top: 168px; bottom: var(--gap); transform: none; width: 360px; max-height: none; }
body.setup-mode #admin-tools { flex: 1; }
.map-setup .queue li:not(.empty) { flex-wrap: wrap; }
.map-setup { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
.map-setup .pick { display: block; font-size: 12px; font-weight: 600; color: var(--dim); }
.map-setup .pick input { display: block; margin-top: 4px; }
.map-setup .admin-head { flex-direction: column; align-items: flex-start; gap: 2px; }
.map-setup .row { align-items: center; }
.map-setup .row.end { justify-content: flex-end; }
.map-setup input[type="range"] { width: 110px; accent-color: var(--teal); }
.map-setup .error { margin: 0; padding: 8px 10px; border-radius: 9px; background: rgba(255, 93, 93, 0.12); border: 1px solid rgba(255, 93, 93, 0.45); color: #ffb3b3; }
.anchor { position: absolute; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 20px; background: var(--teal); color: #05201d; font-size: 11px; font-weight: 800; white-space: nowrap; cursor: grab; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); }
.admin-form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.toast { position: fixed; z-index: 700; top: var(--gap); left: 50%; transform: translateX(-50%); max-width: min(520px, 90vw); padding: 9px 16px; border-radius: 24px; background: #101632; border: 1px solid var(--teal); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.bad { border-color: var(--bad); white-space: normal; }

.leaflet-bar a { background: #0e1430; color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: #18214a; color: #fff; }
.leaflet-bottom.leaflet-right { margin: 0 4px 4px 0; }

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
  .brand { width: auto; right: var(--gap); padding: 10px 14px; }
  .brand h1 { font-size: 20px; }
  .tagline { display: none; }
  .countdown { gap: 8px; margin-top: 6px; }
  .countdown .unit { flex-direction: row; gap: 3px; align-items: baseline; }
  .countdown .unit b { font-size: 15px; }
  .tabs { display: flex; gap: 8px; position: fixed; z-index: 550; left: 50%; bottom: calc(var(--gap) + env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .tabs button { padding: 9px 14px; white-space: nowrap; font-size: 13px; background: var(--panel); backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
  .panel { display: none; left: var(--gap) !important; right: var(--gap) !important; top: auto !important; bottom: calc(64px + env(safe-area-inset-bottom)) !important; width: auto !important; max-height: 58vh !important; }
  .panel.open { display: flex; }
  .admin { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .leaflet-bottom.leaflet-right { display: none; }
  .region-label span { font-size: 10px; letter-spacing: 1px; }
  .player { left: var(--gap); right: var(--gap); top: 92px; bottom: auto; width: auto; }
  /* One row on a phone: the Twitch logo inside the player already opens the channel. */
  .player-head { flex-wrap: nowrap; }
  .player-head strong { min-width: 0; flex: 1; }
  .player-head #player-link { display: none; }
  .player-head button { white-space: nowrap; flex: none; }
  .prelaunch { top: 84px; transform: translateX(-50%); max-height: calc(100vh - 84px - 76px); padding: 20px 18px 14px; gap: 11px; }
  .prelaunch h2 { font-size: 23px; }
  .countdown.big { gap: 14px; }
  .countdown.big .unit { flex-direction: column; }
  .countdown.big .unit b { font-size: 32px; }
  .pin { width: 28px; height: 28px; font-size: 13px; margin: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .live::before { animation: none; }
  .pin { transition: none; }
}
