:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #efe9de;
  --surface-3: #e6dfd1;
  --text: #1f1b16;
  --muted: #6f675c;
  --line: #e4ddd0;
  --accent: #c2552d;
  --accent-hover: #a9461f;
  --accent-soft: #f7e4d9;
  --accent-text: #ffffff;
  --heart: #e0476b;
  --warn: #a35a00;
  --danger: #b3261e;
  --shadow-sm: 0 1px 2px rgb(31 27 22 / 0.06), 0 2px 8px rgb(31 27 22 / 0.05);
  --shadow: 0 10px 30px rgb(31 27 22 / 0.12), 0 2px 6px rgb(31 27 22 / 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --top-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210;
    --surface: #1b1a17;
    --surface-2: #25231f;
    --surface-3: #2f2c27;
    --text: #f1ece3;
    --muted: #a39b8e;
    --line: #302d27;
    --accent: #e98a5f;
    --accent-hover: #f29d76;
    --accent-soft: #3a2519;
    --accent-text: #1a0f09;
    --heart: #ff6f8e;
    --warn: #f0a94a;
    --danger: #ff8a80;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 12px 34px rgb(0 0 0 / 0.55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 44px; height: 44px; stroke-width: 1.4; color: var(--muted); margin-bottom: 8px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 500; font-size: 14px; text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; }
.link { border: 0; background: none; color: var(--accent); padding: 4px; font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: background .15s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
#fav-filter[aria-pressed="true"] { background: var(--heart); border-color: var(--heart); color: #fff; }

/* ---------- top bar ---------- */

.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: var(--top-h); padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: 6px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 3px, transparent 3.5px),
    radial-gradient(circle at 50% 50%, transparent 0 7px, #fff 7.5px 9.5px, transparent 10px),
    linear-gradient(135deg, #d9693c, #a9461f);
  box-shadow: var(--shadow-sm);
}
.brand-name { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }

.tabs { display: flex; gap: 2px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: none; padding: 8px 13px; border-radius: 999px;
  color: var(--muted); font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.tab .ic { width: 18px; height: 18px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab[aria-pressed="true"] .ic { color: var(--accent); }
.count { font-weight: 400; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 7px 13px; color: var(--muted); font-size: 14px; font-weight: 500; }
.seg button .ic { width: 17px; height: 17px; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.view-toggle { margin-left: auto; }
.help-btn {
  width: 34px; height: 34px; flex: none; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-weight: 600; font-size: 15px; transition: background .15s, color .15s;
}
.help-btn:hover { background: var(--surface-2); color: var(--text); }
body:not([data-section="photo"]):not([data-section="video"]):not([data-section="albums"]) .view-toggle { visibility: hidden; }

/* ---------- filters ---------- */

.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 12px 24px;
}
.search {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px;
  width: 260px; max-width: 100%;
}
.search .ic { width: 17px; height: 17px; color: var(--muted); }
.search input { border: 0; background: none; padding: 7px 8px; width: 100%; outline: none; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search.ask { width: 300px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.search.ask .ic { color: var(--accent); }
.search-note {
  margin: 4px 0 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: 14px;
}
#person, .date input {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px;
}
#person { max-width: 170px; }
.date { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }

/* Dates: one button that opens a small panel with the day and range pickers. */
.dates { position: relative; }
.dates summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.dates summary::-webkit-details-marker { display: none; }
.dates summary .ic { width: 16px; height: 16px; color: var(--muted); }
.dates[open] summary { background: var(--surface-2); }
.dates summary.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.dates summary.on .ic { color: inherit; }
.dates-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; min-width: 260px;
  display: grid; gap: 10px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: pop .15s ease;
}
.dates-pop .date { justify-content: space-between; color: var(--text); }
.dates-or { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.result-note { color: var(--muted); font-size: 13.5px; }
#montage-from-filter { margin-left: auto; }
.chip-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- layout ---------- */

.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 130px); }
.sidebar {
  position: sticky; top: var(--top-h); align-self: start;
  max-height: calc(100vh - var(--top-h)); overflow-y: auto;
  padding: 8px 14px 100px 24px;
}
.year h2, .places-box h2 {
  font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--text);
  margin: 18px 0 4px;
}
.year:first-child h2 { margin-top: 4px; }
.month-link {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  border: 0; background: none; padding: 5px 10px; margin-left: -10px; border-radius: 8px; text-align: left; font-size: 14.5px;
  transition: background .15s;
}
.month-link:hover { background: var(--surface-2); }
.month-link span:last-child, #places .n { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.places-box { margin-top: 26px; padding-top: 6px; border-top: 1px solid var(--line); }
#places { list-style: none; margin: 0; padding: 0; }
#places button { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: none; padding: 5px 10px; margin-left: -10px; border-radius: 8px; text-align: left; font-size: 14px; }
#places button:hover { background: var(--surface-2); }
#places .empty { color: var(--muted); font-size: 13.5px; }
#places ul { list-style: none; margin: 0; padding: 0; }
#places .country h3 { margin: 10px 0 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#places button.active, .day-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }

.month-group .days { display: none; padding: 2px 0 6px 10px; border-left: 2px solid var(--line); margin: 0 0 4px 2px; }
.month-group.open .days { display: block; }
.month-group.open .month-link { font-weight: 600; }
.day-link {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  border: 0; background: none; padding: 3px 10px; border-radius: 8px; text-align: left; font-size: 13.5px;
}
.day-link:hover { background: var(--surface-2); }
.day-link span:last-child { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.place-suggest { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.place-suggest button {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text);
}
.place-suggest button:hover, .place-suggest button:focus-visible { background: var(--surface-2); outline: none; }
.place-suggest .ic { flex: none; margin-top: 2px; color: var(--accent); }
.place-suggest strong { display: block; font-weight: 500; }
.place-suggest small { display: block; color: var(--muted); font-size: 12.5px; }
.place-suggest .near { background: var(--accent-soft); }
.place-suggest .near small { color: var(--accent-hover); font-weight: 500; }
.place-suggest .searching { color: var(--muted); font-size: 13px; padding: 6px 10px; }

main { padding: 0 24px 140px 8px; min-width: 0; }

/* ---------- banners (album / person) ---------- */

.banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px;
  margin: 4px 0 12px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.banner .back { margin-right: -4px; }
.banner-face { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent-soft); }
.banner-title { display: grid; margin-right: auto; min-width: 0; }
.banner-title h2 { font-family: var(--display); font-size: 26px; margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
.banner-title small { color: var(--muted); font-size: 14px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.suggest-panel {
  margin: -4px 0 16px; padding: 16px 20px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.suggest-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 18px; margin-bottom: 14px; }
.suggest-head > div:first-child { margin-right: auto; }
.suggest-head h3 { margin: 0; font-family: var(--display); font-size: 19px; }
.suggest-actions { display: flex; gap: 8px; }
.suggest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px 12px; }
.suggest-card { display: grid; justify-items: center; gap: 6px; text-align: center; transition: opacity .2s; }
.suggest-card img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.suggest-card small { color: var(--muted); font-size: 12.5px; }
.suggest-card .yes-no { display: flex; gap: 4px; }
.suggest-card .btn { padding: 5px 9px; font-size: 13px; }
.suggest-card.answered { opacity: 0.35; }

/* ---------- grid ---------- */

.month { scroll-margin-top: calc(var(--top-h) + 60px); }
.month-head {
  position: sticky; top: var(--top-h); z-index: 6;
  display: flex; align-items: baseline; gap: 12px;
  margin: 0 -24px 0 -8px; padding: 16px 24px 10px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.month-head h2 { margin: 0; font-family: var(--display); font-size: 28px; letter-spacing: -0.015em; line-height: 1.15; }
.month-head span { color: var(--muted); font-size: 14px; }
.day { margin: 6px 0 30px; }
.day-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 10px; }
.day-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.day-places, .moment-places { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.place-pill {
  border: 0; background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 2px 10px;
  font-size: 13px; font-weight: 500;
}
.place-pill::before { content: "📍 "; }
.place-pill:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Tagging links stay quiet until you reach for them. */
.day-head .link, .moment-head .link { font-size: 13px; color: var(--muted); padding: 2px 4px; }
.day-head .link:hover, .moment-head .link:hover { color: var(--accent); }
.day-head h3 .day-open { font: inherit; color: inherit; padding: 0; }
.day-head h3 .day-open:hover { color: var(--accent); text-decoration: none; }
.day-time, .moment-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* A day's moments sit side by side and wrap, so short moments don't each take a whole row. */
:root { --tile: 172px; }
.moments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 22px; }
.moment { min-width: 0; max-width: 100%; }
.moment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 6px; width: 0; min-width: 100%; }
.moment-head .link { margin-left: -4px; }
.moment-time { font-weight: 500; font-size: 12.5px; }
.day-head { position: relative; }
.day-select { display: inline-flex; }
.day-select input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
@media (hover: hover) {
  /* In the margin, so day titles line up with the photos. */
  .day-select { position: absolute; left: -26px; opacity: 0; transition: opacity .15s; }
  .day:hover .day-select, .day-select:has(:checked), .day-select:has(:focus-visible), body.selecting .day-select { opacity: 1; }
  .day .link.tag-day, .day .link.tag-moment { opacity: 0.75; }
  .day:hover .link.tag-day, .moment:hover .link.tag-moment { opacity: 1; }
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, var(--tile)); gap: 5px; }
.moment .tiles { display: flex; flex-wrap: wrap; }
.moment .tile { width: var(--tile); }
.tile {
  position: relative; aspect-ratio: 1; background: var(--surface-2); border-radius: 12px; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); z-index: 1; }
