/* ============================================================ tokens == */
/* Grayscale only. No hues, no gradients — contrast and space do the work. */
:root {
  --bg: #0b0c0d;
  --surface: rgba(24, 25, 27, 0.94);
  --surface-solid: #18191b;
  --raise: rgba(255, 255, 255, 0.06);
  --raise-2: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.18);
  --text: #f3f4f5;
  --muted: #9ca0a6;
  --dim: #6b6f76;
  /* the only "accent" is plain white */
  --ink-invert: #0b0c0d;

  --lift: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  --lift-lg: 0 2px 8px rgba(0, 0, 0, .45), 0 20px 50px rgba(0, 0, 0, .55);

  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#map { position: fixed; inset: 0; }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--muted); font-weight: 400; }
.hint { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 0 0 10px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 9px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); background-clip: content-box; }

button, input, textarea { font-family: inherit; }
button { cursor: pointer; }

/* ============================================================= boot == */
#boot {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .4s ease, visibility .4s;
}
#boot.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { text-align: center; }
.boot-spin {
  width: 26px; height: 26px; margin: 0 auto 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#bootMsg { color: var(--muted); font-size: 13px; margin: 0; }
#bootMsg code { background: var(--raise); padding: 2px 5px; border-radius: 5px; font-size: 12px; }

/* ============================================================== hud == */
.hud { position: fixed; z-index: 20; display: flex; gap: 8px; align-items: flex-start; }
.hud-tl { top: calc(14px + var(--safe-t)); left: 14px; }
.hud-tr { top: calc(14px + var(--safe-t)); right: 14px; }

.ico {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text);
  box-shadow: var(--lift);
  transition: background .13s, color .13s, border-color .13s;
}
.ico:hover { background: rgba(38,40,43,.95); border-color: var(--line-2); }
.ico.on { background: var(--text); border-color: var(--text); color: var(--ink-invert); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px 0 12px;
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text);
  font: 500 13px/1 var(--font);
  box-shadow: var(--lift);
  transition: background .13s;
}
.chip:hover { background: rgba(38,40,43,.95); }
.chip svg { width: 16px; height: 16px; color: var(--muted); }
.chip-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
body.panel-open .chip { background: var(--text); border-color: var(--text); color: var(--ink-invert); }
body.panel-open .chip svg, body.panel-open .chip-count { color: rgba(11,12,13,.55); }

.searchbox { display: flex; align-items: center; }
.searchbox input {
  width: 0; padding: 0; border: 0; outline: 0; background: none;
  font: 400 13px var(--font); color: var(--text);
  transition: width .22s cubic-bezier(.4,0,.2,1), padding .22s;
}
.searchbox.open {
  background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--r-pill); box-shadow: var(--lift);
  padding-right: 6px;
}
.searchbox.open .ico { box-shadow: none; border: 0; background: none; width: 34px; backdrop-filter: none; }
.searchbox.open input { width: 178px; padding: 0 6px 0 0; }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbox input::placeholder { color: var(--dim); }

/* ------------------------------------------------------------ popovers */
.pop-wrap { position: relative; }
.pop {
  position: absolute; top: 46px; right: 0;
  min-width: 218px; padding: 7px;
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-lg);
  animation: popIn .15s cubic-bezier(.2,.8,.3,1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-5px); } }
.pop-label {
  margin: 5px 9px 7px; font: 600 10.5px var(--font);
  letter-spacing: .07em; text-transform: uppercase; color: var(--dim);
}
.pop-sep { height: 1px; background: var(--line); margin: 7px -7px; }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border: 0; border-radius: 9px;
  background: none; color: var(--text); font: 400 13px var(--font);
  text-align: left;
}
.pop-item:hover { background: var(--raise); }
.pop-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.pop-item span:first-of-type { flex: 1; }
.pop-flag { font-size: 11px; color: var(--text); font-weight: 600; }

.pop-maps, .pop-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pop-maps button, .pop-langs button {
  padding: 7px 9px; border: 0; border-radius: 9px;
  background: var(--raise); color: var(--muted);
  font: 500 12px var(--font);
}
.pop-maps button:hover, .pop-langs button:hover { color: var(--text); background: var(--raise-2); }
.pop-maps button.on, .pop-langs button.on { background: var(--text); color: var(--ink-invert); }

