[hidden] { display: none !important; }

:root {
  --surface: #fcfcfb;
  --surface-2: #f2f1ee;
  --border: #dddcd7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --accent: #2a78d6;
  --shadow: 0 2px 10px rgba(0, 0, 0, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #1a1a19;
    --surface-2: #262624;
    --border: #3a3a37;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #96958d;
    --accent: #3987e5;
    --shadow: 0 2px 10px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #1a1a19;
  --surface-2: #262624;
  --border: #3a3a37;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #96958d;
  --accent: #3987e5;
  --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

html, body { margin: 0; height: 100%; background: var(--surface); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.value-tile { image-rendering: pixelated; }

#panel { position: absolute; top: 12px; left: 12px; z-index: 1000; width: 300px;
  max-height: calc(100% - 24px); overflow-y: auto; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 12px 14px; }
#panel h1 { font-size: 16px; margin: 0; }
#panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
  margin: 0 0 6px; font-weight: 600; }
#panel section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.sub, .note, .muted { color: var(--muted); }
.sub { margin: 2px 0 0; font-size: 12px; }
.note { font-size: 12px; margin: 6px 0 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.row input[type=range] { flex: 1 1 100%; accent-color: var(--accent); }
select { width: 100%; padding: 4px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.row select { width: auto; }
code { font-size: 11px; }

#legend { margin-top: 8px; }
.ramp { height: 12px; border-radius: 3px; border: 1px solid var(--border); }
.ticks { position: relative; height: 16px; font-size: 11px; color: var(--text-2); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; font-size: 12px; }
.swatches i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px;
  vertical-align: -1px; }

#panel-toggle { display: none; position: absolute; z-index: 1001; top: 10px; right: 10px;
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); box-shadow: var(--shadow); font: inherit; }

#coffee { display: inline-block; margin-top: 8px; padding: 5px 12px; border-radius: 6px; font-size: 13px;
  font-weight: 600; text-decoration: none; background: #ffdd00; color: #000; border: 1px solid #e6c700; }
#coffee:hover { background: #f5d400; }

#about-toggle { position: absolute; z-index: 1001; top: 10px; right: 10px; padding: 6px 12px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); font: inherit; cursor: pointer; }
#about { position: absolute; z-index: 1002; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100%;
  box-sizing: border-box; overflow-y: auto; background: var(--surface); color: var(--text);
  border-left: 1px solid var(--border); box-shadow: var(--shadow); padding: 14px 18px 24px; }
#about[hidden] { display: none; }
#about .about-head { display: flex; align-items: center; justify-content: space-between; }
#about h1 { font-size: 17px; margin: 0; }
#about h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
  margin: 0 0 6px; font-weight: 600; }
#about section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
#about p, #about li { font-size: 13px; line-height: 1.45; }
#about ol, #about ul { padding-left: 18px; margin: 4px 0; }
#about li { margin-bottom: 6px; }
#about .credits li { font-size: 12px; color: var(--text-2); }
#about .credits strong { color: var(--text); }
#about a { color: var(--accent); }
#about-close { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; font: inherit; }

.inspect { font-size: 12px; border-collapse: collapse; }
.inspect td { padding: 1px 6px 1px 0; vertical-align: top; }
.inspect td:first-child { color: #52514e; }
.inspect tr.head td { font-weight: 600; font-size: 13px; color: #0b0b0b; padding-bottom: 4px; }
.inspect tr.sep td { border-top: 1px solid #dddcd7; padding-top: 4px; }

@media (max-width: 640px) {
  #panel-toggle { display: block; }
  #about-toggle { top: 50px; }
  #about { width: 100%; border-left: none; }
  #panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 55%;
    border-radius: 10px 10px 0 0; padding: 10px 16px; }
  #panel.collapsed { display: none; }
}
