/* Same night palette as the example sites. Themes override the --map-* variables. */
:root {
  --bg: #1d1b24; --panel: #2a2633; --panel-2: #24212c; --ink: #f1e9dc; --muted: #b6aabb; --line: #3d3747;
  --pub: #8fd19e; --priv: #e7a6c2; --accent: #f0c46e; --portal: #aa78f0;
  --map-bg: #1a1820; --map-edge: #4a4356; --map-realm: #f0c46e; --map-site: #7fb7d9; --map-place: #8fd19e;
  --map-private: #e7a6c2; --map-object: #b6aabb; --map-portal: #aa78f0; --map-label: #f1e9dc; --map-glow: #f0c46e;
  --map-halo: rgba(240, 196, 110, .05);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 ui-rounded, "Segoe UI", system-ui, sans-serif; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }

.top { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; padding: 16px 20px 10px; }
.kicker { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
h1 { margin: 0; font-size: 24px; color: var(--accent); letter-spacing: .3px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stats span { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 3px 11px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.errors { margin: 0 20px; padding: 0; list-style: none; }
.errors li { background: rgba(231, 120, 120, .14); border: 1px solid #c86b6b; border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 0 20px 18px; }
.map-card { position: relative; min-height: 420px; background: var(--map-bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.map { flex: 1; min-height: 0; }
.map-hint { position: absolute; top: 8px; left: 12px; margin: 0; color: var(--muted); font-size: 12px; opacity: .7; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 8px 12px; list-style: none; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; border-radius: 50%; }
.lg-realm { background: var(--map-realm); }
.lg-site { background: var(--map-site); border-radius: 3px !important; }
.lg-place { background: var(--map-place); }
.lg-private { border: 1.5px dashed var(--map-private); }
.lg-object { background: var(--map-object); transform: rotate(45deg) scale(.75); border-radius: 1px !important; }
.lg-portal { border-top: 2px dashed var(--map-portal); border-radius: 0 !important; height: 0 !important; width: 18px !important; }
.lg-visitor { background: hsl(200 80% 65%); box-shadow: 0 0 0 2px var(--map-bg), 0 0 0 3px hsl(200 80% 65% / .6); }

.side { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 0; display: flex; flex-direction: column; }
.panel:last-child { flex: 1; }
.panel h2 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); }
.panel ul { margin: 0; padding: 0; list-style: none; overflow: auto; }
.visitors { max-height: 42vh; }
.empty { color: var(--muted); padding: 4px 0; }
.filter { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(240, 196, 110, .12); border: 1px solid var(--accent); border-radius: 10px; padding: 6px 6px 6px 12px; }
.filter button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); text-decoration: underline dotted; text-underline-offset: 3px; }

.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--h) 80% 65%); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px hsl(var(--h) 80% 65% / .5); }
.visitor { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.visitor:last-child { border-bottom: 0; }
.visitor.idle { opacity: .55; }
.who { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.who .nick { font-weight: 700; text-transform: capitalize; }
.who .when { margin-left: auto; color: var(--muted); font-size: 12px; }
.where { margin: 2px 0 2px 18px; color: var(--muted); }
.realm-tag { font-size: 11px; border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.did { margin: 0 0 0 18px !important; font-size: 12.5px; color: var(--muted); }
.did li::before { content: "· "; }
.did .hop { color: var(--portal); }

.activity li.empty { display: block; border: 0; }
.activity li { display: grid; grid-template-columns: 10px 1fr; column-gap: 9px; align-items: start; padding: 6px 4px; border-bottom: 1px dashed var(--line); border-radius: 6px; }
.activity .dot { margin-top: 5px; }
.activity .nick { text-transform: capitalize; font-weight: 600; }
.activity .meta { grid-column: 2; color: var(--muted); font-size: 12px; }
.act-travel .text, .act-portal .text { color: #d7c2fb; }
.activity li.fresh { animation: fresh 2.4s ease; }
@keyframes fresh { from { background: rgba(240, 196, 110, .28); } to { background: transparent; } }

/* ---- graph map ---- */
.graph-map { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; }
.graph-map.dragging { cursor: grabbing; }
.gm-halo { fill: var(--map-halo); }
.gm-edge { fill: none; stroke: var(--map-edge); stroke-width: 1.6; }
.gm-edge-realm { stroke-width: 3; }
.gm-edge-site { stroke-width: 2.4; }
.gm-edge-object { stroke-dasharray: 2 4; }
.gm-edge.private { stroke: var(--map-private); stroke-opacity: .45; stroke-dasharray: 4 4; }
.gm-portal { fill: none; stroke: var(--map-portal); stroke-width: 2.4; stroke-dasharray: 7 7; opacity: .8; animation: flow 1.6s linear infinite; }
.gm-portal.active { stroke-width: 4; opacity: 1; filter: drop-shadow(0 0 6px var(--map-portal)); }
@keyframes flow { to { stroke-dashoffset: -28; } }
.gm-portal-label { fill: var(--map-portal); font-size: 12px; font-weight: 600; }
.gm-node { transition: opacity .3s; }
.gm-realm circle { fill: var(--map-realm); }
.gm-halo { stroke: var(--map-realm); stroke-opacity: .18; stroke-width: 1.5; stroke-dasharray: 2 6; }
.gm-site rect { fill: var(--map-site); }
.gm-site .gm-glyph { fill: var(--map-bg); font-size: 24px; font-weight: 700; }
.gm-site a:hover rect { filter: brightness(1.2); }
.gm-place { cursor: pointer; }
.gm-place-dot { fill: var(--map-bg); stroke: var(--map-place); stroke-width: 2.5; transition: r .4s; }
.gm-place.occupied .gm-place-dot { fill: color-mix(in srgb, var(--map-place) 30%, var(--map-bg)); }
.gm-place.private .gm-place-dot { stroke: var(--map-private); stroke-dasharray: 4 3; }
.gm-portal-ring { fill: none; stroke: var(--map-portal); stroke-width: 2; stroke-dasharray: 3 3; }
.gm-object rect { fill: var(--map-bg); stroke: var(--map-object); stroke-width: 1.5; }
.gm-object.used rect { fill: var(--map-object); }
.gm-object.private rect { stroke: var(--map-private); stroke-dasharray: 2 2; }
.gm-glyph { pointer-events: none; }
.gm-glyph.small { font-size: 10px; }
.gm-label { fill: var(--map-label); font-size: 13px; paint-order: stroke; stroke: var(--map-bg); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.gm-label-realm { fill: var(--map-realm); font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; opacity: .8; pointer-events: auto; }
.gm-label-site { fill: var(--map-site); font-size: 16px; font-weight: 700; }
.gm-label-object { fill: var(--muted); font-size: 11px; }
.gm-stat { fill: var(--muted); font-size: 11px; }
.gm-visitor { cursor: pointer; transition: transform 1s cubic-bezier(.5, 0, .2, 1); }
.gm-visitor circle { fill: hsl(var(--h) 80% 65%); stroke: var(--map-bg); stroke-width: 2.5; }
.gm-visitor.idle circle { fill-opacity: .35; }
.gm-traveller { fill: hsl(var(--h) 80% 65%); filter: drop-shadow(0 0 6px hsl(var(--h) 80% 65%)); }
.gm-pulse { fill: none; stroke: var(--map-glow); stroke-width: 3; animation: pulse 1.6s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.gm-pulse-interact { stroke: var(--map-object); }
@keyframes pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(5); } }
.graph-map.has-hl .gm-node:not(.hl):not(.gm-root):not(.gm-realm):not(.gm-site), .graph-map.has-hl .gm-visitor:not(.hl) { opacity: .3; }
.gm-node.hl .gm-place-dot { stroke: var(--accent); stroke-width: 4; }
.gm-visitor.hl circle { stroke: var(--accent); }

@media (max-width: 960px) {
  body { display: block; }
  .layout { grid-template-columns: 1fr; padding: 0 16px 16px; }
  .top { padding: 14px 16px 8px; }
  .map-card { min-height: 0; }
  .map { flex: none; aspect-ratio: 4 / 3; }
  .visitors { max-height: none; }
}
