:root {
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #e8b86d;
  --accent-dim: #c49a4a;
  --surface: #161616;
  --border: #2a2a2a;
  --btn: rgba(28, 28, 28, 0.88);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: Outfit, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

.wordmark {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 48px; padding: .7rem 1.15rem;
  border-radius: .75rem; border: 1px solid rgba(255,255,255,.14);
  cursor: pointer; font-weight: 600; font-size: 1rem;
  background: var(--btn); color: var(--fg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: rgba(232,184,109,.95); color: #1a1205; border-color: transparent; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-ghost { background: var(--btn); }
.btn-icon { width: 48px; min-width: 48px; padding: 0; }
.btn-icon svg { width: 22px; height: 22px; display: block; }
.btn-sm { min-height: 40px; padding: .45rem .8rem; font-size: .9rem; }

.input {
  width: 100%; min-height: 48px; padding: .75rem 1rem;
  border-radius: .75rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); font-size: 1.05rem;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.screen { min-height: 100dvh; padding-bottom: 6.5rem; }
.topbar {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1rem;
  position: sticky; top: 0; z-index: 15;
  background: rgba(10,10,10,.92);
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar .crumb {
  flex: 1; min-width: 0;
  display: flex; flex-wrap: wrap; gap: .3rem; align-items: center;
  font-size: .95rem; color: var(--muted); padding: 0;
}
.topbar .crumb a { color: var(--fg); }
.topbar .crumb a:hover { color: var(--accent); }
.topbar .crumb .here { color: var(--accent); font-weight: 600; }

.header {
  padding: 1rem 1.15rem .75rem;
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.header h1 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.muted { color: var(--muted); }

.grid-albums {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem;
  padding: 0 1rem;
}
@media (min-width: 640px) { .grid-albums { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid-albums { grid-template-columns: repeat(4, 1fr); } }

.album-card {
  position: relative; aspect-ratio: 4/5; border-radius: 1rem; overflow: hidden;
  background: var(--surface); display: block;
}
.album-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.album-card .shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,.2) 42%, transparent);
}
.album-card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: .75rem; }
.album-card .meta strong { display: block; font-size: 1.05rem; line-height: 1.2; }
.album-card .share-btn {
  position: absolute; top: .55rem; right: .55rem; z-index: 2;
  width: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: .65rem;
}
.badge-new {
  position: absolute; top: .55rem; left: .55rem; z-index: 2;
  background: var(--accent); color: #111; font-size: .7rem; font-weight: 700;
  padding: .25rem .5rem; border-radius: .4rem;
}

.fab {
  position: fixed; left: 0; right: 0; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap;
  padding: 0 1rem; z-index: 20; pointer-events: none;
}
.fab .btn { pointer-events: auto; box-shadow: 0 8px 28px rgba(0,0,0,.5); }

.grid-photos {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; padding: 0 1rem;
}
@media (min-width: 640px) { .grid-photos { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 960px) { .grid-photos { grid-template-columns: repeat(5, 1fr); } }

.ph {
  aspect-ratio: 1; background: var(--surface); border-radius: .5rem; overflow: hidden;
  border: none; padding: 0; position: relative; cursor: pointer;
}
.ph img, .ph video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .proc {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .7rem; text-align: center; padding: .25rem;
}
.ph .play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 2.2rem; height: 2.2rem; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
  border: 1px solid rgba(255,255,255,.35);
}
.ph .dur {
  position: absolute; right: .3rem; bottom: .3rem;
  background: rgba(0,0,0,.65); color: #fff; font-size: .65rem;
  padding: .1rem .35rem; border-radius: .3rem;
}
.ph.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.ph .check {
  position: absolute; top: .35rem; right: .35rem; width: 1.4rem; height: 1.4rem;
  border-radius: .35rem; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.7);
  display: none; align-items: center; justify-content: center; color: #111; font-size: .85rem; font-weight: 700;
}
.select-mode .ph .check { display: flex; }
.ph.selected .check { background: var(--accent); border-color: var(--accent); }

.sel-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom));
  background: rgba(10,10,10,.94); border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
}

