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

/* ── Palette ─────────────────────────────────────────────────────────────────
   Thème sombre neutre, accent bleu cobalt cohérent avec les pins et tracés.
   ─────────────────────────────────────────────────────────────────────────── */
:root {
  --bg:         #0d0d0e;
  --bg-strip:   rgba(13,13,14,0.96);
  --surface:    rgba(255,255,255,0.04);
  --surface-h:  rgba(255,255,255,0.08);
  --border:     rgba(255,255,255,0.09);
  --border-h:   rgba(255,255,255,0.18);
  --text:       #eeeef2;
  --text-dim:   rgba(238,238,242,0.40);
  --text-faint: rgba(238,238,242,0.20);
  --accent:     #3b82f6;
  --accent-dim: rgba(59,130,246,0.13);
  --accent-h:   #2563eb;
}

html { height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  min-height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HOMEPAGE  (body.page-home)
═══════════════════════════════════════════════════════════════════════════════ */

.page-home {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.home-header {
  padding: 40px 36px 0;
  flex-shrink: 0;
}

.home-logo {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-logo::after {
  content: '.';
  color: var(--accent);
}

.home-summary {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ── Album grid ─────────────────────────────────────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 28px 36px 52px;
  flex: 1;
}

.grid-empty {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-size: 13px;
  padding: 40px 0;
}
.grid-empty code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── Album card ─────────────────────────────────────────────────────────────── */
.album-card {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: border-color 0.25s, transform 0.28s ease, box-shadow 0.28s ease;
}
.album-card:hover {
  border-color: var(--border-h);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(59,130,246,0.14);
}

.album-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.38s ease;
}
.album-card img.loaded        { opacity: 1; }
.album-card:hover img.loaded  { transform: scale(1.05); }

.album-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 36px 14px 13px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}

.album-card-name {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  line-height: 1.3;
}

.album-card-count {
  margin-top: 3px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.01em;
}

.album-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAP PAGE  (body.page-map)
═══════════════════════════════════════════════════════════════════════════════ */

.page-map {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-page-header {
  height: 48px;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg);
}

.map-page-back {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
}
.map-page-back:hover { color: var(--text); }

.map-page-title-wrap { display: flex; align-items: baseline; gap: 10px; }

.map-page-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.map-page-count {
  font-size: 11px;
  color: var(--text-dim);
}

#world-map { flex: 1; min-height: 0; position: relative; }

/* ── Map album card visual (home page) ──────────────────────────────────────── */
.album-card-map-visual {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #080c14 0%, #0d1a2e 50%, #08111c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.album-card-map-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}

.album-card-map-dots {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   VIEWER  (body.page-viewer)
═══════════════════════════════════════════════════════════════════════════════ */

.page-viewer {
  overflow: hidden;
  height: 100vh;
}

/* ── App shell ──────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Album nav ──────────────────────────────────────────────────────────────── */
#album-nav {
  height: 46px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 0 16px;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#album-nav::-webkit-scrollbar { display: none; }

.album-map-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.album-map-btn:hover:not(:disabled) { color: var(--text); }
.album-map-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.album-map-btn:disabled { opacity: 0.22; cursor: default; }

#album-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.album-tab-back {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 18px;
  color: var(--text-dim);
  text-decoration: none;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.album-tab-back:hover { color: var(--text); }

.album-tab-divider {
  width: 1px;
  background: var(--border);
  margin: 10px 6px;
  flex-shrink: 0;
}

.album-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.album-tab:hover  { color: var(--text); }
.album-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.album-tab .count { opacity: 0.35; font-size: 11px; margin-left: 5px; }

/* ── Main viewer ────────────────────────────────────────────────────────────── */
#viewer {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #080808;
  min-height: 0;
  touch-action: none;
}

#viewer::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 140px;
  background: linear-gradient(to bottom, transparent, rgba(8,8,8,0.72));
  pointer-events: none;
  z-index: 5;
}

/* ── Pannellum container ─────────────────────────────────────────────────────── */
#pnl-container {
  position: absolute;
  inset: 0;
  display: none;
}

.pnlm-container { background: #080808 !important; }
.pnlm-load-box  { display: none !important; }

/* ── Standard image ─────────────────────────────────────────────────────────── */
#std-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.28s ease;
  will-change: transform;
  touch-action: none;
  display: none;
}
#std-img.loaded { opacity: 1; }

#photo-info {
  position: absolute;
  bottom: 18px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
  max-width: min(480px, calc(100% - 110px));
}