.tile .open { display: block; width: 100%; height: 100%; border: 0; padding: 0; background: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease, opacity .3s; }
.tile .open:hover img { transform: scale(1.04); }
.tile .noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12.5px; padding: 8px; word-break: break-all; }
/* Round, see-through tick circles, like a phone's photo picker. */
.tile .pick {
  appearance: none; -webkit-appearance: none;
  position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; margin: 0;
  border: 2px solid rgb(255 255 255 / 0.95); border-radius: 50%; background: rgb(0 0 0 / 0.18);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  opacity: 0; transition: opacity .15s, background-color .15s; cursor: pointer;
}
.tile .pick:checked {
  border-color: var(--accent); background: var(--accent) no-repeat center / 14px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.5 3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.tile:hover .pick, .tile .pick:checked, body.selecting .tile .pick, .tile .pick:focus-visible { opacity: 1; }
.tile.selected { box-shadow: 0 0 0 3px var(--accent); transform: scale(0.96); }
.tile.selected img { opacity: 0.85; }
.tile .heart {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgb(0 0 0 / 0.32); color: #fff; font-size: 16px; line-height: 1;
  opacity: 0; transition: opacity .15s, transform .12s, background .15s;
  backdrop-filter: blur(4px);
}
.tile:hover .heart, .tile .heart:focus-visible, .tile.fav .heart { opacity: 1; }
.tile .heart:hover { transform: scale(1.12); }
.tile.fav .heart { color: var(--heart); background: rgb(255 255 255 / 0.9); }
.badges { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; justify-content: flex-end; gap: 4px; pointer-events: none; }
.badge {
  background: rgb(0 0 0 / 0.58); color: #fff; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.badge.warn { background: rgb(163 90 0 / 0.88); }
.placeholder { color: var(--muted); padding: 24px 0; }
.empty-state { display: grid; justify-items: center; text-align: center; color: var(--muted); padding: 90px 20px; grid-column: 1 / -1; }
.empty-state strong { display: block; color: var(--text); font-family: var(--display); font-size: 22px; font-weight: 600; margin-bottom: 6px; }

/* ---------- map ---------- */

#map-wrap { position: relative; margin-top: 10px; }
#map { height: calc(100vh - 170px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.map-note {
  position: absolute; z-index: 500; left: 50%; top: 20px; transform: translateX(-50%);
  background: var(--surface); padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); max-width: 90%; margin: 0;
}

