:root {
  --bg: #0f1419;
  --card: #1a1f2e;
  --ink: #e6e9ef;
  --muted: #8a93a6;
  --line: #2a3144;
  --accent: #f5d76e;
  --good: #4ade80;
  --mixed: #fbbf24;
  --bad: #f87171;
  --unk: #6b7280;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
a { color: var(--accent); }
.muted { color: var(--muted); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 500; position: relative;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .tag { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
.clock { font-family: ui-monospace, Menlo, monospace; color: var(--accent); }

.hero {
  background: linear-gradient(180deg, #1a1f2e 0%, #0f1419 100%);
  padding: 20px 16px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.sun {
  position: relative;
  width: 110px; height: 110px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8dc 0%, #f5d76e 60%, #d4a017 100%);
  box-shadow: 0 0 60px rgba(245, 215, 110, 0.4);
}
.moon {
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--bg);
  transform: translate(40%, -15%);
  transition: transform 1s ease;
}
.timeline {
  display: flex; justify-content: center; gap: 18px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
}
.timeline .phase { display: flex; flex-direction: column; align-items: center; }
.timeline .t { color: var(--accent); font-weight: 600; }
.timeline .l { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.timeline .phase.active .t { color: var(--ink); }
.timeline .phase.active .l { color: var(--accent); }

#status { font-size: 12px; margin: 8px 0 0; }

.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.legend .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.dot-good { background: var(--good); }
.dot-mixed { background: var(--mixed); }
.dot-bad { background: var(--bad); }
.dot-unk { background: var(--unk); }

#map {
  height: calc(100vh - 320px);
  min-height: 300px;
  background: #1a1f2e;
}
.leaflet-container { background: #1a1f2e !important; }

.spot {
  position: fixed;
  right: -360px; top: 0; bottom: 0;
  width: 360px; max-width: 90vw;
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
  transition: right 0.3s ease;
  z-index: 1000;
}
.spot.open { right: 0; }
.spot .close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer;
}
.spot h2 { margin: 0 0 4px; font-size: 18px; }
.bars { margin: 16px 0; }
.bar {
  display: grid;
  grid-template-columns: 50px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.bar .h { color: var(--muted); font-family: ui-monospace, monospace; }
.bar .track {
  height: 8px; background: var(--line); border-radius: 4px;
  overflow: hidden; position: relative;
}
.bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--unk); transition: width 0.3s;
}
.bar.good .fill { background: var(--good); }
.bar.mixed .fill { background: var(--mixed); }
.bar.bad .fill { background: var(--bad); }
.bar .v { text-align: right; font-family: ui-monospace, monospace; }
.verdict {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 14px;
}
.verdict.good { border-left-color: var(--good); }
.verdict.mixed { border-left-color: var(--mixed); }
.verdict.bad { border-left-color: var(--bad); }

.spot .actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--line); border-color: var(--accent); }
.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { background: #e0c560; border-color: #e0c560; }

#nav h4[style*="cursor: pointer"]:hover { color: var(--accent); }

.leaflet-popup-content-wrapper {
  background: var(--card); color: var(--ink);
  border-radius: 6px;
}
.leaflet-popup-tip { background: var(--card); }
.spot-marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}
.spot-marker:hover {
  transform: scale(1.4);
  z-index: 1000;
}
.spot-marker.good { background: var(--good); }
.spot-marker.mixed { background: var(--mixed); }
.spot-marker.bad { background: var(--bad); }
.spot-marker.unk { background: var(--unk); }

.foot {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 10px; color: var(--muted);
  z-index: 400;
}
.foot a { color: var(--muted); text-decoration: underline; }
.foot .muted { color: var(--muted); }

@media (max-width: 600px) {
  .hero { padding: 14px 12px 8px; }
  .sun { width: 80px; height: 80px; }
  #map { height: calc(100vh - 280px); }
  .spot { width: 100%; }
}
