/* Collection dialog. Hidden legacy buttons retain the existing tested theme-switch behavior. */
html[data-skin] body .header-right .theme-picker.theme-library-source{display:none!important}
html[data-skin] body .header-right #theme-library-open{order:3;min-height:44px;padding:10px 20px;white-space:nowrap}
#theme-library{width:min(1000px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;background:var(--p-panel-flat,#11110e)!important;color:var(--p-ink,#f6eed8)!important;border:1px solid var(--p-rule,#b49657)!important;border-radius:10px!important;box-shadow:0 30px 100px #0009!important;overflow:auto}
#theme-library::backdrop{background:#080b08b8;backdrop-filter:blur(6px)}
.theme-library-shell{padding:24px}
#theme-library .theme-library-header{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;border:0;padding:0;background:none;position:static}
#theme-library .library-kicker{margin:0 0 7px;font:700 10px/1.2 'Segoe UI',sans-serif;letter-spacing:.2em;color:var(--p-muted)!important}
#theme-library h2{margin:0;font:400 36px/1.1 Georgia,serif!important;color:var(--p-ink)!important;letter-spacing:0!important}
#theme-library h3{margin:8px 0;font:600 22px/1.15 Georgia,serif!important;color:var(--p-ink)!important}
#theme-library p{color:var(--p-muted)!important;font-family:'Segoe UI',sans-serif!important}
#theme-library .library-close{width:44px;height:44px;flex-shrink:0;padding:0;border:1px solid var(--p-line);background:var(--p-inset);color:var(--p-ink);font:28px/1 sans-serif;border-radius:4px}
#theme-library [hidden]{display:none!important}
#theme-library .library-intro{margin:16px 0;font:14px/1.5 'Segoe UI',sans-serif}
.theme-library-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
#theme-library .theme-option{min-width:0;border:1px solid var(--p-line);background:var(--p-inset);border-radius:6px;overflow:hidden}
.theme-option-copy{padding:16px}
#theme-library .theme-option-copy p{font-size:13px;line-height:1.5;min-height:39px;margin:8px 0 16px}
.theme-scene{position:relative;display:grid;place-items:center;width:100%;height:165px;overflow:hidden;border:0;padding:0;background:#17291d}
.scene-marble{background:url('assets/marble-world-hd.webp') center/cover}
.scene-forest{background:url('assets/jungle-sanctuary.png') center/cover}
.scene-bitmap{background:#202224 url('assets/bitmap-mosaic.svg') center/170px 170px}.scene-bitmap .library-mini-board{outline-color:#e9812a;border-color:#151718}.scene-bitmap .mini-light{background:#e8ad5d url('assets/bitmap-square-light-1.svg') center/cover}.scene-bitmap .mini-dark{background:#292b2c url('assets/bitmap-square-dark-1.svg') center/cover}
.library-mini-board{display:grid;grid-template-columns:repeat(4,1fr);width:125px;height:125px;transform:rotate(-8deg);box-shadow:0 9px 25px #0008;outline:5px solid #d4b979;border:2px solid #373b31}
.library-mini-board>span{display:grid;place-items:center;position:relative;min-width:0}
.scene-marble .mini-light{background:#f6f4e9}.scene-marble .mini-dark{background:#70858e}
.scene-forest .mini-light{background:#e8dfc4}.scene-forest .mini-dark{background:#365f4c}
.scene-forest .library-mini-board{outline-color:#6b5033;border-color:#c5ad6a}
.library-piece{display:block;width:100%;height:100%;min-width:0}
.library-mini-board .library-piece{position:absolute;inset:-7px 0 0;height:39px;filter:drop-shadow(0 1px 1px #18151080)}
#theme-library .library-owned,#theme-library .library-premium{font:700 10px/1.4 'Segoe UI',sans-serif;letter-spacing:.1em;color:var(--p-label)}
#theme-library .library-premium{color:var(--p-ink)}
#theme-library .theme-option-copy button{width:100%;min-height:44px;border:1px solid var(--p-rule);border-radius:3px;background:var(--p-panel-flat);color:var(--p-ink);font:600 13px/1.3 'Segoe UI',sans-serif;padding:9px}
#theme-library [aria-pressed="true"]{background:var(--p-cta)!important;color:var(--p-cta-ink)!important}
#theme-library .library-feedback{min-height:20px;font-size:13px;margin:12px 0 0}
#theme-library button:focus-visible{outline:3px solid var(--p-rule);outline-offset:3px}
@media(max-width:650px){
 .theme-library-shell{padding:16px}#theme-library h2{font-size:29px!important}
 .theme-library-grid{grid-template-columns:1fr;gap:12px}
 #theme-library .theme-option{display:grid;grid-template-columns:110px minmax(0,1fr)}
 .theme-scene{height:100%;min-height:160px}.theme-option-copy{padding:13px}
 .library-mini-board{width:92px;height:92px}.library-mini-board .library-piece{height:31px}
 #theme-library .theme-option-copy p{min-height:0;margin:7px 0 12px;font-size:12px}
 #theme-library h3{font-size:20px!important}
 html[data-skin] body .header-right #theme-library-open{flex:1 1 100%;text-align:center;padding:7px 12px}
}
@media(prefers-reduced-motion:reduce){#theme-library *{scroll-behavior:auto;transition:none!important}}