/* ============================================================ panel == */
#panel {
  position: fixed; z-index: 25;
  top: calc(62px + var(--safe-t)); left: 14px;
  /* hug the content — a half-empty column is not minimal */
  max-height: calc(100vh - 76px - var(--safe-t) - var(--safe-b));
  width: 280px;
  display: flex; flex-direction: column;
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-lg);
  transition: transform .26s cubic-bezier(.4,0,.2,1), opacity .18s;
  overflow: hidden;
}
body:not(.panel-open) #panel { transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; }
.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.pblock { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.pblock:last-child { border-bottom: 0; }
.pblock h2 {
  margin: 0 0 9px; font: 600 10.5px var(--font);
  letter-spacing: .07em; text-transform: uppercase; color: var(--dim);
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}

.list { display: flex; flex-direction: column; gap: 1px; }
.row-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 9px;
  cursor: pointer; transition: background .12s;
}
.row-item:hover { background: var(--raise); }
.row-item.off { opacity: .4; }
.swatch { width: 14px; height: 2px; border-radius: 2px; flex: none; background: var(--muted); }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 11.5px; color: var(--dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-act {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; background: none; color: var(--dim); border-radius: 7px;
  opacity: 0; transition: opacity .12s, background .12s;
}
.row-item:hover .row-act, .row-item.off .row-act { opacity: 1; }
.row-act:hover { background: var(--raise-2); color: var(--text); }
.row-act svg { width: 15px; height: 15px; }

.seg { display: flex; gap: 2px; padding: 2px; background: var(--raise); border-radius: 10px; }
.seg button {
  flex: 1; height: 27px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font: 500 12px var(--font); transition: .12s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise-2); color: var(--text); }

.check {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 9px;
  cursor: pointer; font-size: 12.5px; color: var(--muted);
}
.check:hover { background: var(--raise); color: var(--text); }
.check input {
  appearance: none; width: 16px; height: 16px; flex: none;
  border: 1.5px solid var(--line-2); border-radius: 5px;
  position: relative; transition: .12s; cursor: pointer;
}
.check input:checked { background: var(--text); border-color: var(--text); }
.check input:checked::after {
  content: ''; position: absolute; left: 4.5px; top: 1.5px;
  width: 4px; height: 8px; border: solid var(--ink-invert); border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
#panel .check { margin-top: 6px; }

.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 5px; max-height: 180px; overflow-y: auto; }
.tray-item {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--raise); cursor: pointer;
}
.tray-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-item:hover { border-color: var(--text); }
body.editing .tray-item { cursor: grab; }

.panel-foot {
  padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums;
}
#statLine { display: flex; gap: 12px; }

/* ========================================================= timeline == */
#timeline {
  position: fixed; z-index: 20;
  bottom: calc(14px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--lift);
  overflow: hidden;
  width: min(560px, calc(100vw - 28px));
  transition: width .24s cubic-bezier(.4,0,.2,1);
}
#timeline.collapsed { width: 38px; }
#timeline.collapsed .tl-body { display: none; }
#timelineToggle {
  height: 36px; width: 100%; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center;
}
#timelineToggle:hover { background: var(--raise); color: var(--text); }
#timeline:not(.collapsed) #timelineToggle { display: none; }
.tl-body { position: relative; padding: 12px 14px 9px; }
#tlCanvas { display: block; width: 100%; height: 40px; cursor: crosshair; }
.tl-handle {
  position: absolute; top: 12px; width: 12px; height: 40px; margin-left: -6px;
  cursor: ew-resize; z-index: 2;
}
.tl-handle::before { content: ''; position: absolute; left: 5px; top: 0; width: 2px; height: 100%; background: var(--text); }
.tl-handle::after {
  content: ''; position: absolute; left: 0; top: 50%; margin-top: -8px;
  width: 12px; height: 16px; background: var(--text); border-radius: 4px;
}
.tl-labels {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 6px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums;
}
#tlRange { color: var(--muted); font-weight: 500; }
.tl-reset {
  position: absolute; right: 12px; top: 6px;
  border: 0; background: var(--raise); color: var(--muted);
  font: 500 10px var(--font); padding: 4px 9px; border-radius: 7px;
  opacity: 0; pointer-events: none; transition: opacity .16s;
}
#timeline.filtered .tl-reset { opacity: 1; pointer-events: auto; }
.tl-reset:hover { color: var(--text); background: var(--raise-2); }

