/* Design tokens taken live from my.imperialtours.at's app.css (curl'd, not
   guessed) - --primary/--primary-soft/--accent/--surface-alt/--page-bg are
   its --navy/--navy-soft/--orange/--surface-alt/--page-bg verbatim, so the
   two apps read as one family. */
:root {
  color-scheme: light;
  --primary: #233a4e;
  --primary-soft: #2e4a63;
  --accent: #e74011;
  --border: #dfe5e5;
  --text: #1b2733;
  --muted: #5b6b76;
  --bg: #fff;
  --surface-alt: #f3f6f6;
  --page-bg: #eff2f1;
  --radius-pill: 100px;
  --radius-card: 12px;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* 100dvh (with 100vh as a fallback for browsers that don't support it):
     iPad Safari landscape reports 100vh as taller than what's actually
     visible above its own tab/address bar chrome, pushing the header
     button behind it - verified live. dvh tracks the real visible area. */
  height: 100vh;
  height: 100dvh;
}

h1, h2 {
  font-family: "Fraunces", serif;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  /* Needs viewport-fit=cover on the meta viewport tag - otherwise this
     resolves to 0px everywhere and does nothing. */
  padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

header h1 {
  font-size: 1.1rem;
  margin: 0;
  min-width: 0; /* may shrink and wrap instead of pushing the buttons out of the page */
}

/* Narrow phones: the header used to be ~440 px wide at 375 px, which made Safari lay the whole page out wider than the
   screen (zoomed out, everything at the right edge - the log-out button, the album's close button, the thumbnail +/-
   - partly or fully out of sight). It must never be wider than the screen. */
@media (max-width: 480px) {
  header {
    gap: 0.5rem;
    padding-left: max(0.6rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.6rem, env(safe-area-inset-right, 0px));
  }
  header h1 {
    font-size: 0.95rem;
    line-height: 1.15;
    flex: 1 1 0;
  }
  header .tab {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
  }
  header nav {
    gap: 0.3rem;
    flex: 0 0 auto;
  }
  header #favorites-toggle,
  header #mac-link,
  header #passkeys-link,
  header #logout-button {
    flex: 0 0 auto;
  }
}

/* iPhone SE class (320 px): no room left for the title next to the tabs and three round buttons. */
@media (max-width: 360px) {
  header h1 {
    display: none;
  }
}

nav {
  display: flex;
  gap: 0.5rem;
}

.tab {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#favorites-toggle {
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  border-radius: 50%;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}

#favorites-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#mac-link,
#passkeys-link,
#logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  border-radius: 50%;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}

#source-pills {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}

#source-pills:empty {
  display: none;
  border-bottom: none;
}

.source-pill {
  flex: 0 0 auto;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.source-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.source-pill:disabled {
  opacity: 0.5;
  cursor: default;
}

.source-pill-count {
  margin-left: 0.45rem;
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.75;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.view {
  display: none;
  height: 100%;
}

.view.active {
  display: block;
}

#view-map {
  position: relative;
}

#map {
  height: 100%;
  background: #1b2d3d; /* what shows while dark tiles load */
}

.tile-preview-badge {
  position: absolute;
  left: 0.5rem;
  bottom: 1.9rem;
  z-index: 500;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  color: #fff;
  text-decoration: none;
  background: rgba(35, 58, 78, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
}

/* MAP_TILES=osm-dark: darken the light OpenStreetMap tiles, see the SVG
   filter in index.html */
.osm-dark-tiles {
  filter: url(#osm-dark-filter);
}

#region-search {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 500; /* above Leaflet's own panes, below the album/lightbox overlays */
  width: min(280px, calc(100vw - 1.5rem));
  background: var(--bg);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  padding: 0.5rem;
}

.region-search-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#region-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 1rem; /* 16px: below that iOS Safari zooms into the field when it gets the focus and keeps the zoom */
}

#region-clear {
  flex: 0 0 auto;
  border: none;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

#region-suggestions {
  margin-top: 0.3rem;
}

#region-suggestions:empty {
  margin-top: 0;
}

.suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: none;
  background: none;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
}

.suggestion:hover {
  background: var(--surface-alt);
}

#region-radius-panel {
  margin-top: 0.5rem;
}

