/* Optional attachment: the reading column and command dock keep their existing styles. */
.log-pres:has(> .room-paperclip),.log-pres-suspect:has(> .room-paperclip),.log-loc:has(> .room-paperclip){position:relative;padding-right:58px;}
.room-paperclip {
    --clip-overhang: 12px;
    position: absolute;
    right: -39px;
    top: -9px;
    width: 80px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 2;
}
.room-paperclip svg,.note-paperclip svg{position:absolute;left:0;top:10px;width:80px;height:27px;overflow:visible;transition:rotate .2s;rotate:var(--clip-tilt,0deg);}
.room-paperclip path,.note-paperclip path{fill:none;stroke-linecap:round;stroke-linejoin:round;}
.clip-back{clip-path:inset(0 0 0 calc(100% - var(--clip-overhang)));}
.clip-front{filter:drop-shadow(0 1px 1px #30261950);}
.clip-shadow{stroke:#6d695e;stroke-width:2.7;}
.clip-wire{stroke:#d3d0c5;stroke-width:1.2;}
.room-paperclip:hover svg {
    rotate: 5deg;
}
@media(max-width:680px){.room-paperclip{right:-28px;}}
.room-paperclip:focus-visible{outline:2px solid var(--oxblood);outline-offset:4px;border-radius:3px;}
.room-sketch-viewer{position:fixed;inset:0;box-sizing:border-box;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:24px;background:transparent;border:0;overflow:auto;color:var(--ink);}
.room-sketch-viewer[open]{display:grid;place-items:center;}
.room-sketch-viewer::backdrop{background:rgba(30,24,17,.48);backdrop-filter:blur(1px);}
.room-sketch-sheet{box-sizing:border-box;width:min(100%,860px);max-height:calc(100dvh - 48px);overflow:auto;background:var(--sketch-paper,#f8f5ed);padding:28px 32px 26px;box-shadow:2px 4px 8px #21180e30,8px 24px 55px #21180e55;border:0;border-radius:0;transform-origin:center;}
.room-sketch-sheet header{text-align:left;display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin:0 0 6px;padding:0;border:0;border-radius:0;background:none;box-shadow:none;min-height:0;}
.sketch-eyebrow{font:10px/1.5 var(--mono);letter-spacing:.14em;color:var(--brass);}
.room-sketch-sheet h2{font:17px/1.4 var(--mono);text-align:left;margin:5px 0 0;color:var(--ink);}
.sketch-close{width:44px;height:44px;flex-shrink:0;padding:0;border:0;background:none;color:var(--ink-dim);font:30px/1 Georgia;cursor:pointer;}
.sketch-close:focus-visible{outline:2px solid var(--oxblood);outline-offset:2px;}
.sketch-picture{min-height:80px;}
.sketch-picture img{display:block;width:auto;height:auto;max-width:100%;max-height:65dvh;margin-inline:auto;object-fit:contain;mix-blend-mode:normal;mask-image:linear-gradient(to right,transparent,#000 4%,#000 96%,transparent),linear-gradient(to bottom,transparent,#000 5%,#000 95%,transparent);mask-composite:intersect;}
.sketch-picture img[hidden],.sketch-load-error[hidden]{display:none;}
.sketch-load-error{font:13px/1.6 var(--mono);color:var(--ink-dim);margin:15px 0 0;}
@media(max-width:600px){.room-sketch-viewer{padding:14px 24px;}.room-sketch-sheet{padding:16px;max-height:calc(100dvh - 28px);}.room-sketch-sheet h2{font-size:16px;}}
@media(prefers-reduced-motion:reduce){.room-paperclip svg,.note-paperclip svg{transition:none;}.room-sketch-viewer::backdrop{backdrop-filter:none;}}

/* Keep the image paper and the surrounding card in the same colour space. */
.sketch-picture img{filter:none;}

/* The same outer-loop-over / inner-loop-under clip travels with the loose note. */
.room-sketch-note{position:relative;width:min(100%,860px);transform-origin:center;}
.room-sketch-note .room-sketch-sheet{width:100%;}
.note-paperclip{--clip-overhang:12px;position:absolute;right:-12px;top:76px;width:80px;height:44px;z-index:2;pointer-events:none;}

/* A whisper of pressure in the paper, not another exposed metal loop. */
.clip-impression{clip-path:inset(0 var(--clip-overhang) 0 0);}
.room-paperclip .clip-indent-fill,.note-paperclip .clip-indent-fill{fill:rgba(75,57,31,.035);stroke:none;}
.clip-indent-wire{stroke:rgba(75,57,31,.085);stroke-width:1.4;}

.room-paperclip.is-away{visibility:hidden;pointer-events:none;}

/* Reserve the page scrollbar gutter even while a modal locks body scrolling. */
html:has(#app.game){scrollbar-gutter:stable;}

/* The note and its attached clip arrive as one piece of paper. */
.room-sketch-viewer[open] .room-sketch-note{animation:sketch-card-in 280ms ease-out both;}
@keyframes sketch-card-in{
    from{opacity:0;transform:translateY(8px) rotate(-.8deg);}
    to{opacity:1;transform:translateY(0) rotate(0);}
}
@media(prefers-reduced-motion:reduce){.room-sketch-viewer[open] .room-sketch-note{animation:none;}}

/* A real strip of desk remains beside the paper, including on touch screens. */
@media(max-width:704px){
    html:has(#app.game){--deck-h:calc((100vw - 16px) * .22 + env(safe-area-inset-bottom,0px));}
    body:has(#app.game){padding-right:16px;}
    body:has(#app.game) .prompt-dock,body:has(#app.game) .typewriter-machine,body:has(#app.game) .command-flight-layer{width:min(calc(100% - 16px),680px);left:calc(50% - 8px);}
}
/* Quiet sepia scroll thumbs; retain native scrolling and accessibility. */
html:has(#app.game),body:has(#app.game) :is(.prompt-dock,.room-sketch-viewer,.room-sketch-sheet,.clue-scroll){scrollbar-width:thin;scrollbar-color:#9b9283 transparent;}
html:has(#app.game)::-webkit-scrollbar,body:has(#app.game) ::-webkit-scrollbar{width:8px;height:8px;}
html:has(#app.game)::-webkit-scrollbar-thumb,body:has(#app.game) ::-webkit-scrollbar-thumb{background:#9b9283;border:2px solid transparent;background-clip:padding-box;border-radius:10px;}
html:has(#app.game)::-webkit-scrollbar-track,body:has(#app.game) ::-webkit-scrollbar-track{background:transparent;}
@media(forced-colors:active){html:has(#app.game),body:has(#app.game) :is(.prompt-dock,.room-sketch-viewer,.room-sketch-sheet,.clue-scroll){scrollbar-color:auto;}}

@media (min-width: 705px) {
    button.room-paperclip {
        zoom: 1.2;
        right: -35px;
    }
}
