/* Theme: light by default (Google Photos style), dark when the system is dark. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f0f4f9;
  --surface-2: #e3e9f1;
  --line: rgba(0,0,0,.09);
  --hover: rgba(0,0,0,.06);
  --text: #1f1f1f;
  --muted: #5f6368;
  --faint: rgba(0,0,0,.28);
  --accent: #0b57d0;
  --accent-ink: #ffffff;
  --accent-soft: #d3e3fd;
  --accent-soft-ink: #041e49;
  --danger: #b3261e;
  --danger-soft: #f9dedc;
  --bar: rgba(255,255,255,.92);
  --glass: rgba(255,255,255,.92);
  --shadow: 0 10px 34px rgba(0,0,0,.16);
  --login-glow: #d3e3fd;
  --radius: 16px;
  --nav-h: 0px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --font: "Google Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131314;
    --surface: #1e1f20;
    --surface-2: #2a2b2d;
    --line: rgba(255,255,255,.09);
    --hover: rgba(255,255,255,.08);
    --text: #e3e3e3;
    --muted: #a0a4a9;
    --faint: rgba(255,255,255,.25);
    --accent: #a8c7fa;
    --accent-ink: #062e6f;
    --accent-soft: #004a77;
    --accent-soft-ink: #c2e7ff;
    --danger: #f2b8b5;
    --danger-soft: #601410;
    --bar: rgba(19,19,20,.9);
    --glass: rgba(30,31,32,.92);
    --shadow: 0 12px 40px rgba(0,0,0,.55);
    --login-glow: #1b2a4a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
svg { width: 22px; height: 22px; fill: currentColor; display: block; }

/* Brand */
.logo { width: 24px; height: 24px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2392b8ff'/%3E%3Cstop offset='1' stop-color='%233d7bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M12 20.7c-.3 0-.6-.1-.8-.3C6.4 16.3 2.5 12.9 2.5 8.9 2.5 6 4.7 3.8 7.5 3.8c1.8 0 3.4.9 4.5 2.4 1.1-1.5 2.7-2.4 4.5-2.4 2.8 0 5 2.2 5 5.1 0 4-3.9 7.4-8.7 11.5-.2.2-.5.3-.8.3z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 2px 8px rgba(61,123,255,.35)); }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--login-glow) 0%, transparent 60%), var(--bg); }
.login-card { width: min(360px, 100%); text-align: center; }
.logo-big { display: block; width: 72px; height: 72px; margin: 0 auto; filter: drop-shadow(0 8px 28px rgba(61,123,255,.45));
  animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.08); } 24% { transform: scale(1); } 36% { transform: scale(1.05); } 48% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .logo-big { animation: none; } }
.pin { position: relative; display: flex; gap: 10px; justify-content: center; margin: 28px 0 14px; cursor: text; }
.pin input { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; caret-color: transparent; }
.pin span { width: 46px; height: 58px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 24px; font-weight: 600; transition: border-color .15s, transform .15s; }
.pin span.filled { border-color: var(--accent); }
.pin span.cursor { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin.shake { animation: shake .35s; }
.pin.busy span { opacity: .5; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.login-error { color: var(--danger); min-height: 1.4em; margin: 0; }

/* App bar for filtered views: fixed at the top; the date chip sits below it */
:root { --appbar: 0px; }
body.filtered { --appbar: 60px; }
.filterbar { display: none; position: fixed; z-index: 20; left: 0; right: 0; top: 0; height: calc(var(--top) + var(--appbar)); padding: var(--top) 8px 0 4px;
  align-items: center; gap: 6px; background: var(--bar); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px); }
body.filtered .filterbar { display: flex; }
.filterbar .title-block { flex-direction: column; align-items: flex-start; gap: 0; }
.filterbar h1 { font-size: 18px; font-weight: 500; }
.filterbar .count { font-size: 12px; }

.nav-badge { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; color: var(--text); transition: background .15s; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); }
.title-block { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.title-block h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 13px; font-weight: 600; max-width: 220px; }
.admin-only { display: none !important; }
body.admin .icon-btn.admin-only { display: grid !important; }
body.admin .btn.admin-only { display: inline-flex !important; }