/* ======================================================= map markers == */
.pin { cursor: pointer; }
.pin-thumb {
  position: relative;
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(255,255,255,.9);
  background: #1a1b1d;
  box-shadow: 0 2px 10px rgba(0,0,0,.55);
  transition: transform .16s cubic-bezier(.34,1.3,.5,1), border-color .16s;
}
.pin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin:hover .pin-thumb { transform: scale(1.16); border-color: #fff; }
.pin.sel .pin-thumb { transform: scale(1.2); border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25), 0 2px 10px rgba(0,0,0,.55); }
.pin-badge {
  position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  padding: 1px 5px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.75);
  font: 600 8.5px/1.5 var(--font); color: #fff;
}
.pin-badge svg { width: 7px; height: 7px; fill: #fff; stroke: none; }

.pin-cluster {
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(20,21,23,.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,.55);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
  color: #fff; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: transform .16s cubic-bezier(.34,1.3,.5,1);
}
.pin-cluster:hover { transform: scale(1.1); border-color: #fff; }

.pin-mini {
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(0,0,0,.5);
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.pin-mini:hover { transform: scale(1.35); }

/* ========================================================= info card == */
.card {
  position: fixed; z-index: 30;
  bottom: calc(14px + var(--safe-b)); left: 14px;
  width: 300px;
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-lg);
  overflow: hidden;
  animation: cardIn .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } }
body.panel-open .card { left: 308px; }
.card-media { position: relative; aspect-ratio: 3/2; background: #000; cursor: zoom-in; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media .play {
  position: absolute; inset: 0; margin: auto; width: 40px; height: 40px;
  background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.5); border-radius: 50%;
  display: grid; place-items: center; pointer-events: none;
}
.card-media .play svg { width: 15px; height: 15px; fill: #fff; stroke: none; margin-left: 2px; }
.card-body { padding: 11px 13px 12px; }
.card-title { font-size: 13.5px; font-weight: 600; margin: 0 0 3px; }
.card-sub { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 9px; }
.card-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; white-space: pre-wrap; }
.card-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  display: grid; place-items: center;
}
.card-close svg { width: 14px; height: 14px; }
.card-close:hover { background: rgba(0,0,0,.85); }
.card-stats { display: flex; gap: 18px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.card-stat b { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-stat span { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.tagline { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: var(--r-pill); background: var(--raise); color: var(--muted); }
.tag.accent { background: var(--raise-2); color: var(--text); }
.card-body .btn {
  width: 100%; height: 32px; margin-top: 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: 500 12.5px var(--font);
}
.card-body .btn:hover { background: var(--raise-2); }
.card-body input[type=text], .card-body textarea {
  width: 100%; margin-top: 7px; padding: 8px 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: 400 13px var(--font); resize: vertical;
}
.card-body textarea { min-height: 60px; line-height: 1.5; }
.card-body input:focus, .card-body textarea:focus { outline: 0; border-color: var(--line-2); }

/* ========================================================== lightbox == */
#lightbox {
  --strip-h: calc(84px + var(--safe-b));
  position: fixed; inset: 0; z-index: 60;
  background: #08090a;
  animation: fade .18s ease;
}
#lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.lb-stage {
  position: absolute; top: 0; left: 0; right: 0; bottom: var(--strip-h);
  overflow: hidden;
  /* flex, not grid: an implicit `auto` grid row would size itself to the
     full-resolution photo and max-height:100% would resolve against that */
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
#lbImg, #lbVideo {
  max-width: 100%; max-height: 100%;
  display: block; user-select: none;
  transform-origin: 0 0;
  will-change: transform;
}
/* an id-level `display: block` outranks the UA rule for [hidden] */
#lbImg[hidden], #lbVideo[hidden] { display: none; }
#lbImg { cursor: grab; }
#lbImg.dragging { cursor: grabbing; transition: none !important; }
#lbVideo { background: #000; outline: 0; }

.lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; gap: 14px;
  padding: calc(12px + var(--safe-t)) 14px 12px;
  pointer-events: none;
}
.lb-top > * { pointer-events: auto; }
.lb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-title strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-title span { font-size: 11.5px; }
.lb-actions { display: flex; align-items: center; gap: 5px; }
.lb-actions .muted { margin-right: 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ico.dark { width: 34px; height: 34px; }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); box-shadow: var(--lift);
  display: grid; place-items: center;
  transition: background .12s, transform .12s;
}
.lb-nav:active { transform: translateY(-50%) scale(.94); }
.lb-nav:hover { background: rgba(38,40,43,.95); }
.lb-nav svg { width: 19px; height: 19px; }
.lb-nav-prev { left: 16px; }
.lb-nav-next { right: 16px; }
#lightbox.info-open .lb-nav-next { right: 344px; }
.lb-nav[disabled] { opacity: 0 !important; pointer-events: none; }

