/* DarkRoom - "Gallery" theme.
   iOS-native dark gallery: bottom tab bar, large titles, hairlines,
   -apple-system UI type with a serif display face for placards only.
   No gradients on chrome; photos are the hero. */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    system-ui, "Segoe UI", sans-serif;
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, serif;

  --bg: #000;
  --bg-soft: #0a0a0d;
  --elev: #131318;
  --elev-2: #1c1c21;
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.6);
  --text-3: rgba(235, 235, 245, 0.32);
  --hairline: rgba(255, 255, 255, 0.14);
  --hairline-soft: rgba(255, 255, 255, 0.07);
  --accent: #0a84ff;
  --accent-dim: rgba(10, 132, 255, 0.16);
  --danger: #ff453a;
  --ok: #30d158;

  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --tabbar-h: calc(52px + env(safe-area-inset-bottom, 0px));
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  padding-bottom: var(--tabbar-h);
}

/* Whisper of film grain over everything. Opacity stays barely-there. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

.ambient { display: none; }
.hidden, .view.hidden { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: var(--font-ui); touch-action: manipulation; }
button, .photo-cell, .cluster-card, .face-card { -webkit-tap-highlight-color: transparent; }
img { display: block; }

.meta { color: var(--text-2); font-size: 13px; }
.fineprint { color: var(--text-3); font-size: 12px; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hairline-soft);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .mark { width: 26px; height: 26px; flex: none; }
.brand-text h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand-text .tagline { display: none; }

/* ---------- buttons ---------- */
.primary {
  appearance: none;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.18s var(--spring), filter 0.18s var(--spring), opacity 0.18s;
}
.primary:hover { filter: brightness(1.1); }
.primary:active { transform: scale(0.97); }
.primary:disabled { opacity: 0.4; cursor: default; transform: none; }
.primary.big { font-size: 16px; padding: 14px 30px; border-radius: 14px; width: 100%; }

.ghost {
  appearance: none;
  border: 0.5px solid var(--hairline);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: transform 0.18s var(--spring), background 0.18s;
}
.ghost:hover { background: rgba(255, 255, 255, 0.1); }
.ghost:active { transform: scale(0.97); }
.ghost.danger { color: var(--danger); border-color: rgba(255, 69, 58, 0.4); }
.ghost:disabled { opacity: 0.4; }

#topbar .primary { padding: 7px 14px; font-size: 14px; border-radius: 999px; }

/* ---------- bottom tab bar ---------- */
#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 10, 13, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: 0.5px solid var(--hairline-soft);
}
#tabbar .navbtn {
  flex: 1 1 0;
  min-width: 0;
  appearance: none;
  border: none;
  background: none;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s var(--spring), transform 0.2s var(--spring);
}
#tabbar .navbtn svg { width: 24px; height: 24px; }
#tabbar .navbtn.active { color: var(--accent); }
#tabbar .navbtn:active { transform: scale(0.92); }
/* Active-tab indicator pill: glides between tabs on transform only.
   Positioned from JS (count-agnostic: measured off the live buttons). */
#tab-indicator {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 3px);
  left: 0;
  width: 30px;
  height: 3.5px;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
  transition: transform 0.34s var(--spring);
  will-change: transform;
}

/* ---------- views ---------- */
main {
  max-width: 1120px;
  margin: 0 auto;
}
.view { padding: 0 0 24px; }
.view:not(.hidden) { animation: viewIn 0.38s var(--spring); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
/* Direction-aware tab switches: incoming view slides from the side the
   user came from. JS adds slide-fwd/slide-back before unhiding. */
.view.slide-fwd:not(.hidden) { animation: viewFwd 0.32s var(--spring); }
.view.slide-back:not(.hidden) { animation: viewBack 0.32s var(--spring); }
@keyframes viewFwd {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: none; }
}
@keyframes viewBack {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: none; }
}