/* Grid */
.grid-wrap { padding: 4px 16px calc(var(--bottom) + var(--nav-h) + 40px); }
.grid { position: relative; contain: layout; }
.tile, .day { position: absolute; contain: strict; }
.tile { overflow: hidden; background: var(--surface); border-radius: 4px; cursor: pointer; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s, transform .2s, border-radius .2s; }
.tile img.ok { opacity: 1; }
@media (hover: hover) { .tile:hover img { transform: scale(1.025); } }
.tile .badge { position: absolute; right: 6px; top: 6px; display: flex; align-items: center; gap: 3px; padding: 1px 6px 1px 4px; color: #fff;
  border-radius: 999px; background: rgba(0,0,0,.5); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .badge svg { width: 12px; height: 12px; }
.tile .check { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 999px; border: 2px solid rgba(255,255,255,.9);
  background: rgba(0,0,0,.2); display: none; }
.selecting .tile .check { display: block; }
.tile.sel { background: var(--accent-soft); }
.tile.sel .check { background: var(--accent); border-color: var(--accent); }
.tile.sel .check::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.tile.sel img { transform: scale(.86); border-radius: 10px; }
.day { display: flex; align-items: flex-end; padding-bottom: 8px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.day span { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }
.day.month, .day.year { font-size: 20px; font-weight: 600; padding-bottom: 10px; }
.grid-foot { text-align: center; padding: 6px 16px 8px; }
.logout-btn { padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; background: transparent; }
.grid-total { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 16px 8px; }
.empty { text-align: center; color: var(--muted); padding: 80px 0; }

/* Floating date while scrolling the continuous mobile grid */
.date-chip { position: fixed; z-index: 19; left: 50%; top: calc(var(--top) + var(--appbar) + 10px); transform: translateX(-50%); padding: 7px 14px; border-radius: 999px;
  background: var(--bar); color: var(--text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); pointer-events: none;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: opacity .3s, top .25s; white-space: nowrap; }
.date-chip.fade { opacity: 0; }

/* Fast scroller (Google Photos style) */
.scrub { position: fixed; z-index: 18; right: 0; top: calc(var(--top) + 76px); bottom: calc(var(--bottom) + var(--nav-h) + 12px); width: 56px; pointer-events: none; }
/* Always shown (not only while scrolling) and big enough for a thumb that moves fast. */
.scrub-handle { position: absolute; right: 0; top: 0; width: 48px; height: 64px; border-radius: 32px 0 0 32px; pointer-events: auto; touch-action: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); cursor: grab; }
.scrub.drag .scrub-handle { cursor: grabbing; background: var(--accent); color: var(--accent-ink); }
.scrub-handle svg { width: 24px; height: 24px; }
/* An invisible grip around it, for a thumb that lands beside it. */
.scrub-handle::before { content: ""; position: absolute; inset: -16px 0 -16px -24px; }
.scrub-bubble { position: absolute; right: 56px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); display: none; }
.scrub.drag .scrub-bubble { display: block; }
.scrub-years { position: absolute; right: 56px; top: 0; bottom: 0; display: none; }
.scrub.drag .scrub-years { display: block; }
.scrub-years span { position: absolute; right: 0; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 2px 8px; border-radius: 999px; background: var(--bar); }

/* Pages & cards (Album tab) */
.page { position: fixed; z-index: 15; left: 0; right: 0; top: 0; bottom: calc(var(--nav-h)); overflow-y: auto; background: var(--bg);
  padding: calc(var(--top) + 8px) 16px 24px; overscroll-behavior: contain; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 12px; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 500; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 12px; }
.card { text-align: left; position: relative; min-width: 0; }
.card .cover { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-name { margin-top: 8px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-count { color: var(--muted); font-size: 13px; }
.card-more { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(0,0,0,.45); color: #fff; }
.card-more svg { width: 18px; height: 18px; }

/* Search / filter sheet */
.panel { position: fixed; z-index: 25; top: 0; right: 0; bottom: 0; width: min(420px, 100%); display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow); padding-top: var(--top); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.panel-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; overscroll-behavior: contain; }
.search-field { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; margin-bottom: 8px; border-radius: 26px; background: var(--surface); color: var(--muted); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--text); }
.btn.wide { width: 100%; justify-content: center; padding: 13px; font-size: 15px; border-radius: 999px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* Map */
.mapview { position: fixed; inset: 0; z-index: 40; background: var(--surface); }
/* .mapview prefix beats maplibre-gl.css (.maplibregl-map { position: relative }). */
.mapview .map { position: absolute; inset: 0; }
.map-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--top) + 10px) 12px 10px; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.map-title { display: flex; align-items: baseline; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.map-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); }
/* Map on top, photos in the visible area in a sheet below (Google Photos places map) */
.mapview .map { bottom: 45%; }
.map-sheet { position: absolute; left: 0; right: 0; top: 55%; bottom: 0; margin-top: -18px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.12); padding: 8px 0 calc(var(--nav-h) + 12px); }
.map-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--faint); margin: 2px auto 8px; }
.map-sheet-head { padding: 0 16px 10px; font-weight: 600; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 2px; }
.map-grid button { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; background: var(--surface); }
.map-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-grid .badge { position: absolute; right: 4px; top: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; font-size: 11px; font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 14px; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }

/* Selection bar */
.selbar { position: fixed; z-index: 22; left: 50%; bottom: calc(var(--bottom) + var(--nav-h) + 14px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 999px; width: max-content; max-width: calc(100vw - 24px);
  background: var(--surface); box-shadow: var(--shadow); }
.selbar #selCount { font-weight: 600; margin-right: 6px; white-space: nowrap; }
.selbar-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.selbar-actions .btn { white-space: nowrap; }
.selbar { flex-wrap: wrap; row-gap: 6px; }

/* Bottom navigation (mobile) */
.bottom-nav { display: none; }

/* Lightbox (always dark, like Google Photos) */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #000; transition: background .2s; color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; color-scheme: dark; }
.lightbox .muted { color: rgba(255,255,255,.7); }
/* Photos start below the status bar: in a Home Screen app iPadOS 26 blurs whatever lies under it,
   and on iPad it reports no safe-area inset there, so reserve at least its height (24px). On the
   black background the gap doesn't show. */
html.lb-open, html.lb-open body { background: #000; }
html.lb-open #app { visibility: hidden; }
html.tab-away #gridWrap { visibility: hidden; } /* see showTab */ /* keeps its layout and scroll position for when the photo view closes */
.lightbox { --lb-top: var(--top); }
@media (display-mode: standalone) { .lightbox { --lb-top: max(var(--top), 24px); } }
.lb-stage { position: absolute; inset: var(--lb-top) 0 0; overflow: hidden; }
.lb-track { position: absolute; inset: 0; will-change: transform; }
.lb-slide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
/* Always fit the screen; the low-res thumbnail is stretched until the sharp version swaps in. */
.lb-slide img, .lb-slide video { width: 100%; height: 100%; object-fit: contain; display: block; }
.lb-slide img { -webkit-user-drag: none; }
/* Videos sit between the top bar and the bottom bar (actions, or the slideshow bar), so their own
   controls are never underneath ours. A layer over the middle takes swipes and taps (play/pause);
   the controls' strips along the video's top and bottom edges stay uncovered. */
.lb-slide.video { padding: 68px 0 calc(var(--bottom) + 84px); }
.lb-vbox { position: relative; width: 100%; height: 100%; }
.lb-vcatch { position: absolute; left: 0; right: 0; top: 56px; bottom: 76px; }
.lb-slide img { will-change: transform; }
.lb-slide .lb-spinner { position: absolute; width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lb-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 12px; padding: calc(var(--lb-top) + 10px) 168px 24px 12px;
  background: linear-gradient(rgba(0,0,0,.6), transparent); transition: opacity .25s; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.14); }
.lb-info { flex: 1; min-width: 0; font-size: 14px; }
.lb-info div:first-child { font-weight: 600; }
.lb-actions { position: absolute; top: calc(var(--lb-top) + 10px); right: 12px; display: flex; gap: 4px; transition: opacity .25s; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 999px; color: #fff;
  background: rgba(30,30,34,.6); display: grid; place-items: center; transition: opacity .3s, background .15s; backdrop-filter: blur(8px); }
.lb-nav:hover { background: rgba(60,60,66,.8); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
@media (hover: none) { .lb-nav { display: none; } }
.lightbox.chrome-off .lb-top, .lightbox.chrome-off .lb-actions, .lightbox.chrome-off .lb-nav { opacity: 0; pointer-events: none; }
.lightbox.idle .lb-top, .lightbox.idle .lb-actions, .lightbox.idle .lb-nav, .lightbox.idle .ss-bar { opacity: 0; pointer-events: none; }
.lightbox.idle { cursor: none; }
.lb-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 62%; overflow-y: auto;
  padding: 10px 20px calc(var(--bottom) + 20px); border-radius: 24px 24px 0 0; background: #1e1f20; color: #e3e3e3;
  box-shadow: 0 -10px 40px rgba(0,0,0,.5); animation: rise .2s ease-out; touch-action: pan-y; }
.lb-sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); margin: 0 auto 14px; }
.lb-sheet h4 { margin: 0 0 4px; font-size: 18px; font-weight: 500; }
.lb-sheet .row { display: flex; gap: 16px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.08); }
.lb-sheet .row svg { width: 22px; height: 22px; flex: none; color: #a0a4a9; margin-top: 1px; }
.lb-sheet .row small { display: block; color: #a0a4a9; font-size: 13px; }
.lb-sheet .row button { color: #a8c7fa; font-weight: 600; padding: 0; margin-top: 4px; }
/* Slideshow controls: one compact rounded row; the photo view's own buttons hide meanwhile. */
.ss-bar { position: absolute; left: 50%; bottom: calc(var(--bottom) + 22px); transform: translateX(-50%); display: flex; flex-wrap: nowrap; gap: 4px;
  align-items: center; padding: 6px; border-radius: 999px; background: rgba(32,33,36,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0,0,0,.45); transition: opacity .3s; white-space: nowrap; }
.ss-bar .icon-btn { width: 44px; height: 44px; }
.ss-bar .icon-btn.on { background: rgba(168,199,250,.22); color: #a8c7fa; }
.ss-speed { min-width: 52px; height: 36px; padding: 0 12px; border-radius: 18px; background: rgba(255,255,255,.1); color: #e3e3e3; font-weight: 600; font-size: 14px; }
.ss-progress { position: absolute; left: 22px; right: 22px; bottom: 3px; height: 2px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.ss-progress div { height: 100%; width: 0; background: #a8c7fa; }
.lightbox.slideshow .lb-actions, .lightbox.slideshow .lb-nav { display: none; }

/* Modal & toast */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.45); }
.modal-card { width: min(420px, 100%); padding: 22px; border-radius: 28px; background: var(--bg); box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 500; }
.modal-card p:empty { display: none; }
.modal-card input { width: 100%; margin-top: 12px; padding: 12px 14px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.modal-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; margin-top: 10px; }
.modal-list:empty { display: none; }
.modal-list button { text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--surface); display: flex; justify-content: space-between; }
.modal-list button:hover { background: var(--surface-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--bottom) + var(--nav-h) + 24px); transform: translateX(-50%); padding: 12px 18px; border-radius: 10px;
  background: #303030; color: #f2f2f2; font-weight: 500; box-shadow: var(--shadow); animation: rise .2s ease-out; max-width: calc(100vw - 32px); }

/* ---------- Google Photos layout: the same on phone, iPad and computer ---------- */
@media all {
  :root { --nav-h: calc(88px + var(--bottom)); }
  .title-block h1 { font-size: 18px; }
  .grid-wrap { padding: calc(var(--top) + 2px) 0 calc(var(--bottom) + var(--nav-h) + 40px); touch-action: pan-y; }
  body.filtered .grid-wrap { padding-top: calc(var(--top) + var(--appbar) + 2px); }
  .day { padding-left: 14px; font-size: 14px; font-weight: 500; }
  .day.month, .day.year { font-size: 18px; }
  .day span { display: none; }
  .tile { border-radius: 0; }
  .tile .badge { right: 4px; top: 4px; }
  .scrub { top: calc(var(--top) + var(--appbar) + 12px); }
  /* Floating, rounded, translucent navigation island (Google Photos style). */
  .bottom-nav { display: flex; position: fixed; z-index: 30; left: 50%; bottom: calc(var(--bottom) + 14px); transform: translateX(-50%);
    height: 60px; padding: 0 8px; gap: 2px; border-radius: 30px; background: var(--bar); border: 1px solid var(--line);
    backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px); box-shadow: var(--shadow); }
  .bottom-nav button { width: 58px; display: grid; place-items: center; color: var(--muted); }
  .bottom-nav .pill { position: relative; width: 56px; height: 36px; border-radius: 18px; display: grid; place-items: center; transition: background .2s; }
  .bottom-nav button.active { color: var(--text); }
  .bottom-nav button.active .pill { background: var(--accent-soft); color: var(--accent-soft-ink); }
  .bottom-nav .nav-badge { top: -2px; right: 8px; }
  .panel { top: 0; bottom: 0; width: 100%; border-left: 0; box-shadow: none; animation: none; z-index: 25; }
  .mapview { bottom: 0; z-index: 25; }

  .page { z-index: 25; bottom: 0; padding-bottom: calc(var(--nav-h) + 16px); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  /* Wide screens: keep pages and the search sheet at a readable width. */
  .page { padding-left: max(16px, calc((100vw - 1100px) / 2)); padding-right: max(16px, calc((100vw - 1100px) / 2)); }
  .panel { padding-left: max(0px, calc((100vw - 760px) / 2)); padding-right: max(0px, calc((100vw - 760px) / 2)); }
  .selbar { width: min(560px, calc(100vw - 16px)); justify-content: space-between; }
  /* Photo view: tap toggles the controls; actions sit in a bottom bar. */
  .lb-top { padding-right: 12px; }
  .lb-actions { top: auto; bottom: 0; left: 0; right: 0; justify-content: space-around; padding: 18px 12px calc(var(--bottom) + 12px);
    background: linear-gradient(transparent, rgba(0,0,0,.6)); }
  .lb-actions .icon-btn { width: 48px; height: 48px; }
  .lb-actions .icon-btn svg { width: 24px; height: 24px; }
}

/* Pull to refresh (all views): a round spinner drops in from the top, like Google Photos. */
.ptr { position: fixed; z-index: 45; left: 50%; top: calc(var(--top) + var(--appbar) - 44px); width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; will-change: transform; }
.ptr svg { width: 22px; height: 22px; }
.ptr.armed { color: var(--accent); }
.ptr.spin svg { animation: ptrspin .8s linear infinite; }
.ptr.back { transition: transform .25s, opacity .25s; }
@keyframes ptrspin { to { transform: rotate(360deg); } }
