@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #080b0f;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
}

/* ─── Canvas layers ─────────────────────────────────────────────────────── */

#globe-webgl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#globe {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
}

/* ─── Logo ───────────────────────────────────────────────────────────────── */

#logo {
  position: fixed;
  top: 24px;
  left: 28px;
  height: 72px;
  width: auto;
  z-index: 100;
  opacity: 0.9;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

#logo:hover {
  opacity: 1;
}

/* ─── Tooltip — glassy pill ─────────────────────────────────────────────── */

#tooltip {
  position: fixed;
  background: rgba(220, 235, 255, 0.12);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.3);
  color: #eaf2ff;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 200;
}

#tooltip.visible {
  opacity: 1;
}

/* ─── Panel — liquid glass bubble ───────────────────────────────────────── */

#panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 510px;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 100;

  background:
    linear-gradient(
      170deg,
      rgba(200, 225, 255, 0.14) 0%,
      rgba(160, 200, 255, 0.08) 30%,
      rgba(130, 180, 255, 0.05) 60%,
      rgba(100, 160, 240, 0.08) 100%
    );
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.28);
  border-left-color: rgba(255, 255, 255, 0.2);

  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 2px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);

  transform: translateX(calc(100% + 32px));
  transition: transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
}

#panel.open {
  transform: translateX(0);
}

/* Specular highlight — animated subtle shimmer */
#panel::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -20px;
  width: 220px;
  height: 140px;
  background: radial-gradient(
    ellipse at 40% 50%,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 3;
  border-radius: 50%;
  animation: shimmer 6s ease-in-out infinite alternate;
}

@keyframes shimmer {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.8; }
  100% { transform: translate(20px, 10px) scale(1.1); opacity: 1; }
}

/* Bottom reflection with accent color */
#panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(
    to top,
    rgba(74, 158, 255, 0.06) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 3;
  border-radius: 0 0 28px 28px;
}

/* ─── Panel header ──────────────────────────────────────────────────────── */

#panel-header {
  padding: 20px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Stagger-in for panel header content */
#panel.open #panel-header > * {
  animation: panelSlideIn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
#panel.open #panel-header > *:nth-child(1) { animation-delay: 0.05s; }
#panel.open #panel-header > *:nth-child(2) { animation-delay: 0.1s; }
#panel.open #panel-header > *:nth-child(3) { animation-delay: 0.15s; }

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

#panel-name {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #eef4ff;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Hide datetime from header chips — it now lives in the camera row */
#panel-datetime { display: none !important; }

/* Metadata tags — pill-shaped chips */
#panel-coords {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: rgba(180, 210, 255, 0.7);
    font-family: 'Nunito', monospace;
    font-weight: 600;
    margin-top: 6px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    transition: all 0.2s ease;
}

#panel-coords:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

#panel-coords:empty {
    display: none;
}

#panel-spatial {
    display: inline-block;
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 0.12em;
    font-family: 'Nunito', monospace;
    font-weight: 800;
    padding: 4px 11px;
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 14px;
    color: #4a9eff;
}

#panel-spatial::before { content: '\2726  SPATIAL'; }

/* ─── Panel footer (attribution + camera + 3D button) ────────────────────── */

/* ─── Panel footer — attribution card ───────────────────────────────────── */

#panel-footer {
    margin-top: 0;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: linear-gradient(
        170deg,
        rgba(200, 225, 255, 0.13) 0%,
        rgba(130, 180, 255, 0.08) 100%
    );
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    border-radius: 0 0 14px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

#panel-footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#panel-attr {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

#panel-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    text-transform: uppercase;
    /* color/bg set dynamically by JS per-user hue */
}

#panel-attr-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: rgba(235, 248, 255, 0.97);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

#panel-view3d {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 6px 13px;
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(74, 158, 255, 0.28);
    border-radius: 10px;
    color: #4a9eff;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

#panel-view3d:hover {
    background: rgba(74, 158, 255, 0.24);
    border-color: rgba(74, 158, 255, 0.5);
    color: #fff;
    box-shadow: 0 2px 12px rgba(74, 158, 255, 0.2);
}

#panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#panel-share {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 6px 13px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: rgba(210, 230, 255, 0.75);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

#panel-share:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#panel-share.copied {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.35);
    color: #34c759;
}

#panel-camera-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(180, 210, 255, 0.55);
}

#panel-camera-row svg {
    flex-shrink: 0;
    opacity: 0.7;
}

#panel-meta-datetime {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgba(200, 225, 255, 0.82);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

#panel-meta-cam-sep {
    color: rgba(180, 210, 255, 0.55);
    font-size: 15px;
    line-height: 1;
}

#panel-camera {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgba(200, 225, 255, 0.82);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ─── Panel cluster navigation arrows ───────────────────────────────────── */

#panel-nav {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

#panel-prev,
#panel-next {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(220, 235, 255, 0.75);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    padding: 0;
}

#panel-prev:hover,
#panel-next:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}

/* ─── Close button — bubbly circle ───────────────────────────────────────── */

#close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(220, 235, 255, 0.7);
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  margin-left: 12px;
  transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 1px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#close-btn:hover {
  background: rgba(255, 100, 100, 0.2);
  border-color: rgba(255, 120, 120, 0.4);
  color: #ff8888;
  transform: scale(1.15) rotate(90deg);
  box-shadow:
    0 2px 12px rgba(255, 100, 100, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#close-btn:active {
  transform: scale(0.9) rotate(90deg);
}

/* ─── Back button ────────────────────────────────────────────────────────── */

#back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(220, 235, 255, 0.7);
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  margin-right: 12px;
  transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#back-btn.visible {
  display: flex;
}

#back-btn:hover {
  background: rgba(74, 158, 255, 0.2);
  border-color: rgba(74, 158, 255, 0.4);
  color: #4a9eff;
  transform: scale(1.15) translateX(-2px);
  box-shadow:
    0 2px 12px rgba(74, 158, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#back-btn:active {
  transform: scale(0.9) translateX(-2px);
}

/* ─── Panel body ────────────────────────────────────────────────────────── */

#panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  position: relative;
  z-index: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

#panel-body::-webkit-scrollbar {
  width: 4px;
}

#panel-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
}

/* Stagger content items on open */
#panel.open #panel-body > * {
  animation: contentFadeUp 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
#panel.open #panel-body > *:nth-child(1) { animation-delay: 0.12s; }
#panel.open #panel-body > *:nth-child(2) { animation-delay: 0.18s; }
#panel.open #panel-body > *:nth-child(3) { animation-delay: 0.24s; }

@keyframes contentFadeUp {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Panel image — hero card ───────────────────────────────────────────── */

#panel-img {
  width: 100%;
  display: none;
  border-radius: 14px 14px 0 0;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 1;
  transition: opacity 0.18s ease-out;
  max-height: 62vh;
  object-fit: cover;
}

/* ─── Panel grid (cluster view) — card mosaic ───────────────────────────── */

#panel-grid {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

#panel-grid.visible {
  display: grid;
}

#panel-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#panel-grid img:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(100, 170, 255, 0.15);
}

/* ─── Description — quote bubble ────────────────────────────────────────── */

#panel-desc {
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(210, 225, 245, 0.65);
  padding: 14px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 400;
  font-style: italic;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(74, 158, 255, 0.3);
}

#panel-desc:empty {
  display: none;
}

/* ─── Custom modal ──────────────────────────────────────────────────────── */

#pg-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

#pg-modal.open {
  display: flex;
}

#pg-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 22, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.18s ease-out;
}

#pg-modal.closing #pg-modal-bg {
  opacity: 0;
}

#pg-modal-box {
  position: relative;
  z-index: 1;
  width: 340px;
  max-width: calc(100vw - 40px);
  background: rgba(14, 22, 42, 0.92);
  border: 1px solid rgba(74, 158, 255, 0.2);
  border-radius: 20px;
  padding: 28px 28px 22px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