.subgrid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; padding: 0 1rem 1rem; }
@media (min-width: 640px) { .subgrid { grid-template-columns: repeat(3,1fr); } }
.subcard {
  position: relative; aspect-ratio: 16/9; border-radius: .75rem; overflow: hidden; background: var(--surface);
}
.subcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.subcard .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.8), transparent); }
.subcard .meta { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; }
.subcard .share-btn {
  position: absolute; top: .4rem; right: .4rem; z-index: 2;
  width: 44px; min-width: 44px; min-height: 44px; padding: 0; border-radius: .55rem;
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center; padding: 1rem;
}
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 1rem;
  width: 100%; max-width: 28rem; padding: 1.25rem; max-height: 90dvh; overflow: auto;
}
.modal h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.center { text-align: center; }
.err { color: #f87171; }
.ok { color: var(--accent); word-break: break-all; }

.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.login-card { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 1.5rem; }
.logo-mark {
  width: 4rem; height: 4rem; border: 2px solid rgba(245,245,245,.8); border-radius: 1rem;
  margin: 0 auto; position: relative;
}
.logo-mark::after {
  content: ''; position: absolute; top: -.25rem; right: -.25rem;
  width: 1rem; height: 1rem; border-radius: 999px; background: var(--accent);
}

.list-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: .75rem;
  padding: .85rem; display: flex; justify-content: space-between; gap: .5rem; align-items: center; flex-wrap: wrap;
  color: var(--fg);
}
.list-item button {
  color: var(--fg);
}
.list-item button[data-pick] {
  flex: 1; text-align: left; background: none; border: 0; padding: .15rem 0;
  font: inherit; font-weight: 600; color: var(--fg); cursor: pointer;
}
.list-item .slide-toggle,
.header .slide-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem; color: var(--muted); white-space: nowrap;
  min-height: 40px; cursor: pointer; user-select: none;
}
.list-item .slide-toggle input,
.header .slide-toggle input {
  width: 1.15rem; height: 1.15rem; accent-color: var(--accent);
}
.album-card .badge-off {
  position: absolute; top: .55rem; left: .55rem; z-index: 2;
  background: rgba(0,0,0,.65); color: #ddd; font-size: .65rem; font-weight: 600;
  padding: .25rem .45rem; border-radius: .4rem; border: 1px solid rgba(255,255,255,.2);
}
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; padding: 0 1rem; }

.viewer {
  position: fixed; inset: 0; background: #000; z-index: 50; touch-action: none; user-select: none;
}
.viewer .slide-layer {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.viewer .slide-layer img,
.viewer .slide-layer video {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
}
.viewer .slide-layer video { pointer-events: auto; }
.viewer-top, .viewer-bottom {
  position: absolute; left: 0; right: 0; z-index: 4;
  padding: 1rem; display: flex; justify-content: space-between; align-items: flex-start;
  background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);
  pointer-events: none;
}
.viewer-bottom {
  bottom: 0; top: auto; flex-direction: column; align-items: center; gap: .75rem;
  background: linear-gradient(to top, rgba(0,0,0,.88), transparent); padding-bottom: 2rem;
}
.viewer-top > *, .viewer-bottom > * { pointer-events: auto; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 3.25rem; height: 3.25rem; min-width: 3.25rem; min-height: 3.25rem;
  padding: 0; border-radius: .85rem; font-size: 2rem; line-height: 1;
  background: rgba(28,28,28,.88); color: var(--fg);
  border: 1px solid rgba(255,255,255,.18);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.viewer-nav.prev { left: 1rem; }
.viewer-nav.next { right: 1rem; }
.viewer-nav:hover { background: rgba(232,184,109,.92); color: #1a1205; border-color: transparent; }
.viewer-hint {
  position: absolute; left: 50%; bottom: 7.5rem; transform: translateX(-50%);
  z-index: 4; font-size: .8rem; pointer-events: none; opacity: .7;
  display: none;
}
.mobile-only { display: none !important; }
@media (max-width: 767px) {
  .mobile-only { display: block !important; }
  .viewer-nav { width: 2.75rem; height: 2.75rem; min-width: 2.75rem; min-height: 2.75rem; font-size: 1.75rem; }
}

/* Ken Burns — only while slideshow plays */
@keyframes kbZoomIn {
  from { transform: scale(1); }
  to { transform: scale(1.14); }
}
@keyframes kbZoomOut {
  from { transform: scale(1.14); }
  to { transform: scale(1); }
}
@keyframes kbPanA {
  from { transform: scale(1.08) translate(0, 0); }
  to { transform: scale(1.18) translate(-3%, -2%); }
}
@keyframes kbPanB {
  from { transform: scale(1.08) translate(0, 0); }
  to { transform: scale(1.18) translate(3%, 2%); }
}
@keyframes kbPanC {
  from { transform: scale(1.1) translate(2%, -1%); }
  to { transform: scale(1.2) translate(-2%, 2%); }
}
@keyframes kbPanD {
  from { transform: scale(1.06) translate(-2%, 1%); }
  to { transform: scale(1.16) translate(2%, -2%); }
}
.kb-zoom-in { animation-name: kbZoomIn; animation-timing-function: linear; animation-fill-mode: forwards; }
.kb-zoom-out { animation-name: kbZoomOut; animation-timing-function: linear; animation-fill-mode: forwards; }
.kb-pan-zoom-a { animation-name: kbPanA; animation-timing-function: linear; animation-fill-mode: forwards; }
.kb-pan-zoom-b { animation-name: kbPanB; animation-timing-function: linear; animation-fill-mode: forwards; }
.kb-pan-zoom-c { animation-name: kbPanC; animation-timing-function: linear; animation-fill-mode: forwards; }
.kb-pan-zoom-d { animation-name: kbPanD; animation-timing-function: linear; animation-fill-mode: forwards; }

.panel {
  width: min(28rem, calc(100% - 2rem));
  background: rgba(22,22,22,.95); border: 1px solid var(--border); border-radius: 1rem; padding: 1rem;
}
.range-wrap { display: flex; flex-direction: column; gap: .4rem; }
.range-wrap input[type=range] {
  width: 100%; accent-color: var(--accent); height: 1.5rem;
}
.range-labels {
  display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem;
}
