.gallery-controls{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:24px 0}.gallery-controls label,.gallery-manage label{display:grid;gap:6px;color:var(--text)}.gallery-controls select,.gallery-manage select,.gallery-manage input{width:min(100%,360px);min-height:43px;padding:9px 12px;background:var(--surface);border:1px solid var(--line);color:var(--text);border-radius:8px;font:inherit}.gallery-manage{border:1px solid var(--line);border-radius:12px;padding:18px 22px;margin-top:55px;background:var(--surface)}.gallery-manage summary{cursor:pointer;font-size:18px;color:var(--text)}.gallery-manage form{display:grid;gap:15px;max-width:550px;margin:18px 0}.gallery-manage button{justify-self:start}.gallery-item button{border:0;background:none;padding:0;display:block;width:100%;cursor:zoom-in}.gallery-item img{width:100%;height:auto;aspect-ratio:4/3;object-fit:cover}.gallery-item .gallery-delete{cursor:pointer;width:auto;margin:0 14px 14px;color:#ffb6b6;border:1px solid #ad4343;border-radius:6px;padding:5px 12px;font-size:13px}.gallery-item figcaption{min-height:58px}#gallery-more{margin-top:24px}#gallery-viewer{padding:20px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);max-width:min(96vw,1200px);max-height:94vh}#gallery-viewer::backdrop{background:#000c}#gallery-viewer img{display:block;max-width:100%;max-height:75vh;margin:auto}#gallery-viewer p{margin:10px 0 0}#gallery-viewer-close{float:right;margin-bottom:10px}html[data-theme=light] .gallery-item{background:#fff}html[data-theme=light] .gallery-manage{background:#fff}html[data-theme=light] #gallery-viewer{background:#fff}
/* Shared responsive photo experience; uses the existing B2 theme tokens. */
.gallery-upload-public{position:relative;padding:clamp(18px,3vw,28px);margin:24px 0 32px;border:1px solid var(--line,#284457);border-radius:22px;background:linear-gradient(135deg,#28c7f214,transparent 65%),var(--surface,#0c1924)}
.gallery-upload-public h2{margin:0 0 8px}.gallery-upload-public p{margin:0 0 16px;color:var(--muted,#aebfcd)}
#gallery-upload{display:grid;gap:14px}#gallery-upload label{display:grid;gap:8px;color:var(--text,#edf5fa)}
#gallery-upload input{width:100%;min-width:0;padding:12px;border:1px solid var(--line,#365469);border-radius:10px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}
#gallery-file{border-style:dashed!important;cursor:pointer}#gallery-file::file-selector-button{border:0;border-radius:7px;background:#59d0f1;color:#08202d;padding:10px 14px;margin-right:12px;cursor:pointer}
.gallery-upload-actions{display:flex;gap:10px;flex-wrap:wrap}.gallery-upload-actions button{background:transparent;color:var(--text,#eaf5fa);border-color:var(--line,#365469)}
.gallery-upload-queue{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:10px;max-height:440px;overflow:auto;overscroll-behavior:contain}
.gallery-queue-item{display:flex;gap:12px;align-items:center;min-width:0;padding:10px;border:1px solid var(--line,#365469);border-radius:12px;background:var(--surface,#0b1924)}
.gallery-queue-item img{width:56px;height:56px;object-fit:cover;border-radius:8px;flex-shrink:0}.gallery-queue-item>div{min-width:0;flex:1}.gallery-queue-item strong{display:block;font-size:13px;overflow-wrap:anywhere;font-weight:500}.gallery-queue-item span{display:block;font-size:12px;line-height:1.5;color:var(--muted,#adc1cf)}
.gallery-queue-item button{font-size:12px;padding:6px 9px;min-height:44px;flex-shrink:0;background:transparent;color:var(--text,#edf5fa);border-color:var(--line,#365469)}
.gallery-queue-item.state-success{border-color:#36a97c}.gallery-queue-item.state-failed,.gallery-queue-item.state-invalid,.gallery-queue-item.state-unknown{border-color:#c68b43}.gallery-queue-item.state-uploading{border-color:#58d2f6;background:#26c4ef12}
#gallery-upload-status{margin-top:14px;overflow-wrap:anywhere}button:disabled{opacity:.5;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #52ccef;outline-offset:4px}
.gallery-upload-tags{display:grid;gap:10px;margin:0;padding:12px;border:1px solid var(--line,#365469);border-radius:12px}.gallery-upload-tags>legend{padding:0 6px;font-weight:700}.gallery-upload-tags>p{margin:0;font-size:13px}.gallery-upload-tag-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr));gap:8px;max-height:220px;overflow:auto}.gallery-upload-tag-options fieldset{display:grid;align-content:start;gap:6px;margin:0;padding:8px;border:1px solid var(--line,#365469);border-radius:9px}.gallery-upload-tag-options legend{padding:0 4px;font-size:12px;color:var(--muted,#adc1cf)}.gallery-upload-tag-options label{display:flex!important;grid-template-columns:none!important;align-items:center;gap:7px!important;font-size:13px}.gallery-upload-tag-options input[type=checkbox]{width:auto!important;padding:0!important}.gallery-queue-item label{margin-top:5px;font-size:12px}.gallery-queue-item label input{padding:7px!important;font-size:13px}
.gallery-controls{padding:16px 0;border-bottom:1px solid var(--line,#294557)}.gallery-controls select{max-width:100%;flex:1;min-width:0}.gallery-controls>label{font-size:13px;letter-spacing:.03em}
.gallery-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,210px),1fr));gap:18px;margin-top:22px}.gallery-item{border-radius:16px;border:1px solid var(--line,#284457);background:var(--surface,#0c1924);box-shadow:0 8px 26px #0001;transition:transform .15s ease,box-shadow .15s ease}.gallery-item:hover{transform:translateY(-3px);box-shadow:0 12px 32px #0003}
.gallery-item button{overflow:hidden;border-radius:0;min-height:0}.gallery-item img{aspect-ratio:4/3;object-fit:cover;transition:transform .2s ease;background:#ffffff08}.gallery-item button:hover img{transform:scale(1.025)}.gallery-item figcaption{padding:14px 16px;min-height:0;color:var(--text,#dceaf3);overflow-wrap:anywhere;font-size:13px}.gallery-item .gallery-delete{min-height:44px;border-radius:8px}
#gallery-grid[aria-busy=true]{opacity:.65}#gallery-status:not(:empty){padding:22px;border:1px dashed var(--line,#365469);border-radius:14px;margin:18px 0;text-align:center;color:var(--text,#dceaf3)}
#gallery-viewer{width:min(96vw,1200px);max-width:96vw;max-height:96dvh;padding:18px;border-radius:20px;box-sizing:border-box;overflow:auto}#gallery-viewer-image{clear:both;max-height:70dvh;object-fit:contain;width:100%;touch-action:pan-y pinch-zoom}#gallery-viewer-caption{color:var(--text,#e8f5fc);overflow-wrap:anywhere;padding:10px 4px}#gallery-viewer-close{min-width:80px}.gallery-viewer-nav{display:flex;align-items:center;justify-content:space-between;gap:10px}.gallery-viewer-nav button{min-width:90px}.gallery-viewer-nav span{color:var(--text,#e8f5fc);white-space:nowrap;font-size:13px}
html[data-theme=light] .gallery-upload-public{background:linear-gradient(135deg,#eafaff,#fff)}html[data-theme=light] .gallery-queue-item{background:#fff}html[data-theme=light] .gallery-queue-item span{color:#476073}html[data-theme=light] .gallery-upload-public p{color:#476073}html[data-theme=light] #gallery-upload input{background:#fff;color:#182b3a}html[data-theme=light] .gallery-upload-actions button,html[data-theme=light] .gallery-queue-item button{color:#182b3a}html[data-theme=light] .gallery-item figcaption,html[data-theme=light] #gallery-viewer-caption,html[data-theme=light] .gallery-viewer-nav span{color:#182b3a}
@media(max-width:520px){.gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.gallery-item{border-radius:12px}.gallery-item figcaption{font-size:12px;padding:10px}.gallery-upload-public{padding:16px;border-radius:16px}.gallery-queue-item button{font-size:11px}.gallery-viewer-nav button{min-width:0;font-size:12px;padding:10px}#gallery-viewer{padding:12px}}
@media(prefers-reduced-motion:reduce){.gallery-item,.gallery-item img{transition:none}.gallery-item:hover{transform:none}}
.gallery-item .gallery-edit{cursor:pointer;width:auto;margin:0 8px 14px 14px;border:1px solid var(--line,#365469);border-radius:8px;padding:7px 12px;font-size:13px}.gallery-attribution{margin:0;padding:0 16px 14px;color:var(--muted,#adc1cf);font-size:12px;line-height:1.45}.gallery-item figcaption+.gallery-attribution{margin-top:-7px}.gallery-filters input{width:min(100%,220px);min-height:43px;padding:9px 12px;background:var(--surface);border:1px solid var(--line);color:var(--text);border-radius:8px;font:inherit}
.gallery-tag-prompt{position:sticky;bottom:14px;z-index:4;display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:20px auto 0;padding:14px 16px;max-width:780px;border:1px solid #42c9ee;border-radius:14px;background:var(--surface,#0c1924);box-shadow:0 12px 36px #0008}.gallery-tag-prompt>div{display:grid;gap:3px;flex:1;min-width:220px}.gallery-tag-prompt span{font-size:13px;color:var(--muted,#adc1cf)}
#gallery-metadata-dialog{width:min(94vw,720px);max-height:92dvh;padding:0;border:1px solid var(--line,#365469);border-radius:20px;background:var(--surface,#0c1924);color:var(--text,#edf5fa)}#gallery-metadata-dialog::backdrop{background:#000b}#gallery-metadata-form{display:grid;gap:18px;max-width:none;margin:0;padding:clamp(18px,4vw,28px)}.gallery-dialog-head{display:flex;justify-content:space-between;align-items:start;gap:16px}.gallery-dialog-head h2{margin:3px 0}.gallery-dialog-head .eyebrow{margin:0}.gallery-metadata-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.gallery-metadata-fields label,.gallery-player-search{display:grid;gap:7px}.gallery-metadata-fields small{color:var(--muted,#adc1cf)}#gallery-metadata-dialog fieldset{display:grid;gap:12px;margin:0;padding:16px;border:1px solid var(--line,#365469);border-radius:14px}#gallery-metadata-dialog input{width:100%;min-width:0;box-sizing:border-box;padding:11px 12px;border:1px solid var(--line,#365469);border-radius:9px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}.gallery-player-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:260px;overflow:auto}.gallery-player-option{display:flex!important;align-items:center;gap:9px;padding:10px;border:1px solid var(--line,#365469);border-radius:9px;cursor:pointer}.gallery-player-option input{width:auto!important;margin:0;accent-color:#4acdf2}.gallery-player-chips{display:flex;gap:7px;flex-wrap:wrap}.gallery-player-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 7px 5px 10px;border:1px solid #42c9ee;border-radius:999px;background:#34c5ef18;font-size:13px}.gallery-player-chip button{min-height:30px;min-width:30px;padding:0;border:0;background:transparent;color:inherit}.gallery-dialog-actions{display:flex;gap:10px;flex-wrap:wrap}
html[data-theme=light] #gallery-metadata-dialog,html[data-theme=light] .gallery-tag-prompt{background:#fff}html[data-theme=light] #gallery-metadata-dialog input{background:#fff;color:#182b3a}html[data-theme=light] .gallery-attribution{color:#476073}
@media(max-width:520px){.gallery-metadata-fields,.gallery-player-options{grid-template-columns:1fr}.gallery-tag-prompt{bottom:6px}.gallery-filters>label{width:calc(50% - 6px)}.gallery-filters>label input,.gallery-filters>label select{width:100%}.gallery-attribution{padding:0 10px 10px;font-size:11px}}
.gallery-browser{display:grid;grid-template-columns:minmax(210px,260px) minmax(0,1fr);gap:28px;align-items:start}.gallery-tags{position:sticky;top:88px;max-height:calc(100dvh - 110px);overflow:auto;padding:16px;border:1px solid var(--line,#294557);border-radius:16px;background:var(--surface,#0c1924)}.gallery-tags-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.gallery-tags-head h2{margin:0}.gallery-tags-head button{display:none}.gallery-tag-all{width:100%;margin:12px 0;text-align:left;background:transparent;color:var(--text,#edf5fa);border-color:transparent}.gallery-tag-all.is-active{border-color:#42c9ee;background:#32c5ef18}.gallery-tag-group{display:grid;gap:5px;padding:13px 0;border-top:1px solid var(--line,#294557)}.gallery-tag-group>div{display:flex;align-items:center;justify-content:space-between;gap:8px}.gallery-tag-group h3{margin:0;font-size:14px}.gallery-tag-group>div button{min-height:32px;padding:4px 8px;font-size:11px}.gallery-tag-choice{display:grid!important;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:8px;padding:8px;border-radius:8px;cursor:pointer}.gallery-tag-choice:hover{background:#35c7ef12}.gallery-tag-choice input{width:auto!important;margin:0;accent-color:#42c9ee}.gallery-tag-choice small{color:var(--muted,#adc1cf)}.gallery-tags-open{display:none}.gallery-result-tools{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin-bottom:12px}.gallery-result-tools label{display:grid;gap:6px}.gallery-result-tools .gallery-search{flex:1;min-width:min(100%,260px)}.gallery-result-tools input,.gallery-result-tools select{width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--line,#365469);border-radius:9px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}.gallery-result-tools span{margin-left:auto;padding-bottom:10px;color:var(--muted,#adc1cf)}.gallery-selected-tags{display:flex;gap:7px;flex-wrap:wrap}.gallery-selected-tag{min-height:36px;padding:6px 10px;border:1px solid #42c9ee;border-radius:999px;background:#32c5ef18;color:var(--text,#edf5fa);font-size:12px}.gallery-card-tags{display:flex;gap:5px;flex-wrap:wrap;padding:0 14px 10px}.gallery-card-tags span{padding:3px 7px;border:1px solid var(--line,#365469);border-radius:999px;color:var(--muted,#adc1cf);font-size:10px}.gallery-edit-tag-groups{display:grid;gap:12px;max-height:360px;overflow:auto}.gallery-edit-tag-groups section{display:grid;gap:5px}.gallery-edit-tag-groups h3{position:sticky;top:0;z-index:1;margin:0;padding:8px;background:var(--surface,#0c1924);font-size:14px}.gallery-edit-tag{display:flex!important;align-items:center;gap:9px;padding:10px;border:1px solid var(--line,#365469);border-radius:9px;cursor:pointer}.gallery-edit-tag input{width:auto!important;accent-color:#42c9ee}.gallery-edit-tag:has(input:disabled){opacity:.62}.gallery-new-tag{grid-template-columns:minmax(110px,.5fr) minmax(180px,1fr) auto;align-items:end}.gallery-new-tag legend{grid-column:1/-1}.gallery-new-tag label{display:grid;gap:6px}.gallery-new-tag select{min-height:44px;padding:9px;border:1px solid var(--line,#365469);border-radius:9px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}
html[data-theme=light] .gallery-tags{background:#fff}html[data-theme=light] .gallery-edit-tag-groups h3{background:#fff}html[data-theme=light] .gallery-result-tools input,html[data-theme=light] .gallery-result-tools select,html[data-theme=light] .gallery-new-tag select{background:#fff;color:#182b3a}
@media(max-width:760px){.gallery-browser{grid-template-columns:1fr}.gallery-tags-open{display:inline-flex;margin:12px 0}.gallery-tags{position:fixed;inset:0 auto 0 0;z-index:20;width:min(88vw,340px);max-height:none;border-radius:0;transform:translateX(-105%);transition:transform .18s ease;box-shadow:18px 0 50px #0009}.gallery-tags.is-open{transform:translateX(0)}.gallery-tags-head button{display:inline-flex}.gallery-result-tools span{margin-left:0}.gallery-new-tag{grid-template-columns:1fr}.gallery-new-tag legend{grid-column:auto}}
@media(prefers-reduced-motion:reduce){.gallery-tags{transition:none}}
[hidden]{display:none!important}
#gallery-metadata-dialog{overflow:hidden}#gallery-metadata-form{box-sizing:border-box;max-height:92dvh;overflow:auto;overscroll-behavior:contain}.gallery-dialog-actions{position:sticky;bottom:-1px;z-index:3;margin:0 -4px -4px;padding:12px 4px 4px;background:linear-gradient(transparent,var(--surface,#0c1924) 18%)}html[data-theme=light] .gallery-dialog-actions{background:linear-gradient(transparent,#fff 18%)}
/* Staged viewer-side editor: one photo list, compact tags, reachable actions. */
#gallery-viewer{width:min(96vw,1380px);max-width:96vw;padding:14px;overflow:auto;position:relative}.gallery-viewer-shell{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}.gallery-viewer-shell>.gallery-viewer-media{min-width:0}.gallery-viewer-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.gallery-viewer-head button{float:none;margin:0}.gallery-viewer-media #gallery-viewer-image{max-height:68dvh}.gallery-viewer-media .gallery-attribution{padding:0 4px 10px}.gallery-viewer-media .gallery-viewer-nav{margin-top:10px}#gallery-viewer.is-editing .gallery-viewer-shell{grid-template-columns:minmax(0,1.2fr) minmax(340px,.8fr)}
#gallery-metadata-dialog{width:auto;max-height:none;padding:0;border:1px solid var(--line,#365469);border-radius:16px;background:var(--surface,#0c1924);color:var(--text,#edf5fa);align-self:start;position:sticky;top:0}#gallery-metadata-form{display:grid;gap:14px;max-height:calc(96dvh - 30px);padding:18px;margin:0;overflow:auto}#gallery-metadata-form>label,.gallery-player-search{display:grid;gap:6px}#gallery-metadata-form small{color:var(--muted,#adc1cf)}#gallery-metadata-form input{width:100%;min-width:0;box-sizing:border-box;padding:11px 12px;border:1px solid var(--line,#365469);border-radius:9px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}.gallery-metadata-selected{display:flex;gap:7px;flex-wrap:wrap;min-height:36px;align-items:center}.gallery-metadata-chip{min-height:34px;padding:6px 10px;border:1px solid #42c9ee;border-radius:999px;background:#32c5ef18;color:var(--text,#edf5fa);font-size:12px}.gallery-metadata-chip-empty{color:var(--muted,#adc1cf);font-size:13px}.gallery-tag-groups-details,.gallery-new-tag{border:1px solid var(--line,#365469);border-radius:12px;padding:10px}.gallery-tag-groups-details>summary,.gallery-new-tag>summary{cursor:pointer;font-weight:700}.gallery-edit-tag-groups{max-height:270px;margin-top:10px}.gallery-new-tag>div{display:grid;grid-template-columns:minmax(100px,.55fr) minmax(160px,1fr) auto;gap:10px;align-items:end;margin-top:12px}.gallery-new-tag label{display:grid;gap:6px}.gallery-new-tag select{min-height:44px;padding:9px;border:1px solid var(--line,#365469);border-radius:9px;background:var(--surface,#10202c);color:var(--text,#edf5fa);font:inherit}.gallery-dialog-actions{display:flex;gap:8px;flex-wrap:wrap;position:sticky;bottom:-1px;padding:18px 0 2px;background:linear-gradient(transparent,var(--surface,#0c1924) 18%)}.gallery-unsaved{position:fixed;z-index:40;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:min(90vw,480px);padding:22px;border:1px solid #42c9ee;border-radius:16px;background:var(--surface,#0c1924);box-shadow:0 20px 70px #000d;color:var(--text,#edf5fa)}.gallery-unsaved h2{margin-top:0}.gallery-unsaved>div{display:flex;gap:9px;flex-wrap:wrap}
html[data-theme=light] #gallery-metadata-dialog,html[data-theme=light] .gallery-unsaved{background:#fff}html[data-theme=light] #gallery-metadata-form input,html[data-theme=light] .gallery-new-tag select{background:#fff;color:#182b3a}html[data-theme=light] .gallery-metadata-chip{color:#182b3a}html[data-theme=light] .gallery-dialog-actions{background:linear-gradient(transparent,#fff 18%)}
@media(max-width:820px){#gallery-viewer{inset:1dvh auto auto 1vw;width:98vw;max-width:98vw;max-height:98dvh;padding:10px}#gallery-viewer.is-editing{scroll-padding-top:190px;scroll-padding-bottom:90px}#gallery-viewer.is-editing .gallery-viewer-shell{grid-template-columns:1fr;gap:10px}#gallery-viewer.is-editing .gallery-viewer-media{position:sticky;top:-10px;z-index:6;padding:10px 0 8px;background:var(--surface,#0c1924);border-bottom:1px solid var(--line,#365469)}#gallery-viewer.is-editing .gallery-viewer-head{margin-bottom:6px}#gallery-viewer.is-editing #gallery-viewer-image{height:clamp(96px,20dvh,150px);max-height:none;object-fit:contain}#gallery-viewer.is-editing #gallery-viewer-caption{max-height:2.7em;margin:4px 0 0;padding:2px 4px;overflow:hidden;font-size:13px}#gallery-viewer.is-editing #gallery-viewer-attribution{display:none}#gallery-viewer.is-editing .gallery-viewer-nav{margin-top:4px}.gallery-viewer-media #gallery-viewer-image{max-height:44dvh}#gallery-metadata-dialog{position:static}#gallery-metadata-form{max-height:none;padding:14px 14px 92px}.gallery-player-search{scroll-margin-top:190px;scroll-margin-bottom:90px}.gallery-new-tag>div{grid-template-columns:1fr}.gallery-dialog-actions{position:fixed;left:calc(2vw + 14px);right:calc(2vw + 14px);bottom:2dvh;z-index:8;margin:0;padding:9px;border:1px solid var(--line,#365469);border-radius:13px;background:var(--surface,#0c1924);box-shadow:0 10px 30px #0009}.gallery-dialog-actions button{flex:1 1 90px;min-width:0}#gallery-metadata-selected{order:2}.gallery-dialog-actions{order:3}.gallery-player-search{order:4}.gallery-tag-groups-details{order:5}.gallery-new-tag{order:6}#gallery-metadata-form>label:has(#gallery-metadata-date){order:7}#gallery-metadata-status{order:8}}
@media(max-width:820px){html[data-theme=light] #gallery-viewer.is-editing .gallery-viewer-media,html[data-theme=light] .gallery-dialog-actions{background:#fff}}
@media(max-width:820px) and (max-height:600px){#gallery-viewer.is-editing .gallery-viewer-media{padding-top:6px}#gallery-viewer.is-editing #gallery-viewer-image{height:72px}#gallery-viewer.is-editing #gallery-viewer-caption{display:none}#gallery-viewer.is-editing .gallery-viewer-head button,#gallery-viewer.is-editing .gallery-viewer-nav button{min-height:34px;padding:6px 9px}#gallery-viewer.is-editing .gallery-viewer-nav{font-size:11px}}
#gallery-viewer-status:empty{display:none}
