:root {
  --ink: #f2f1ec; --muted: rgba(242, 241, 236, 0.62); --bg: rgba(16, 19, 23, 0.84); --bg2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12); --accent: #ffd23f; --hike: #ff5a2e; --ski: #2a7bff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1f25; color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; touch-action: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 6px 10px; }
button:hover { border-color: rgba(255, 255, 255, 0.3); }
button.primary { background: rgba(255, 210, 63, 0.16); border-color: var(--accent); font-weight: 600; flex: 1; }
button.primary:disabled { opacity: 0.55; cursor: progress; }
button.ghost { background: none; }
input, select { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; min-width: 0; }
select option { background: #1d2228; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row > input[type=search] { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); white-space: nowrap; }
.chips label { font-size: 12px; display: flex; gap: 4px; align-items: center; padding: 2px 8px; border: 1px solid var(--line); border-radius: 10px; }

#side { position: fixed; top: 12px; left: 12px; bottom: 40px; width: 360px; display: flex; flex-direction: column;
  background: var(--bg); backdrop-filter: blur(10px); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; z-index: 5; }
#side > header, #side > section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; margin-bottom: 8px; }
.brand .logo { color: var(--accent); }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
#region-form { display: flex; gap: 8px; }
#region-form input { flex: 1; }
#crawl-log { margin: 6px 0 0; padding-left: 18px; max-height: 120px; overflow: auto; font-size: 11px; color: var(--muted); }
#crawl-status { margin-top: 6px; }
.static-site #crawl-box .row, .static-site #crawl-more, .static-site #crawl-log { display: none !important; }
.static-site #crawl-status { margin-top: 0; }
#browse { display: flex; flex-direction: column; min-height: 0; flex: 1; border-bottom: none !important; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; border: none; border-radius: 0; background: none; padding: 6px 4px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(255, 210, 63, 0.18); color: #fff; font-weight: 600; }
#count { margin-left: auto; }
.kinds { display: flex; flex-wrap: wrap; gap: 5px; }
.kinds button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 14px; font-size: 12.5px; background: none; }
.kinds button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.kinds button.on { background: rgba(255, 210, 63, 0.18); border-color: var(--accent); color: #fff; font-weight: 600; }
.kinds button::after { content: attr(data-count); font-size: 10.5px; color: var(--muted); font-weight: 400; }
.kinds button.none { opacity: 0.4; }
#list { list-style: none; margin: 8px -14px 0; padding: 0; overflow-y: auto; flex: 1; }
#list li { padding: 8px 14px; border-top: 1px solid rgba(255, 255, 255, 0.05); cursor: pointer; display: grid; grid-template-columns: 10px 1fr; gap: 2px 9px; }
#list li:hover, #list li.hover { background: rgba(255, 255, 255, 0.07); }
#list li .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
#list li .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list li .meta { grid-column: 2; font-size: 12px; color: var(--muted); }
#list .empty { color: var(--muted); padding: 16px 14px; cursor: default; display: block; }

#detail { overflow-y: auto; flex: 1; border-bottom: none !important; }
#detail h2 { margin: 8px 0 4px; font-size: 18px; line-height: 1.25; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stats div { background: var(--bg2); border-radius: 8px; padding: 6px 8px; }
.stats b { display: block; font-size: 15px; }
.stats span { font-size: 11px; color: var(--muted); }
#profile { width: 100%; height: 110px; background: rgba(0, 0, 0, 0.25); border-radius: 8px; cursor: crosshair; }
#d-desc { color: rgba(242, 241, 236, 0.85); font-size: 13px; }
#d-img { width: 100%; border-radius: 8px; margin: 4px 0 8px; }
#detail.drop { outline: 2px dashed var(--accent); outline-offset: -8px; background: rgba(255, 210, 63, 0.06); }
#d-actions { flex-wrap: wrap; }
#d-actions a, #d-actions button { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--bg2); font-size: 13px; }

.panel { position: fixed; background: var(--bg); backdrop-filter: blur(10px); border-radius: 12px; border: 1px solid var(--line); z-index: 5; }
#layers { top: 12px; right: 12px; width: 250px; padding: 12px; }
#layers .field { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
#layers .field select { color: var(--ink); font-size: 13px; }
#layers .checks { display: grid; gap: 5px; margin-top: 10px; font-size: 13px; }
#layers .checks label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
#s2-info { margin-top: 4px; }
.legend { display: flex; margin-top: 8px; font-size: 10px; }
.legend span { flex: 1; border-top: 6px solid var(--c); padding-top: 2px; color: var(--muted); }
#sun { width: 100%; }
#nav { right: 12px; bottom: 44px; display: grid; padding: 4px; gap: 2px; border-radius: 22px; }
#nav button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: none; background: none; border-radius: 50%; font-size: 18px; line-height: 1; }
#nav button:hover { background: rgba(255, 255, 255, 0.1); }
#nav #tilt { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
#nav #help-btn { font-size: 14px; color: var(--muted); }
#help { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(8, 10, 12, 0.45); }
#help .card { position: relative; max-width: 560px; margin: 16px; padding: 18px 22px; }
#help h3 { margin: 0 0 10px; font-size: 16px; }
#help .close { position: absolute; top: 10px; right: 10px; padding: 2px 8px; }
#help .keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13px; align-items: baseline; }
#help .keys b { font-weight: 600; white-space: nowrap; }
#help .keys span { color: rgba(242, 241, 236, 0.8); }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 1px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 4px;
  font: 11px/17px ui-monospace, Menlo, monospace; text-align: center; }

#status { position: fixed; left: 0; right: 0; bottom: 0; height: 30px; display: flex; gap: 16px; align-items: center; padding: 0 14px;
  background: rgba(12, 14, 17, 0.8); font-size: 12px; z-index: 6; white-space: nowrap; overflow: hidden; }
#cursor { font-variant-numeric: tabular-nums; min-width: 260px; }
#loading { color: var(--accent); min-width: 110px; }
#status .attr { margin-left: auto; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; }
#tooltip { position: fixed; pointer-events: none; z-index: 7; background: rgba(12, 14, 17, 0.9); padding: 4px 9px; border-radius: 8px; font-size: 12px;
  transform: translate(12px, -50%); white-space: nowrap; border: 1px solid var(--line); }

#layers-btn { display: none; }
@media (max-width: 760px) {
  /* the side panel becomes a bottom sheet; tap its header to expand it */
  #side { top: auto; bottom: 30px; left: 0; right: 0; width: auto; height: 46%; border-radius: 14px 14px 0 0; transition: height 0.2s; }
  #side.expanded { height: calc(100% - 90px); }
  #side > header, #side > section { padding: 8px 12px; }
  #side > header { position: relative; cursor: pointer; padding-top: 14px; }
  #side > header::before { content: ''; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
  .brand { font-size: 15px; margin-bottom: 6px; }
  #crawl-status { margin-top: 4px; }
  #browse .row { margin-top: 6px; }
  #list { margin: 6px -12px 0; }
  #list li { padding: 7px 12px; }
  #layers-btn { display: grid; place-items: center; top: 8px; right: 8px; width: 40px; height: 40px; padding: 0; border-radius: 50%; }
  #layers { display: none; width: 220px; top: 56px; right: 8px; padding: 10px; }
  #layers.open { display: block; }
  #nav { bottom: calc(46% + 40px); }
  #nav #help-btn { display: none; }
  #side.expanded ~ #nav { display: none; }
  #help .keys { grid-template-columns: 1fr; gap: 2px; }
  #help .keys span { margin-bottom: 6px; }
  #status .attr { display: none; }
  #cursor { min-width: 0; }
}