.badge-360 {
  display: none;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.28);
  border-radius: 3px;
  padding: 2px 7px;
  margin-bottom: 8px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.badge-360.visible { display: inline-block; }

#photo-name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0,0,0,0.95);
}
#photo-desc {
  font-size: 12px;
  color: rgba(238,238,242,0.55);
  line-height: 1.55;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.photo-location {
  display: none;
  font-size: 11px;
  color: rgba(59,130,246,0.80);
  margin-bottom: 5px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  letter-spacing: 0.02em;
}
.photo-location::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 12px;
  margin-right: 4px;
  vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.photo-location.visible { display: block; }

/* ── Navigation arrows ──────────────────────────────────────────────────────── */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(8,8,8,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(238,238,242,0.65);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: background 0.15s, color 0.15s, opacity 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding-bottom: 1px;
  line-height: 1;
  user-select: none;
}
#viewer:hover .nav-arrow { opacity: 1; }
.nav-arrow:hover          { background: rgba(8,8,8,0.70); color: var(--text); }
.nav-arrow:disabled       { opacity: 0 !important; pointer-events: none; }
#prev-btn { left: 14px; }
#next-btn { right: 14px; }

/* ── Panorama controls ──────────────────────────────────────────────────────── */
#pano-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 10;
  display: none;
  flex-direction: column;
  gap: 6px;
}

#pano-controls button {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(8,8,8,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(238,238,242,0.70);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
}
#pano-controls button:hover { background: rgba(8,8,8,0.80); color: var(--text); }
#pano-recenter { font-size: 18px; }

#pano-gyro.active {
  background: rgba(59,130,246,0.60);
  color: #fff;
  border-color: rgba(59,130,246,0.75);
}
#pano-gyro.active:hover { background: rgba(59,130,246,0.82); }

.viewer-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  z-index: 5;
}

/* ── Thumbnail strip ────────────────────────────────────────────────────────── */
#strip {
  height: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-strip);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#thumbnails {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 48px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(59,130,246,0.22) transparent;
}
#thumbnails::-webkit-scrollbar       { height: 3px; }
#thumbnails::-webkit-scrollbar-track { background: transparent; }
#thumbnails::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.24); border-radius: 2px; }

/* ── Strip scroll arrows ─────────────────────────────────────────────────────── */
.strip-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: rgba(238,238,242,0.80);
  font-size: 26px;
  line-height: 1;
  z-index: 3;
  transition: color 0.15s, opacity 0.2s;
  user-select: none;
  padding-bottom: 2px;
}
.strip-arrow-left {
  left: 0;
  background: linear-gradient(to right, rgba(13,13,14,0.92) 40%, transparent 100%);
  justify-content: flex-start;
  padding-left: 10px;
}
.strip-arrow-right {
  right: 0;
  background: linear-gradient(to left, rgba(13,13,14,0.92) 40%, transparent 100%);
  justify-content: flex-end;
  padding-right: 10px;
}
.strip-arrow:hover:not(:disabled) { color: var(--text); }
.strip-arrow:disabled { opacity: 0; pointer-events: none; }

/* ── Thumbnails ─────────────────────────────────────────────────────────────── */
.thumb {
  width: 64px;
  height: 56px;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  background: var(--surface);
}
.thumb:hover  { border-color: var(--border-h); transform: translateY(-3px); }
.thumb.active { border-color: var(--accent); }

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s;
}
.thumb img.loaded { opacity: 1; }

.thumb-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(8,8,8,0.65);
  color: rgba(59,130,246,0.95);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 1px 4px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAPS
═══════════════════════════════════════════════════════════════════════════════ */

/* ── Per-photo mini-map ─────────────────────────────────────────────────────── */
.photo-map-mini {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 190px;
  height: 138px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(59,130,246,0.28);
  box-shadow: 0 4px 20px rgba(0,0,0,0.55);
  z-index: 11;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.photo-map-mini:hover { transform: scale(1.03); box-shadow: 0 6px 28px rgba(0,0,0,0.70); }
.photo-map-mini.hidden { display: none; }

#photo-map-canvas { width: 100%; height: 100%; }

.photo-map-expand-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: rgba(8,8,8,0.65);
  border: 1px solid rgba(59,130,246,0.25);
  color: rgba(238,238,242,0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.photo-map-expand-btn:hover { background: rgba(8,8,8,0.90); }

/* ── Map modal ──────────────────────────────────────────────────────────────── */
.map-modal {
  position: fixed;
  inset: 0;
  background: rgba(8,8,8,0.84);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}
.map-modal.hidden { display: none; }

#map-modal-canvas {
  width: min(820px, 92vw);
  height: min(580px, 80vh);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(59,130,246,0.20);
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

.map-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(20,20,22,0.88);
  border: 1px solid var(--border-h);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.map-modal-close:hover { background: rgba(8,8,8,0.95); color: var(--text); }

/* ── Album map overlay ──────────────────────────────────────────────────────── */
.album-map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,8,0.86);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}
.album-map-overlay.hidden { display: none; }

