:root {
  --bg: #e9ecea;
  --panel: rgba(250, 249, 246, 0.88);
  --panel-solid: #faf9f6;
  --text: #1c2220;
  --muted: #65706b;
  --line: rgba(20, 30, 25, 0.1);
  --chip: rgba(20, 30, 25, 0.06);
  --chip-hover: rgba(20, 30, 25, 0.1);
  --accent: #2d5b4c;
  --accent-text: #ffffff;
  --shadow: 0 8px 30px rgba(20, 30, 25, 0.14), 0 1px 3px rgba(20, 30, 25, 0.08);
  --radius: 14px;
  --gap: 16px;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716;
    --panel: rgba(23, 27, 26, 0.86);
    --panel-solid: #1a1e1d;
    --text: #ebefed;
    --muted: #9aa49f;
    --line: rgba(255, 255, 255, 0.1);
    --chip: rgba(255, 255, 255, 0.07);
    --chip-hover: rgba(255, 255, 255, 0.12);
    --accent: #7cc0a4;
    --accent-text: #0f1a16;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; }
#app { position: fixed; inset: 0; overflow: hidden; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.info, .toggles, .views {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* info panel */
.info {
  position: absolute; top: var(--gap); left: var(--gap); width: 340px;
  max-height: calc(100% - 2 * var(--gap) - 80px); overflow: auto;
}
.info summary {
  list-style: none; cursor: pointer; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; background: var(--panel-solid); border-radius: var(--radius); z-index: 1;
}
.info summary::-webkit-details-marker { display: none; }
.info .title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-top: -4px; transition: transform .2s; }
.info[open] .chev { transform: rotate(-135deg); margin-top: 4px; }
.info-body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.info h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 6px 0 -2px; }
dl.rows { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
dl.rows dt { color: var(--muted); }
dl.rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eyes { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.eye {
  border: 0; background: transparent; cursor: pointer; text-align: left; padding: 6px 8px; border-radius: 9px;
  display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--muted);
}
.eye .v { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.eye:hover { background: var(--chip); }
.eye[aria-pressed="true"] { background: var(--chip-hover); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); }
.note { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; }

/* toggles */
.toggles {
  position: absolute; top: var(--gap); right: var(--gap); padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 200px;
}
.pair { display: flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; }
.plabel { font-size: 14px; margin-right: auto; padding-right: 8px; white-space: nowrap; }
.pair button { border: 0; background: transparent; cursor: pointer; padding: 6px 12px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.pair button:hover { background: var(--chip); }
.pair button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; cursor: pointer; padding: 7px 8px 7px 10px; border-radius: 9px; }
.switch:hover { background: var(--chip); }
.switch input { width: 36px; height: 20px; appearance: none; -webkit-appearance: none; background: var(--chip-hover); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; margin: 0; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* views */
.views {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--gap);
  display: flex; gap: 2px; padding: 4px; max-width: calc(100% - 2 * var(--gap)); overflow-x: auto; scrollbar-width: none;
}
.views::-webkit-scrollbar { display: none; }
.views button { flex: none; border: 0; background: transparent; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.views button:hover { background: var(--chip); }
.views button[aria-pressed="true"] { background: var(--chip-hover); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.views [data-walk] { position: relative; margin-left: 7px; }
.views [data-walk]::before { content: ''; position: absolute; left: -5px; top: 9px; bottom: 9px; width: 1px; background: var(--line); }
.views [data-walk][aria-pressed="true"] { background: var(--accent); color: var(--accent-text); box-shadow: none; }

.walk-hint {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--gap) + 58px); margin: 0;
  font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); pointer-events: none; white-space: nowrap;
}
.walk-hint[hidden] { display: none; }

/* point labels */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.labels[hidden] { display: none; }
.pt-label {
  position: absolute; left: 0; top: 0; font-size: 11px; font-weight: 700; line-height: 1; color: #1c2220;
  background: rgba(255, 255, 255, 0.9); border-radius: 999px; padding: 3px 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* loader */
.loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg); color: var(--muted); font-size: 14px; z-index: 10; transition: opacity .4s;
}
.loader.gone { opacity: 0; pointer-events: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* mobile */
@media (max-width: 600px), (pointer: coarse) and (max-width: 900px) {
  :root { --gap: 10px; }
  .info { left: var(--gap); right: var(--gap); width: auto; max-height: 52%; }
  .info summary { padding: 10px 14px; }
  .info-body { padding: 0 14px 12px; }
  dl.rows { font-size: 13px; gap: 5px 10px; }
  .toggles {
    top: auto; right: var(--gap); left: var(--gap); bottom: calc(var(--gap) + 92px); min-width: 0;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 3px; gap: 0;
  }
  .pair { flex: none; padding-left: 8px; }
  .plabel, .switch { font-size: 13px; }
  .pair button { padding: 6px 10px; }
  .switch { flex: none; gap: 8px; padding: 6px 8px; }
  .views { left: var(--gap); right: var(--gap); transform: none; max-width: none; display: grid; grid-template-columns: repeat(4, 1fr); }
  .views button { padding: 8px 2px; font-size: 13px; }
  .eye { font-size: 13px; }
  .views [data-walk] { margin-left: 0; }
  .views [data-walk]::before { display: none; }
  .walk-hint { bottom: calc(var(--gap) + 96px); }
  #app.walk .toggles { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}