.lb-info {
  position: absolute; top: 0; right: 0; bottom: var(--strip-h); z-index: 4;
  width: 328px; padding: calc(62px + var(--safe-t)) 20px 24px;
  background: var(--surface-solid);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(100%); transition: transform .24s cubic-bezier(.4,0,.2,1);
}
#lightbox.info-open .lb-info { transform: none; }
.lb-info h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.lb-info .path { font-size: 11.5px; color: var(--dim); overflow-wrap: anywhere; }
.lb-info .meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 16px 0; font-size: 12.5px; }
.lb-info .meta-grid dt { color: var(--dim); }
.lb-info .meta-grid dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lb-info .sec { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.lb-info .sec > label {
  display: block; font: 600 10.5px var(--font);
  letter-spacing: .07em; text-transform: uppercase; color: var(--dim); margin-bottom: 7px;
}
.lb-info input[type=text], .lb-info textarea, .lb-info input[type=number] {
  width: 100%; padding: 8px 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: 400 13px var(--font); resize: vertical;
}
.lb-info input:focus, .lb-info textarea:focus { outline: 0; border-color: var(--line-2); }
.lb-info textarea { min-height: 80px; line-height: 1.5; }
.lb-info .btn {
  width: 100%; height: 32px; margin-top: 9px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: 500 12.5px var(--font);
}
.lb-info .btn:hover { background: var(--raise-2); }

.compass { display: flex; align-items: center; gap: 14px; }
.dial {
  width: 68px; height: 68px; flex: none; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--raise);
  position: relative; cursor: crosshair;
}
.dial::after { content: 'N'; position: absolute; top: 3px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--dim); }
.dial-needle {
  position: absolute; left: 50%; top: 50%; width: 2.5px; height: 27px;
  margin-left: -1.25px; transform-origin: 50% 100%;
  background: var(--text); border-radius: 2px;
  transform: translateY(-100%) rotate(0deg);
}
.dial-hub { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--text); }

.lb-strip {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--strip-h);
  display: flex; gap: 6px; align-items: center;
  padding: 0 14px calc(10px + var(--safe-b));
  overflow-x: auto; overflow-y: hidden;
  background: var(--surface-solid);
  border-top: 1px solid var(--line);
}
.lb-strip::-webkit-scrollbar { height: 5px; }
.strip-item {
  flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; opacity: .45;
  transition: opacity .13s, border-color .13s; position: relative; background: #000;
}
.strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-item:hover { opacity: .8; }
.strip-item.on { opacity: 1; border-color: #fff; }
.strip-item.vid::after {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  border-left: 6px solid #fff; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.9));
}

/* ============================================================ misc == */
.toast {
  position: fixed; z-index: 80; bottom: calc(24px + var(--safe-b)); left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--text); color: var(--ink-invert);
  box-shadow: var(--lift-lg);
  font-size: 12.5px; font-weight: 500;
  animation: cardIn .2s cubic-bezier(.2,.8,.3,1);
}

.drag-ghost {
  position: fixed; z-index: 100; pointer-events: none;
  width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  border: 2px solid #fff; box-shadow: var(--lift-lg);
  transform: translate(-50%, -50%);
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; }