#pg-modal.closing #pg-modal-box {
  opacity: 0;
  transform: scale(0.93) translateY(6px);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

#pg-modal-title {
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: rgba(220, 235, 255, 0.95);
  margin-bottom: 6px;
}

#pg-modal-subtitle {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: rgba(160, 190, 230, 0.6);
  margin-bottom: 18px;
  line-height: 1.4;
  white-space: pre-line;
}

#pg-modal-subtitle:empty {
  margin-bottom: 0;
}

#pg-modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(74, 158, 255, 0.25);
  border-radius: 12px;
  color: rgba(220, 235, 255, 0.9);
  font-family: 'Nunito', monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#pg-modal-input:focus {
  border-color: rgba(74, 158, 255, 0.55);
  background: rgba(74, 158, 255, 0.06);
}

#pg-modal-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: rgba(140, 170, 210, 0.5);
  margin-top: 6px;
  min-height: 16px;
}

#pg-modal-error {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: rgba(255, 100, 100, 0.85);
  margin-top: 6px;
  min-height: 16px;
  font-weight: 600;
}

#pg-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

#pg-modal-cancel {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(160, 190, 230, 0.65);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#pg-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(200, 220, 255, 0.85);
}

#pg-modal-confirm {
  padding: 8px 22px;
  border-radius: 10px;
  border: 1px solid rgba(74, 158, 255, 0.35);
  background: rgba(74, 158, 255, 0.15);
  color: rgba(140, 200, 255, 0.95);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#pg-modal-confirm:hover {
  background: rgba(74, 158, 255, 0.25);
  border-color: rgba(74, 158, 255, 0.55);
}

/* ─── Clock ─────────────────────────────────────────────────────────────── */

#clock {
  position: fixed;
  top: 24px;
  right: 16px;
  color: #FFD700; /* Your Gold/Yellow */
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 26px;
  z-index: 10;
  /* This is the magic line that makes it monospaced for clocks */
  font-variant-numeric: tabular-nums; 
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
  letter-spacing: -0.5px;
}

#panel.open ~ #clock {
  opacity: 0;
  pointer-events: none;
}

/* ─── Folder picker (top-right, left of profile button) ─────────────────── */

/* ─── Filters button + dropdown ──────────────────────────────────────────── */

#filters-picker {
  position: fixed;
  top: 19px;
  right: 432px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

#panel.open ~ #filters-picker {
  opacity: 0;
  pointer-events: none;
}

#filters-trigger {
  display: flex;
  align-items: center;
  padding: 0 14px 0 14px;
  height: 48px;
  min-width: 118px;
  background: rgba(20, 30, 50, 0.6);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  cursor: pointer;
  color: rgba(200, 220, 255, 0.7);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 15px;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

#filters-trigger-text {
  flex: 1;
}

#filters-active-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  background: #4a9eff;
  border-radius: 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  /* Hidden by default — use opacity+scale so layout never shifts */
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

#filters-active-badge.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.filters-chevron {
  color: rgba(200, 220, 255, 0.5);
  transition: transform 0.2s ease, color 0.2s ease;
}

#filters-trigger:hover {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.35);
  color: #4a9eff;
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2);
}

#filters-trigger:hover .filters-chevron {
  color: #4a9eff;
}

#filters-picker.open #filters-trigger {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.35);
  color: #4a9eff;
}

#filters-picker.open .filters-chevron {
  transform: rotate(180deg);
  color: #4a9eff;
}

#filters-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  width: 380px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(14, 22, 38, 0.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255,255,255,0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  /* Closed state — centered under button */
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#filters-dropdown::-webkit-scrollbar {
  width: 4px;
}
#filters-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
#filters-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

#filters-picker.open #filters-dropdown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.filter-section-header {
  padding: 12px 16px 5px;
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(150, 180, 255, 0.45);
  user-select: none;
  position: sticky;
  top: 0;
  background: rgba(14, 22, 38, 0.95);
  z-index: 1;
}

