.library-scene{position:fixed;inset:0 0 auto;height:calc(var(--app-height,100svh) - var(--console-height));isolation:isolate;overflow:hidden;background:#172d39 url('./library-room-v1.png') center/cover no-repeat;color:#fff0c7;font-family:system-ui}.library-scene[hidden],.library-scene [hidden]{display:none!important}body:has(#library:not([hidden])) .masthead{display:none}body:has(#library:not([hidden])){overflow:hidden}
.library-heading{position:absolute;top:8px;left:10px;right:60px;display:flex;align-items:center;gap:10px;z-index:2}.library-heading strong{padding:7px 14px;background:linear-gradient(#29485b,#0b2131);border:2px solid #cba463;border-radius:6px;color:#ffe5aa;font-size:clamp(12px,1.4vw,18px)}.library-heading button,.library-details button{background:linear-gradient(#a9462e,#6d291d);color:#fff0bb;border:2px solid #cba463;border-radius:5px;font-weight:800;padding:6px 10px}.library-heading select{margin-left:auto;max-width:45%;padding:8px;background:#102c3d;color:#ffe6b0;border:2px solid #bd9458;border-radius:6px;font-size:clamp(11px,1.1vw,16px)}
.library-shelves,.library-case{position:absolute;left:3%;width:61%;box-sizing:border-box;border:5px solid #80502a;border-radius:9px;box-shadow:0 3px 10px #0009,inset 0 0 0 2px #d3ab64;background:linear-gradient(110deg,#102c3eea,#081721e8);padding:8px 12px}.library-shelves{top:16%;height:39%}.library-case{bottom:7%;height:33%;background:repeating-linear-gradient(45deg,#164e3bee 0 3px,#1b5842ee 3px 6px);border-color:#aa7e3e}.library-shelves h2,.library-case h2{font-size:clamp(10px,1vw,15px);color:#ffe1a1;margin:0 0 6px}.library-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;height:calc(100% - 28px)}.library-slot{min-width:0;min-height:0;border:1px solid #94754b;border-radius:4px;background:#05131bbf;display:flex;align-items:center;justify-content:center}.library-slot>span{font-size:11px;color:#b5b9ae;text-align:center}.library-tape{position:relative;display:flex;flex-direction:column;align-items:stretch;justify-content:center;width:100%;height:100%;min-height:0;min-width:0;padding:3px;background:linear-gradient(110deg,#344452,#091a24);border:2px solid #b48e54;border-left:5px solid #bc7f42;border-radius:4px;color:#fff0ce;touch-action:none;user-select:none;cursor:grab;box-shadow:2px 3px 5px #0007}.library-tape img{width:100%;height:55%;min-height:0;object-fit:cover;border-radius:2px;pointer-events:none}.library-tape strong{font-size:clamp(9px,1vw,14px);line-height:1.1;margin:4px 2px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.library-tape small{font-size:clamp(8px,.75vw,10px);color:#d5c59d}.library-tape:hover,.library-tape:focus-visible{outline:2px solid #ffdd8e}.library-tape.dragging{opacity:.3}.library-case-items{display:flex;gap:8px;height:calc(100% - 51px);overflow:auto;align-items:stretch}.library-case-items .library-tape{flex:0 0 110px}.library-case p{font-size:clamp(8px,.8vw,11px);margin:5px 0 0;color:#d9d5b6}.library-empty{margin:auto;font-size:clamp(10px,1vw,14px);text-align:center;color:#e6e2c7}.library-drop-ready{outline:3px solid #ffe58f;box-shadow:0 0 18px #ffd46a}
.library-details{position:absolute;z-index:5;right:2%;top:17%;width:29%;max-height:72%;box-sizing:border-box;overflow:auto;padding:12px;background:linear-gradient(120deg,#fff1ce,#d9c18a);border:4px solid #a87a3d;border-radius:8px;color:#302b22;box-shadow:0 5px 12px #0009}.library-details h2{font-size:clamp(13px,1.5vw,20px);margin:0 20px 8px 0}.library-details p{font-size:clamp(10px,1vw,13px);line-height:1.4}.library-details .library-close{position:absolute;right:4px;top:4px;padding:0;width:24px;height:24px}.library-details button:disabled{opacity:.5}.library-status{position:absolute;bottom:3px;left:10px;right:10px;padding:3px 7px;margin:0;text-align:center;font-size:clamp(8px,.8vw,11px);border:1px solid #c6a05e;border-radius:4px;background:#0c2434ef;pointer-events:none}.library-drag-ghost{position:fixed;z-index:180;pointer-events:none;transform:translate(-50%,-60%);width:100px;height:90px;padding:4px;background:#183341;border:2px solid #ddb36b;color:#fff0cb}.library-drag-ghost img{width:100%;height:55%;object-fit:cover}.library-drag-ghost strong,.library-drag-ghost small{display:block;font-size:10px}
@media(max-width:600px){.library-heading{left:7px;right:43px;gap:5px;flex-wrap:wrap}.library-heading strong{font-size:11px;padding:6px}.library-heading button{font-size:9px;padding:6px}.library-heading select{max-width:100%;width:100%;margin:0;padding:5px;font-size:12px}.library-shelves{top:20%;height:39%;width:94%}.library-slots{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:6px}.library-tape{display:grid;grid-template-columns:40% 60%;grid-template-rows:1fr auto;align-items:center}.library-tape img{grid-row:1/3;height:100%}.library-tape strong{font-size:11px}.library-tape small{font-size:9px}.library-case{width:94%;height:30%;bottom:6%}.library-case-items .library-tape{display:flex;flex:0 0 95px}.library-details{top:22%;left:7%;right:7%;width:auto;max-height:65%}.library-details h2{font-size:17px}.library-details p{font-size:13px}.library-status{font-size:8px}}
.programme-ratings{padding:6px;border:1px solid #b1965e;border-radius:5px;background:#fff1cc90;color:#302b22;margin:6px 0}.programme-ratings>div{display:grid;grid-template-columns:1fr auto;gap:0 6px;font:11px/1.4 system-ui;margin-bottom:5px}.programme-ratings meter{grid-column:1/3;width:100%;height:10px;accent-color:#b94b31}.programme-ratings small{display:block;font:9px/1.2 system-ui;color:#665132}.planner-details .programme-ratings{margin:5px 0;padding:4px}.planner-details .programme-ratings>div{font-size:10px}


/* Scoped approved library design. */

.library-scene{position:fixed;inset:0 0 auto;height:calc(var(--app-height,100svh) - var(--console-height));container-type:size;isolation:isolate;overflow:hidden;background:#12303c url('./library-room-pixel.png') center/cover no-repeat;color:#fff2cf;font-family:system-ui,sans-serif;font-weight:750;text-shadow:1px 2px #00121d}
.library-scene[hidden],.library-scene [hidden]{display:none!important}body:has(#library:not([hidden])) .masthead{display:none}body:has(#library:not([hidden])){overflow:hidden}
.library-scene button,.library-scene select{font:inherit;color:inherit;text-shadow:inherit;cursor:pointer}.library-scene .library-heading{position:absolute;top:2%;left:1.2%;height:11%;display:flex;gap:1.2cqw;align-items:stretch}.library-scene .library-heading button,.library-scene .library-heading strong{display:flex;align-items:center;justify-content:center;padding:0 1.6cqw;border:3px solid #ffcc42;border-radius:12px;background:linear-gradient(#123d50,#032032);box-shadow:inset 0 0 0 2px #fff1a8,0 0 0 2px #62310d,3px 4px #180f0b;font-size:clamp(12px,2.1cqw,32px)}.library-scene .library-heading button{font-size:clamp(10px,1.5cqw,23px);background:linear-gradient(#8f231b,#50160f)}.library-scene .library-shelves,.library-scene .library-case{position:absolute;top:17%;bottom:2%;width:33.8%;padding:1.2cqh 1.5cqw 2.1cqh;box-sizing:border-box;border:4px solid #ffd143;border-radius:22px;background:linear-gradient(115deg,#064153,#002538);box-shadow:inset 0 0 0 2px #fff0aa,inset 0 0 0 5px #84601c,0 0 0 2px #713b10,3px 5px #160d09}.library-scene .library-shelves{left:2.6%}.library-scene .library-case{right:2.6%}.library-scene .library-shelves header,.library-scene .library-case header{height:16%;display:flex;align-items:flex-start;justify-content:space-between;gap:.5cqw;padding:.6cqh 0 1.4cqh;box-sizing:border-box}
.library-scene h2{font-size:clamp(13px,2.05cqw,32px);line-height:1.06;margin:0;white-space:nowrap}.library-scene .library-shelves header p,.library-scene .library-case header p{font-size:clamp(9px,1.1cqw,18px);margin:.8cqh 0 0}.library-scene .library-shelves h2:before{content:'▣';color:#ffcf32;margin-right:.6cqw}.library-scene .library-case h2:before{content:'▣';color:#ffcf32;margin-right:.6cqw}.library-scene .library-shelves select{max-width:33%;margin-top:.2cqh;padding:.7cqh .4cqw;background:#052b3e;border:3px solid #ffd043;border-radius:8px;box-shadow:inset 0 0 0 1px #fff2aa,2px 3px #04131d;font-size:clamp(9px,1.12cqw,18px)}.library-scene .library-slots,.library-scene .library-case-items{height:84%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:2.2cqh 1.6cqw;overflow:auto;padding:3px;box-sizing:border-box}.library-scene .library-slot{min-width:0;min-height:0}.library-scene .library-tape{width:100%;height:100%;display:flex;flex-direction:column;padding:3px;border:3px solid #ffcc46;border-radius:12px;background:linear-gradient(#0b3d50,#00192b);box-shadow:inset 0 0 0 1px #fff3ac,0 0 0 2px #86420d,2px 3px #000b;overflow:hidden;user-select:none}.library-scene .library-tape img,.library-scene .library-cover-art{display:block;width:100%;min-height:0;flex:1;object-fit:cover;image-rendering:pixelated;border-radius:5px}.library-scene .library-cover-art{background-image:url('./library-covers-pixel.png');background-size:200% 200%;background-repeat:no-repeat;background-position:0 0}.library-scene .library-cover-1{background-position:100% 0}.library-scene .library-cover-2{background-position:0 100%}.library-scene .library-tape strong{display:flex;align-items:center;justify-content:center;flex:0 0 30%;font-size:clamp(10px,1.7cqw,27px);line-height:1.03;padding:.3cqh .3cqw;overflow:hidden;text-align:center}.library-scene .library-tape.selected{box-shadow:0 0 0 2px #fff1a2,0 0 12px 4px #ffcf26}.library-scene .library-free{border:2px dashed #8cbac4;border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#00213388;color:#a1d0d5;box-sizing:border-box}.library-scene .library-free b{font-size:clamp(26px,4cqw,65px);line-height:1}.library-scene .library-free span{font-size:clamp(10px,1.25cqw,20px);margin-top:.5cqh;color:#fff0d0}.library-scene .library-modal-layer{position:absolute;inset:0;z-index:10;background:#0005;display:flex;align-items:flex-end;justify-content:center;padding-bottom:6cqh;box-sizing:border-box}
.library-scene .library-details{position:relative;inset:auto;width:36%;max-height:85%;overflow:visible;padding:2.7cqh 1.4cqw 1.8cqh;box-sizing:border-box;border:5px solid #ffce34;border-radius:22px;color:#fff0cc;background:linear-gradient(110deg,#075066,#002232);box-shadow:inset 0 0 0 2px #fff4b2,inset 0 0 0 5px #90551a,0 0 0 2px #74370d,5px 8px #160c0cbd}.library-scene .library-modal-title{position:absolute;top:-2.5cqh;left:9%;right:9%;text-align:center;white-space:nowrap;padding:.7cqh .5cqw;background:#052b3e;border:3px solid #ffc72a;box-shadow:inset 0 0 0 1px #ffef9d,0 2px #62330b;border-radius:10px;font-size:clamp(12px,1.72cqw,27px);line-height:1.1}.library-scene .library-modal-content{display:grid;grid-template-columns:34% minmax(0,1fr);gap:1.2cqw;align-items:center;margin-top:1.2cqh}.library-scene .library-modal-cover{height:22cqh;min-height:0;display:flex;border:3px solid #ffca36;border-radius:10px;overflow:hidden;box-shadow:inset 0 0 0 1px #fff4a2}.library-scene .library-modal-cover img{width:100%;height:100%;object-fit:cover;image-rendering:pixelated}.library-scene .library-modal-content h2{font-size:clamp(14px,2.05cqw,32px);white-space:normal}.library-scene .library-details p{font-size:clamp(10px,1.35cqw,21px);line-height:1.2;margin:1.5cqh 0 0;color:#fff0d0}.library-scene .library-modal-actions{display:grid;grid-template-columns:1.25fr 1fr;gap:1cqw;margin-top:2.5cqh}
.library-scene .library-modal-actions button{min-height:8cqh;padding:.5cqh .4cqw;border:3px solid #ffcf39;box-shadow:inset 0 0 0 1px #fff5ae,0 0 0 2px #70380f,2px 3px #0008;border-radius:9px;background:linear-gradient(#0aa128,#006408);font-size:clamp(11px,1.65cqw,26px);line-height:1.05;font-weight:800}
.library-scene .library-modal-actions [data-library-close]{background:linear-gradient(#303030,#141414)}.library-scene button:disabled{opacity:.45;cursor:default}.library-scene button:focus-visible,.library-scene select:focus-visible{outline:3px solid #fff;outline-offset:3px}.library-scene .library-modal-message:empty{display:none}.library-scene .library-status{position:absolute;bottom:0;pointer-events:none}.library-scene .library-status:empty{display:none}
@media(max-height:450px){.library-scene .library-shelves,.library-scene .library-case{border-width:3px;border-radius:12px;padding:1cqh 1.1cqw 2cqh}.library-scene .library-heading button,.library-scene .library-heading strong{border-width:2px;border-radius:7px}.library-scene h2{font-size:1.9cqw}.library-scene .library-shelves header p,.library-scene .library-case header p{font-size:1.05cqw}.library-scene .library-tape{border-width:2px;border-radius:8px}.library-scene .library-tape strong{font-size:1.45cqw}.library-scene .library-free span{font-size:1.1cqw}.library-scene .library-details{width:40%;border-width:3px;padding:2cqh 1.4cqw}.library-scene .library-modal-title{border-width:2px}.library-scene .library-details p{font-size:1.2cqw}.library-scene .library-modal-content h2{font-size:1.9cqw}.library-scene .library-modal-actions{margin-top:2cqh}.library-scene .library-modal-actions button{border-width:2px;font-size:1.5cqw}.library-scene .library-modal-cover{height:21cqh}}
.library-scene .library-shelves,.library-scene .library-case{height:auto}.library-scene .library-case{left:auto}.library-scene h2{font-family:system-ui,sans-serif;font-weight:850}.library-scene .library-case-items .library-tape{flex:auto}.library-scene .library-tape img{height:auto}.library-scene .library-tape strong{display:flex;margin:0;-webkit-line-clamp:unset;-webkit-box-orient:unset}.library-scene .library-tape{touch-action:manipulation;cursor:pointer}
.library-scene .library-heading button,.library-scene .library-heading strong{min-height:0;box-sizing:border-box}.library-scene .library-modal-content h2{margin:0 0 1cqh}.library-scene .library-modal-content p{margin:1cqh 0 0}.library-scene .library-modal-content>div:last-child{min-width:0}
@media(max-height:450px){.library-scene .library-details{padding-top:5cqh;width:44%}.library-scene .library-modal-title{font-size:1.65cqw}.library-scene .library-modal-content h2{font-size:1.9cqw}.library-scene .library-modal-content p{font-size:1.25cqw}.library-scene .library-modal-cover{height:27cqh}.library-scene .library-shelves select{padding:.5cqh .4cqw;font-size:1.1cqw;min-height:0}.library-scene .library-shelves header,.library-scene .library-case header{height:19%}.library-scene .library-slots,.library-scene .library-case-items{height:81%}}
.library-scene .library-shelves h2:before,.library-scene .library-case h2:before{content:'';display:inline-block;vertical-align:middle;width:2.4cqw;height:1.5cqw;border:2px solid #ffd139;border-radius:3px;box-shadow:1px 2px #5f310a;background:radial-gradient(circle at 27% 50%,#003445 0 12%,transparent 13%),radial-gradient(circle at 73% 50%,#003445 0 12%,transparent 13%),linear-gradient(#ffef7c,#e9ad14)}
.library-scene .library-case h2:before{height:1.7cqw;background:linear-gradient(transparent 42%,#885016 43% 53%,transparent 54%),linear-gradient(#fff18e,#eeb022)}
.library-scene .library-cover-catalogue{background-image:url('./library-catalogue-pixel.png');background-size:600% 500%}.library-scene .library-modal-content{max-height:48cqh;overflow:auto;overscroll-behavior:contain}
.library-scene .library-tape strong span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.library-scene .library-tape strong{white-space:normal;min-width:0;width:100%;box-sizing:border-box}.library-scene .library-tape strong span{min-width:0;max-width:100%;width:100%;overflow-wrap:anywhere}
/* Approved visible-category navigation, proposal 10. */
.library-scene .library-shelves{width:52.3%}.library-scene .library-case{width:32.3%}.library-scene .library-shelves>header{height:12%;justify-content:center;border-bottom:2px solid #edbd35;padding:0 0 1cqh}.library-scene .library-shelves>header p{display:none}.library-scene .library-collection{display:grid;grid-template-columns:39% minmax(0,1fr);gap:1.3cqw;height:88%;padding-top:1.2cqh;box-sizing:border-box}.library-scene .library-genres{display:flex;flex-direction:column;min-height:0;padding-right:1.2cqw;border-right:2px solid #e7b832}.library-scene .library-genres h3,.library-scene .library-section h3{font:850 clamp(10px,1.6cqw,25px)/1.1 system-ui;margin:0;text-align:center}.library-scene .library-genres h3{flex:0 0 7%;display:flex;align-items:center;justify-content:center}.library-scene .library-genre-list{display:grid;grid-template-rows:repeat(11,minmax(0,1fr));gap:.5cqh;flex:1;min-height:0;padding:2px}.library-scene .library-genre-list button{display:grid;grid-template-columns:1.5cqw minmax(0,1fr) auto;align-items:center;gap:.4cqw;padding:0 .6cqw;min-width:0;min-height:0;border:1px solid #85bec3;border-radius:7px;background:linear-gradient(#073a49,#031c29);box-shadow:inset 0 0 0 1px #245c66;font:750 clamp(9px,1.25cqw,20px)/1 system-ui;color:#fff1d1;white-space:nowrap;text-align:left}.library-scene .library-genre-list button.empty{color:#92b4bb}.library-scene .library-genre-list button.selected{background:linear-gradient(#fff17a,#f4b923);color:#15222b;text-shadow:none;border-color:#fff7c1;box-shadow:0 0 0 2px #a36a13,inset 0 0 0 1px #f8d75a}.library-scene .library-genre-icon{text-align:center;color:#ffd04c}.library-scene .selected .library-genre-icon{color:#172935}.library-scene .library-genre-label{min-width:0}.library-scene .library-section{min-height:0;display:flex;flex-direction:column}.library-scene .library-section>p{margin:.6cqh 0 1.2cqh;text-align:center;font-size:clamp(9px,1.1cqw,18px)}.library-scene .library-section .library-slots{flex:1;height:auto;min-height:0;gap:2cqh 1cqw}.library-scene .library-section .library-tape strong{font-size:clamp(10px,1.55cqw,25px)}
@media(max-height:450px){.library-scene .library-shelves>header{height:12%}.library-scene .library-collection{height:88%;padding-top:1cqh;gap:1cqw}.library-scene .library-genre-list{gap:.5cqh}.library-scene .library-genre-list button{font-size:1.2cqw;border-radius:4px;padding:0 .4cqw}.library-scene .library-genres h3,.library-scene .library-section h3{font-size:1.4cqw}.library-scene .library-section>p{font-size:1.05cqw;margin:.4cqh 0 .8cqh}.library-scene .library-section .library-tape strong{font-size:1.4cqw}}
.library-scene{background-size:max(120%,calc((var(--app-height,100svh) - var(--console-height)) * 3)) auto;background-position:left center}.library-scene .library-genre-list button.selected{position:relative}.library-scene .library-genre-list button.selected:before{content:'▶';position:absolute;left:-1.5cqw;color:#ffd447;text-shadow:1px 2px #562a0c;font-size:1.4cqw}
/* Larger programme cards; labels remain in the category buttons. */
.library-scene .library-heading{right:5%;width:auto;justify-content:space-between}.library-scene .library-heading strong{order:0}.library-scene .library-heading [data-library-exit]{order:1;aspect-ratio:1;padding:0;min-width:44px;min-height:32px;justify-content:center}.library-scene [data-library-exit] svg{height:65%;width:65%;display:block}.library-scene .library-genre-list{height:100%}