body.editing #map { cursor: crosshair; }
.edit-banner {
  position: fixed; z-index: 22; top: calc(62px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  padding: 7px 14px; border-radius: var(--r-pill); font-size: 12px;
  background: var(--text); color: var(--ink-invert); font-weight: 500;
  white-space: nowrap; box-shadow: var(--lift);
}

/* maplibre chrome, restyled to match */
.maplibregl-ctrl-group {
  background: var(--surface) !important;
  backdrop-filter: blur(16px);
  border: 1px solid var(--line) !important;
  border-radius: var(--r) !important;
  box-shadow: var(--lift) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button { width: 34px !important; height: 34px !important; background: none !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button:hover { background: var(--raise) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) brightness(1.7); }
.maplibregl-ctrl-attrib {
  background: rgba(11,12,13,.72) !important; backdrop-filter: blur(10px);
  border-radius: 7px 0 0 0 !important; font-size: 10px !important; color: var(--dim) !important;
}
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-bottom-right { margin-bottom: var(--safe-b); }
.maplibregl-canvas:focus { outline: none; }
.maplibregl-ctrl-scale {
  background: rgba(11,12,13,.6) !important; backdrop-filter: blur(10px);
  border-color: var(--line-2) !important; color: var(--muted) !important;
  border-radius: 0 3px 3px 0; font-size: 10px !important;
}

/* ======================================================= responsive == */
@media (max-width: 860px) {
  .lb-info { width: 100%; }
  #lightbox.info-open .lb-nav { opacity: 0; pointer-events: none; }
  body.panel-open .card { left: 14px; }
  #panel { width: calc(100vw - 28px); max-width: 320px; }
  .searchbox.open input { width: 130px; }
}
@media (max-width: 620px) {
  .card { width: calc(100vw - 28px); }
  #lightbox { --strip-h: calc(72px + var(--safe-b)); }
  .strip-item { width: 48px; height: 48px; }
  #timeline { width: calc(100vw - 20px); }
  #timeline.collapsed { width: 38px; }
  .chip span[data-i18n="brand"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ------------------------------------------------- viewer affordances -- */
/* Shown once, to a first-time visitor who may never have used a map UI. */
.hint-bubble {
  position: fixed; z-index: 40;
  bottom: calc(66px + var(--safe-b));
  left: 14px; right: 14px;
  margin: 0 auto; width: fit-content; max-width: calc(100vw - 28px);
  display: flex; align-items: center; gap: 12px;
  padding: 11px 11px 11px 16px;
  background: var(--text); color: var(--ink-invert);
  /* a rounded rectangle, not a pill — the text is a sentence, not a word */
  border-radius: 14px;
  box-shadow: var(--lift-lg);
  font-size: 13px; font-weight: 500; line-height: 1.35;
  animation: cardIn .3s cubic-bezier(.2,.8,.3,1);
}
.hint-bubble > span { flex: 1; }
.hint-ok {
  flex: none; border: 0; border-radius: var(--r-pill);
  padding: 6px 13px; background: rgba(11,12,13,.12);
  color: var(--ink-invert); font: 600 12px var(--font);
}
.hint-ok:hover { background: rgba(11,12,13,.2); }

.row-play svg { fill: currentColor; stroke: none; width: 13px; height: 13px; }

/* Touch devices get bigger targets and permanently visible row actions. */
@media (hover: none) {
  .row-act { opacity: 1; width: 34px; height: 34px; }
  .row-item { padding: 11px 9px; }
  .ico { width: 42px; height: 42px; }
  .lb-nav { width: 46px; height: 46px; }
  .pin-thumb { width: 48px; height: 48px; }
  .check { padding: 10px 9px; }
  .pop-item { padding: 11px 9px; }
}

/* ---------------------------------------------------------- upload UI -- */
.sheet-wrap {
  position: fixed; left: 0; right: 0; top: 0;
  height: 100dvh; z-index: 70;
  display: flex; flex-direction: column;
  background: rgba(0,0,0,.6);
  padding: 16px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: fade .16s ease;
}
.sheet {
  /* auto margins centre it but, unlike justify-content, never clip the top
     when the sheet is taller than the space the keyboard leaves behind */
  flex: none; margin: auto;
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-lg);
  animation: cardIn .2s cubic-bezier(.2,.8,.3,1);
}
.sheet h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.sheet-hint { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.sheet-label {
  display: block; margin: 14px 0 6px;
  font: 600 10.5px var(--font); letter-spacing: .07em;
  text-transform: uppercase; color: var(--dim);
}
.sheet input[type=text], .sheet input[type=password] {
  width: 100%; padding: 12px 12px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text);
  /* 16px exactly: anything smaller makes iOS Safari zoom the page on focus */
  font: 400 16px var(--font);
}
.sheet input:focus { outline: 0; border-color: var(--line-2); }
.sheet-error { margin: 8px 0 0; font-size: 12.5px; color: #ff8f8f; }
.sheet-actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.sheet .btn {
  height: 42px; padding: 0 16px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: 500 14px var(--font);
}
.sheet .btn:hover { background: var(--raise-2); }
.sheet .btn.primary { background: var(--text); border-color: var(--text); color: var(--ink-invert); font-weight: 600; }
.sheet .btn.primary:hover { background: #fff; }
.sheet .btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.sheet .btn.ghost { background: none; }
.sheet .btn.block { width: 100%; margin-top: 14px; }

.up-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.up-row {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--raise); font-size: 12.5px;
}
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { color: var(--muted); font-variant-numeric: tabular-nums; }
.up-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--raise-2); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--text); transition: width .2s; }
.up-row.ok .up-state { color: var(--text); }
.up-row.failed { background: rgba(255,120,120,.12); }
.up-row.failed .up-state { color: #ff8f8f; }