.filter-section-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 2px 0 0;
}

/* User chips — single-select, wrapping avatar pills */
#filter-users {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 16px 14px;
}

.filter-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 5px;
  border-radius: 20px;
  border: 1.5px solid rgba(200, 220, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(200, 220, 255, 0.65);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.filter-user-chip:hover {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.3);
  color: #eaf2ff;
}

.filter-user-chip.selected {
  background: rgba(74, 158, 255, 0.2);
  border-color: #4a9eff;
  color: #4a9eff;
}

.filter-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}

/* Camera chips — multi-select, wrapping pill buttons */
#filter-cameras {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 16px 16px;
}

.filter-camera-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid rgba(200, 220, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(200, 220, 255, 0.65);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.filter-camera-chip:hover {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.3);
  color: #eaf2ff;
}

.filter-camera-chip.selected {
  background: rgba(74, 158, 255, 0.2);
  border-color: #4a9eff;
  color: #4a9eff;
}

.filter-camera-chip-count {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.6;
}

/* ─── Search bar ─────────────────────────────────────────────────────────── */

#search-bar {
  position: fixed;
  top: 19px;
  right: 222px;
  bottom: auto;
  left: auto;
  transform: none;
  z-index: 100;
  width: 200px;
  transition: opacity 0.3s ease;
}

#search-input {
  width: 100%;
  height: 48px;
  background: rgba(20, 30, 50, 0.6);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.18);
  color: rgba(200, 220, 255, 0.85);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 0 18px;
  border-radius: 24px;
  outline: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#search-input::placeholder {
  color: rgba(200, 220, 255, 0.35);
  font-weight: 600;
}

#search-input:focus {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.35);
  color: rgba(220, 235, 255, 0.95);
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2);
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  right: 0;
  margin-bottom: 0;
  background: rgba(12, 16, 24, 0.92);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  overflow: hidden;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#search-results.visible {
  display: block;
}

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(74, 158, 255, 0.12);
}

.search-result-name {
  color: #eaf2ff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.search-result-date {
  color: rgba(180, 210, 255, 0.5);
  font-family: 'Nunito', monospace;
  font-weight: 600;
  font-size: 11px;
  margin-top: 2px;
}

#panel.open ~ #search-bar {
  opacity: 0;
  pointer-events: none;
}

/* ─── Spatial 3D viewer ──────────────────────────────────────────────────── */

#spatial-viewer {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0.3s;
}

#spatial-viewer.open {
  visibility: visible;
  pointer-events: auto;
}

#spatial-bg {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: all 0.3s ease-out;
}

#spatial-viewer.open #spatial-bg {
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#spatial-container {
  position: relative;
  display: flex;
  gap: 8px;
  max-width: 90vw;
  max-height: 70vh;
  z-index: 1;
}

#spatial-container img {
  max-width: 45vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#spatial-viewer.open #spatial-container img {
  opacity: 1;
  transform: scale(1);
}

/* Wiggle + anaglyph: stack mode uses single-image layout */
#spatial-container.wiggle-mode,
#spatial-container.anaglyph-mode {
  position: relative;
  gap: 0;
}

#spatial-container.wiggle-mode img,
#spatial-container.anaglyph-mode img {
  max-width: 60vw;
}

/* In wiggle mode, right overlays left; JS toggles visibility */
#spatial-container.wiggle-mode #spatial-right {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Anaglyph mode: hide both images, show canvas */
#spatial-container.anaglyph-mode #spatial-left,
#spatial-container.anaglyph-mode #spatial-right {
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

#spatial-container.anaglyph-mode #spatial-anaglyph {
  display: block !important;
  max-width: 60vw;
  max-height: 70vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#spatial-viewer.open #spatial-container.anaglyph-mode #spatial-anaglyph {
  opacity: 1;
  transform: scale(1);
}

#spatial-mode-toggle {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  z-index: 1;
  background: rgba(12, 16, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

#spatial-viewer.open #spatial-mode-toggle {
  opacity: 1;
}