.pagetitle { padding: 18px 16px 6px; }
.pagetitle h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.pagetitle .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* iOS-style grouped card */
.card {
  background: var(--elev);
  border: 0.5px solid var(--hairline-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 16px;
}
.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card p { color: var(--text-2); font-size: 14px; }
.card p + p { margin-top: 8px; }
.card .primary { margin-top: 12px; }

/* ---------- empty state: full-bleed gallery wall ---------- */
#emptystate.hero {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  margin: 0;
  border: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(20, 22, 34, 0.9) 0%, rgba(0, 0, 0, 0) 60%),
    radial-gradient(140% 120% at 50% 115%, rgba(38, 30, 52, 0.55) 0%, rgba(0, 0, 0, 0) 55%),
    #000;
  padding: 64px 28px 56px;
  text-align: center;
}
#emptystate.hero::after {
  /* vignette */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(90% 75% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
}
#emptystate .hero-mark { width: 54px; height: 54px; margin: 0 auto 22px; opacity: 0.95; }
#emptystate h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: 0;
  margin: 0 0 14px;
}
#emptystate .lede {
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.55;
  max-width: 30em;
  margin: 0 auto;
}
#emptystate .primary.big { max-width: 340px; margin: 26px auto 0; }
#emptystate .trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 26px;
}
#emptystate .fineprint { margin-top: 22px; max-width: 34em; margin-left: auto; margin-right: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  border: 0.5px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
}
.chip svg { width: 13px; height: 13px; }

/* ---------- workstream H: tag cloud ---------- */
.tagchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tagchip {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  border: 0.5px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}
.tagchip:hover { border-color: var(--accent); color: var(--text); }

/* ---------- iOS import + storage cards ---------- */
#ios-card { border-color: rgba(10, 132, 255, 0.25); }
#ios-card .honest {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin: 10px 0 4px;
}
#ios-card .primary.big { margin-top: 14px; }
.storage-meter { margin-top: 12px; }
.storage-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
#storage-card .ghost.danger { margin-top: 12px; }
.bar.big {
  height: 6px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
}
.bar.big > div {
  height: 100%;
  width: 100%;
  background: var(--text-2);
  border-radius: 999px;
  /* Compositor-only fill: scaleX instead of width (see progress pill). */
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s var(--spring);
}

/* ---------- library tools row (captions toggle) ---------- */
#lib-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 16px 8px;
}
.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.25s var(--spring);
}
.switch .knob::before {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s var(--spring);
}
.switch input:checked + .knob { background: var(--ok); }
.switch input:checked + .knob::before { transform: translateX(20px); }

/* ---------- photo grid: edge-to-edge gallery wall ---------- */
.gridwrap {
  position: relative;
  height: calc(100vh - 260px);
  min-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
#searchgrid { height: 52vh; }
.grid-spacer { position: relative; }
.grid-row { position: absolute; left: 0; right: 0; display: flex; gap: 2px; padding: 0 2px; }
.photo-cell {
  position: relative;
  flex: none;
  min-width: 0;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-soft);
}
.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Thumbnails fade in once decoded: opacity-only, staggered by position
     via --cd (set from JS for newly appearing cells). transform is reserved
     for the hover zoom. */
  opacity: 0;
  transition: transform 0.45s var(--spring), opacity 0.28s ease var(--cd, 0ms);
}
.photo-cell img.ld { opacity: 1; }
.photo-cell:hover img { transform: scale(1.04); }
.photo-cell .cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 6px 5px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}
body.show-caps .photo-cell .cap { display: block; }
.score-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border: 0.5px solid var(--hairline);
  padding: 2px 7px;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.grid-empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

