/* Appearance is independent of the photo API and storage implementation. */
:root {
  --bg:#f7f8fa; --panel:#ffffff; --text:#20282e; --muted:#67717b;
  --line:#dfe4e8; --green:#293e4b; --soft:#e9eef2; --red:#ad3c39;
  --on-primary:#ffffff; --hover:#eff2f5; --image-bg:#e8edf0;
  --input-line:#cbd3da; --warning-bg:#fff3d9; --warning-text:#795415;
  --toast-bg:#273743; --toast-text:#ffffff; --preview-bg:#111517;
  --shadow:0 8px 28px #182d3a0a;
  font-size:17px; letter-spacing:-.2px; color-scheme:light;
}
:root[data-theme="dark"] {
  --bg:#121416; --panel:#1b1e21; --text:#edf0f3; --muted:#a0aab4;
  --line:#333a40; --green:#d3e0e8; --soft:#2b353d; --red:#f19791;
  --on-primary:#15232d; --hover:#262c31; --image-bg:#252d33;
  --input-line:#424b53; --warning-bg:#392f1d; --warning-text:#efd49b;
  --toast-bg:#d3e0e8; --toast-text:#15232d; --preview-bg:#080b0d;
  --shadow:0 8px 28px #00000020; color-scheme:dark;
}
body { background:var(--bg); color:var(--text); }
h1 { font-size:clamp(27px,3vw,33px); letter-spacing:-.8px; font-weight:600; }
h2 { font-size:21px; }
.btn { border-radius:8px; font-size:16px; padding:10px 16px; }
.btn.large { min-height:54px; font-size:18px; padding:12px 22px; }
.btn.primary { background:var(--green); color:var(--on-primary); border-color:var(--green); }
.btn:hover { background:var(--hover); filter:none; }
.btn.primary:hover { opacity:.88; background:var(--green); }
.logo { gap:10px; font-size:19px; letter-spacing:-.6px; }
.logo img { width:30px; height:30px; border-radius:7px; }
.sidebar { background:var(--panel); padding:30px 18px; }
.sidebar .logo { padding-left:11px; }
.nav { gap:3px; }
.nav button { border-radius:7px; min-height:48px; padding:11px 14px; font-size:16px; }
.nav button:hover { background:var(--hover); }
.nav button.active { background:var(--soft); color:var(--text); }
.sidebar-bottom { gap:8px; }
.main { padding:28px 38px 60px; }
.topbar { margin-bottom:36px; }
.header-actions { display:flex; align-items:center; gap:8px; }
.user-button { border-radius:8px; padding:9px 13px; font-size:15px; max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.theme-toggle { display:grid; place-items:center; width:44px; height:44px; padding:10px; border:1px solid var(--line); border-radius:8px; background:var(--panel); color:var(--text); }
.theme-toggle:hover { background:var(--hover); }
.theme-toggle svg { width:20px; height:20px; }
.theme-options { display:flex; flex-wrap:wrap; gap:8px; }
.theme-options .btn { flex:1; }
.theme-options [aria-pressed="true"] { background:var(--green); color:var(--on-primary); border-color:var(--green); }
.checkbox-row { display:flex; align-items:center; gap:10px; font-weight:400; }
.checkbox-row input { flex:0 0 23px; min-height:23px; }
.hero { padding-bottom:25px; border-bottom:1px solid var(--line); margin-bottom:24px; }
.hero p { font-size:15px; margin-top:8px; }
.hero .btn { align-self:center; }
.filters { margin-bottom:24px; }
.filters label { font-size:13px; color:var(--muted); }
input,select,textarea { border-color:var(--input-line); border-radius:7px; min-height:46px; background:var(--panel); }
.search input { border-radius:8px; }
.photo-grid { gap:15px; }
.photo-open { border-radius:7px; background:var(--image-bg); aspect-ratio:1.15; }
.photo-placeholder { color:var(--muted); }
.photo-label { font-size:13px; padding-top:8px; }
.group-heading { font-size:16px; margin-bottom:13px; font-weight:600; }
.group-heading small { font-weight:400; }
.photo-group { margin-bottom:32px; }
.select-photo { background:var(--panel); border-color:var(--muted); color:var(--text); }
.select-photo.selected { background:var(--green); color:var(--on-primary); border-color:var(--panel); }
.favorite-badge { background:#17222bad; color:#fff; }
.selection-bar { border-radius:8px; }
.empty { border:1px solid var(--line); background:var(--panel); border-radius:12px; padding:64px 24px; }
.empty-icon { font-size:30px; color:var(--muted); }
.empty h2 { font-size:21px; }
.album-card { border-radius:10px; padding:16px; }
.album-cover { border-radius:6px; }
.album-card:hover { border-color:var(--input-line); background:var(--hover); }
.panel { border-radius:10px; padding:25px; box-shadow:none; }
.panel .row { margin-top:17px; }
.panel p+p { margin-top:7px; }
.panel .row+p { margin-top:15px; }
.notice-inline { background:var(--warning-bg); color:var(--warning-text); border-radius:8px; }
.drop-target { border-color:var(--input-line); border-radius:10px; background:var(--bg); }
.drop-target.dragover { background:var(--soft); border-color:var(--green); }
.drop-target p { font-size:16px; }
.upload-state { color:var(--muted); }
.upload-state.failed { color:var(--red); }
.upload-summary { display:grid; gap:8px; margin:20px 0; padding:16px; border:1px solid var(--line); border-radius:10px; }
.upload-summary progress { width:100%; height:10px; accent-color:var(--green); }
.invitation-list { display:grid; gap:12px; margin-top:20px; }
.invitation-card { display:grid; gap:9px; padding:17px; border:1px solid var(--line); border-radius:10px; }
.invitation-code { overflow-wrap:anywhere; min-width:0; }
.status-badge { display:inline-flex; align-items:center; padding:4px 9px; border-radius:6px; font-size:12px; font-weight:500; color:var(--muted); background:var(--soft); white-space:nowrap; }
.status-badge.success { color:var(--green); }
.status-badge.failure { color:var(--red); }
.upload-filters { display:flex; flex-wrap:wrap; gap:4px; }
.upload-list-tools { display:flex; align-items:center; gap:10px 16px; flex-wrap:wrap; margin:16px 0; }
.upload-list-tools .btn { min-height:44px; }
.upload-thumbnail { position:relative; }
.upload-thumbnail .upload-video-mark { position:absolute; right:4px; bottom:4px; z-index:1; background:#15232dbd; color:#fff; border-radius:4px; padding:1px 5px; font-size:15px; }
.video-badge { position:absolute; left:8px; bottom:8px; color:#fff; background:#15232dbd; border-radius:5px; padding:3px 7px; font-size:12px; pointer-events:none; }
.upload-filters .btn { font-size:13px; padding:6px 10px; min-height:38px; }
.upload-filters [aria-pressed=true] { background:var(--soft); color:var(--text); border-color:var(--line); }
.upload-row { display:grid; grid-template-columns:76px minmax(0,1fr); gap:13px; align-items:start; padding:13px 0; }
.upload-thumbnail { width:76px; height:76px; position:relative; display:grid; place-items:center; overflow:hidden; border-radius:8px; background:var(--soft); color:var(--muted); font-size:12px; }
.upload-thumbnail img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.upload-file-detail { display:grid; gap:4px; min-width:0; }
.upload-file-detail .upload-name { white-space:normal; overflow-wrap:anywhere; min-width:0; flex:1; }
.upload-file-detail .btn { justify-self:start; margin-top:6px; min-height:38px; font-size:13px; }
.people-status { display:grid; gap:14px; padding:22px; border:1px solid var(--line); border-radius:10px; background:var(--panel); margin-bottom:28px; }
.people-status-heading,.people-status-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.people-status-heading h2 { font-size:18px; margin-bottom:5px; }
.people-status progress { width:100%; height:8px; accent-color:var(--green); }
.people-status-footer .row { gap:6px; }
.people-status-footer .btn { min-height:44px; font-size:14px; padding:8px 12px; }
.people-local-note { color:var(--muted); font-size:12px; padding-top:12px; border-top:1px solid var(--line); }
.people-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:16px; }
.person-card { display:grid; align-content:start; justify-items:center; gap:7px; min-width:0; padding:20px 14px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:var(--panel); text-align:center; }
.person-card:hover { background:var(--hover); border-color:var(--input-line); }
.person-card strong { font-size:16px; font-weight:500; max-width:100%; overflow-wrap:anywhere; }
.person-portrait,.face-portrait { position:relative; display:grid; place-items:center; overflow:hidden; background:var(--image-bg); color:var(--muted); }
.person-portrait { width:112px; height:112px; border-radius:50%; margin-bottom:5px; }
.person-portrait svg { width:57px; height:57px; }
.person-portrait img,.face-portrait img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.people-empty .empty-icon svg { width:40px; height:40px; }
.photo-faces { margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.photo-faces h3 { font-size:17px; }
.photo-faces>.muted { margin:7px 0 15px; }
.photo-faces>.row .btn { min-height:44px; padding:6px 12px; font-size:13px; }
.photo-face-list { list-style:none; padding:0; margin:0; display:grid; gap:13px; }
.photo-face { display:grid; grid-template-columns:72px minmax(0,1fr); gap:14px; align-items:center; padding:13px; border:1px solid var(--line); border-radius:9px; }
.face-portrait { width:72px; height:72px; border-radius:8px; flex-shrink:0; }
.face-portrait svg { width:40px; height:40px; }
.photo-face-content { min-width:0; }
.photo-face-content strong { display:block; font-size:15px; font-weight:500; overflow-wrap:anywhere; margin-bottom:5px; }
.face-actions { display:flex; flex-wrap:wrap; gap:3px 6px; }
.face-actions .btn { min-height:44px; font-size:13px; padding:7px 10px; white-space:normal; text-align:left; }
.face-edit-preview { display:flex; align-items:center; gap:15px; padding:14px; border:1px solid var(--line); border-radius:9px; }
.face-edit-preview p { overflow-wrap:anywhere; }
.person-merge-section { display:grid; gap:12px; margin-top:28px; padding-top:23px; border-top:1px solid var(--line); }
.person-merge-section h3 { font-size:17px; }
.person-merge-section .btn { justify-self:start; }
.ignored-faces { margin-top:16px; border-top:1px solid var(--line); padding-top:8px; }
.ignored-faces summary { padding:11px 0; min-height:44px; color:var(--muted); cursor:pointer; font-size:14px; }
.ignored-faces[open] summary { margin-bottom:5px; }
@media(max-width:700px){
  .people-status { padding:17px; gap:13px; margin-bottom:23px; }
  .people-status-heading h2 { font-size:17px; }
  .people-status-footer { align-items:flex-start; }
  .people-status-footer .row { width:100%; }
  .people-status-footer .btn { flex:1; white-space:normal; }
  .people-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
  .person-card { padding:18px 10px; }
  .person-portrait { width:98px; height:98px; }
  .person-card strong { font-size:15px; }
  .photo-face { grid-template-columns:60px minmax(0,1fr); padding:11px; gap:11px; align-items:start; }
  .photo-face .face-portrait { width:60px; height:60px; }
  .face-actions { gap:3px; }
  .face-actions .btn { padding:7px 9px; }
}
@media(max-width:480px){.upload-row{grid-template-columns:60px minmax(0,1fr);gap:10px}.upload-thumbnail{width:60px;height:60px}.upload-file-detail .row{gap:5px;align-items:start}.invitation-card{padding:13px}.invitation-card .btn{font-size:13px;padding:9px 11px}}
dialog { border-radius:14px; box-shadow:0 22px 80px #00000050; }
dialog::backdrop { background:#0b1016b8; backdrop-filter:blur(3px); }
.close { background:transparent; border:1px solid var(--line); border-radius:8px; font-size:23px; }
.close:hover { background:var(--hover); }
.detail-media { border-radius:8px; background:var(--preview-bg); color:#e9edf1; }
.photo-swipe-surface { touch-action:pan-y pinch-zoom; }
.viewport-zoomed .photo-swipe-surface { touch-action:auto; }
.photo-swipe-surface img { -webkit-user-drag:none; user-select:none; }
.photo-viewer-position { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 14px; color:var(--muted); font-size:12px; margin-top:10px; }
.photo-swipe-hint { display:none; }
@media(pointer:coarse),(max-width:700px) { .photo-swipe-hint { display:inline; } }
.detail-form label { color:var(--muted); font-weight:400; }
.detail-form input,.detail-form textarea { color:var(--text); }
.detail-info { margin-top:10px; }
.login-shell { margin-top:8vh; }
.login-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:28px; }
.login-heading .logo { margin:0; }
.login-card { border-radius:14px; box-shadow:var(--shadow); }
.login-card h1 { font-size:28px; }
.login-note { color:var(--muted); }
.storage-dot { background:#7c9d82; }
.storage-dot.offline { background:var(--red); }
#notice { border-radius:9px; background:var(--toast-bg); color:var(--toast-text); }
@media(max-width:1000px) {
  .main { padding:24px; }
  .hero .btn { align-self:stretch; }
}
@media(max-width:700px) {
  .main { padding:19px 16px 65px; }
  .topbar { margin-bottom:22px; gap:14px 8px; }
  .logo { font-size:17px; gap:8px; }
  .logo img { width:29px; height:29px; }
  .header-actions { gap:7px; }
  .user-button { font-size:13px; padding:9px 10px; max-width:110px; }
  .theme-toggle { width:42px; height:44px; }
  .hero { gap:19px; padding-bottom:22px; margin-bottom:22px; }
  .hero h1 { font-size:28px; }
  .hero .btn.large { min-height:56px; font-size:18px; }
  .hero p { font-size:14px; }
  .mobile-nav { gap:5px; padding-bottom:18px; border-bottom:1px solid var(--line); margin-bottom:24px; }
  .mobile-nav button { border:0; border-radius:6px; background:transparent; padding:10px 13px; min-height:44px; font-size:14px; color:var(--muted); }
  .mobile-nav button.active { background:var(--soft); color:var(--text); }
  .photo-grid { gap:13px 10px; }
  .photo-open { border-radius:6px; }
  .photo-label { font-size:12px; }
  .group-heading { font-size:15px; }
  .album-card { padding:12px; }
  .album-cover { height:110px; }
  .panel { padding:20px; }
  .btn { font-size:15px; }
}
@media(max-width:355px) {
  .logo { font-size:16px; }
  .logo img { width:26px; height:26px; }
  .user-button { max-width:83px; }
  .header-actions { gap:5px; }
  .theme-toggle { width:40px; }
}

/* Gallery gestures affect tile size; page zoom elsewhere remains available. */
#app[data-gallery-density] .photo-grid {
  grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--photo-min-size,190px)),1fr));
  touch-action:pan-y;
}
.gallery-size-tools { display:flex; align-items:center; justify-content:space-between; gap:10px 20px; flex-wrap:wrap; margin:0 0 22px; }
.gallery-size-control { display:flex; align-items:center; gap:8px; font-size:13px; }
.gallery-size-control>span { color:var(--muted); margin-right:3px; }
.gallery-size-control button { width:44px; height:44px; padding:0; border:1px solid var(--line); border-radius:7px; background:var(--panel); font-size:22px; }
.gallery-size-control button:disabled { cursor:default; opacity:.35; }
.gallery-size-control output { min-width:70px; text-align:center; font-size:13px; }
.pinch-hint { display:none; font-size:12px; }
#app[data-gallery-density="3"] .photo-grid { gap:7px; }
#app[data-gallery-density="4"] .photo-grid { gap:4px; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .photo-label { display:none; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .photo-open { aspect-ratio:1; border-radius:4px; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .video-badge { left:4px; bottom:4px; padding:2px 5px; font-size:0; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .video-badge::before { content:'▷'; font-size:12px; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .photo-placeholder { padding:3px; font-size:10px; gap:3px; }
#app:is([data-gallery-density="3"],[data-gallery-density="4"]) .select-photo { left:3px; top:3px; }
@media(max-width:700px) {
  #app[data-gallery-density] .photo-grid { grid-template-columns:repeat(var(--photo-columns,2),minmax(0,1fr)); }
  .pinch-hint { display:block; }
}