.region-radius-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#region-radius {
  flex: 1 1 auto;
  accent-color: var(--accent);
}

#region-radius-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

#region-result-count {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

#view-timeline {
  position: relative;
  background: #1b2d3d;
  color: #fff;
}

#timeline-scroll,
#groups-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 1rem;
  padding-right: 2.25rem; /* clears the right-edge scrubber */
  padding-bottom: 4.5rem; /* clears the bottom granularity bar */
  /* Off on purpose: newer pages are prepended above the viewport and
     timeline.js corrects scrollTop by hand (same frame) - native scroll
     anchoring on top of that would correct twice (Chrome), and Safari has
     no reliable native anchoring to lean on anyway. */
  overflow-anchor: none;
}

#timeline-load-newer {
  height: 1px;
}

#timeline-sticky-date {
  position: sticky;
  top: 0;
  z-index: 15;
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.8rem;
  /* Fully opaque, not translucent: a semi-transparent background here
     (verified live) fails to composite in some browser/scroll-position:sticky
     combinations, rendering only the text with no visible pill at all. */
  background: #3c424a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
}

.month-heading {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 1.5rem 0 0.5rem;
}

.month-grid {
  display: grid;
  /* fixed --tile-size (see grid-sizing.js), not aspect-ratio + auto rows -
     that combination breaks down with many implicit rows, see the JS file */
  grid-template-columns: repeat(auto-fill, var(--tile-size, 120px));
  grid-auto-rows: var(--tile-size, 120px);
  gap: 4px;
}

.thumb {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  cursor: pointer;
}

.thumb .day-badge {
  /* overrides the generic ".thumb span" flex/height:100% rule below, which
     would otherwise vertically center this in the full tile instead of
     pinning it to the top-left corner */
  position: absolute;
  top: 4px;
  left: 4px;
  height: auto;
  display: block;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 4px;
  text-align: center;
  word-break: break-all;
}

#timeline-load-more {
  text-align: center;
  padding: 1.5rem;
  /* --muted (#5b6b76) is tuned for the light map UI - all but invisible on
     the Timeline's dark background, verified live. */
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
}

/* "Jahre"/"Monate" cover cards reuse .thumb/.month-grid, just bigger
   (see grid-sizing.js's minTile=150 call) with a label overlay. */
.thumb-labeled {
  position: relative;
}

.thumb-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.4rem 0.5rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
}

.thumb-label small {
  font-weight: 400;
  opacity: 0.85;
}

/* Jahre- und Monate-Kacheln: bold Label, top-left, kein Hintergrund-Box
   (gleiche Behandlung für beide - nur die Schriftgröße unterscheidet sich,
   da der Jahreszahl-Text kürzer ist als "August 2026"). */
.cover-card .thumb-label {
  inset: 0.5rem auto auto 0.5rem;
  background: none;
  padding: 0;
}

.cover-card .thumb-label .cover-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.cover-card.year-card .thumb-label .cover-label {
  font-size: 1.4rem;
}

.cover-card .thumb-label small {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#timeline-granularity {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.3rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

.granularity-btn {
  border: none;
  background: none;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.granularity-btn.active {
  background: var(--primary);
  color: #fff;
}

#timeline-scrubber {
  position: absolute;
  top: 0.5rem;
  right: 0.25rem;
  bottom: 4.5rem;
  width: 1.5rem;
  display: flex;
  justify-content: center;
  touch-action: none;
}

#timeline-scrubber-track {
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  position: relative;
}

#timeline-scrubber-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

#timeline-scrubber-label {
  position: absolute;
  right: 1.75rem;
  top: 0;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

/* Lightbox ------------------------------------------------------------------
   One fixed full-viewport layer. Everything the user can operate (close,
   Original, heart, "i", arrows) is an overlay button in a corner or at an
   edge, inside the safe-area insets and never in the layout flow, so the
   picture can never push a control out of sight. The picture itself fills
   whatever room the safe-area padding leaves and is never larger than it
   (max 100%, object-fit: contain). */