/* timeline placards */
.date-header {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 26px 16px 10px;
  background: linear-gradient(to bottom, var(--bg) 30%, rgba(0, 0, 0, 0));
}
.date-header .placard-month {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.1;
}
.date-header .placard-day {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-top: 5px;
}
.date-header .placard-day.compact {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.date-header .count {
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-left: 8px;
  text-transform: none;
}

/* ---------- search view ---------- */
.searchform { padding: 14px 16px; }
.srow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.srow label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.srow label.grow { flex: 1 1 160px; }
input[type="text"], input[type="date"], select {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid var(--hairline-soft);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s;
  max-width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
select option { background: var(--elev); }
#searchmeta { margin: 10px 2px 0; }

.smartsearch { margin-top: 12px; }
.ss-query { display: flex; gap: 10px; margin-top: 12px; }
.ss-query input { flex: 1; }
.dl-row { margin-top: 12px; }
.dl-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.dl-btns { display: flex; gap: 8px; flex: none; }

/* ---------- duplicates ---------- */
.dup-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.dup-intro .primary { margin-top: 0; flex: none; }
#dupmeta { padding: 0 16px; }
#duptabs { margin: 10px 16px 0; }
.dup-group { padding: 6px 16px 18px; }
.dup-group h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dup-group .meta { margin: 0 0 10px; }
.dup-members { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
.dup-members > div { flex: 0 0 150px; }
.dup-members .photo-cell { aspect-ratio: 1; }
.dup-members .cap {
  position: static;
  display: block;
  background: none;
  padding: 5px 2px 0;
  color: var(--text-2);
  font-size: 11px;
}

/* ---------- faces ---------- */
.faces-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.faces-intro .primary { margin-top: 0; flex: none; }
#faces-meta { padding: 0 16px; }
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px;
  padding: 12px 2px 0;
}
.cluster-card {
  position: relative;
  background: var(--bg-soft);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.3s var(--spring);
}
.cluster-card:active { transform: scale(0.97); }
.cluster-card.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.cluster-card .face-frame { aspect-ratio: 1; }
.cluster-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}
.cluster-name {
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cluster-name input {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
}
.cluster-sub { padding: 0 10px 10px; }
.mergebar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 16px 0;
  padding: 10px 12px;
  background: var(--elev);
  border: 0.5px solid var(--hairline-soft);
  border-radius: 12px;
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px 10px;
}
.detail-head h3 { font-family: var(--font-display); font-size: 24px; font-weight: 500; }
.moverow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 16px 10px;
  padding: 10px 12px;
  background: var(--elev);
  border: 0.5px solid var(--hairline-soft);
  border-radius: 12px;
}
.face-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 0 2px;
}
.face-card { position: relative; cursor: pointer; background: var(--bg-soft); }
.face-card.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.face-card .cap {
  font-size: 10.5px;
  color: var(--text-2);
  padding: 5px 6px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.face-frame { position: relative; overflow: hidden; background: var(--bg-soft); }
.face-frame img { width: 100%; height: 100%; object-fit: contain; }
.face-box {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ---------- map ---------- */
.map-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.map-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.map-actions .ghost { padding: 7px 11px; font-size: 15px; }
#mapwrap {
  margin: 12px 16px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 0.5px solid var(--hairline-soft);
  background: var(--bg-soft);
  min-height: 420px;
}
#mapwrap canvas { width: 100%; display: block; }

/* ---------- lightbox: immersive viewer + bottom sheet ---------- */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  animation: lbIn 0.38s var(--spring);
  touch-action: pan-y;
}
@keyframes lbIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
#lightbox.hidden { display: none; }
.lb-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 24px;
  z-index: 3;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
  pointer-events: none;
}
.lb-top > * { pointer-events: auto; }
.lb-top.lb-top-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lb-top { transition: opacity 0.25s ease; }
#lb-count { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
#lb-close {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s var(--spring);
  user-select: none;
  -webkit-user-drag: none;
}
/* Swipe track: three full-stage panels (prev/current/next) translated as
   one compositor layer. Built by JS on first open; keeps #lb-img's id. */
.lb-stage { touch-action: none; }
#lb-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 300%;
  display: flex;
  will-change: transform;
}
.lb-slide {
  flex: 0 0 33.3333%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lb-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
/* Track position scrubber: slim rail + knob, knob moves on transform only. */
#lb-scrub {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  left: 50%;
  width: min(38vw, 200px);
  height: 14px;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#lb-scrub.on { opacity: 1; }
#lb-scrub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}
#lb-scrub-knob {
  position: absolute;
  top: 3.5px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0.85;
}
#lb-prev { left: 12px; }
#lb-next { right: 12px; }
@media (hover: none) { .lb-nav { display: none; } }

