:root {
  --bg: #070c11;
  --panel: rgba(12, 19, 26, 0.88);
  --panel-solid: #0d141b;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #edf4f1;
  --muted: #8b9ba6;
  --accent: #ff7a66;
  --teal: #5fe0c0;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --header-h: 58px;
  --sheet-h: 32dvh;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app { position: relative; width: 100%; height: 100dvh; overflow: hidden; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 900;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(6, 11, 15, 0.84);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--accent);
  background: rgba(255, 122, 102, 0.12);
  border: 1px solid rgba(255, 122, 102, 0.22);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { font-weight: 650; font-size: 14px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.count-pill {
  min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums;
}
.sync { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(95, 224, 192, 0.14); animation: pulse 2.4s infinite; }
.sync.offline .sync-dot { background: #f0a35e; box-shadow: 0 0 0 3px rgba(240, 163, 94, 0.14); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- map ---------- */
.map-wrap { position: absolute; inset: 0; transition: right 0.28s cubic-bezier(.2,.8,.2,1); }
#map { position: absolute; inset: 0; background: #0a1015; }
.leaflet-container { background: #0a1015; font-family: inherit; }
.leaflet-top.leaflet-left { top: calc(var(--header-h) + env(safe-area-inset-top) + 8px); left: 10px; }
.leaflet-control-zoom { border: none !important; box-shadow: 0 6px 20px rgba(0,0,0,.35) !important; }
.leaflet-control-zoom a {
  width: 34px !important; height: 34px !important; line-height: 34px !important;
  background: rgba(13, 20, 27, 0.88) !important; color: #dfeae6 !important;
  border-color: var(--line) !important; backdrop-filter: blur(10px);
}
.leaflet-control-zoom a:hover { background: #16232c !important; }
.leaflet-control-attribution {
  background: rgba(6, 11, 15, 0.72) !important; color: #73848e !important;
  font-size: 9.5px !important; padding: 2px 7px !important; border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: #9fb0b8 !important; }
.leaflet-bottom.leaflet-right { bottom: calc(var(--sheet-h) + 4px); }
.leaflet-bottom.leaflet-left { bottom: calc(var(--sheet-h) + 10px); }

/* ---------- photo pins ---------- */
.photo-pin-wrap { background: none !important; border: none !important; }
.photo-pin {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.5);
  background: #1a2731;
}
.photo-pin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pin-wrap .tail {
  position: absolute; left: 50%; bottom: 1px; width: 9px; height: 9px;
  background: rgba(255, 255, 255, 0.92); transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 4px 8px rgba(0,0,0,.35);
}
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(255, 122, 102, 0.28) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background: var(--accent) !important; color: #1b0b08 !important;
  font-weight: 700 !important; font-size: 12px !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}

.leaflet-popup-content-wrapper {
  background: #0d161d; color: var(--text); border-radius: 14px;
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: #0d161d; }
.leaflet-popup-content { margin: 0; width: 290px !important; }
.popup-photo { width: 236px; height: 158px; object-fit: cover; display: block; border-radius: 13px 13px 0 0; background: #16222b; }
.popup-body { padding: 10px 12px 12px; }
.popup-place { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.popup-place .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.popup-meta { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.popup-caption { margin: 7px 0 0; font-size: 12px; line-height: 1.5; color: #c8d5d0; }
.popup-delete { margin-top: 9px; border: 0; border-radius: 999px; padding: 5px 10px; background: rgba(255, 122, 102, 0.12); color: #ff9a86; font-size: 10.5px; font-weight: 600; }
.leaflet-popup-close-button { color: #93a5ae !important; padding: 8px 8px 0 0 !important; font-size: 18px !important; }

/* ---------- empty state ---------- */
.map-empty {
  position: absolute; inset: 0; z-index: 500; display: grid; place-items: center;
  padding: 80px 20px calc(var(--sheet-h) + 24px);
  pointer-events: none; background: radial-gradient(600px 300px at 50% 45%, rgba(12, 25, 32, 0.66), transparent 70%);
}
.map-empty[hidden] { display: none; }
.empty-card {
  pointer-events: auto; width: min(380px, 100%); padding: 22px;
  border-radius: 18px; border: 1px solid var(--line); background: rgba(9, 15, 20, 0.82);
  backdrop-filter: blur(14px); box-shadow: var(--shadow); text-align: center;
}
.empty-emoji { font-size: 28px; }
.empty-card h2 { margin: 8px 0 6px; font-size: 17px; letter-spacing: -0.01em; }
.empty-card p { margin: 0 0 16px; font-size: 12px; line-height: 1.65; color: var(--muted); }

/* ---------- sheet / gallery ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 800;
  height: var(--sheet-h); display: flex; flex-direction: column;
  background: var(--panel); border-top: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0; backdrop-filter: blur(18px);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.35);
  padding-bottom: env(safe-area-inset-bottom);
  transition: height 0.28s cubic-bezier(.2,.8,.2,1), transform 0.28s cubic-bezier(.2,.8,.2,1);
}
.sheet.expanded { height: 66dvh; }
.sheet-handle {
  flex: 0 0 26px; width: 100%; border: 0; background: transparent;
  display: grid; place-items: center; padding: 0;
}
.sheet-handle span { width: 38px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 16px 10px; }
.sheet-actions { display: flex; align-items: center; gap: 8px; }
.eyebrow { font-size: 8.5px; letter-spacing: 0.22em; color: var(--accent); font-weight: 700; }
.sheet-head h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -0.02em; }
.gallery {
  flex: 1; min-height: 0; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
  padding: 2px 16px 14px; scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery::-webkit-scrollbar { display: none; }
.card {
  position: relative; flex: 0 0 148px; border-radius: 14px; overflow: hidden;
  background: #101a22; border: 1px solid var(--line); scroll-snap-align: start;
  text-align: left; padding: 0; transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:active { transform: scale(0.97); }
.card img { display: block; width: 100%; height: 98px; object-fit: cover; background: #182630; }
.card-body { padding: 7px 9px 9px; }
.card-place { font-size: 11.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-date { margin-top: 1px; font-size: 9.5px; color: var(--muted); }
.gallery-empty { align-self: center; color: var(--muted); font-size: 12px; padding: 0 4px; }
.sheet-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 16px 10px; font-size: 10px; color: #6f818b;
}
.live-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 8.5px; letter-spacing: 0.16em; color: var(--teal); }
.live-badge i { width: 4px; height: 4px; border-radius: 50%; background: var(--teal); }

/* ---------- floating action ---------- */
.fab {
  position: absolute; right: 16px; bottom: calc(var(--sheet-h) + 16px); z-index: 850;
  width: 54px; height: 54px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18);
  display: grid; place-items: center; color: #1d0c08;
  background: linear-gradient(145deg, #ff9a7f, #ff6f58);
  box-shadow: 0 10px 30px rgba(255, 106, 82, 0.32), 0 2px 8px rgba(0,0,0,.35);
  transition: transform 0.18s ease;
}
.fab:active { transform: scale(0.94); }
.fab svg { width: 24px; height: 24px; }

/* ---------- buttons / fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1d0c08; }
.btn.primary:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.ghost { background: rgba(255, 255, 255, 0.04); }
.btn.tiny { min-height: 30px; padding: 0 11px; font-size: 11px; }
.btn.full { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--muted); font-size: 22px; line-height: 1;
  display: grid; place-items: center;
}
.desktop-only { display: none; }

/* ---------- pick banner ---------- */
.pick-banner {
  position: absolute; top: calc(var(--header-h) + env(safe-area-inset-top) + 12px); left: 50%;
  z-index: 950; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 9px 12px 9px 14px; border-radius: 999px;
  background: rgba(15, 23, 30, 0.94); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-size: 11.5px; color: #d7e3de; white-space: nowrap;
}
.pick-banner[hidden] { display: none; }

/* ---------- upload dialog ---------- */
.upload-dialog {
  border: 0; padding: 0; background: transparent; color: var(--text);
  width: 100%; max-width: 100%; max-height: 100%; margin: auto;
}
.upload-dialog::backdrop { background: rgba(2, 5, 8, 0.72); backdrop-filter: blur(6px); }
.upload-card {
  width: min(560px, calc(100vw - 28px));
  max-height: min(88dvh, 860px);
  overflow-y: auto; display: flex; flex-direction: column; gap: 13px;
  padding: 20px; border-radius: 22px;
  background: #0d151c; border: 1px solid var(--line-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}
.upload-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.upload-head h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -0.02em; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 132px; padding: 18px; text-align: center;
  border: 1.5px dashed rgba(255, 255, 255, 0.18); border-radius: 16px;
  background: rgba(255, 255, 255, 0.025); color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.drag { border-color: var(--accent); background: rgba(255, 122, 102, 0.07); }
.dropzone strong { font-size: 13.5px; color: var(--text); }
.dropzone span:last-child { font-size: 11px; }
.drop-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 2px; background: rgba(255,122,102,.12); color: var(--accent); font-size: 20px; }
.picked { display: flex; flex-direction: column; gap: 8px; max-height: 226px; overflow-y: auto; }
.picked:empty { display: none; }
.picked-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); }
.picked-item img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; background: #18242e; }
.picked-meta { flex: 1; min-width: 0; }
.picked-meta strong { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked-meta span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.status.good { color: var(--teal); }
.status.warn { color: #ffb454; }
.remove { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 600; color: #c8d5d0; }
.field .optional { color: var(--muted); font-weight: 400; }
.field-row { display: flex; gap: 8px; }
.place-selects { display: flex; flex-direction: column; gap: 6px; }
.place-selects .btn { width: 100%; }
.field input[type="search"] { margin-bottom: 6px; }
select, input[type="text"], input[type="search"] {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: #0a1117; color: var(--text);
  outline: none; font-size: 12.5px;
}
select:focus, input[type="text"]:focus { border-color: rgba(255, 122, 102, 0.55); }
.hint { margin: 0; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.upload-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.upload-note { font-size: 10px; line-height: 1.5; color: #72848f; }
.upload-actions { display: flex; justify-content: flex-end; gap: 8px; }
.progress { height: 3px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.08); }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sheet-h) + 84px); z-index: 3000;
  transform: translate(-50%, 10px); max-width: calc(100vw - 32px);
  padding: 9px 14px; border-radius: 999px; background: rgba(18, 27, 34, 0.96);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  color: #dbe7e2; font-size: 11.5px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  :root { --sheet-h: 0px; }
  .map-wrap { inset: 0 380px 0 250px; }
  .topbar { right: 380px; }
  .sheet {
    left: auto; right: 0; top: 0; bottom: 0; width: 380px; height: 100dvh;
    border-radius: 0; border-top: 0; border-left: 1px solid var(--line-strong);
    padding-bottom: 0;
  }
  .sheet.expanded { height: 100dvh; }
  .sheet-handle { display: none; }
  .sheet-head { padding: 22px 20px 12px; align-items: center; }
  .sheet-head h2 { font-size: 22px; }
  .desktop-only { display: inline-flex; }
  .gallery { display: grid; grid-template-columns: 1fr 1fr; align-content: start; align-items: start; gap: 10px; overflow-y: auto; overflow-x: hidden; padding: 4px 20px 16px; }
  .card { flex: none; }
  .card img { height: 104px; }
  .sheet-foot { padding: 0 20px 16px; }
  .fab { display: none; }
  .map-empty { left: 250px; right: 380px; padding-bottom: 24px; }
  .toast { bottom: 24px; }
  .leaflet-bottom.leaflet-right { bottom: 4px; }
  .leaflet-bottom.leaflet-left { bottom: 10px; }
}

@media (max-width: 640px) {
  .upload-dialog[open] { height: 100dvh; }
  .upload-foot { margin-top: auto; }
  .upload-card {
    width: 100vw; height: 100dvh; max-height: none; border-radius: 0;
    padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
    border: 0;
  }
  .upload-actions .btn { flex: 1; }
  .toast { bottom: calc(var(--sheet-h) + 80px); }
}

.place-dot-wrap { background: none !important; border: none !important; display: grid !important; place-items: center; }
.place-dot {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: #ff4d4f; border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(255, 77, 79, 0.2), 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.place-dot-wrap:hover .place-dot { transform: scale(1.22); box-shadow: 0 0 0 6px rgba(255, 77, 79, 0.22), 0 4px 14px rgba(0, 0, 0, 0.5); }
.place-popup { padding: 12px; width: 290px; }
.place-popup-head { display: flex; align-items: flex-start; gap: 9px; }
.place-popup-head .place-dot { width: 10px; height: 10px; margin-top: 4px; flex: 0 0 auto; border-width: 1.5px; }
.place-popup-name { font-size: 14px; font-weight: 650; line-height: 1.3; color: var(--text); }
.place-popup-count { margin-top: 2px; font-size: 10px; color: var(--muted); }
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 310px; overflow-y: auto; margin-top: 10px; padding-right: 2px; }
.place-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; padding: 0;
  border: 0; border-radius: 8px; overflow: hidden; background: #17232c; cursor: pointer;
}
.place-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place-thumb span {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 4px; border-radius: 4px;
  background: rgba(4, 9, 12, 0.62); color: #e8f1ee; font-size: 8.5px; line-height: 1.4;
}
.lightbox {
  position: fixed; inset: 0; z-index: 2500; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
  padding-top: calc(env(safe-area-inset-top) + 24px); padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
  background: rgba(3, 6, 9, 0.95); backdrop-filter: blur(8px);
}
.lightbox[hidden] { display: none; }
.lightbox-stage { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 0; flex: 1; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); background: #0a1015; }
.lightbox-close {
  position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: 16px;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: rgba(13, 20, 27, 0.8); color: #e8f1ee; font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.lightbox-meta { width: min(680px, 100%); text-align: left; }
.lightbox-place { font-size: 16px; font-weight: 650; }
.lightbox-date { margin-top: 2px; font-size: 11px; color: var(--muted); }
.lightbox-caption { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: #c8d5d0; }
.lightbox-delete {
  margin-top: 10px; border: 1px solid rgba(255, 77, 79, 0.3); border-radius: 999px;
  padding: 6px 12px; background: rgba(255, 77, 79, 0.12); color: #ff9a98; font-size: 11px; font-weight: 600;
}
@media (max-width: 640px) {
  .lightbox { padding: 14px; padding-top: calc(env(safe-area-inset-top) + 54px); padding-bottom: calc(env(safe-area-inset-bottom) + 14px); }
  .lightbox-stage img { max-height: 66dvh; }
  .place-popup { width: 270px; }
  .leaflet-popup-content { width: 270px !important; }
}
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(255, 77, 79, 0.26) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: #ff4d4f !important; color: #fff !important; }
.sheet-collapse { width: 32px; height: 32px; flex: 0 0 auto; }
.sheet-collapse svg { width: 16px; height: 16px; }
.sheet-reopen {
  position: absolute; left: 16px; bottom: 16px; z-index: 860;
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(13, 20, 27, 0.92);
  color: var(--text); font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.sheet-reopen[hidden] { display: none; }
.sheet-reopen svg { width: 15px; height: 15px; color: var(--accent); }
.sheet-reopen .reopen-count {
  min-width: 20px; height: 18px; padding: 0 6px; display: inline-grid; place-items: center;
  border-radius: 999px; background: rgba(255, 122, 102, 0.15); color: var(--accent);
  font-size: 10px; font-variant-numeric: tabular-nums;
}
body.sheet-hidden .sheet { pointer-events: none; }
@media (min-width: 900px) {
  body.sheet-hidden .map-wrap { right: 0; }
  body.sheet-hidden .topbar { right: 0; }
  body.sheet-hidden .map-empty { right: 0; }
  body.sheet-hidden .sheet { transform: translateX(100%); }
  .sheet-collapse svg { transform: rotate(0deg); }
}
@media (max-width: 899px) {
  body.sheet-hidden .sheet { transform: translateY(110%); }
  body.sheet-hidden .fab { bottom: 16px; }
  body.sheet-hidden .leaflet-bottom.leaflet-right { bottom: 4px; }
  body.sheet-hidden .leaflet-bottom.leaflet-left { bottom: 10px; }
  body.sheet-hidden .map-empty { padding-bottom: 24px; }
  .sheet-collapse svg { transform: rotate(90deg); }
}

.places-panel {
  position: absolute; left: 0; top: calc(var(--header-h) + env(safe-area-inset-top)); bottom: 0;
  z-index: 820; width: 250px; display: flex; flex-direction: column;
  background: rgba(9, 15, 21, 0.9); border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.places-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 18px 14px 10px; }
.places-head h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -0.02em; }
.places-close { display: none; width: 32px; height: 32px; flex: 0 0 auto; }
.places-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 18px; scrollbar-width: thin; }
.place-row {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 10px;
  border: 1px solid transparent; border-radius: 11px; background: transparent;
  color: var(--text); text-align: left; transition: background .15s ease, border-color .15s ease;
}
.place-row:hover, .place-row:active { background: rgba(255,255,255,.05); border-color: var(--line); }
.place-row-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff4d4f; box-shadow: 0 0 0 3px rgba(255,77,79,.18); flex: 0 0 auto; }
.place-row-main { flex: 1; min-width: 0; }
.place-row-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-row-meta { margin-top: 2px; font-size: 9.5px; color: var(--muted); }
.place-row-count { flex: 0 0 auto; min-width: 20px; height: 18px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: rgba(255,77,79,.12); color: #ff8d8f; font-size: 9.5px; font-variant-numeric: tabular-nums; }
.places-empty { padding: 18px 10px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.places-toggle {
  display: none; position: absolute; left: 12px; top: calc(var(--header-h) + env(safe-area-inset-top) + 10px);
  z-index: 860; align-items: center; gap: 6px; height: 34px; padding: 0 11px 0 9px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(13,20,27,.9);
  color: var(--text); font-size: 11px; font-weight: 600; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.places-toggle svg { width: 14px; height: 14px; color: #ff6b6e; }
.places-toggle-count { min-width: 18px; height: 17px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: rgba(255,77,79,.14); color: #ff9a9c; font-size: 9px; }
.places-backdrop { display: none; }

/* MapLibre */
.maplibregl-map { font-family: inherit; background: #050a0f; }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-top-left { top: calc(var(--header-h) + env(safe-area-inset-top) + 10px); left: 10px; }
.maplibregl-ctrl-top-right { top: calc(var(--header-h) + env(safe-area-inset-top) + 10px); right: 10px; }
.maplibregl-ctrl-group { border-radius: 10px !important; overflow: hidden; border: 1px solid var(--line-strong) !important; box-shadow: 0 6px 20px rgba(0,0,0,.35) !important; background: rgba(13,20,27,.9) !important; }
.maplibregl-ctrl-group button { width: 34px !important; height: 34px !important; background: transparent !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button:hover { background: rgba(255,255,255,.06) !important; }
.maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-h) + 4px); }
.maplibregl-ctrl-attrib { background: rgba(6,11,15,.72) !important; border-radius: 6px 0 0 0; }
.maplibregl-ctrl-attrib a { color: #a8bac2 !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(6,11,15,.72) !important; }
.maplibregl-popup-content { background: #0d161d !important; color: var(--text) !important; border-radius: 14px !important; border: 1px solid var(--line-strong); box-shadow: var(--shadow) !important; padding: 0 !important; overflow: hidden; }
.maplibregl-popup-tip { display: none !important; }
.maplibregl-popup-close-button { color: #93a5ae !important; font-size: 20px !important; padding: 4px 7px !important; }
.maplibregl-popup-close-button:hover { background: rgba(255,255,255,.05) !important; color: #fff !important; }
body.sheet-hidden .maplibregl-ctrl-bottom-right { bottom: 4px; }

@media (max-width: 899px) {
  .places-panel {
    top: 0; bottom: 0; width: min(320px, 86vw); z-index: 1200;
    transform: translateX(-102%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
    padding-top: calc(env(safe-area-inset-top) + 4px);
    border-right: 1px solid var(--line-strong); box-shadow: 30px 0 80px rgba(0,0,0,.45);
  }
  body.places-open .places-panel { transform: translateX(0); }
  .places-close { display: grid; }
  .places-toggle { display: inline-flex; }
  .places-backdrop { position: fixed; inset: 0; z-index: 1100; display: block; background: rgba(0,0,0,.52); backdrop-filter: blur(2px); }
  .places-backdrop[hidden] { display: none; }
  .maplibregl-ctrl-bottom-right { right: 78px; }
}

.cesium-viewer, .cesium-viewer-cesiumWidgetContainer, .cesium-widget, .cesium-widget canvas { width: 100%; height: 100%; }
.cesium-viewer { background: #02060b; }
.cesium-widget-credits, .cesium-viewer-bottom, .cesium-credit-lightbox-overlay { display: none !important; }
.cesium-widget canvas { outline: none; }
.globe-card {
  position: fixed; z-index: 880; width: 310px; max-height: min(70dvh, 500px); overflow-y: auto;
  background: #0d161d; border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); transform: translateX(-50%);
}
.globe-card[hidden] { display: none; }
.globe-card .place-popup { width: 100%; }
.globe-card-close {
  position: absolute; top: 4px; right: 6px; z-index: 2; width: 28px; height: 28px;
  border: 0; border-radius: 50%; background: rgba(13, 20, 27, 0.7); color: #93a5ae;
  font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.globe-card-close:hover { color: #fff; background: rgba(255,255,255,.08); }
.globe-zoom {
  position: fixed; left: 262px; top: calc(var(--header-h) + env(safe-area-inset-top) + 10px);
  z-index: 850; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(13, 20, 27, 0.9); box-shadow: 0 6px 20px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
}
.globe-zoom button {
  width: 34px; height: 34px; border: 0; background: transparent; color: #dfeae6;
  font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.globe-zoom button + button { border-top: 1px solid var(--line); }
.globe-zoom button:hover { background: rgba(255,255,255,.06); }
.map-credit {
  position: fixed; z-index: 845; right: 392px; bottom: 10px; pointer-events: none;
  padding: 2px 6px; border-radius: 4px; background: rgba(6, 11, 15, 0.6);
  color: #71828c; font-size: 9px;
}
body.sheet-hidden .map-credit { right: 12px; }

.night-toggle {
  position: fixed; left: 262px; top: calc(var(--header-h) + env(safe-area-inset-top) + 88px);
  z-index: 850; width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(13, 20, 27, 0.9); color: #82959f;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); backdrop-filter: blur(10px);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.night-toggle svg { width: 16px; height: 16px; }
.night-toggle:hover { color: #e9f3ef; background: rgba(255,255,255,.06); }
.night-toggle.active {
  color: #ffd166; border-color: rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.1); box-shadow: 0 0 18px rgba(255, 209, 102, 0.16);
}

@media (max-width: 899px) {
  .globe-zoom { left: auto; right: 12px; }
  .night-toggle { left: auto; right: 12px; }
  .map-credit { left: 12px; right: auto; bottom: calc(var(--sheet-h) + 10px); }
  body.sheet-hidden .map-credit { bottom: 10px; }
  .globe-card { width: min(320px, calc(100vw - 24px)); }
}

.globe-loading {
  position: absolute; inset: 0; z-index: 700; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: #02060b; color: #81949e; font-size: 12px; letter-spacing: 0.04em;
}
.globe-loading[hidden] { display: none; }
.globe-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.13); border-top-color: #ff6b6e;
  animation: globe-spin 0.9s linear infinite;
}
@keyframes globe-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- video media ---------- */
.picked-thumb { position: relative; flex: 0 0 auto; width: 50px; height: 50px; border-radius: 8px; overflow: hidden; background: #18242e; }
.picked-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .media-play, .place-thumb .media-play, .picked-thumb .media-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(4, 9, 12, 0.66); border: 1px solid rgba(255,255,255,.4);
  color: #fff; font-size: 11px; line-height: 1; padding-left: 2px; pointer-events: none;
}
.card .media-duration, .place-thumb .media-duration, .picked-thumb .media-duration {
  position: absolute; right: 4px; bottom: 4px; padding: 1px 4px; border-radius: 4px;
  background: rgba(4, 9, 12, 0.72); color: #e8f1ee; font-size: 8.5px; line-height: 1.4;
}
.place-thumb .media-duration { bottom: 4px; right: 4px; }
.place-thumb .date-label { left: 4px; bottom: 4px; }
.card .card-body { position: relative; }
.lightbox-stage video { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); background: #000; outline: none; }
.lightbox-stage [hidden] { display: none !important; }
@media (max-width: 640px) {
  .lightbox-stage video { max-height: 66dvh; }
}