.spatial-mode-btn {
  background: transparent;
  border: none;
  color: rgba(220, 235, 255, 0.6);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spatial-mode-btn:hover {
  color: #eaf2ff;
  background: rgba(255, 255, 255, 0.08);
}

.spatial-mode-btn.active {
  color: #eaf2ff;
  background: rgba(74, 158, 255, 0.2);
  border: 1px solid rgba(74, 158, 255, 0.3);
}

#spatial-close {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(220, 235, 255, 0.8);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.2s ease;
  opacity: 0;
}

#spatial-viewer.open #spatial-close {
  opacity: 1;
}

#spatial-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: scale(1.1);
}

/* ─── Upload button ──────────────────────────────────────────────────────── */

#upload-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(20, 30, 50, 0.6);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(200, 220, 255, 0.7);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#upload-btn:hover {
  transform: scale(1.08);
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.35);
  color: #4a9eff;
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2);
}

#upload-btn:active {
  transform: scale(0.97);
}

#upload-btn.uploading {
  pointer-events: none;
  opacity: 0.5;
}

#panel.open ~ #upload-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Drag-over state — subtle glow on the button */
body.drag-over #upload-btn {
  transform: scale(1.12);
  background: rgba(74, 158, 255, 0.25);
  border-color: rgba(74, 158, 255, 0.5);
  color: #4a9eff;
  box-shadow: 0 0 24px rgba(74, 158, 255, 0.3);
}

/* ─── Profile button (bottom-left, mirrors upload button) ─────────────────── */

#profile-btn {
  position: fixed;
  top: 18px;
  right: 162px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(20, 30, 50, 0.6);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(200, 220, 255, 0.7);
  transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#profile-btn:hover {
  transform: scale(1.08);
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.35);
  color: #4a9eff;
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2);
}

#profile-btn:active {
  transform: scale(0.97);
}

#profile-btn.active {
  background: rgba(74, 158, 255, 0.22);
  border-color: rgba(74, 158, 255, 0.4);
  color: #4a9eff;
}

#panel.open ~ #profile-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ─── Profile panel ──────────────────────────────────────────────────────── */

#profile-panel {
  position: fixed;
  top: 78px;
  right: 66px;
  z-index: 99;
  width: 240px;
  background: rgba(14, 22, 38, 0.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255,255,255,0.04);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#profile-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#panel.open ~ * #profile-panel,
#panel.open ~ #profile-panel {
  opacity: 0;
  pointer-events: none;
}

#profile-smiley-row {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

#profile-smiley {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

#profile-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#profile-username {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #eaf2ff;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile-edit-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(200, 220, 255, 0.45);
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

#profile-edit-btn:hover {
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.12);
}

#profile-edit-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

#profile-username-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #eaf2ff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.2s ease;
}

#profile-username-input:focus {
  border-color: rgba(74, 158, 255, 0.5);
}

#profile-save-btn {
  background: rgba(74, 158, 255, 0.18);
  border: 1px solid rgba(74, 158, 255, 0.3);
  color: #4a9eff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

#profile-save-btn:hover {
  background: rgba(74, 158, 255, 0.28);
  border-color: rgba(74, 158, 255, 0.5);
}

#profile-edit-error {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  color: #ff6b6b;
  margin-top: 4px;
  min-height: 0;
}

#profile-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0;
}

#profile-uid-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#profile-uid-label {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(200, 220, 255, 0.4);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
}

#profile-uid-value {
  font-family: 'Nunito', monospace;
  font-size: 13px;
  font-weight: 600;
  color: rgba(200, 220, 255, 0.6);
  letter-spacing: 0.5px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile-copy-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: rgba(200, 220, 255, 0.4);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

#profile-copy-btn:hover {
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.12);
}

#profile-copy-btn.copied {
  color: #4ecb71;
}

/* ─── Profile actions (sign out / delete) ───────────────────────────────── */

#profile-stats {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(160, 200, 255, 0.55);
  letter-spacing: 0.01em;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#profile-divider-2 {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0;
}