/* bottom sheet */
#lb-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  background: rgba(16, 16, 20, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-top: 0.5px solid var(--hairline-soft);
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  max-height: 70vh;
  overflow-y: auto;
  transform: translateY(105%);
  transition: transform 0.38s var(--spring);
}
#lb-sheet.open {
  transform: translateY(0);
  animation: none;
}
@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
#lb-sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  margin: 0 auto 12px;
}
.segmented {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 2px;
  margin-bottom: 12px;
}
.segmented button {
  flex: 1;
  appearance: none;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s var(--spring);
}
.segmented button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
#lb-meta { background: none; border: none; padding: 0; margin: 0; }
#lb-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin: 0;
  font-size: 13.5px;
}
#lb-meta dt { color: var(--text-3); font-weight: 500; }
#lb-meta dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
#lb-sheet .ghost { width: 100%; margin-top: 4px; }

/* ---------- progress pill ---------- */
#progress {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  pointer-events: auto;
  max-width: calc(100vw - 32px);
}
#progress.hidden { display: none; }
.progress-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 20, 26, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--hairline);
  border-radius: 999px;
  padding: 9px 9px 9px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: pillIn 0.35s var(--spring);
}
@keyframes pillIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
#progresstext {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}
.progress-pill .bar {
  width: 110px;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.progress-pill .bar > div, #progressfill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  /* Compositor-only fill: scaleX instead of width, so progress updates
     never trigger layout. The rest state is scaleX(0). */
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.25s var(--spring);
}
.progress-pill .bar.indet > div { transform: none; }
.progress-pill .bar.indet > div { width: 40% !important; animation: indet 1.1s ease-in-out infinite alternate; }
@keyframes indet { from { margin-left: -40%; } to { margin-left: 100%; } }
#cancelBtn { border-radius: 999px; padding: 6px 12px; font-size: 13px; }

/* ---------- status toast + notice + footer ---------- */
#statusbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 12px);
  z-index: 110;
  max-width: calc(100vw - 40px);
  background: rgba(22, 22, 28, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--hairline);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: pillIn 0.35s var(--spring);
  text-align: center;
}
#statusbar.hidden { display: none; }
#statusbar.err { border-color: rgba(255, 69, 58, 0.5); }
#statusbar.ok { border-color: rgba(48, 209, 88, 0.4); }

.notice {
  margin: 12px 16px;
  padding: 14px 16px;
  background: var(--elev);
  border: 0.5px solid var(--hairline-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.notice .primary { margin-top: 0; flex: none; }

footer {
  text-align: center;
  padding: 26px 20px 10px;
  color: var(--text-3);
  font-size: 12px;
}

/* Compact cards once the library has photos: the wall is the star. */
body.has-photos #ios-card .honest,
body.has-photos #ios-card #ios-note,
body.has-photos #storage-card #storage-note { display: none; }
body.has-photos #ios-card { padding: 14px 16px; }
body.has-photos #ios-card h2 { font-size: 15px; margin-bottom: 0; }
body.has-photos #ios-card .primary.big {
  width: auto;
  margin-top: 10px;
  padding: 10px 20px;
  font-size: 15px;
}
body.has-photos #storage-card { padding: 12px 16px; }
body.has-photos #storage-card h2 { font-size: 15px; margin-bottom: 0; }
body.has-photos #storage-card .storage-top { margin-bottom: 6px; }
body.has-photos #storage-card .ghost.danger { margin-top: 0; padding: 6px 12px; font-size: 13px; }

/* ---------- wider screens ---------- */
@media (min-width: 720px) {
  .pagetitle { padding: 26px 24px 8px; }
  .pagetitle h1 { font-size: 40px; }
  .card { margin: 14px 24px; padding: 20px 22px; }
  #lib-tools { padding: 2px 24px 10px; }
  .notice { margin: 14px 24px; }
  #dupmeta, #faces-meta { padding: 0 24px; }
  #duptabs { margin-left: 24px; margin-right: 24px; }
  .dup-group { padding: 6px 24px 22px; }
  .detail-head { padding: 4px 24px 12px; }
  .mergebar, .moverow { margin-left: 24px; margin-right: 24px; }
  #mapwrap { margin: 14px 24px 0; }
  #emptystate h2 { font-size: 52px; }
  #tabbar { justify-content: center; }
  #tabbar .navbtn { flex: 0 1 120px; }
  .face-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) {
  .face-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- motion: reduced-motion support ----------
   Every animation in this file is transform/opacity-only, and JS-driven
   motion (lightbox springs, tab indicator, staggered fades) checks
   matchMedia('(prefers-reduced-motion: reduce)') and snaps instantly.
   This block kills the CSS side for users who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  #tab-indicator { transition: none !important; }
  .photo-cell img { opacity: 1 !important; }
}

/* ---------- Cleanup assistant (workstream I) ---------- */
.cl-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.cl-cell { flex: 0 0 150px; min-width: 0; }
.cl-cell .photo-cell { aspect-ratio: 1; }
.cl-box { position: relative; display: block; cursor: pointer; }
.cl-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px; margin: 0; cursor: pointer;
  accent-color: var(--accent);
}
.cl-reason {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--hairline);
}
hr.hairline { border: none; border-top: 0.5px solid var(--hairline); margin: 16px 0; }