#lightbox {
  --lb-top: max(0.5rem, env(safe-area-inset-top, 0px));
  --lb-right: max(0.5rem, env(safe-area-inset-right, 0px));
  --lb-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  --lb-left: max(0.5rem, env(safe-area-inset-left, 0px));
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 2000;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  /* one finger: no page scroll and no browser back/forward gesture (the swipe is ours, see lightbox.js); two fingers: the browser may
     zoom, so a page that was zoomed by accident (iOS zooms into small input fields) can always be zoomed back out */
  touch-action: pinch-zoom;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

/* a quiet note when only a small picture could be shown (the preview route fell back to a thumbnail) */
#lightbox-note {
  position: absolute;
  left: 50%;
  bottom: calc(var(--lb-bottom) + 2.6rem);
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  text-align: center;
  pointer-events: none;
  z-index: 3;
}
#lightbox-note.hidden {
  display: none;
}

#lightbox.hidden {
  display: none;
}

/* the page is zoomed (visualViewport.scale > 1): lightbox.js pins the box to the visible part (left/top/width/height inline) and the
   page may be moved with one finger again, so close button and arrows are never out of reach */
#lightbox.lb-zoomed {
  touch-action: pan-x pan-y pinch-zoom;
}

html.lightbox-open,
html.lightbox-open body {
  overscroll-behavior: none;
}

/* Swipe stage: three full-size slots (previous / current / next) side by side
   on a track that follows the finger. Each slot pads itself by the safe-area
   insets; the picture lives in its padding box. */
#lightbox-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#lightbox-track {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.lb-slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--lb-top) var(--lb-right) var(--lb-bottom) var(--lb-left);
}

.lb-slot[data-pos='prev'] {
  transform: translate3d(-100%, 0, 0);
}

.lb-slot[data-pos='next'] {
  transform: translate3d(100%, 0, 0);
}

.lb-slot img,
.lb-slot video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-touch-callout: none;
}

/* Overlay buttons ---------------------------------------------------------- */
.lightbox-ctl {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  margin: 0;
  font: inherit;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#lightbox-download {
  top: var(--lb-top);
  left: var(--lb-left);
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
}

#lightbox-download:hover {
  background: rgba(255, 255, 255, 0.15);
}

#lightbox-close {
  top: var(--lb-top);
  right: var(--lb-right);
  font-size: 2rem;
}

#lightbox-favorite-btn {
  top: var(--lb-top);
  right: calc(var(--lb-right) + 2.75rem);
  font-size: 1.6rem;
}

#lightbox-favorite-btn.active {
  color: var(--accent);
}

#lightbox-info-btn {
  right: var(--lb-right);
  bottom: var(--lb-bottom);
  width: 2.25rem;
  padding: 0;
  font: italic 600 1.05rem/1 Georgia, 'Times New Roman', serif;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
}

#lightbox.info-open #lightbox-info-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  text-shadow: none;
}

/* Previous / next: only where a mouse hovers (touch devices swipe). */
.lightbox-arrow {
  display: none;
  top: 50%;
  width: 3rem;
  height: 4rem;
  margin-top: -2rem;
  font-size: 2.6rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.5rem;
}

#lightbox-prev {
  left: var(--lb-left);
}

#lightbox-next {
  right: var(--lb-right);
}

@media (hover: hover) and (pointer: fine) {
  .lightbox-arrow {
    display: flex;
  }
}

.lightbox-arrow.hidden {
  display: none;
}

/* "3 von 12" - finite lists only */
#lightbox-counter {
  position: absolute;
  top: var(--lb-top);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

/* "Standort geschätzt" - small chip, bottom left, display only */
#lightbox-location {
  position: absolute;
  left: var(--lb-left);
  bottom: var(--lb-bottom);
  z-index: 2;
  pointer-events: none;
}

#lightbox-location.hidden {
  display: none;
}

.location-estimated-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

/* Bottom stack over the picture: drive panel of an external entry (always) above the info layer (off until "i" is tapped) */
#lightbox-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: var(--lb-bottom);
  pointer-events: none;
}

#lightbox.info-open #lightbox-bottom {
  padding-bottom: 0;
}

/* Info layer over the bottom edge of the picture - off until "i" is tapped */
#lightbox-info {
  position: static;
  display: none;
  padding: 0.7rem calc(var(--lb-right) + 3rem) calc(var(--lb-bottom) + 0.1rem) var(--lb-left);
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.lightbox-nearby {
  margin-top: 0.35rem;
}