#profile-actions {
  display: flex;
  gap: 8px;
}

#profile-signout-btn,
#profile-delete-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#profile-signout-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(200, 220, 255, 0.7);
}

#profile-signout-btn:hover {
  background: rgba(74, 158, 255, 0.14);
  border-color: rgba(74, 158, 255, 0.3);
  color: #4a9eff;
}

#profile-delete-btn {
  background: rgba(255, 80, 80, 0.07);
  border: 1px solid rgba(255, 80, 80, 0.15);
  color: rgba(255, 130, 130, 0.7);
}

#profile-delete-btn:hover {
  background: rgba(255, 80, 80, 0.18);
  border-color: rgba(255, 80, 80, 0.35);
  color: #ff6b6b;
}

/* Drop overlay for drag-and-drop */
#drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(200, 220, 255, 0.9);
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 600;
}

body.drag-over #drop-overlay {
  display: flex;
}

#drop-overlay svg {
  width: 48px;
  height: 48px;
  color: #4a9eff;
  opacity: 0.8;
}

#drop-overlay span {
  color: rgba(180, 210, 255, 0.6);
  font-size: 13px;
  font-weight: 400;
}

/* ─── Timeline scrubber ──────────────────────────────────────────────────── */

#timeline {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(38vw);
  min-width: 380px;
  max-width: calc(100vw - 48px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 20px;
}

#timeline.visible {
  opacity: 1;
  pointer-events: auto;
}

#panel.open ~ #timeline {
  opacity: 0;
  pointer-events: none;
}

#timeline-label {
  color: rgba(200, 225, 255, 0.9);
  font-family: 'Nunito', monospace;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  width: 120px;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.03em;
}

#timeline.hidden-by-search {
  opacity: 0 !important;
  pointer-events: none !important;
}

#timeline-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#timeline-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4a9eff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

#timeline-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#timeline-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4a9eff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
  cursor: pointer;
}

/* ─── Lightbox — fullscreen photo viewer ────────────────────────────────── */

#lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0.3s;
}

#lightbox.open {
  visibility: visible;
  pointer-events: auto;
}

#lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0);
  backdrop-filter: blur(0px) saturate(1);
  -webkit-backdrop-filter: blur(0px) saturate(1);
  transition:
    background-color 0.3s ease-out,
    backdrop-filter 0.3s ease-out,
    -webkit-backdrop-filter 0.3s ease-out;
  will-change: backdrop-filter, background-color;
}

#lightbox.open #lightbox-bg {
  background: rgba(4, 6, 10, 0.75);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
}

/* Fade lightbox UI elements in/out with the overlay.
   pointer-events are already blocked by visibility:hidden on the container. */
#lightbox-close,
#lightbox-prev,
#lightbox-next {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

#lightbox.open #lightbox-close,
#lightbox.open #lightbox-prev,
#lightbox.open #lightbox-next {
  opacity: 1;
}

/* Navigation fade — toggled by JS class. Duration must match FADE_MS in globe.js */
#lightbox-img.lb-fading {
  opacity: 0 !important;
  transform: scale(0.97) !important;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out !important;
}

/* ─── Lightbox image ─────────────────────────────────────────────────────── */

#lightbox-img {
  position: relative;
  max-width: 75%;
  max-height: 75%;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 12px 60px rgba(0, 0, 0, 0.5),
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 0.3s ease-out,
    transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

#lightbox.open #lightbox-img {
  opacity: 1;
  transform: scale(1);
  cursor: zoom-in;
}

/* Zoom state — transition fires on zoom-out; JS overrides cursor/transition during drag */
#lightbox-img.lb-zoomed {
  cursor: grab;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.3s ease-out;
}

/* ─── Lightbox prev/next arrows ─────────────────────────────────────────── */

#lightbox-prev,
#lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(220, 235, 255, 0.85);
  cursor: pointer;
  font-size: 22px;
  display: none; /* shown via JS only when multiple images exist */
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 2001;
}

