:root {
  --bg: #151a22; --panel: rgba(24, 30, 40, .94); --line: rgba(255,255,255,.09); --text: #e7ebf0; --mute: #9aa6b4;
  --accent: #f0b429; --r: 12px; --gut: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
#view { position: fixed; inset: 0; touch-action: none; }
#view canvas { display: block; }

#bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gut) 10px; pointer-events: none; }
#bar > * { pointer-events: auto; }
.ttl { display: flex; flex-direction: column; line-height: 1.15; text-shadow: 0 1px 3px #000a; }
.ttl b { font-size: 16px; } .ttl span { font-size: 12px; color: var(--mute); }
.views { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
button { font: inherit; color: var(--text); }
.views button, .iconbtn { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px;
  font-size: 13px; cursor: pointer; backdrop-filter: blur(6px); }
.views button:hover, .iconbtn:hover { border-color: #ffffff40; }
.views button.on { border-color: var(--accent); color: var(--accent); }
.iconbtn { padding: 7px; display: grid; place-items: center; }
/* link to the other page: clearly different from the view buttons */
.linkbtn { display: inline-flex; align-items: center; gap: 5px; background: #e9eef5; color: #141a24; border: 1px solid #fff;
  border-radius: 9px; padding: 7px 11px; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.linkbtn span { font-size: 14px; line-height: 1; }
.linkbtn:hover { background: #fff; }
@media (max-width: 760px) { .linkbtn { padding: 6px 9px; font-size: 12px; } }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.panel { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(8px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 30px #0006; }
.panel.hidden { display: none; }
.phead { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.x { background: none; border: 0; color: var(--mute); font-size: 16px; cursor: pointer; padding: 2px 6px; }
#layers { top: 64px; left: var(--gut); width: 310px; max-height: calc(100% - 110px); }
#info { top: 64px; right: var(--gut); width: 340px; max-height: calc(100% - 80px); }

#routes { top: 64px; left: var(--gut); width: 330px; max-height: calc(100% - 110px); }
.chips { display: flex; gap: 6px; padding: 10px 12px 4px; flex-wrap: wrap; }
.chips button { background: #ffffff0d; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chips button.on { border-color: var(--accent); color: var(--accent); }
.rnote { padding: 4px 12px 8px; font-size: 11px; color: var(--mute); border-bottom: 1px solid var(--line); }
#rlist { overflow-y: auto; padding: 4px; flex: 1; -webkit-overflow-scrolling: touch; }
.rt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.rt:hover { background: #ffffff0d; } .rt.sel { background: #f0b42922; }
.rt .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rt .nm { flex: 1; min-width: 0; } .rt .nm small { display: block; color: var(--mute); font-size: 11px; }
.rt .v { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.also { margin-top: 10px; font-size: 12px; color: var(--mute); }
.also button { display: block; width: 100%; text-align: left; margin-top: 4px; background: #ffffff0d; border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 8px; font-size: 12px; cursor: pointer; }
.rnote2 { font-size: 11px; color: var(--mute); margin-top: 8px; }
.slider { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.slider label { display: flex; justify-content: space-between; font-size: 13px; }
.slider input { width: 100%; accent-color: var(--accent); margin: 8px 0 2px; }
.slider small { color: var(--mute); font-size: 11px; }
#tree { overflow-y: auto; padding: 6px 4px 8px; flex: 1; -webkit-overflow-scrolling: touch; }
.grp > .row .caret { width: 18px; text-align: center; color: var(--mute); transition: transform .15s; cursor: pointer; }
.grp.closed > .row .caret { transform: rotate(-90deg); }
.grp.closed > .kids { display: none; }
.kids { padding-left: 18px; }
.row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; font-size: 13.5px; cursor: pointer; user-select: none; }
.row:hover { background: #ffffff0d; }
.row input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.row .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid #0006; }
.row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { color: var(--mute); font-size: 11px; }
.grp > .row .nm { font-weight: 600; }
.foot { padding: 8px 12px; font-size: 11px; color: var(--mute); border-top: 1px solid var(--line); }

#infoBody { overflow-y: auto; padding: 6px 12px 12px; -webkit-overflow-scrolling: touch; }
#infoBody table { width: 100%; border-collapse: collapse; font-size: 13px; }
#infoBody td { padding: 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
#infoBody td:first-child { color: var(--mute); padding-right: 12px; width: 48%; }
#infoBody td:last-child { text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }
#infoBody .lay { color: var(--mute); font-size: 11px; margin: 8px 0 2px; word-break: break-all; }
#infoBody .xyz { font-size: 12px; color: var(--mute); margin-top: 10px; font-variant-numeric: tabular-nums; }

#compass { position: fixed; right: var(--gut); bottom: calc(var(--gut) + env(safe-area-inset-bottom)); width: 44px; height: 44px; cursor: pointer; }
#compass svg { width: 100%; height: 100%; }
#compass circle { fill: var(--panel); stroke: var(--line); }
#compass path { fill: var(--accent); }
#compass text { fill: var(--mute); font-size: 8px; text-anchor: middle; font-weight: 700; }
#hint { position: fixed; left: var(--gut); bottom: calc(var(--gut) + env(safe-area-inset-bottom)); font-size: 12px; color: var(--mute);
  text-shadow: 0 1px 3px #000; pointer-events: none; max-width: calc(100% - 100px); }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); transition: opacity .4s; z-index: 10; }
#loading .box { width: min(280px, 80vw); text-align: center; }
#loading .bar { height: 4px; background: #ffffff14; border-radius: 2px; margin: 14px 0 8px; overflow: hidden; }
#loading i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#loading span { font-size: 12px; color: var(--mute); }

@media (max-width: 760px) {
  .ttl span { display: none; }
  .views button { padding: 6px 9px; font-size: 12px; }
  #layers, #routes { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-radius: var(--r) var(--r) 0 0;
    padding-bottom: env(safe-area-inset-bottom); }
  #info { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 48vh; border-radius: var(--r) var(--r) 0 0;
    padding-bottom: env(safe-area-inset-bottom); }
  .row { padding: 8px; font-size: 14.5px; }
  .row input { width: 19px; height: 19px; }
}