/* "Fotos in der Umgebung" and "Gehe zur Timeline": one row, each at least 44px high; on a phone each takes a whole row */
.lightbox-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lightbox-action-row button {
  min-height: 44px;
}

@media (max-width: 480px) {
  .lightbox-action-row button {
    flex: 1 1 100%;
  }
}

.lightbox-nearby button {
  font: inherit;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  cursor: pointer;
}

.lightbox-nearby button:disabled {
  opacity: 0.5;
  cursor: default;
}

.nearby-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.4rem;
}

.nearby-panel input[type='range'] {
  width: min(220px, 50vw);
}

#lightbox.info-open #lightbox-info:not(.hidden) {
  display: block;
}

#lightbox-info-text {
  overflow-wrap: anywhere;
}

/* the layer itself ignores touches (it sits over the picture); its links and controls do not */
#lightbox-info a,
#lightbox-info .lightbox-nearby {
  pointer-events: auto;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Low viewport (phone in landscape): translucent backing so the corner
   buttons stay readable on top of the picture. */
@media (max-height: 500px) {
  .lightbox-ctl {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 999px;
  }

  #lightbox-close {
    font-size: 1.6rem;
  }

  #lightbox-favorite-btn {
    font-size: 1.3rem;
  }

  #lightbox.info-open #lightbox-info-btn {
    background: rgba(255, 255, 255, 0.9);
  }

  .lightbox-arrow {
    border-radius: 0.5rem;
  }
}

.thumb .favorite-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  height: auto;
  display: block;
  padding: 0;
  font-size: 0.8rem;
  color: var(--accent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Album overlay - sits above the map, below the lightbox */
#album {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #1b2d3d;
  color: #fff;
  display: flex;
  flex-direction: column;
}

#album.hidden {
  display: none;
}

#album .overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  /* the overlay is fixed full-bleed: keep the header (and its +/- buttons) out from under the notch / status bar */
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.5rem max(1rem, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
}

#album-count {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin-right: auto;
  /* gives way first on a narrow screen, so the buttons next to it never get pushed out of the page */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 380px) {
  #album .overlay-header {
    gap: 0.4rem;
  }
}

/* Thumbnail-size +/- (Timeline toolbar and Album header): round buttons, at least 44 x 44 px (Apple's minimum tap size),
   so they are easy to find and hit on an iPhone. */
.grid-zoom {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.grid-zoom button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: rgba(27, 45, 61, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation; /* no double-tap zoom delay on iOS */
  -webkit-tap-highlight-color: transparent;
}

.grid-zoom button:disabled {
  opacity: 0.35;
  cursor: default;
}

#album .select-toggle-btn {
  min-height: 44px;
}

#album-close {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
}

#album-grid {
  overflow-y: auto;
  padding: 1rem;
  padding-right: 2.25rem; /* clears the right-edge scrubber */
  flex: 1 1 auto;
}

/* Positioned relative to #album (position:fixed), spanning the grid area
   below the header - same visual language as #timeline-scrubber. */
#album-scrubber {
  position: absolute;
  top: 4.5rem;
  right: 0.25rem;
  bottom: 0.75rem;
  width: 1.5rem;
  display: flex;
  justify-content: center;
  touch-action: none;
}

#album-scrubber-track {
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  position: relative;
}

#album-scrubber-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

#album-scrubber-label {
  position: absolute;
  right: 1.75rem;
  top: 0;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

/* --- Mehrfachauswahl + Teilen (Timeline "Alle" + Album) ------------------ */

.select-toggle-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}

.select-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

/* One toolbar for +/- and "Auswählen", pinned over whichever grid is shown (Alle / Monate / Jahre). It sits LEFT of the
   right-edge scrubber (never over it) and inside the safe-area inset (iPhone landscape / notch). Nothing is placed over it. */
#timeline-toolbar {
  position: absolute;
  top: 0.75rem;
  right: calc(2.25rem + env(safe-area-inset-right, 0px));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#timeline-toolbar .select-toggle-btn {
  min-height: 44px; /* same tap height as the +/- buttons */
  padding-top: 0;
  padding-bottom: 0;
}