/* ---------- section pages (people / albums / montages) ---------- */

.section-view { padding: 26px 28px 140px; max-width: 1480px; }
.section-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 22px; }
.section-head > div:first-child { margin-right: auto; }
.section-head h2 { margin: 0; font-family: var(--display); font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; }
.section-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hint-text { color: var(--muted); margin: 6px 0 0; max-width: 64ch; }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 14px; }
.person-card {
  display: grid; justify-items: center; gap: 2px; text-align: center;
  border: 0; background: none; padding: 10px 6px; border-radius: var(--radius);
}
.person-card img {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover; background: var(--surface-2); margin-bottom: 8px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line);
  transition: box-shadow .2s, transform .2s;
}
.person-card:hover img { transform: scale(1.04); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.person-card strong { font-weight: 600; font-size: 15px; }
.person-card small { color: var(--muted); font-size: 13px; }
.person-card .unnamed { color: var(--accent); font-weight: 500; }
.person-card.hidden-person { opacity: 0.5; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 20px; }
.album-card { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 0; }
.album-mosaic {
  display: grid; gap: 3px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
  background: var(--surface-2); margin-bottom: 10px; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.album-card:hover .album-mosaic { transform: translateY(-3px); box-shadow: var(--shadow); }
.album-mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.album-mosaic.n2 { grid-template-columns: 1fr 1fr; }
.album-mosaic.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.album-mosaic.n3 img:first-child { grid-row: span 2; }
.album-mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.album-mosaic.empty { place-items: center; color: var(--muted); }
.album-mosaic.empty .ic { width: 40px; height: 40px; stroke-width: 1.4; }
.album-card strong { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.album-card small { color: var(--muted); font-size: 13.5px; }

.year-head { font-family: var(--display); font-size: 22px; font-weight: 600; margin: 8px 0 14px; }
.year-head:not(:first-child) { margin-top: 34px; }
.trip-tag {
  display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-hover); font-size: 12px; font-weight: 600;
}
.album-card.hidden-event { opacity: 0.5; }

/* ---------- tidy up ---------- */

.dupe-section, .bin { margin-bottom: 40px; }
.dupe-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px 20px; margin: 0 0 14px; }
.dupe-head > div:first-child { margin-right: auto; }
.dupe-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--display); font-size: 21px; }
.dupe-group {
  margin: 0 0 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.dupe-tiles { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.dupe-tile {
  position: relative; flex: none; width: 150px; padding: 0; border: 0; background: var(--surface-2);
  border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 0 0 3px var(--accent);
  margin: 3px; transition: box-shadow .15s;
}
.dupe-tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transition: opacity .15s, filter .15s; }
.dupe-tile.drop { box-shadow: 0 0 0 1px var(--line); }
.dupe-tile.drop img { opacity: 0.45; filter: grayscale(0.6); }
.dupe-flag {
  position: absolute; top: 6px; left: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: var(--accent-text);
}
.dupe-tile.drop .dupe-flag { background: rgb(0 0 0 / 0.6); color: #fff; }
.dupe-meta { display: block; padding: 5px 8px; font-size: 12px; color: var(--muted); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dupe-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dupe-when { margin-right: auto; color: var(--muted); font-size: 13.5px; }
.btn.more { display: flex; margin: 16px auto 0; }
.empty-state.slim { padding: 40px 20px; }
.bin-tile .restore {
  position: absolute; top: 8px; left: 8px; border: 0; border-radius: 999px; padding: 4px 12px;
  background: rgb(255 255 255 / 0.92); color: #1f1b16; font-size: 13px; font-weight: 600;
}
.bin-tile img { opacity: 0.8; }
.bin-tile .noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12.5px; padding: 8px; word-break: break-all; }

.montage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px 20px; }
.montage-card { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 0; }
.montage-card:disabled { cursor: progress; }
.montage-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--surface-2); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.montage-card:not(:disabled):hover .montage-thumb { transform: translateY(-3px); box-shadow: var(--shadow); }
.montage-thumb img { width: 100%; height: 100%; object-fit: cover; }
.montage-thumb .play { position: absolute; left: 12px; bottom: 12px; font-size: 13px; padding: 5px 11px; }
.montage-status { color: var(--muted); text-align: center; padding: 12px; }
.montage-status.bad { color: var(--warn); }
.montage-card strong { font-family: var(--display); font-size: 19px; font-weight: 600; }
.montage-card small { color: var(--muted); font-size: 13.5px; }

