:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #181818; background: #fff; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; }
html { scrollbar-gutter: stable; }
html:has(#lightbox[open]) { background: #111; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button, input, select { min-height: 44px; border: 1px solid #dedede; border-radius: 6px; background: #fff; color: inherit; }
button { padding: 0 18px; }
button:hover { background: #f2f2f2; }
input { min-width: 0; padding: 0 14px; }
input::placeholder { color: #777; }
select { padding: 0 32px 0 14px; text-overflow: ellipsis; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#login { min-height: 100svh; display: grid; place-items: center; padding: 28px; }
#login-form { width: min(100%, 320px); display: grid; gap: 12px; }
#login-form input, #login-form button { min-height: 52px; }
#login-form button { background: #191919; color: #fff; border-color: #191919; }
#login-form button:disabled { opacity: .5; }
#login-error { margin: 0; font-size: 14px; line-height: 1.5; }
#login-error:empty { display: none; }
#toolbar { position: sticky; top: 0; z-index: 5; padding: 12px 20px; background: rgba(255,255,255,.97); backdrop-filter: blur(14px); }
.controls { display: flex; gap: 12px; align-items: center; max-width: 1800px; margin: auto; }
#album { max-width: 320px; width: 260px; }
.person-picker { position: relative; width: 280px; }
#person-search { width: 100%; }
#person-options { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: min(50svh, 360px); overflow: auto; padding: 6px; border: 1px solid #e3e3e3; border-radius: 8px; background: #fff; box-shadow: 0 10px 40px #00000014; }
#person-options button { display: flex; align-items: center; gap: 10px; border: 0; width: 100%; text-align: left; padding: 6px 10px; min-height: 48px; }
.person-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #e4e4e4; color: #555; font-size: 14px; }
.person-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#person-options button[aria-selected="true"] { background: #eee; }
#person-options p { margin: 12px; font-size: 14px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; padding: 10px; border: 0; background: transparent; color: inherit; border-radius: 6px; }
.icon-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#share-photos { margin-left: auto; }
#shuffle:disabled { opacity: .3; cursor: default; }
#chips { max-width: 1800px; margin: auto; display: flex; gap: 8px; flex-wrap: wrap; }
#chips:empty { display: none; }
#chips button { margin-top: 10px; min-height: 36px; border: 0; background: #f1f1f1; padding: 0 12px; border-radius: 20px; font-size: 14px; }
#chips button { display: inline-flex; align-items: center; gap: 8px; }
#chips button .person-avatar { flex-basis: 24px; width: 24px; height: 24px; margin-left: -5px; font-size: 12px; }
#chips button span:not(.person-avatar) { margin-left: 2px; font-size: 18px; color: #777; }
#photos { padding: 0 12px 12px; max-width: 1824px; margin: auto; }
.photo-row { display: flex; gap: 6px; margin-bottom: 6px; }
.photo { display: block; flex: none; position: relative; padding: 0; border: 0; border-radius: 0; min-height: 0; overflow: hidden; background: #f1f1f1; }
.photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo:hover { opacity: .93; }
.video-badge { position: absolute; z-index: 1; bottom: 10px; left: 10px; padding: 5px 9px; border-radius: 4px; background: #111c; color: white; font-size: 12px; }
.video-play { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; background: #111b; }
.video-play span { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 15px solid currentColor; margin-left: 4px; }
#gallery-message { text-align: center; margin: 60px 20px; color: #777; font-size: 14px; }
#gallery-message:empty { display: none; }
#lightbox { border: 0; padding: 0; margin: 0; width: 100%; max-width: none; height: 100%; max-height: none; background: #111; color: #fff; overflow: hidden; }
#lightbox[open] { display: flex; align-items: center; justify-content: center; }
#lightbox::backdrop { background: #111; }
#photo-stage { position: absolute; inset: 64px 68px 28px; overflow: hidden; touch-action: none; cursor: zoom-in; }
#photo-stage.zoomed { cursor: grab; }
#photo-stage.dragging { cursor: grabbing; }
#large-photo { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; transform-origin: center; }
#zoom-controls { display: flex; align-items: center; gap: 2px; }
#zoom-reset { width: 64px; padding: 0 4px; font-size: 13px; font-variant-numeric: tabular-nums; }
#large-video { max-width: calc(100% - 136px); width: auto; height: calc(100% - 100px); object-fit: contain; }
.lightbox-tools { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); display: flex; gap: 6px; z-index: 2; }
#lightbox .icon-button { background: #1119; }
#lightbox .icon-button:hover { background: #333; }
#lightbox .icon-button:disabled { opacity: .2; cursor: default; }
.arrow { position: absolute; top: calc(50% - 22px); z-index: 2; }
.previous { left: 12px; }
.next { right: 12px; }
#photo-error { position: absolute; text-align: center; padding: 20px; }
@media (max-width: 600px) {
  #toolbar { padding: 8px; }
  .controls { gap: 6px; }
  #album { width: 36%; padding-left: 9px; padding-right: 20px; font-size: 14px; }
  .person-picker { flex: 1; min-width: 0; }
  #person-search { padding: 0 9px; font-size: 16px; }
  #person-options { left: auto; width: min(280px, 85vw); }
  #logout { width: 40px; }
  #shuffle { width: 40px; }
  #chips { gap: 6px; }
  #chips button { min-height: 44px; margin-top: 6px; }
  #photos { padding: 0 4px 4px; }
  .photo-row { gap: 4px; margin-bottom: 4px; }
  #photo-stage { inset: 64px 0 60px; }
  #large-video { max-width: 100%; height: calc(100% - 140px); }
  .arrow { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); }
  .previous { left: calc(50% - 60px); }
  .next { right: calc(50% - 60px); }
}
@media (prefers-reduced-motion: no-preference) { .photo { transition: opacity .15s; } }

#welcome { min-height: 100svh; display: grid; place-items: center; padding: 60px 24px; }
.welcome-card { width: min(100%, 520px); text-align: center; }
.welcome-card h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(38px, 6vw, 58px); line-height: 1.08; letter-spacing: -1.6px; margin: 0 0 26px; }
.welcome-card h1:focus { outline: none; }
.welcome-card h1 { text-wrap: balance; }
.welcome-intro { font-size: 16px; line-height: 1.75; margin: 0 0 18px; color: #444; }
.welcome-private { font-size: 14px; line-height: 1.7; color: #777; max-width: 420px; margin: 0 auto 30px; }
.upload-area { background: #f6f6f5; border-radius: 12px; padding: 24px; }
.upload-choice { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; background: white; padding: 0 24px; }
.upload-choice svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#upload-files { padding: 0; margin: 20px 0 0; list-style: none; max-height: 240px; overflow: auto; text-align: left; }
#upload-files:empty, #upload-status:empty, #welcome-error:empty { display: none; }
#upload-files li { display: grid; grid-template-columns: minmax(0,1fr) 40px; column-gap: 8px; padding: 10px 0; border-bottom: 1px solid #dedede; font-size: 13px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-detail { grid-column: 1; color: #777; font-size: 12px; line-height: 1.5; margin-top: 4px; }
#upload-files button { grid-column: 2; grid-row: 1 / span 2; padding: 0; min-height: 40px; width: 40px; border: 0; background: transparent; font-size: 21px; }
.primary-button { background: #191919; color: #fff; border-color: #191919; min-height: 48px; }
.primary-button:hover { background: #333; }
#send-photos { width: 100%; margin-top: 20px; }
#upload-status { margin: 16px 0 0; font-size: 14px; line-height: 1.6; }
.welcome-continue { margin-top: 24px; min-height: 48px; border: 0; background: transparent; }
.welcome-continue span { margin-left: 10px; }
#enter-gallery { background: #191919; color: #fff; padding: 0 26px; }
#enter-gallery:hover:not(:disabled) { background: #333; }
.welcome-card button:disabled { opacity: .45; cursor: default; }
#welcome-error { font-size: 14px; line-height: 1.6; }
@media (max-width: 600px) {
  #welcome { padding: 38px 20px; }
  .upload-area { padding: 20px 16px; }
  .controls { flex-wrap: wrap; }
  #album { width: calc(100% - 150px); flex: 1; }
  .person-picker { order: 5; flex: 1 0 100%; }
  #person-options { width: 100%; }
  #share-photos { margin-left: 0; }
}