.thumb .select-circle {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

body.selection-mode .thumb .select-circle {
  display: block;
}

.thumb.selected .select-circle {
  background: var(--accent);
  border-color: var(--accent);
}

.thumb.selected .select-circle::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.thumb.selected img {
  opacity: 0.8;
}

/* Video marker on thumbnails and map icons: dark translucent disc with a white
   triangle, 30% of the tile width but never below 20px / above 44px. Purely
   decorative - pointer-events:none, so taps/selection still hit the tile. */
.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(20px, 30%, 44px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.play-badge::before {
  content: "";
  position: absolute;
  left: 55%;
  top: 50%;
  width: 42%;
  height: 42%;
  transform: translate(-50%, -50%);
  background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.duration-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
}

#selection-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  background: #1b2d3d;
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

#selection-count {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.selection-actions {
  display: flex;
  gap: 0.6rem;
}

.selection-actions button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* Photo-tile marker icons (single markers and cluster icons alike) */
.photo-icon {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  background-color: #ccc;
  background-size: cover;
  background-position: center;
  position: relative;
}

.photo-icon .cluster-badge {
  position: absolute;
  left: -6px;
  bottom: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}

/* --- Login / Passwort vergessen / Passwort zurücksetzen ------------------ */

.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(27, 39, 51, 0.08);
}

.auth-card h1 {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  margin: 0 0 1.5rem;
  text-align: center;
}

.auth-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -0.75rem 0 1.25rem;
  text-align: center;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-card input {
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-alt);
}

.auth-card input:focus {
  outline: 2px solid var(--primary-soft);
  outline-offset: 1px;
}

.auth-card button {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.auth-card button:hover {
  background: var(--primary-soft);
}

.auth-card button:disabled {
  background: var(--border);
  cursor: default;
}

.auth-error {
  color: var(--accent);
  font-size: 0.85rem;
}

.auth-message {
  color: var(--text);
  font-size: 0.85rem;
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.auth-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--primary-soft);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

/* Passkeys ------------------------------------------------------------------ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider.hidden {
  display: none;
}

.auth-card button.secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.auth-card button.secondary:hover {
  background: var(--surface-alt);
}

.auth-card button.secondary:disabled {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
}

.auth-card button.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

.auth-card #passkey-login-btn,
.auth-card #passkey-add-btn {
  width: 100%;
}

.passkeys-body {
  align-items: flex-start;
}

.passkeys-card {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.passkeys-card h1 {
  margin-bottom: 0.2rem;
}

.passkeys-card h2 {
  font-size: 1rem;
  margin: 0.8rem 0 0;
}

.passkeys-card .auth-hint {
  margin: 0;
  text-align: left;
}

.passkeys-card .back-link {
  text-align: left;
  margin: 0;
}

.passkey-list,
.audit-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.passkey-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.passkey-list small,
.invite-out small {
  color: var(--muted);
}

.audit-log li {
  padding: 0.3rem 0;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.invite-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.invite-out {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.invite-out.hidden {
  display: none;
}

/* Alert banner: something only a person can fix (refused DSM login, ...) */
#alert-banner {
  flex: 0 0 auto;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.4;
}

#alert-banner .alert-item + .alert-item {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

#alert-banner code {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  user-select: all;
}

/* One-time notice (e.g. password login switched off) */
#notice-banner {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
}

#notice-banner button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.auth-hint.left {
  text-align: left;
  margin: 0;
}

