/* Collection only. Room, framed previews and the guest game retain their styles. */
body.gallery-open { overflow:hidden; }
.collection-gallery,.gallery-detail { --g-bg:#101e24; --g-panel:#172a30; --g-line:#3c5256; --g-text:#dbe4cc; --g-muted:#a0b2a7; --g-accent:#c2d39b; color:var(--g-text); background:var(--g-bg); font:14px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace; border:1px solid var(--g-line); padding:0; max-width:none; max-height:none; box-sizing:border-box; }
body[data-time="day"] :is(.collection-gallery,.gallery-detail) { --g-bg:#e0e3cf; --g-panel:#d1d8bf; --g-line:#a3af93; --g-text:#253d32; --g-muted:#52664f; --g-accent:#486b40; }
.collection-gallery::backdrop,.gallery-detail::backdrop { background:#060f18db; backdrop-filter:blur(5px); }
.collection-gallery { width:100%; height:100dvh; margin:0; overflow:hidden; }
.collection-gallery[open] { display:flex; flex-direction:column; }
:is(.collection-gallery,.gallery-detail) [hidden] { display:none!important; }
:is(.collection-gallery,.gallery-detail) :is(button,input,select) { font:inherit; }
:is(.collection-gallery,.gallery-detail) button { color:inherit; border:1px solid var(--g-line); background:var(--g-panel); padding:10px 14px; min-height:44px; cursor:pointer; }
:is(.collection-gallery,.gallery-detail) button:hover { border-color:var(--g-accent); }
:is(.collection-gallery,.gallery-detail) :is(button,input,select,a,summary):focus-visible { outline:2px solid var(--g-accent); outline-offset:3px; }
/* Dialogs initially focus a non-tabbable label, not a selected-looking button. */
.gallery-dialog-focus:focus { outline:none; }
:is(.collection-gallery,.gallery-detail) button:disabled { opacity:.45; cursor:default; }
.gallery-bar { flex:none; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:12px max(24px,calc((100vw - 1520px)/2)); border-bottom:1px solid var(--g-line); }
.gallery-bar .gallery-back { border:0; background:none; padding-left:0; }
.gallery-wordmark { font-size:12px; letter-spacing:.14em; color:var(--g-muted); }
.gallery-total { font-size:11px; letter-spacing:.08em; }
.gallery-header-controls { display:flex; align-items:center; gap:18px; }
.gallery-animate { display:inline-flex; align-items:center; gap:8px; min-height:44px; font-size:11px; color:var(--g-text); cursor:pointer; white-space:nowrap; }
.gallery-animate input { width:18px; height:18px; margin:0; accent-color:var(--g-accent); }
.gallery-animation-note { color:var(--g-muted); font-size:10px; margin:6px 0 0; }
.gallery-animation-note:empty { display:none; }
.gallery-animation-options { display:flex; align-items:center; justify-content:space-between; gap:12px; flex:none; min-height:52px; }
.gallery-animation-options button { font-size:11px; padding:8px 12px; }
.gallery-art-panel .gallery-effects { display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; padding:0 0 6px; }
.gallery-effects>label { display:flex; flex-direction:column; gap:4px; min-width:0; color:var(--g-muted); font-size:10px; }
.gallery-effects select { width:100%; min-height:36px; padding:5px 8px; background:var(--g-panel); color:var(--g-text); border:1px solid var(--g-line); }
.gallery-effects .gallery-weather-intensity { grid-column:1/-1; }
.gallery-weather-intensity>span { display:flex; justify-content:space-between; }
.gallery-weather-intensity input { width:100%; min-width:0; height:26px; margin:0; accent-color:var(--g-accent); }
.gallery-intro .gallery-intro-copy { color:var(--g-muted); margin:0; font-size:12px; }
.gallery-scroll { display:flex; flex-direction:column; overflow:hidden; flex:1; min-height:0; }
.gallery-intro,.gallery-tools,.gallery-browse { width:min(1472px,calc(100% - 64px)); margin-inline:auto; }
.gallery-intro { flex:none; padding:20px 0 12px; }
.gallery-eyebrow { color:var(--g-accent); font-size:10px; font-weight:700; letter-spacing:.18em; margin:0 0 12px; }
.gallery-intro h1 { margin:0 0 12px; font:500 clamp(30px,4vw,48px)/1.1 ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:-.06em; }
.gallery-intro>p:last-child { color:var(--g-muted); margin:0; font-size:12px; }
.gallery-tools { display:flex; flex:none; flex-wrap:wrap; align-items:end; gap:12px; padding:18px 0 16px; }
.gallery-search { display:grid; min-width:0; gap:6px; font-size:10px; color:var(--g-muted); }
.gallery-search-field { display:flex; min-width:0; align-items:center; border:1px solid var(--g-line); background:var(--g-panel); font-size:15px; }
.gallery-search-field input { width:210px; min-width:0; color:var(--g-text); border:0; background:none; height:44px; padding:10px; }
.gallery-search-field #gallerySearchSubmit { flex:none; min-height:44px; width:44px; padding:8px; border:0; border-left:1px solid var(--g-line); font-size:20px; }
.gallery-search-field #gallerySearch:focus { outline:none; box-shadow:inset 0 -1px 0 var(--g-accent); }
.gallery-search-field #gallerySearchSubmit:focus-visible { outline:none; background:var(--g-accent); color:var(--g-bg); }
.gallery-search-field input::placeholder { color:var(--g-muted); }
.gallery-tools output { margin-left:auto; padding:10px 0; color:var(--g-muted); font-size:12px; }
.gallery-wallet-controls { display:flex; flex-basis:100%; align-items:center; gap:10px; min-width:0; color:var(--g-muted); font-size:11px; }
#galleryWalletStatus { flex:1; min-width:0; overflow-wrap:anywhere; }
.gallery-wallet-controls button { flex:none; padding:6px 10px; font-size:11px; }
.gallery-selected-filters { display:flex; align-items:center; flex-wrap:wrap; flex:1; min-width:0; gap:8px; max-height:min(144px,20dvh); overflow-y:auto; overscroll-behavior:contain; scrollbar-color:var(--g-line) var(--g-bg); }
.gallery-selected-filters .gallery-filter-chip { display:inline-flex; align-items:center; justify-content:space-between; gap:9px; max-width:100%; min-height:36px; padding:7px 11px; border-radius:18px; background:var(--g-panel); font-size:11px; text-align:left; }
.gallery-filter-chip>span:first-child { min-width:0; overflow-wrap:anywhere; }
.gallery-filter-chip-remove { flex:none; color:var(--g-muted); font-size:17px; line-height:1; }
.gallery-selected-filters #galleryClear { min-height:36px; padding:7px 11px; border-radius:18px; background:none; }
.gallery-browse { display:grid; flex:1; min-height:0; grid-template-columns:260px minmax(0,1fr); grid-template-rows:minmax(0,1fr); gap:28px; padding-bottom:16px; }
.gallery-browse.filters-hidden { grid-template-columns:minmax(0,1fr); }
.gallery-results { min-width:0; min-height:0; overflow:auto; padding:0 12px 0 2px; overscroll-behavior:contain; overflow-anchor:none; scrollbar-gutter:stable; scrollbar-color:var(--g-line) var(--g-bg); }
.gallery-results:focus-visible { outline:1px solid var(--g-accent); outline-offset:-1px; }
.gallery-filters { display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; border:1px solid var(--g-line); background:var(--g-bg); }
.gallery-filter-heading { display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid var(--g-line); flex:none; }
.gallery-filter-heading h2 { font:500 14px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace; margin:0 auto 0 0; }
.gallery-filter-heading button { border:0; background:none; padding:8px; font-size:11px; text-decoration:underline; text-underline-offset:3px; }
.gallery-filter-list { flex:1; overflow:auto; min-height:0; overscroll-behavior:contain; scrollbar-color:var(--g-line) var(--g-bg); }
.gallery-filter-category+.gallery-filter-category { border-top:1px solid var(--g-line); }
.gallery-filter-category summary { display:flex; align-items:center; gap:8px; min-height:48px; padding:12px; font-size:12px; cursor:pointer; list-style:none; }
.gallery-filter-category summary::-webkit-details-marker { display:none; }
.gallery-filter-category summary>span:first-child { flex:1; }
.gallery-filter-chevron { font-size:18px; line-height:1; color:var(--g-muted); }
.gallery-filter-category[open] .gallery-filter-chevron { transform:rotate(180deg); }
.gallery-filter-badge { font-size:10px; min-width:20px; text-align:center; background:var(--g-accent); color:var(--g-bg); padding:1px 4px; }
.gallery-filter-options { padding:0 6px 8px; max-height:288px; overflow:auto; overscroll-behavior:contain; scrollbar-color:var(--g-line) var(--g-bg); }
.gallery-filter-option { display:flex; align-items:center; min-height:44px; gap:9px; padding:7px 6px; font-size:11px; cursor:pointer; }
.gallery-filter-option:hover,.gallery-filter-option:has(input:checked) { background:var(--g-panel); }
.gallery-filter-option input { width:17px; height:17px; flex:none; margin:0; accent-color:var(--g-accent); }
.gallery-filter-value { flex:1; min-width:0; overflow-wrap:anywhere; }
.gallery-filter-amount { color:var(--g-muted); font-size:10px; font-variant-numeric:tabular-nums; }
.gallery-filter-mobile { display:none; }
.gallery-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:22px 16px; padding-bottom:38px; }
.gallery-grid .gallery-card { display:block; padding:0; border:1px solid transparent; background:transparent; text-align:left; min-width:0; contain:layout style; content-visibility:auto; contain-intrinsic-size:auto 230px; }
.gallery-card img { display:block; width:100%; height:auto; aspect-ratio:1; object-fit:contain; image-rendering:pixelated; background:var(--g-panel); }
.gallery-card-art { display:block; position:relative; }
.gallery-card-animation { position:absolute; inset:0; display:block; width:100%; height:100%; image-rendering:pixelated; pointer-events:none; }
.gallery-card .gallery-card-label { display:block; padding:9px 2px 0; font-size:12px; color:var(--g-muted); }
.gallery-card:hover .gallery-card-label { color:var(--g-text); }
.gallery-status { color:var(--g-muted); padding:35px 0; text-align:center; }
.gallery-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; padding:24px 0; border-top:1px solid var(--g-line); font-size:11px; color:var(--g-muted); }
.gallery-detail { width:min(1440px,calc(100% - 32px)); height:min(900px,calc(100dvh - 32px)); overflow:hidden; box-shadow:12px 12px 0 #0006; }
.gallery-detail[open] { display:flex; flex-direction:column; }
.gallery-detail-bar { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:12px; flex:none; border-bottom:1px solid var(--g-line); padding:10px 18px; }
.gallery-detail-bar>button { background:none; border:0; }
.gallery-paging { grid-column:2; display:flex; align-items:center; justify-content:center; gap:12px; color:var(--g-muted); font-size:12px; }
.gallery-paging button { background:none; border:0; min-width:44px; }
.gallery-detail-bar .gallery-detail-close { grid-column:3; width:44px; font-size:24px; line-height:1; }
.gallery-detail-layout { display:grid; grid-template-columns:160px minmax(0,1.2fr) minmax(300px,1fr); flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.gallery-animation-panel { min-width:0; padding:20px 14px; border-right:1px solid var(--g-line); }
.gallery-animation-panel>.gallery-animate { margin-bottom:12px; }
.gallery-animation-panel fieldset { min-width:0; border:0; padding:0; margin:0 0 18px; }
.gallery-animation-panel fieldset legend { font-size:10px; color:var(--g-muted); padding:0; margin-bottom:7px; }
.gallery-animation-panel .gallery-effects { display:block; }
.gallery-effect-choices { display:grid; gap:5px; }
.gallery-effect-choices label { cursor:pointer; position:relative; font-size:11px; }
.gallery-effect-choices input { position:absolute; opacity:0; width:1px; height:1px; }
.gallery-effect-choices span { display:block; border:1px solid var(--g-line); background:var(--g-panel); min-height:36px; padding:8px; }
.gallery-effect-choices input:checked+span { color:var(--g-bg); background:var(--g-accent); border-color:var(--g-accent); }
.gallery-effect-choices input:focus-visible+span { outline:2px solid var(--g-text); outline-offset:-3px; }
.gallery-effects:disabled .gallery-effect-choices { opacity:.5; }
.gallery-animation-panel .gallery-weather-intensity { display:block; font-size:10px; color:var(--g-muted); }
.gallery-animation-panel .gallery-gif-action { width:100%; margin-bottom:8px; padding-inline:6px; font-size:11px; }
.gallery-animation-panel .gallery-animation-note { line-height:1.6; }
.gallery-art-panel { padding:22px; min-width:0; min-height:0; display:flex; flex-direction:column; }
/* The stage and its options slot never change size when a format changes. */
.gallery-preview { background-color:#1d2d32; background-image:conic-gradient(#ffffff09 25%,transparent 0 50%,#ffffff09 0 75%,transparent 0); background-size:24px 24px; width:100%; flex:0 0 auto; height:clamp(300px,45dvh,520px); min-height:300px; overflow:hidden; border:1px solid var(--g-line); display:flex; align-items:center; justify-content:center; container-type:size; }
body[data-time="day"] .gallery-preview { background-color:#bcc8af; }
.gallery-preview { position:relative; }
.gallery-preview .gallery-detail-animation { position:absolute; inset:0; margin:auto; pointer-events:none; }
.gallery-preview canvas { display:block; width:min(100cqw,100cqh); height:min(100cqw,100cqh); image-rendering:pixelated; }
/* Photo includes fine text: nearest-neighbour scaling erases letter strokes. */
.gallery-preview[data-format="photo"] canvas { width:min(100cqw,83.333333cqh); height:min(120cqw,100cqh); image-rendering:auto; }
.gallery-preview.round canvas { border-radius:50%; }
.gallery-detail-status { flex:none; height:36px; margin:0; text-align:center; font-size:11px; line-height:16px; color:var(--g-accent); overflow:auto; }
.gallery-editor { border-left:1px solid var(--g-line); padding:22px; min-width:0; }
.gallery-editor h2 { font:500 clamp(24px,3vw,34px)/1.2 ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:-.05em; margin:0; }
.gallery-art-panel fieldset { flex:none; min-width:0; padding:0; margin:0; border:0; }
.gallery-art-panel .gallery-format { margin-bottom:12px; }
.gallery-art-panel legend { font-size:11px; margin-bottom:6px; color:var(--g-muted); }
.gallery-sr-only { position:absolute; width:1px; height:1px; margin:-1px!important; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.gallery-segments { display:flex; border:1px solid var(--g-line); }
.gallery-segments label { flex:1; position:relative; cursor:pointer; }
.gallery-segments label+label { border-left:1px solid var(--g-line); }
.gallery-segments input { position:absolute; opacity:0; width:1px; height:1px; }
.gallery-segments span { display:block; padding:12px 4px; text-align:center; font-size:12px; }
.gallery-segments input:checked+span { background:var(--g-accent); color:var(--g-bg); }
.gallery-segments input:focus-visible+span { outline:2px solid var(--g-text); outline-offset:-4px; }
.gallery-check { display:flex; align-items:center; gap:9px; min-height:44px; font-size:12px; cursor:pointer; }
.gallery-check input,.gallery-trait input { width:18px; height:18px; margin:0; accent-color:var(--g-accent); flex:none; }
.gallery-check small { font-size:10px; color:var(--g-muted); }
.gallery-format-options { flex:none; min-height:0; padding-top:10px; }
.gallery-format-options:has(>#galleryCaptionsControl[hidden]):has(>#galleryAvatarControls[hidden]) { display:none; }
.gallery-avatar-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0 14px; }
.gallery-avatar-controls>label:not(.gallery-check) { display:flex; flex-direction:column; min-height:44px; gap:2px; font-size:10px; color:var(--g-muted); }
.gallery-avatar-controls>.gallery-check { grid-column:1/-1; }
.gallery-avatar-controls input[type="range"] { width:100%; min-width:0; height:30px; margin:0; accent-color:var(--g-accent); }
.gallery-export { display:flex; flex:none; gap:10px; margin:10px 0 0; height:48px; }
.gallery-export button { flex:1; min-width:0; min-height:48px; font-size:13px; font-weight:600; }
.gallery-export .gallery-primary { background:var(--g-accent); color:var(--g-bg); border-color:var(--g-accent); font-weight:700; }
.gallery-market { display:inline-flex; padding:9px 0; font-size:11px; color:var(--g-muted); text-decoration:underline; text-underline-offset:4px; }
.gallery-secondary-actions { margin:8px 0 20px; }
.gallery-secondary-actions { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0 10px; }
.gallery-quiet { font-size:11px!important; }
.gallery-traits-section h3 { display:flex; justify-content:space-between; font-size:12px; font-weight:400; margin:0 0 12px; }
.gallery-traits-section h3 span { color:var(--g-muted); }
.gallery-traits { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.gallery-trait-column { display:grid; grid-auto-rows:minmax(54px,auto); align-content:start; gap:8px; min-width:0; margin:0; }
.gallery-trait { border:1px solid var(--g-line); padding:8px 10px; min-width:0; position:relative; }
.gallery-traits dt { color:var(--g-muted); font-size:9px; }
.gallery-traits dd { margin:4px 0 0; font-size:11px; overflow-wrap:anywhere; }
.gallery-trait.is-editable { padding-left:36px; }
.gallery-trait label { cursor:pointer; }
/* The whole trait card is a touch target, without moving its value into the label. */
.gallery-trait label::after { content:""; position:absolute; inset:0; }
.gallery-trait input { position:absolute; left:9px; top:calc(50% - 9px); }
.gallery-trait input:disabled { opacity:.35; }
.gallery-trait:has(input:disabled) label { cursor:default; }
.gallery-trait.is-hidden dd { opacity:.5; }
.gallery-traits-note { font-size:10px; color:var(--g-muted); margin:12px 0 0; }
@media(max-width:1100px) { .gallery-browse { grid-template-columns:230px minmax(0,1fr); gap:20px; }.gallery-grid { grid-template-columns:repeat(auto-fill,minmax(145px,1fr)); } }
@media(max-width:1000px) { .gallery-art-panel,.gallery-editor { padding:16px; } }
@media(max-width:1000px) {
 .gallery-detail-layout { display:flex; flex-direction:column; }
 .gallery-art-panel { flex:none; order:0; width:100%; max-width:560px; margin-inline:auto; }
 .gallery-animation-panel { flex:none; order:1; width:100%; max-width:560px; margin-inline:auto; padding:12px 20px; border:0; border-bottom:1px solid var(--g-line); }
 .gallery-animation-panel .gallery-effects { display:grid; grid-template-columns:1fr 1fr; gap:8px 16px; }
 .gallery-animation-panel .gallery-weather-intensity { grid-column:1/-1; }
 .gallery-editor { flex:none; order:2; border-left:0; }
}
@media(max-width:900px) {
 .gallery-selected-filters { flex-basis:100%; }.gallery-selected-filters :is(.gallery-filter-chip,#galleryClear) { min-height:44px; }
 .gallery-browse { grid-template-columns:minmax(0,1fr); }
 .gallery-filters { position:fixed; z-index:3; top:0; bottom:0; left:0; width:min(360px,calc(100% - 28px)); height:100%; max-height:none; box-shadow:12px 0 36px #0005; }
 .gallery-filter-heading { padding:8px 14px; }.gallery-filter-heading h2 { font-size:16px; }
 .gallery-filter-heading #galleryFilterClose { font-size:24px; text-decoration:none; }
 .gallery-filter-list { flex:1; }.gallery-filter-option { font-size:12px; }
 .gallery-filter-mobile { display:block; }
 #galleryFilterDone { flex:none; margin:12px; color:var(--g-bg); background:var(--g-accent); border-color:var(--g-accent); }
 .collection-gallery .gallery-filter-shade { position:fixed; z-index:2; inset:0; width:100%; height:100%; border:0; padding:0; background:#040b10b8; cursor:default; }
 .filter-drawer-open .gallery-results { overflow:hidden; }
}
@media(min-width:701px) and (max-height:800px) {
 .gallery-detail { height:calc(100dvh - 24px); }.gallery-detail-bar { padding-block:6px; }
 .gallery-art-panel,.gallery-editor { padding:16px; }.gallery-editor h2 { font-size:28px; }
 .gallery-secondary-actions { margin-bottom:12px; }
 .gallery-traits-section h3 { margin-bottom:8px; }.gallery-trait-column { grid-auto-rows:minmax(44px,auto); gap:6px; }
 .gallery-trait { padding-block:5px; padding-right:7px; }.gallery-traits dd { margin-top:2px; }
 .gallery-traits-note { margin-top:8px; }
}
@media(max-width:700px) {
 .gallery-bar { padding:8px 16px; gap:10px; }.gallery-wordmark { display:none; }.gallery-total { font-size:10px; }
 .gallery-intro,.gallery-tools,.gallery-browse { width:calc(100% - 32px); }
 .gallery-intro { padding-top:18px; }.gallery-intro>p:last-child { max-width:310px; font-size:11px; }
 .gallery-results { padding-right:8px; }
 .gallery-tools { gap:10px; padding-block:12px; }.gallery-search { flex:1; }.gallery-search-field input { width:100%; }.gallery-tools output { flex-basis:100%; margin:0; padding:0; }
 .gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px 12px; }
 .gallery-detail { width:100%; height:100dvh; margin:0; border:0; box-shadow:none; }.gallery-detail-bar { padding:6px 12px; }.gallery-detail-bar>button { font-size:12px; padding-inline:0; }
 .gallery-detail-layout { display:flex; }.gallery-art-panel { padding:18px 20px 4px; max-width:440px; width:100%; margin:auto; }
 .gallery-preview { flex:none; height:auto; aspect-ratio:1; }
 .gallery-editor { border-left:0; padding:12px 20px 28px; }.gallery-editor h2 { font-size:28px; }
 .gallery-traits { gap:8px; }.gallery-trait { padding-right:6px; }.gallery-trait.is-editable { padding-left:32px; }.gallery-trait input { left:7px; }
 .gallery-paging { gap:4px; }.gallery-detail-bar { gap:4px; }
}
@media(max-height:600px) and (min-width:1001px) { .gallery-detail { width:100%; height:100dvh; margin:0; }.gallery-art-panel { min-height:500px; } }
@media(max-width:420px) { .gallery-header-controls { gap:0; }.gallery-header-controls .gallery-total { display:none; } }
@media(max-height:600px) {
 .gallery-intro { padding-block:8px 4px; }
 .gallery-intro .gallery-eyebrow { margin-bottom:4px; }
 .gallery-intro h1 { font-size:28px; margin-bottom:4px; }
}
