:root {
  --bg: #061720;
  --panel: #0b2230;
  --panel2: #11303f;
  --ink: #dce9f0;
  --dim: #7f9aa8;
  --accent: #f5d681;
  --line: #1c3a4a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
body { display: flex; flex-direction: column; }
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
#brand .t1 { color: var(--accent); font-weight: 800; letter-spacing: .06em; }
#brand .t2 { color: var(--ink); font-weight: 600; letter-spacing: .12em; font-size: 12px; }
#topactions button {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  margin-left: 6px;
  cursor: pointer;
  font-size: 12px;
}
#maptabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
#maptabs button {
  flex: 0 0 auto;
  background: var(--panel);
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
#maptabs button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #09202c;
  font-weight: 700;
}
#stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
#panelbtn {
  position: absolute;
  z-index: 1000;
  right: 10px;
  top: 10px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}
#panel {
  position: absolute;
  z-index: 1001;
  right: 0;
  top: 0;
  bottom: 0;
  width: 272px;
  max-width: 85vw;
  background: rgba(8, 28, 40, .96);
  border-left: 1px solid var(--line);
  padding: 12px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .18s ease;
}
#panel.open { transform: none; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.chip.on { color: var(--ink); background: var(--panel2); }
.chip .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.4);
  flex: 0 0 auto;
  opacity: .35;
}
.chip.on .dot { opacity: 1; }
.chip .cnt { margin-left: auto; font-size: 11px; color: var(--dim); }
#editbox { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
#edittoggle { display: flex; gap: 8px; align-items: center; cursor: pointer; }
#editcontrols select,
#editcontrols button {
  width: 100%;
  margin-top: 8px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}
#edithint { margin-top: 8px; font-size: 11px; color: var(--dim); }
#about[hidden] { display: none; }
#about {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(2, 10, 16, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#aboutcard {
  position: relative;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}
#aboutcard h2 { margin-top: 0; color: var(--accent); }
#aboutcard a { color: #78c8ee; }
#aboutclose {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 22px;
  cursor: pointer;
}
.leaflet-container { background: var(--bg); font: inherit; }
.leaflet-popup-content-wrapper {
  background: var(--panel2);
  color: var(--ink);
  border-radius: 8px;
}
.leaflet-popup-tip { background: var(--panel2); }
.leaflet-popup-content { margin: 10px 14px; font-size: 13px; }
.pop .ttl { font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.pop .sub { color: var(--dim); font-size: 12px; }
.placelabel {
  color: #eef6fa;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .03em;
}
@media (min-width: 900px) {
  #panel { transform: none; }
  #panelbtn { display: none; }
  #map { right: 272px; }
}
