:root {
  --bg: #0b1117;
  --card: rgba(14, 21, 29, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8eef3;
  --muted: #8d9ba8;
  --amber: #f2b33d;
  --teal: #4fd1b5;
  --blue: #5aa9ff;
  --red: #ff6b5a;
  --radius: 16px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
#map { position: fixed; inset: 0; }

.card {
  position: fixed;
  background: var(--card);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

/* Top card */
.top { top: 16px; left: 16px; width: min(400px, calc(100vw - 32px)); padding: 14px 16px 12px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
h1 { margin: 0; font-size: 18px; letter-spacing: 0.2px; font-weight: 650; }
h1 .radar { color: var(--amber); }
.now { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.now b { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--muted);
  border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.chip .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .55; }
.chip[aria-pressed="true"] { background: #e8eef3; color: #0b1117; border-color: transparent; }
.chip[aria-pressed="true"] .sw { opacity: 1; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.icon-btn {
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text);
  border-radius: 10px; min-width: 34px; height: 34px; cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
}
.dots { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block; }
.dots i.ok { background: var(--teal); }
.dots i.err { background: var(--red); }

/* Ask the city */
.ask { top: 16px; right: 16px; width: min(360px, calc(100vw - 32px)); padding: 14px 16px; }
.ask-q { font-weight: 600; font-size: 14.5px; }
.spark { color: var(--amber); margin-right: 4px; }
.ask-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ask-options button {
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text);
  border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.ask-options button:hover, .ask-options button.active { border-color: var(--amber); }
.ask-answer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; }
.ask-answer .headline { font-weight: 650; font-size: 15px; margin-bottom: 6px; }
.ask-answer .headline em { color: var(--amber); font-style: normal; }
.ask-answer ol { margin: 6px 0 8px; padding-left: 18px; }
.evidence { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.evidence span { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }

/* Bottom slider */
.bottom { left: 50%; transform: translateX(-50%); bottom: 16px; width: min(560px, calc(100vw - 32px)); padding: 12px 16px 10px; }
.time-row { display: flex; align-items: baseline; gap: 10px; }
.clock { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.time-note { color: var(--muted); font-size: 12.5px; flex: 1; }
.play { border: 0; background: var(--amber); color: #0b1117; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 12px; }
input[type=range] { width: 100%; margin: 10px 0 2px; accent-color: var(--amber); }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* Sources panel */
.sources { right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); padding: 14px 16px; z-index: 8; max-height: 70vh; overflow: auto; }
.sources-head { display: flex; justify-content: space-between; align-items: center; }
.sources h2 { font-size: 15px; margin: 0; }
.sources ul { list-style: none; padding: 0; margin: 10px 0; }
.sources li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.sources li .st { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sources li .st.ok { background: var(--teal); }
.sources li .st.err { background: var(--red); }
.sources li small { color: var(--muted); display: block; }
.sources li .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.fine { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 0; }

/* Map markers and popups */
.pin {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); border: 1px solid rgba(0,0,0,.25);
}
.pin.temp { background: rgba(14,21,29,.9); color: var(--text); border-color: var(--line); font-weight: 500; }
.pin.bath { background: #1f6fd1; color: #fff; }
.pin.plan { background: var(--amber); color: #1b1305; }
.pin.wiki { background: rgba(14,21,29,.9); color: #cdb8ff; border-color: rgba(205,184,255,.35); font-weight: 500; }
.maplibregl-popup-content {
  background: #111a23; color: var(--text); border-radius: 12px; border: 1px solid var(--line);
  padding: 12px 14px; font-size: 13px; line-height: 1.45; max-width: 280px;
}
.maplibregl-popup-tip { border-top-color: #111a23 !important; border-bottom-color: #111a23 !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 16px; padding: 2px 6px; }
.cam-img { display: block; max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 8px; background: #000; }
.popup-title { font-weight: 650; margin-bottom: 2px; }
.popup-sub { color: var(--muted); font-size: 12px; }
.for-you { margin-top: 8px; color: var(--amber); font-size: 12.5px; }
.popup-src { margin-top: 8px; color: var(--muted); font-size: 11px; }
.maplibregl-ctrl-attrib { background: rgba(11,17,23,.7) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }

.pin.demo { background: var(--red); color: #fff; }

/* Lens */
#lens-wrap { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#lens-map { position: absolute; inset: 0; }
#lens-ring {
  position: absolute; border-radius: 50%; pointer-events: auto; cursor: grab; touch-action: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 7px rgba(0,0,0,.35), 0 12px 40px rgba(0,0,0,.6), inset 0 0 30px rgba(0,0,0,.45);
}
#lens-ring:active { cursor: grabbing; }
.lens-modes { position: absolute; left: 50%; bottom: -44px; transform: translateX(-50%); display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; white-space: nowrap; }
.lens-modes button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
#lens-legend { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.lens-modes button.on { background: #e8eef3; color: #0b1117; }

@media (max-width: 760px) {
  .ask { top: auto; bottom: 128px; right: 16px; left: 16px; width: auto; padding: 10px 12px; }
  .ask-options { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ask-options button { white-space: nowrap; }
  .ask-answer { max-height: 32vh; overflow: auto; }
  .bottom { width: calc(100vw - 32px); }
  .top { padding: 12px 14px 10px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; }
  .maplibregl-ctrl-bottom-right { bottom: 210px; }
}