/* ===== Filter by person / category + "Screenshots anzeigen" (js/labels.js) ======================================================== */
#filter-bar {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}
.filter-row,
#filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar,
#filter-chips::-webkit-scrollbar {
  display: none;
}
#filter-chips {
  padding-top: 0;
}
#filter-chips:empty {
  display: none;
}
.filter-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.3rem 0.9rem;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.filter-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
@media (pointer: coarse) {
  .filter-btn {
    min-height: 44px;
  }
}
/* narrow screens: the three controls wrap into two rows instead of hiding the switch behind a sideways scroll */
@media (max-width: 560px) {
  .filter-row {
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    overflow-x: visible;
  }
}
.filter-count {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.75;
}
.filter-count:empty {
  display: none;
}
.switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 9px;
  background: #b9c4c8;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.filter-switch.on .switch-track {
  background: var(--accent);
}
.filter-switch.on .switch-knob {
  transform: translateX(12px);
}
.filter-switch.overridden {
  opacity: 0.6;
}
.filter-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.15rem 0.2rem 0.15rem 0.35rem;
  border: 1.5px solid var(--primary);
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}
.filter-chip-concept {
  padding-left: 0.75rem;
}
.filter-chip-text {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-chip-x {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
@media (pointer: coarse) {
  .filter-chip-x {
    width: 44px;
    height: 44px;
    margin: -6px -4px -6px 0;
  }
}

/* round face pictures; people without a picture get a circle with their initials */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-alt);
  color: #fff;
  font-weight: 600;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-xs {
  width: 26px;
  height: 26px;
  font-size: 0.65rem;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 1.35rem;
}
.avatar-initials {
  background: hsl(var(--avatar-hue, 205) 35% 38%);
}

/* the two pickers: a full-screen sheet on phones, a centred dialog on wide screens */
.picker {
  position: fixed;
  inset: 0;
  z-index: 1500; /* above the album (1000), below the lightbox (2500) */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem 0.25rem 1rem;
}
.picker-title {
  margin: 0;
  font-size: 1.25rem;
}
.picker-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}
.picker-search {
  flex: 0 0 auto;
  margin: 0.25rem 1rem 0.5rem;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  font: inherit;
  font-size: 1rem; /* 16px: iOS does not zoom into the field */
  color: var(--text);
}
.picker-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.picker-hint {
  padding: 0 1rem 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.picker-hint:empty {
  display: none;
}
.picker-sentinel {
  height: 1px;
}
.picker-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.picker-apply,
.picker-clear {
  min-height: 44px;
  padding: 0.4rem 1.1rem;
  white-space: nowrap;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.picker-apply {
  border: none;
  background: var(--primary);
  color: #fff;
}
.picker-clear {
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}
.picker-clear:disabled {
  opacity: 0.5;
  cursor: default;
}
body.picker-open {
  overflow: hidden;
}
@media (min-width: 768px) {
  body.picker-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(27, 39, 51, 0.45);
  }
  .picker {
    inset: 5vh max(1rem, calc((100vw - 760px) / 2));
    border-radius: var(--radius-card);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    padding-top: 0;
    padding-bottom: 0;
  }
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.4rem;
  padding: 0.25rem 0.75rem 0.75rem;
}
.person-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  padding: 0.5rem 0.2rem;
  border: none;
  border-radius: var(--radius-card);
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  position: relative;
}
.person-tile .avatar {
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.12s;
}
.person-tile.selected {
  background: var(--surface-alt);
}
.person-tile.selected .avatar {
  box-shadow: 0 0 0 3px var(--accent);
}
.person-tile.selected::after {
  content: '\2713';
  position: absolute;
  top: 0.35rem;
  right: calc(50% - 44px);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  line-height: 22px;
  text-align: center;
}
.person-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.person-meta {
  font-size: 0.7rem;
  color: var(--muted);
}

.concept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 1rem 1rem;
}
.concept-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.3rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.concept-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.concept-chip-count {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
}

/* people and categories of a photo, in the lightbox info layer */
.lightbox-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.lightbox-labels-title {
  font-size: 0.8rem;
  opacity: 0.8;
}
.lightbox-label-chip {
  min-height: 36px;
  padding: 0.2rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  font: inherit;
  font-size: 0.8rem;
  color: #fff;
  cursor: pointer;
}
@media (pointer: coarse) {
  .lightbox-label-chip {
    min-height: 44px;
  }
}