/* ---------- workstream J: Locked folder + blur tools ---------- */
#locked-body { padding: 0 24px 48px; }
#locked-grid { height: 62vh; }
.lock-card { max-width: 560px; margin: 16px auto; }
.lock-card .pin-label { display: block; margin: 14px 0 4px; font-weight: 600; }
.lock-card input[type="password"] {
  display: block; margin-top: 6px; width: 220px;
  font-size: 20px; letter-spacing: 6px;
}
.lock-card .primary { margin-top: 14px; }
.lock-card .meta.err { color: #e08080; }
.lock-bar { display: flex; justify-content: flex-end; margin: 12px 0; }
/* Blur brush overlay: fixed over the displayed photo, above the stage. */
#lb-blur-overlay {
  position: fixed; z-index: 60; touch-action: none; cursor: crosshair;
}
#lb-blurbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 120px; z-index: 61;
  display: flex; gap: 10px; align-items: center;
  background: rgba(10, 10, 16, 0.92); border-radius: 12px; padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
/* EXIF strip checkbox on the Settings export card (workstream C). */
.set-check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.set-check input { margin-top: 3px; }
#cleanup-actionbar {
  position: sticky; bottom: 76px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 12px 16px;
  background: var(--elev); border: 1px solid var(--hairline);
  border-radius: 14px;
}

/* ---------- workstream G: albums, favorites, memories ---------- */

/* Library Timeline|Albums segmented control. */
#lib-seg { margin: 12px 16px 0; max-width: 320px; }

/* Favorite heart on grid cells: small, quiet, top-right. */
.fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
  z-index: 2;
  padding: 0;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.fav-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.fav-btn.on { color: #ff5a6e; opacity: 1; }
.fav-btn.on svg { fill: currentColor; }

/* Lightbox top bar: heart and Edit next to the close button. */
.lb-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
#lb-fav {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
#lb-fav svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
#lb-fav.on { color: #ff5a6e; }
#lb-fav.on svg { fill: currentColor; }

/* Memories card: quiet, serif, at the top of the Library. */
.memories { margin: 12px 16px 0; }
.memories-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 2px;
}
.memory-group { margin-top: 14px; }
.memory-group:first-of-type { margin-top: 10px; }
.memory-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.memory-when {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
}
.memory-year {
  color: var(--text-3);
  font-size: 13px;
}
.memory-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.memory-thumb {
  flex: none;
  border: none;
  padding: 0;
  background: var(--bg-soft);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  width: 96px;
  height: 96px;
}
.memory-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Albums pane inside Library. */
.albums-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 16px 0;
}
.album-actions {
  display: flex;
  gap: 8px;
  flex: none;
  flex-wrap: wrap;
  margin-top: 12px;
}
.albums-intro .album-actions { margin-top: 0; }
#smart-form { margin: 12px 16px 0; }
#albums-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px 14px;
  padding: 12px 16px 0;
}
.album-card { cursor: pointer; }
.album-card:active { transform: scale(0.97); }
.album-cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 0.5px solid var(--hairline-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.album-cover-empty { color: var(--text-3); }
.album-cover-empty svg { width: 34px; height: 34px; display: block; }
.album-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.album-name {
  font-weight: 600;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-sub {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 1px;
}
#smart-form .srow { margin-top: 10px; }
#smart-hint { margin-top: 8px; }
#album-meta { padding: 0 16px; }
#album-detail .album-actions { padding: 0 16px; margin-bottom: 12px; }
#album-detail .detail-head { align-items: center; }
#album-name input {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  background: var(--elev);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 4px 10px;
  width: 100%;
  max-width: 320px;
}

/* Album picker bottom sheet. */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--elev);
  width: 100%;
  max-width: 520px;
  max-height: 72vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 0.5px solid var(--hairline);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sheet-head h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}