#lightbox-prev { left: 28px; }
#lightbox-next { right: 28px; }

#lightbox-prev:hover,
#lightbox-next:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow:
    0 4px 16px rgba(100, 170, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#lightbox-prev:active,
#lightbox-next:active {
  transform: translateY(-50%) scale(0.95);
}

#lightbox-close {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(220, 235, 255, 0.8);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s ease-out, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: scale(1.1);
}

#lightbox-close:active {
  transform: scale(0.95);
}

/* ─── Lightbox "View in 3D" button ───────────────────────────────────────── */

#lightbox-view3d {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2001;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(74, 158, 255, 0.4);
  background: rgba(74, 158, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #4a9eff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#lightbox.open #lightbox-view3d {
  opacity: 1;
}

#lightbox-view3d:hover {
  background: rgba(74, 158, 255, 0.3);
  border-color: rgba(74, 158, 255, 0.6);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.3);
}

/* ─── Lightbox info bar ──────────────────────────────────────────────────── */

#lightbox-info {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2001;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
  text-align: center;
}

#lightbox.open #lightbox-info {
  opacity: 1;
}

#lightbox-location {
  color: rgba(220, 235, 255, 0.95);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

#lightbox-datetime {
  color: rgba(180, 210, 255, 0.7);
  font-family: 'Nunito', monospace;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

#lightbox-camera {
  color: rgba(160, 195, 255, 0.55);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* ─── Spatial tag ────────────────────────────────────────────────────────── */

.spatial-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  background: #4a9eff;
  color: #080b0f;
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.05em;
}

/* ─── Mobile / responsive ─────────────────────────────────────────────── */

@media (max-width: 640px) {
  #panel {
    width: calc(100vw - 16px);
    right: 8px;
    left: 8px;
    top: auto;
    bottom: 0;
    max-height: 55vh;
    border-radius: 28px 28px 0 0;
    transform: translateY(110%);
  }
  #panel.open {
    transform: translateY(0);
  }

  #logo {
    top: 12px;
    left: 12px;
    height: 48px;
  }

  #clock {
    top: 16px;
    right: 12px;
    font-size: 14px;
  }

  #filters-picker {
    top: 11px;
    right: 120px;
    left: auto;
  }
  #search-bar {
    top: auto;
    bottom: 82px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(340px, calc(100vw - 32px));
  }
  #search-results {
    top: auto;
    bottom: calc(100% + 6px);
    margin-bottom: 0;
  }
  #timeline {
    bottom: 140px;
    left: 12px;
    right: 12px;
    border-radius: 16px;
    padding: 6px 14px;
  }
  #filters-trigger {
    font-size: 13px;
    height: 42px;
    padding: 0 10px 0 12px;
  }
  #profile-btn {
    top: 11px;
    right: 68px;
    bottom: auto;
    left: auto;
    width: 42px;
    height: 42px;
  }
  #profile-panel {
    top: 64px;
    right: 8px;
    bottom: auto;
    left: auto;
    width: calc(100vw - 16px);
    max-width: 300px;
  }

  #lightbox-img {
    max-width: 95%;
    max-height: 70%;
    border-radius: 12px;
  }

  #lightbox-prev { left: 8px; width: 40px; height: 40px; font-size: 18px; }
  #lightbox-next { right: 8px; width: 40px; height: 40px; font-size: 18px; }
  #lightbox-close { top: 12px; right: 12px; width: 36px; height: 36px; }

  #lightbox-info { bottom: 16px; }
  #lightbox-location { font-size: 13px; }
  #lightbox-datetime { font-size: 11px; }
  #lightbox-camera { font-size: 10px; }

  /* Prevent touch-action on canvas so browser doesn't hijack gestures */
  #globe, #globe-webgl {
    touch-action: none;
  }
}

/* Also ensure touch-action for larger screens */
#globe, #globe-webgl {
  touch-action: none;
}
/* ─── Globe drag cursor ──────────────────────────────────────────────────── */

#globe.dragging {
  cursor: grabbing;
}
