:root {
  --bg: #f3f4f6;
  --panel: rgba(255, 255, 255, 0.94);
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d1d5db;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --panel: rgba(31, 41, 55, 0.94);
    --text: #f3f4f6;
    --muted: #9ca3af;
    --line: #4b5563;
    --accent: #3b82f6;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; touch-action: none; }

#bar { position: fixed; top: 0; left: 0; right: 0; height: 44px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 3; }
.title { font-weight: 600; }
#badge { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: #f59e0b; color: #000; font-size: 11px; font-weight: 700; }

#panel { position: fixed; top: 52px; left: 8px; width: 230px; max-height: calc(100% - 60px); overflow-y: auto;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; z-index: 2; }
#panel.hidden { display: none; }
#panel h2 { margin: 6px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
section { margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
button { font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 9px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.icon { border: none; font-size: 20px; padding: 2px 6px; }
.buttons button { width: 100%; }

.row { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.swatch { display: inline-block; width: 22px; height: 6px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); }
#legend { margin-top: 4px; font-size: 12px; color: var(--muted); }
#legend .row { cursor: default; }
.help { margin: 4px 0 0; font-size: 11px; color: var(--muted); }

#status { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); padding: 4px 10px;
  border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; z-index: 2; }
#status:empty { display: none; }

@media (max-width: 600px) {
  #panel { left: 8px; right: 8px; width: auto; max-height: 55%; }
}
.row.off { opacity: .5; cursor: default; }
button:disabled { opacity: .45; cursor: not-allowed; }
#mapCredit { position: fixed; right: 6px; bottom: 4px; font-size: 10px; color: var(--muted); background: var(--panel); padding: 1px 5px; border-radius: 4px; z-index: 2; }
#mapCredit[hidden] { display: none; }
#pickInfo { position: fixed; right: 8px; top: 52px; max-width: 300px; padding: 8px 10px; font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; z-index: 2; }
#pickInfo[hidden] { display: none; }
@media (max-width: 600px) { #pickInfo { left: 8px; right: 8px; top: auto; bottom: 40px; max-width: none; } }
.row.slider input[type=range] { flex: 1; min-width: 0; }
.row.slider span { width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