#album-map-canvas {
  width: min(1040px, 94vw);
  height: min(680px, 88vh);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(59,130,246,0.20);
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

.album-map-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(20,20,22,0.88);
  border: 1px solid var(--border-h);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.album-map-close:hover { background: rgba(8,8,8,0.95); color: var(--text); }

/* ── Map markers ────────────────────────────────────────────────────────────── */
.map-marker-wrap {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  cursor: pointer;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.42));
  transition: filter 0.15s, transform 0.15s;
  transform-origin: bottom center;
}
.map-marker-wrap:hover         { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.58)); transform: scale(1.12); }
.map-marker-wrap.current       { filter: drop-shadow(0 3px 9px rgba(239,68,68,0.45)); }
.map-marker-wrap.current:hover { transform: scale(1.1); }

.map-pin-label {
  position: absolute;
  left: calc(100% + 4px);
  top: 4px;
  background: rgba(238,238,242,0.96);
  color: #111114;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 1px 6px rgba(0,0,0,0.28);
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Map popups ─────────────────────────────────────────────────────────────── */
.map-popup-inner {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-width: 148px;
}
.map-popup-album {
  display: block;
  font-size: 10px;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  font-weight: 600;
}
.map-popup-inner strong {
  font-size: 13px;
  display: block;
  margin-bottom: 5px;
  line-height: 1.3;
  color: #111114;
}
.map-popup-inner img {
  width: 148px;
  height: 94px;
  object-fit: cover;
  display: block;
  border-radius: 5px;
  margin-bottom: 8px;
}
.map-popup-date {
  display: block;
  font-size: 10px;
  color: #888;
  margin-bottom: 7px;
}
.map-popup-view {
  display: block;
  width: 100%;
  padding: 7px 0;
  background: #111114;
  color: #eeeef2 !important;
  border: none;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.15s;
}
.map-popup-view:hover { background: #3b82f6; color: #fff !important; }

/* ── Bouton toggle tracé ────────────────────────────────────────────────────── */
.route-toggle-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(13,13,14,0.88);
  border: 1px solid rgba(59,130,246,0.22);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.route-toggle-btn:hover {
  background: rgba(20,20,24,0.92);
  color: var(--text);
}
.route-toggle-btn.active {
  color: var(--accent);
  border-color: rgba(59,130,246,0.42);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════════════════════════
   MOBILE — touch targets, safe-area insets, responsive layout
═══════════════════════════════════════════════════════════════════════════════ */

@supports (height: 100dvh) {
  .page-viewer { height: 100dvh; }
  #app         { height: 100dvh; }
}

@media (pointer: coarse) {
  #strip {
    height: calc(96px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .thumb        { height: 70px; }
  .strip-arrow  { font-size: 30px; }

  #album-nav    { height: 54px; }
  .album-tab    { font-size: 14px; padding: 0 14px; }
  .album-tab-back  { padding: 0 12px; font-size: 22px; }
  .album-map-btn   { font-size: 13px; padding: 0 14px; gap: 6px; }

  .nav-arrow {
    width: 50px;
    height: 50px;
    font-size: 28px;
    opacity: 0.82;
  }
  #viewer:hover .nav-arrow { opacity: 0.82; }
  .nav-arrow:active { background: rgba(8,8,8,0.75); color: var(--text); opacity: 1; }

  #photo-info {
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 120px);
  }
  #photo-name { font-size: 14px; }

  #pano-controls {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  #pano-controls button {
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 8px;
  }
  #pano-recenter { font-size: 22px; }

  .photo-map-mini { width: 150px; height: 108px; }

  .map-modal-close,
  .album-map-close {
    width: 44px;
    height: 44px;
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  .home-header { padding: 24px 16px 0; }
  .album-grid  {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 18px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  }

  #prev-btn { left: 6px; }
  #next-btn { right: 6px; }

  #thumbnails { scrollbar-width: none; }
  #thumbnails::-webkit-scrollbar { display: none; }

  .map-page-header {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    height: auto;
    min-height: 50px;
  }
  #world-map {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