/* ===== source pills: "gezeigt" text, the (i) info button and the numbers sheet; the "N Fotos" count ============================== */
.view-count {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.view-count.loading {
  opacity: 0.55;
}
@media (max-width: 560px) {
  .view-count {
    flex: 1 0 100%;
    margin-left: 0;
    text-align: right;
    min-height: 0;
  }
  .view-count:empty {
    display: none;
  }
}

.source-info-btn {
  position: sticky;
  right: 0;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -6px 0 -6px 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: -8px 0 8px -2px var(--bg);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--primary);
  cursor: pointer;
}
.source-info {
  position: fixed;
  z-index: 1500;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* phone: a bottom sheet */
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 75vh;
  padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.3);
}
body.source-info-open::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(27, 39, 51, 0.4);
}
.source-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.source-info-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}
.source-info-source {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.source-info-name {
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.source-info-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.1rem 0;
}
.source-info-row span:last-child {
  font-variant-numeric: tabular-nums;
}
.source-info-row.strong {
  color: var(--text);
  font-weight: 600;
}
.source-info-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
@media (min-width: 768px) and (hover: hover) {
  /* desktop: a popover under the (i), positioned by sources.js */
  .source-info {
    left: auto;
    bottom: auto;
    width: 360px;
    max-height: 70vh;
    border-radius: var(--radius-card);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem 1rem;
  }
}

/* Drive panel of an entry from an external drive (Phase 3): where the original lies, and the way to it ------------------------- */
#lightbox-external {
  pointer-events: auto;
  margin: 0 calc(var(--lb-right) + 3rem) 0.5rem var(--lb-left);
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: left;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0.7rem;
  -webkit-user-select: text;
  user-select: text;
}

#lightbox-external.hidden {
  display: none;
}

#lightbox-external .ext-title {
  font-weight: 600;
}

#lightbox-external .ext-line {
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.82);
}

#lightbox-external .ext-warn {
  margin-top: 0.25rem;
  color: #ffd27a;
}

#lightbox-external .ext-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

#lightbox-external .ext-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  cursor: pointer;
}

#lightbox-external .ext-btn.primary {
  background: var(--primary, #2f6f8f);
  border-color: transparent;
}

#lightbox-external .ext-btn:active {
  opacity: 0.8;
}

#lightbox-external .ext-btn.hidden {
  display: none;
}

/* /mac: pair a Mac, paired Macs, drives ------------------------------------------------------------------------------------------ */
.mac-card {
  max-width: 560px;
}

.mac-card h2 {
  font-size: 1rem;
  margin: 1.2rem 0 0.3rem;
}

.mac-card .owner-choice {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
}

.mac-card .owner-choice label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  margin: 0;
}

.mac-card .owner-choice input {
  width: auto;
}

.mac-card a.big-link {
  display: block;
  margin-top: 0.6rem;
  padding: 0.8rem 1rem;
  text-align: center;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-pill);
  text-decoration: none;
}

.mac-card .pair-out {
  margin-top: 0.6rem;
}

.mac-card .pair-out input {
  font-size: 1rem; /* 16px: iOS zooms into smaller fields */
  text-overflow: ellipsis;
}

.mac-card ol {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.mac-card .drive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mac-card .drive-table th,
.mac-card .drive-table td {
  padding: 0.35rem 0.3rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.mac-card .muted {
  color: var(--muted);
}

.mac-card a.big-link.hidden {
  display: none;
}

/* Net for every text field, also the ones added later: iOS Safari zooms into a field whose font is smaller than 16px and does not zoom back
   (tests/ui-inputs.test.mjs fails on any rule that sets a smaller size on a field). The zoom itself stays allowed for the user. */
input:not([type='range']):not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='hidden']):not([type='file']),
select,
textarea {
  font-size: 16px;
}

/* "Gehe zur Timeline": the photo found in the timeline blinks for two seconds (orange frame + white ring: visible on the dark timeline and on any picture) */
.thumb.goto-highlight {
  position: relative;
  z-index: 2;
  outline: 4px solid var(--accent);
  outline-offset: -4px;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 6px rgba(231, 64, 17, 0.75);
  animation: goto-pulse 0.7s ease-in-out 3;
}

@keyframes goto-pulse {
  50% {
    transform: scale(1.07);
  }
}

@media (prefers-reduced-motion: reduce) {
  .thumb.goto-highlight {
    animation: none;
  }
}

/* "Filter zurückgesetzt" above the timeline (about 4 seconds, no dialog) and the short messages of the button */
#timeline-notice,
#goto-toast {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100% - 7rem);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#timeline-notice.hidden,
#goto-toast.hidden {
  display: none;
}

/* above the lightbox (2000) when the message belongs to it */
#goto-toast {
  position: fixed;
  top: auto;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 2rem);
  z-index: 3000;
}