.album-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  cursor: pointer;
}
.album-pick-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}
.album-pick-name { flex: 1; font-weight: 500; }
#album-picker-newform {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
#album-picker-newform input { flex: 1; min-width: 0; }
/* Settings view (workstream C). Uses the gallery theme tokens from
   styles.css: --bg, --elev, --elev-2, --text, --text-2, --hairline-soft,
   --accent, --danger, --radius, --spring. Reuses .card, .ghost, .primary,
   .meta from styles.css; nothing here redefines them. */

/* Storage / export meter bars */
.set-meter {
  height: 8px;
  border-radius: 99px;
  background: var(--elev-2);
  overflow: hidden;
  margin: 10px 0 4px;
}
.set-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.4s var(--spring);
}
.set-meter-fill.warn { background: #ff9f0a; }
.set-meter-fill.full { background: var(--danger); }

/* Label + action rows inside cards */
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 0.5px solid var(--hairline-soft);
}
.set-row:first-child { border-top: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row .t { font-size: 14px; font-weight: 500; }
.set-row .s { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.set-row .ghost { flex-shrink: 0; }

.set-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.set-status {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 8px;
  min-height: 1.2em;
}

/* Connected folder rows */
.set-folder {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-top: 0.5px solid var(--hairline-soft);
  font-size: 14px;
}
.set-folder:first-child { border-top: 0; }
.set-folder .count {
  color: var(--text-2);
  font-size: 12px;
  text-align: right;
  flex-shrink: 0;
}

/* Danger zone: hairline tint; armed confirm buttons go solid red */
.card.danger-zone { border-color: rgba(255, 69, 58, 0.35); }
button.ghost.danger.armed {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
/* edit.css (workstream F): styles for the photo/video editor overlay,
   batch select mode, and video badges. The integrator merges this into
   styles.css (motion workstream owns that file). Dark, gallery-like. */

/* ---- editor overlay ---- */
.pp-editor {
  position: fixed; inset: 0; z-index: 60;
  background: #0a0a0d; color: #f2efe6;
  display: flex; flex-direction: column;
  font-family: inherit;
}
.pp-ed-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid #26262c;
}
.pp-ed-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600;
}
.pp-ed-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow: hidden; background: #000;
}
.pp-ed-canvaswrap { position: relative; max-width: 100%; max-height: 100%; line-height: 0; }
.pp-ed-canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.pp-ed-video { max-width: 100%; max-height: 100%; background: #000; }
.pp-ed-panel {
  border-top: 1px solid #26262c; background: #101014;
  max-height: 46vh; display: flex; flex-direction: column;
}
.pp-ed-tabs { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; }
.pp-tab {
  background: none; border: none; color: #b9b4a6; padding: 8px 12px;
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.pp-tab.active { color: #f2efe6; border-bottom-color: #e8b93c; }
.pp-ed-body { overflow-y: auto; padding: 8px 12px 20px; }
.pp-ed-body h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: #b9b4a6; }
.pp-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.pp-lab { min-width: 92px; font-size: 14px; }
.pp-val { min-width: 52px; text-align: right; font-size: 13px; color: #b9b4a6; font-variant-numeric: tabular-nums; }
.pp-slider { flex: 1; min-width: 120px; accent-color: #e8b93c; }
.pp-note { font-size: 13px; color: #8f8a7c; margin: 6px 0; line-height: 1.45; }
.pp-sub { font-size: 12px; color: #8f8a7c; }
.pp-toolbtn.active { outline: 2px solid #e8b93c; }

/* ---- filter picker ---- */
.pp-filtergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; margin: 8px 0; }
.pp-filtergrid.small { max-height: 40vh; overflow-y: auto; }
.pp-filtercard {
  background: #17171c; border: 1px solid #2c2c33; border-radius: 10px;
  padding: 10px; text-align: left; color: #f2efe6; cursor: pointer;
}
.pp-filtercard.active { border-color: #e8b93c; outline: 1px solid #e8b93c; }
.pp-fname { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pp-fdesc { font-size: 12px; color: #a09a8a; line-height: 1.4; }

/* ---- crop overlay ---- */
.pp-cropov { position: absolute; inset: 0; touch-action: none; cursor: move; }
.pp-cropov.hidden { display: none; }
.pp-cropbox {
  position: absolute; border: 2px solid #e8b93c;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}
.pp-crophandle {
  position: absolute; width: 22px; height: 22px; background: #e8b93c; border-radius: 50%;
  transform: translate(-50%, -50%);
}
.pp-crophandle.nw { left: 0; top: 0; } .pp-crophandle.ne { left: 100%; top: 0; }
.pp-crophandle.sw { left: 0; top: 100%; } .pp-crophandle.se { left: 100%; top: 100%; }

/* ---- retouch spots ---- */
.pp-spots { position: absolute; inset: 0; pointer-events: none; }
.pp-spots.hidden { display: none; }
.pp-spot {
  position: absolute; width: 26px; height: 26px; border: 2px solid #e8b93c; border-radius: 50%;
  transform: translate(-50%, -50%); background: rgba(232, 185, 60, 0.15);
}

/* ---- curves ---- */
.pp-curves { margin: 8px 0; }
.pp-curve-canvas { background: #0a0a0d; border: 1px solid #2c2c33; border-radius: 8px; touch-action: none; }
.pp-hslgrp { margin: 4px 0; border: 1px solid #232329; border-radius: 8px; padding: 4px 8px; }
.pp-hslgrp summary { cursor: pointer; padding: 6px 0; color: #d8d2c2; }

/* ---- toast ---- */
.pp-toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(20px);
  background: #1c1c21; color: #f2efe6; border: 1px solid #33333a; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: 86vw; text-align: center;
}
.pp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- batch select mode ---- */
.pp-selectbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 55;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(12, 12, 15, 0.96); border-bottom: 1px solid #2c2c33;
  padding: 10px 12px;
}
.pp-selcount { font-weight: 600; margin-right: auto; }
.pp-check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.pp-check.on { background: #e8b93c; border-color: #e8b93c; }
.pp-check.on::after {
  content: ""; position: absolute; left: 8px; top: 4px; width: 6px; height: 11px;
  border: solid #111; border-width: 0 3px 3px 0; transform: rotate(42deg);
}
.photo-cell { position: relative; }
.pp-select-toggle { margin-left: 8px; }

/* ---- dialogs and progress ---- */
.pp-dialog-ov, .pp-progress-ov {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.pp-dialog, .pp-progress {
  background: #141419; border: 1px solid #2c2c33; border-radius: 14px;
  padding: 18px; width: min(560px, 94vw); max-height: 86vh; overflow-y: auto; color: #f2efe6;
}
.pp-dialog h2 { margin: 0 0 10px; font-size: 17px; }
.pp-proglabel { margin-bottom: 10px; font-size: 14px; }
.pp-progfill { height: 100%; width: 0%; background: #e8b93c; border-radius: 4px; transition: width 0.15s; }

/* ---- video badges in the grid ---- */
.video-badge {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0, 0, 0, 0.72); color: #fff;
  font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 8px;
}
.video-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 0; height: 0; opacity: 0.92;
  border-left: 26px solid #fff; border-top: 16px solid transparent; border-bottom: 16px solid transparent;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

/* ---- lightbox video ---- */
#lb-video { max-width: 100%; max-height: 100%; background: #000; }
/* (lb-stage positioning is defined in the main lightbox rules above) */
/* ---------- Year in photos view (workstream L) ----------
   Append to the end of styles.css. Gallery theme: serif display for the
   year placard, iOS grouped cards, stat tiles, month rhythm bars,
   horizontal standout strip, place rows. */

/* Serif year placard, matching the theme's display face. */
.yr-hero { text-align: center; padding: 28px 16px 22px; }
.yr-hero-year {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Stat tiles: 2x2 grid of small cards. */
.yr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 16px;
}
.yr-stat {
  background: var(--elev);
  border: 0.5px solid var(--hairline-soft);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.yr-stat-num { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.yr-stat-label { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* Month rhythm: 12 vertical bars, compositor-only scaleY. */
.yr-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 110px;
  margin-top: 12px;
}
.yr-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.yr-bar {
  width: 100%;
  max-width: 26px;
  height: 86px;
  background: var(--accent);
  border-radius: 4px;
  transform-origin: bottom;
  transform: scaleY(0);
}
.yr-bar-abbr { color: var(--text-3); font-size: 10px; margin-top: 4px; }

/* Standout strip + place thumbnails: horizontal scroll, square tiles. */
.yr-strip, .yr-place-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.yr-strip::-webkit-scrollbar, .yr-place-thumbs::-webkit-scrollbar { display: none; }
.yr-thumb {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--elev-2);
}
div.yr-thumb { min-height: 112px; } /* placeholder when no thumbnail yet */

/* Places list. */
.yr-places { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.yr-place { display: flex; flex-direction: column; gap: 8px; }
.yr-place-label { font-size: 15px; font-weight: 600; }
.yr-places-note { margin-top: 4px; }

/* Camera ranking. */
.yr-camlist { margin: 10px 0 0; padding-left: 20px; }
.yr-camlist li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--hairline-soft);
}
.yr-camlist li:last-child { border-bottom: none; }

/* Year picker row. */
.year-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 2px;
}
.year-picker-row select {
  flex: 1;
  background: var(--elev);
  color: var(--text);
  border: 0.5px solid var(--hairline);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 16px;
}

@media (min-width: 760px) {
  .yr-stats { margin: 0 24px; gap: 12px; }
  .yr-hero-year { font-size: 84px; }
  .yr-thumb { width: 140px; height: 140px; flex-basis: 140px; }
}
/* Workstream N additions: date-tools card, export format rows, EXIF table.
   Append to styles.css (after workstream C's settings.css). Gallery-theme
   tokens only; reuses .card, .set-row, .ghost, .primary, .meta. */

.set-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--card-bg, #1c1c1e);
  color: inherit;
  border: 1px solid var(--border, #38383a);
  border-radius: 10px;
  padding: 8px 28px 8px 10px;
  font-size: 0.95rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  max-width: 100%;
}

.set-num {
  width: 4.2rem;
  background-color: var(--card-bg, #1c1c1e);
  color: inherit;
  border: 1px solid var(--border, #38383a);
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 0.95rem;
}

input[type="date"].set-select,
input[type="datetime-local"].set-select {
  background-image: none;
  padding-right: 10px;
}

input[type="range"]#set-quality {
  width: 10rem;
  accent-color: var(--accent, #d4a24e);
}

input[type="range"]#set-quality:disabled {
  opacity: 0.35;
}

#set-qualityVal {
  font-variant-numeric: tabular-nums;
}

/* EXIF inspector table in the lightbox Info panel */
.exif-sec {
  margin-top: 14px;
}

.exif-sec h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
}

.exif-table {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 6px 12px;
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.exif-table dt {
  color: var(--muted, #9a9aa0);
}

.exif-table dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.exif-table dd.na {
  color: var(--muted, #9a9aa0);
  font-style: italic;
}


/* Date tools card: long selects and date inputs must not squeeze the labels
   on narrow screens. */
#view-settings .set-row > .set-select,
#view-settings .set-row > input.set-num {
  min-width: 0;
  flex-shrink: 1;
}
#view-settings .set-row > .set-select { max-width: 58%; }

/* Date tools: rows with several controls wrap below their label instead of
   squeezing on narrow screens. */
#dt-rangeRow, #dt-shiftRow { flex-wrap: wrap; }
#dt-rangeRow > .grow, #dt-shiftRow > .grow { flex: 1 1 100%; }
#dt-rangeRow > .set-select, #dt-shiftRow > .set-select { max-width: none; }