/* ---------- floating bits ---------- */

.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 30;
  width: 62px; height: 62px; border-radius: 20px; border: 0;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .15s, background .15s;
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.fab:hover { background: var(--accent-hover); transform: translateY(-2px) rotate(90deg); }
body[data-section="tidy"] .fab, body[data-section="events"] .fab, body[data-section="people"] .fab, body[data-section="places"] .fab { display: none; }

.selection-bar {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 35;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); border-radius: 16px; padding: 10px 10px 10px 18px; box-shadow: var(--shadow);
  animation: rise .2s ease;
}
.sel-count { font-weight: 600; white-space: nowrap; }
.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.selection-bar .btn { background: color-mix(in srgb, var(--bg) 12%, transparent); border-color: transparent; color: var(--bg); }
.selection-bar .btn:hover { background: color-mix(in srgb, var(--bg) 22%, transparent); }
.selection-bar .btn.ghost { color: color-mix(in srgb, var(--bg) 70%, transparent); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

.toast {
  position: fixed; left: 50%; bottom: 104px; z-index: 60; transform: translate(-50%, 16px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.upload-panel {
  position: fixed; right: 28px; bottom: 104px; z-index: 30;
  width: 350px; max-width: calc(100vw - 32px); max-height: 50vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.upload-panel header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
#upload-list { list-style: none; margin: 0; padding: 6px 16px 12px; }
#upload-list li { padding: 7px 0; font-size: 14px; }
#upload-list .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#upload-list .status { color: var(--muted); font-size: 13px; }
#upload-list .status.bad { color: var(--warn); }
#upload-list progress { width: 100%; height: 5px; accent-color: var(--accent); }
.upload-sum { margin: 0; padding: 10px 16px 0; font-size: 13px; color: var(--muted); }
.upload-sum:empty { display: none; }

.add-menu {
  position: fixed; right: 28px; bottom: 104px; z-index: 31; width: 290px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; animation: pop .15s ease;
}
.add-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: none; color: var(--text); padding: 10px; border-radius: var(--radius-sm);
}
.add-menu button:hover { background: var(--surface-2); }
.add-menu .ic { color: var(--accent); width: 24px; height: 24px; }
.add-menu span { display: grid; font-size: 13px; color: var(--muted); }
.add-menu strong { font-size: 14.5px; font-weight: 600; color: var(--text); }
.add-menu p { margin: 4px 10px 6px; font-size: 12.5px; color: var(--muted); }

.drop-zone {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(4px);
}
.drop-zone > div {
  display: grid; justify-items: center; text-align: center; gap: 4px; color: var(--muted);
  width: min(520px, 100%); padding: 56px 24px; border: 2px dashed var(--accent); border-radius: 24px; background: var(--surface);
  pointer-events: none;
}
.drop-zone .ic.big { color: var(--accent); }
.drop-zone strong { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--text); }

/* ---------- viewer ---------- */

#viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0c0c0b; color: #eee; }
#viewer::backdrop { background: #000; }
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; position: relative; }
.stage { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 20px; }
.stage img, .stage video { max-width: 100%; max-height: calc(100vh - 40px); object-fit: contain; border-radius: 4px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.5); }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / 0.1); color: #fff; font-size: 30px; line-height: 1;
  backdrop-filter: blur(6px); transition: background .15s;
}
.nav:hover { background: rgb(255 255 255 / 0.22); }
.prev { left: 16px; }
.next { right: 356px; }
.close { position: absolute; top: 14px; right: 354px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.1); color: #fff; font-size: 26px; width: 42px; height: 42px; line-height: 1; }
.close:hover { background: rgb(255 255 255 / 0.22); }
.info { background: #161614; padding: 26px 22px; overflow-y: auto; border-left: 1px solid #262622; }
.info h2 { font-family: var(--display); font-size: 21px; margin: 0 0 2px; font-weight: 600; }
.info .sub { color: #a5a29a; margin: 0 0 18px; font-size: 13.5px; }
.info h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: #8f8c84; margin: 22px 0 9px; font-weight: 600; }
.info .place-row { display: flex; align-items: center; gap: 8px; }
.info .none { color: #a5a29a; }
.info .btn.danger { color: #ff8a80; margin-left: auto; }
.info .link { color: #f0a07a; }
.info .btn { background: #232320; border-color: #34342f; color: #eee; }
.info .btn:hover { background: #2d2d29; }
.info .btn.primary { background: #e98a5f; border-color: #e98a5f; color: #1a0f09; }
.quality { font-size: 14px; margin: 0 0 10px; }
.quality .warn { color: #f0a94a; }
.versions { display: grid; gap: 6px; }
.version {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid #34342f; border-radius: var(--radius-sm); background: none; color: #eee; text-align: left; width: 100%;
}
.version[aria-pressed="true"] { border-color: #e98a5f; background: rgb(233 138 95 / 0.12); }
.version small { color: #a5a29a; }
.hint { color: #a5a29a; font-size: 13px; margin: 10px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fav-toggle {
  float: right; margin: -2px 0 10px 10px; border: 1px solid #3a3a35; border-radius: 999px;
  background: none; color: #eee; padding: 6px 13px; font-size: 13.5px; font-weight: 500;
}
.fav-toggle[aria-pressed="true"] { color: #ff8aa1; border-color: #ff6f8e; background: rgb(255 111 142 / 0.1); }
.face-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.face-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px;
  border: 1px solid #34342f; border-radius: 999px; background: none; color: #eee; font-size: 13.5px;
}
.face-chip:hover { border-color: #e98a5f; }
.face-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.face-chip-wrap { display: inline-flex; align-items: center; }
.face-chip-wrap .face-chip { padding-right: 28px; }
.face-chip.tagged:hover { border-color: #34342f; }
.face-initial {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: #3a2a22; color: #f3b393; font-weight: 600;
}
.chip-x {
  margin-left: -26px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none;
  color: #a5a29a; font-size: 16px; line-height: 1;
}
.chip-x:hover { background: #3a3a35; color: #fff; }
.face-chip.add { padding: 9px 14px; border-style: dashed; color: #c9c6be; }

#montage-viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0c0c0b; color: #eee; }
#montage-viewer::backdrop { background: #000; }
.montage-viewer { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.montage-viewer .stage img, .montage-viewer .stage video { max-height: calc(100vh - 120px); }
.montage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; background: #161614; border-top: 1px solid #262622; }
.montage-bar strong { font-family: var(--display); font-size: 18px; }
.montage-bar span { color: #a5a29a; }
.montage-bar .btn { background: #232320; border-color: #34342f; color: #eee; }
.montage-bar .btn.primary { background: #e98a5f; border-color: #e98a5f; color: #1a0f09; }

.info-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.info-top .fav-toggle { float: none; margin: 0 0 0 auto; }
.info .edit-btn { padding: 8px 22px; }

/* ---------- photo editor ---------- */

.editor {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #000; color: #f2f2f2; font-family: var(--font);
}
.editor[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.editor::backdrop { background: #000; }
.ed-top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
}
.ed-btn { border: 0; background: none; color: #f2f2f2; font-size: 16px; font-weight: 500; padding: 8px 10px; border-radius: 8px; }
.ed-btn:hover { background: rgb(255 255 255 / 0.08); }
.ed-btn:disabled { opacity: 0.4; }
.ed-cancel { justify-self: start; }
.ed-done { justify-self: end; color: #ffcc00; font-weight: 600; }
.ed-modes { display: flex; gap: 4px; background: rgb(255 255 255 / 0.08); padding: 3px; border-radius: 10px; }
.ed-modes button {
  border: 0; background: none; color: #bdbdbd; padding: 6px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.ed-modes button[aria-selected="true"] { background: rgb(255 255 255 / 0.16); color: #fff; }

.ed-stage { position: relative; min-height: 0; overflow: hidden; }
/* Centred and shrunk to fit with room around it, so crop handles at the edges stay grabbable. */
.ed-canvas {
  position: absolute; inset: 0; margin: auto; display: block;
  max-width: calc(100% - 48px); max-height: calc(100% - 36px);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ed-badge {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: rgb(0 0 0 / 0.6); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.ed-saving {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: rgb(0 0 0 / 0.55); font-weight: 500;
}
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgb(255 255 255 / 0.2); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ed-cropbox {
  position: absolute; box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.55); outline: 1px solid rgb(255 255 255 / 0.9);
  cursor: move; touch-action: none;
}
.ed-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.45) calc(33.33% - 0.5px) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px) calc(66.66% - 0.5px), rgb(255 255 255 / 0.45) calc(66.66% - 0.5px) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.45) calc(33.33% - 0.5px) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px) calc(66.66% - 0.5px), rgb(255 255 255 / 0.45) calc(66.66% - 0.5px) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
}
.ed-cropbox .h { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.ed-cropbox .nw { left: -4px; top: -4px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.ed-cropbox .ne { right: -4px; top: -4px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.ed-cropbox .sw { left: -4px; bottom: -4px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.ed-cropbox .se { right: -4px; bottom: -4px; border-left: 0; border-top: 0; cursor: nwse-resize; }

.ed-panel { padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: #0d0d0d; border-top: 1px solid #1f1f1f; }
.ed-pane { display: grid; justify-items: center; gap: 8px; padding: 6px 0 4px; }
.ed-readout { display: flex; gap: 10px; align-items: baseline; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #bdbdbd; min-height: 18px; }
.ed-readout span:last-child { color: #ffcc00; font-variant-numeric: tabular-nums; }
.ed-slider, .ed-famount, .ed-straighten { width: min(560px, calc(100vw - 48px)); accent-color: #ffcc00; height: 28px; }

.ed-tools, .ed-filters, .ed-croptools {
  display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 4px 20px 6px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.ed-tools::-webkit-scrollbar, .ed-filters::-webkit-scrollbar, .ed-croptools::-webkit-scrollbar { display: none; }
.ed-tool {
  flex: none; display: grid; justify-items: center; gap: 5px; width: 72px; padding: 6px 2px;
  border: 0; background: none; color: #9a9a9a; font-size: 11px; scroll-snap-align: center;
}
.ed-tool .ic {
  width: 44px; height: 44px; padding: 10px; border-radius: 50%; border: 1.5px solid #3a3a3a; stroke-width: 1.6;
  transition: border-color .15s, color .15s;
}
.ed-tool.changed .ic { border-color: #8a8a8a; color: #e6e6e6; }
.ed-tool[aria-selected="true"] { color: #fff; }
.ed-tool[aria-selected="true"] .ic { border-color: #ffcc00; color: #ffcc00; }
.ed-filter {
  flex: none; display: grid; justify-items: center; gap: 5px; border: 0; background: none; color: #9a9a9a;
  font-size: 11px; padding: 2px; scroll-snap-align: center;
}
.ed-filter img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; }
.ed-filter[aria-selected="true"] { color: #fff; }
.ed-filter[aria-selected="true"] img { border-color: #ffcc00; }
.ed-chip {
  flex: none; border: 1px solid #333; background: #161616; color: #e6e6e6; border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.ed-chip[aria-pressed="true"] { border-color: #ffcc00; color: #ffcc00; }
.ed-foot { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; padding: 4px 16px 0; }
.ed-hint { color: #777; font-size: 12px; }
.ed-revert { color: #ff6b5e; font-size: 14px; }

@media (max-width: 760px) {
  .ed-modes button { padding: 6px 10px; font-size: 12px; }
  .ed-btn { font-size: 15px; padding: 6px; }
  .ed-canvas { max-width: calc(100% - 28px); max-height: calc(100% - 28px); }
  .ed-tool { width: 64px; }
  .ed-tool .ic { width: 40px; height: 40px; padding: 9px; }
}

/* ---------- dialogs ---------- */

.small-dialog {
  border: 0; border-radius: 20px; padding: 26px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.small-dialog[open] { animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(6px); } }
.small-dialog.wide { width: min(580px, calc(100vw - 32px)); }
.small-dialog::backdrop { background: rgb(20 16 12 / 0.45); backdrop-filter: blur(3px); }
.small-dialog h2 { margin: 0 0 4px; font-family: var(--display); font-size: 24px; letter-spacing: -0.01em; }
.small-dialog p { margin: 0 0 16px; color: var(--muted); }
.small-dialog input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), .small-dialog select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg); color: var(--text);
}
.small-dialog input:focus, .small-dialog select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
#tag-remove { margin-right: auto; }
.small-dialog .error { color: var(--danger); margin: 10px 0 0; }
.field { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); margin-top: 14px; }

.tour { text-align: center; }
.tour-ic {
  display: block; width: 58px; height: 58px; padding: 14px; margin: 4px auto 16px;
  border-radius: 18px; background: var(--accent-soft); color: var(--accent); stroke-width: 1.6;
}
.tour h2 { margin-bottom: 8px; }
.tour p { min-height: 6.2em; line-height: 1.55; margin-bottom: 18px; }
.tour p strong { color: var(--text); font-weight: 600; }
.tour-dots { display: flex; justify-content: center; gap: 6px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 999px; background: var(--line); transition: width .2s, background .2s; }
.tour-dots span.on { width: 20px; background: var(--accent); }
#tour-skip { margin-right: auto; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

.album-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.album-pick label {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.album-pick label:has(input:checked:not(:disabled)) { border-color: var(--accent); background: var(--accent-soft); }
.album-pick label:has(input:disabled) { opacity: 0.5; }
.album-pick input { accent-color: var(--accent); }
.album-pick img, .album-dot { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
.album-dot { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.album-pick span { display: grid; }
.album-pick small { color: var(--muted); }

.seg.kind { display: flex; margin: 14px 0 14px; }
.seg.kind label { flex: 1; text-align: center; padding: 9px 10px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg.kind input { position: absolute; opacity: 0; }
.seg.kind label:has(input:checked) { background: var(--accent); color: var(--accent-text); }
.seg.kind label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); }
.form-grid label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.form-grid input[type="file"] { font-size: 13px; }
/* Montage preview: the picked photos in a scrolling strip. */
.m-preview { margin: -4px 0 16px; transition: opacity .2s; }
.m-preview.loading { opacity: 0.5; }
.m-preview:empty { display: none; }
.m-preview-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 13.5px; }
.m-preview-head span { color: var(--muted); }
.m-preview-head .link { margin-left: auto; font-size: 13px; }
.m-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.m-thumb { position: relative; flex: none; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s, filter .15s; }
.m-thumb.out img { opacity: 0.3; filter: grayscale(1); }
.m-thumb button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%;
  display: grid; place-items: center; padding: 0; font-size: 15px; line-height: 1;
  background: rgb(0 0 0 / 0.55); color: #fff;
}
.m-thumb button:hover { background: var(--danger); }
.m-thumb.out button { background: var(--accent); }
.m-play { position: absolute; left: 5px; bottom: 4px; color: #fff; font-size: 11px; text-shadow: 0 1px 3px rgb(0 0 0 / 0.6); }
.with-btn { display: flex; gap: 6px; }
.with-btn select { flex: 1; min-width: 0; }
.with-btn .btn { flex: none; width: 42px; padding: 0; }
.form-grid .theme-hint { grid-column: 1 / -1; margin: -4px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px; }
/* "Describe it" and how it was read: places, people and a mood, each its own colour. */
label.describe { display: grid; gap: 5px; margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
label.describe input::placeholder { color: var(--muted); opacity: 0.55; }
.m-understood { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.m-understood span { font-weight: 600; color: var(--text); }
.m-understood .u-place::before { content: '📍 '; }
.m-understood .u-person::before { content: '🙂 '; }
.m-understood .u-mood::before { content: '✨ '; }

/* ---------- login ---------- */

.login-page {
  display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 0%, var(--accent-soft), transparent 60%), var(--bg);
}
.login { width: min(360px, 100%); background: var(--surface); border-radius: 20px; padding: 32px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.login h1 { margin: 0 0 10px; font-family: var(--display); font-size: 28px; letter-spacing: -0.01em; }
.login label { font-size: 13.5px; color: var(--muted); }
.login input { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; background: var(--bg); }
.login input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login .btn { padding: 11px; margin-top: 6px; }
.login .error { color: var(--danger); margin: 0; }

/* ---------- tablets ---------- */

@media (max-width: 1100px) {
  .tab span:not(.count) { display: none; }
  .tab .count { display: none; }
  .tab { padding: 9px 11px; }
  .seg button span { display: none; }
}

/* ---------- phones ---------- */

@media (max-width: 760px) {
  :root { --top-h: 56px; }
  /* No blur here: backdrop-filter would pin the "fixed" bottom tab bar inside the header. */
  .top { padding: 0 16px; gap: 10px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .brand-name { font-size: 18px; }

  /* Tabs become an app-style bottom bar. */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tab { flex-direction: column; gap: 2px; padding: 6px 0; border-radius: 12px; font-size: 10.5px; white-space: nowrap; min-width: 0; }
  .tab span:not(.count) { display: block; }
  .tab .ic { width: 22px; height: 22px; }
  .tab[aria-pressed="true"] { box-shadow: none; background: none; color: var(--accent); }
  .tab:hover { background: none; }

  .filters { flex-wrap: nowrap; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .search { flex: none; width: 200px; }
  .search.ask { width: 230px; }
  .dupe-tile { width: 112px; }
  .dupe-meta { font-size: 11px; padding: 4px 6px; }
  .filters > * { flex: none; }
  .result-note { display: none; }
  #montage-from-filter { margin-left: 0; }

  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  #timeline { display: flex; gap: 6px; }
  .year { display: contents; }
  .year h2 { display: none; }
  .month-link { flex: none; width: auto; gap: 6px; margin: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 13px; white-space: nowrap; font-size: 13.5px; }
  .places-box { display: none; }

  main { padding: 0 12px 170px; }
  .month-head { margin: 0 -12px; padding: 12px 14px 8px; }
  .month-head h2 { font-size: 23px; }
  :root { --tile: calc((100vw - 30px) / 3); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .moments { gap: 12px 3px; }
  .moment .tiles { gap: 3px; }
  .dates-pop { position: fixed; top: calc(var(--top-h) + 58px); left: 16px; right: 16px; }
  .tile { border-radius: 6px; }
  .tile:hover { transform: none; box-shadow: none; }
  .tile .pick { opacity: 1; top: 6px; left: 6px; }
  .chip-row { display: contents; }
  .tile .heart { width: 28px; height: 28px; font-size: 14px; }
  .banner { padding: 14px; }
  .banner-title h2 { font-size: 22px; }

  .section-view { padding: 18px 16px 170px; }
  .section-head h2 { font-size: 28px; }
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 14px 6px; }
  .person-card img { width: 84px; height: 84px; }
  .album-grid, .montage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .album-card strong, .montage-card strong { font-size: 16px; }

  .fab { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; }
  .selection-bar {
    bottom: calc(80px + env(safe-area-inset-bottom)); width: calc(100vw - 20px);
    flex-direction: column; align-items: stretch; gap: 8px; padding: 12px;
  }
  .sel-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .selection-bar .btn { padding: 8px 6px; font-size: 13px; }
  body.selecting .fab { display: none; }
  .upload-panel { right: 10px; bottom: calc(150px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

  .viewer { grid-template-columns: 1fr; grid-template-rows: 62vh auto; overflow-y: auto; }
  .stage { padding: 10px; }
  .stage img, .stage video { max-height: calc(62vh - 20px); }
  .next { right: 10px; }
  .prev { left: 10px; }
  .nav { top: 31vh; width: 42px; height: 42px; }
  .close { right: 10px; top: 10px; }
  .info { border-left: 0; border-top: 1px solid #262622; }
  .form-grid { grid-template-columns: 1fr; }
}
