:root { --bar: 56px; --lab-gold: #ffd18b; --lab-line: #b98169; --lab-panel: #141329e8; }
/* The dev-only lab page (room-lab.html); on the home page the floor sits inside .arcade-stage instead. */
.lab-page, .lab-page * { box-sizing: border-box; }
html:has(body.lab-page), body.lab-page { margin: 0; height: 100%; background: #08091a; color: #ffe0ab; font-family: monospace; overflow: hidden; }
.lab-bar { height: var(--bar); display: flex; align-items: center; gap: 18px; padding: 0 20px; background: #111222; border-bottom: 3px solid #3a3047; }
.lab-bar strong { font-size: 18px; letter-spacing: .06em; color: #fff; }
.lab-bar strong span { color: #ff9a5c; }
.lab-badge { padding: 4px 8px; border: 2px solid #ff6fb4; color: #ff9fd0; font-weight: 900; font-size: 10px; letter-spacing: .1em; }
.lab-bar a { margin-left: auto; color: var(--lab-gold); font-size: 12px; }
.lab-stage { position: relative; height: calc(100svh - var(--bar)); }
.lab-viewport { width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; cursor: grab; outline: none; scrollbar-color: #ca8669 #161324; scrollbar-width: thin; touch-action: pan-x; }
.lab-viewport:active { cursor: grabbing; }
.lab-track { position: relative; height: 100%; overflow: hidden; }
.lab-skybg { position: absolute; inset: 0; background-repeat: repeat-x; background-position-y: center; pointer-events: none; }
.lab-viewport { position: relative; }
.lab-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; }
.lab-world img { user-select: none; -webkit-user-drag: none; }
.sky { position: absolute; left: 0; width: auto; z-index: 0; will-change: transform; pointer-events: none; }
.layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.seg { position: absolute; top: 0; display: block; background-repeat: no-repeat; pointer-events: none; }
.joint { position: absolute; top: 0; z-index: 2; pointer-events: none; }
.floor-strip { position: absolute; left: 0; z-index: 3; background-repeat: repeat-x; pointer-events: none; }

.item, .hot { position: absolute; display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: none; }
.item .sprite { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.item .art, .item .screen { position: absolute; object-fit: cover; pointer-events: none; }
.item .screen { border-radius: 6px; opacity: .92; box-shadow: inset 0 0 30px #000; filter: saturate(1.15) contrast(1.05); }
.marquee { position: absolute; display: flex; align-items: center; justify-content: center; color: #fff4d6; font-family: "Barlow Condensed", Impact, sans-serif; font-weight: 900; letter-spacing: .04em; line-height: 1; white-space: nowrap; text-shadow: 0 0 6px #ff7ad9, 0 0 18px #ff3fbf, 3px 3px 0 #2a0d3a; pointer-events: none; }
a.item, button.item, .hot { cursor: pointer; }
a.item:hover .sprite, button.item:hover .sprite, a.item:focus-visible .sprite, button.item:focus-visible .sprite { filter: drop-shadow(0 0 14px #ffd27b) drop-shadow(0 0 40px #ffb54a99) brightness(1.08); }
.hot { z-index: 4; border-radius: 40px; }
.hot:hover, .hot:focus-visible { box-shadow: 0 0 0 6px #ffd27b, 0 0 60px 20px #ffc26777, inset 0 0 60px #ffd17b55; outline: none; }
.item::after, .hot::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 20px); transform: translateX(-50%); width: max-content; max-width: 600px; padding: 14px 20px; border: 4px solid #f8bd74; background: #141529ed; box-shadow: 8px 8px 0 #09091a; color: #ffe2ac; font: 900 26px/1.2 monospace; letter-spacing: .04em; opacity: 0; pointer-events: none; transition: opacity .16s; z-index: 50; }
.item:hover::after, .item:focus-visible::after, .hot:hover::after, .hot:focus-visible::after { opacity: 1; }
.editing .item { cursor: ew-resize; outline: 3px dashed #7cf0ff66; }
.editing .item.dragging { outline: 4px solid #7cf0ff; }
.item .pos { position: absolute; left: 0; right: 0; bottom: -34px; color: #7cf0ff; font: 700 22px monospace; text-align: center; text-shadow: 2px 2px 0 #000; }

.lab-controls { position: absolute; left: 20px; right: 20px; bottom: 19px; z-index: 4; display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
.lab-position, .lab-arrows { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--lab-line); background: var(--lab-panel); color: #f6ce93; font: 900 10px monospace; letter-spacing: .06em; }
.lab-progress { width: 130px; height: 7px; border: 1px solid #ba866c; background: #443251; }
.lab-progress span { display: block; height: 100%; width: 0; background: var(--lab-gold); }
.lab-arrows { gap: 0; padding: 0; }
.lab-arrows button { width: 48px; height: 44px; border: 0; background: transparent; color: var(--lab-gold); font: 900 25px monospace; cursor: pointer; }
.lab-arrows button + button { border-left: 2px solid var(--lab-line); }
.lab-arrows button:hover { background: #69516e; }
.lab-arrows button:disabled { opacity: .35; cursor: default; }
.lab-toast { position: absolute; left: 50%; bottom: 84px; z-index: 5; transform: translateX(-50%); max-width: min(90vw, 390px); padding: 13px 18px; border: 2px solid #f3b579; background: #17162fe8; box-shadow: 5px 5px 0 #0b0a19; font: 900 13px/1.4 monospace; text-align: center; }
.lab-editor { position: absolute; top: 14px; right: 14px; z-index: 6; width: min(380px, calc(100vw - 28px)); padding: 12px; border: 2px solid #7cf0ff; background: #0d1426f2; color: #cdeff5; font-size: 11px; }
.lab-editor p { margin: 6px 0 8px; }
.lab-editor textarea { width: 100%; height: 30vh; background: #060a14; color: #c3e7e1; border: 1px solid #335; font: 10px/1.4 monospace; }
.lab-editor button { margin-top: 6px; padding: 6px 10px; border: 2px solid #7cf0ff; background: transparent; color: #7cf0ff; font: 900 11px monospace; cursor: pointer; }
.hidden { display: none !important; }
@media (max-width: 600px) { .lab-badge { display: none; } .lab-progress { width: 70px; } }

/* ---- Portals ---- */
.portal, .portal-spill { --c1: #b77cff; --c2: #3fd6e0; --c3: #f5b43c; --c4: #fff3cf; --t-op: 1; }
.portal { position: absolute; overflow: hidden; background: #07031a; pointer-events: none; }
.p-scene { left: 50%; top: 50%; width: 135%; min-height: 135%; object-fit: cover; translate: -50% -50%; image-rendering: pixelated; animation: p-drift 38s ease-in-out infinite alternate; }
.portal img, .portal canvas { position: absolute; pointer-events: none; }
.p-base, .p-tunnel { position: absolute; inset: 0; transition: transform .9s cubic-bezier(.2,.7,.2,1), filter .9s; }
.p-swirl { left: 50%; top: 55%; width: 1150px; height: 1150px; translate: -50% -50%; opacity: .9; filter: brightness(.55) saturate(1.35); animation: p-spin-rev 70s linear infinite; }
.p-t { left: 50%; top: 55%; width: 900px; height: 900px; mix-blend-mode: screen; animation: p-tunnel 9s linear infinite; opacity: 0; }
.p-stars { left: 50%; top: 55%; width: 760px; height: 760px; animation: p-stars 7s linear infinite; opacity: 0; }
.p-sparks { inset: 0; width: 100%; height: 100%; mix-blend-mode: screen; }
.p-core { position: absolute; left: 50%; top: 55%; width: 420px; height: 420px; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, var(--c4) 0, color-mix(in srgb, var(--c4) 75%, transparent) 6%, color-mix(in srgb, var(--c3) 40%, transparent) 16%, color-mix(in srgb, var(--c1) 14%, transparent) 34%, transparent 55%); opacity: var(--core-op, 1); mix-blend-mode: screen; animation: p-pulse 2.6s ease-in-out infinite; }
.p-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, transparent 30%, #07031a99 70%, #05020fee 100%); box-shadow: inset 0 0 70px 26px #05020f; }
.p-doors { position: absolute; inset: 0; perspective: 900px; }
.leaf { top: -14px; height: calc(100% + 22px); width: 51%; object-fit: fill; transition: transform 1.15s cubic-bezier(.2,.75,.2,1), filter 1.15s; }
.leaf.l { left: 0; transform-origin: 0 50%; }
.leaf.r { right: 0; transform-origin: 100% 50%; }
.crack { position: absolute; left: 50%; top: 4%; bottom: 0; width: 10px; translate: -50% 0; background: linear-gradient(#fff0, var(--c4) 15%, var(--c1) 60%, var(--c2) 85%, #fff0); filter: blur(3px); mix-blend-mode: screen; animation: p-crack 2.2s ease-in-out infinite; transition: opacity .4s; }
.p-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, #fff 0, color-mix(in srgb, var(--c4) 80%, transparent) 25%, color-mix(in srgb, var(--c1) 33%, transparent) 55%, transparent 80%); opacity: 0; mix-blend-mode: screen; }
.portal.peek .leaf.l { transform: rotateY(22deg); filter: brightness(.85); }
.portal.peek .leaf.r { transform: rotateY(-22deg); filter: brightness(.85); }
.portal.peek .crack, .portal.open .crack { opacity: 0; animation: none; }
.portal.open .leaf.l { transform: rotateY(84deg); filter: brightness(.45); }
.portal.open .leaf.r { transform: rotateY(-84deg); filter: brightness(.45); }
.portal.surge .p-tunnel { transform: scale(1.45); filter: brightness(1.35) saturate(1.3); }
.portal.surge .p-base { transform: scale(1.25) rotate(25deg); filter: brightness(1.4); }
.portal.surge .p-flash { animation: p-flash .95s ease-out; }
.portal-spill { position: absolute; z-index: 4; pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse at 50% 58%, color-mix(in srgb, var(--c1) 25%, transparent) 0, color-mix(in srgb, var(--c2) 13%, transparent) 32%, color-mix(in srgb, var(--c3) 7%, transparent) 50%, transparent 70%); mix-blend-mode: screen; opacity: .6; animation: p-pulse-o 3.2s ease-in-out infinite; transition: opacity .6s; }
.portal-spill.peek { opacity: .9; } .portal-spill.open { opacity: 1.2; filter: brightness(1.4); }
.portal-motes { position: absolute; z-index: 6; pointer-events: none; mix-blend-mode: screen; }
.portal-hot { z-index: 7; border-radius: 260px 260px 0 0; }
.portal-hot:hover, .portal-hot:focus-visible { box-shadow: none; }
.decor { position: absolute; z-index: 3; pointer-events: none; }
.decor-text { position: absolute; z-index: 3; display: flex; align-items: center; justify-content: center; pointer-events: none; font-weight: 700; letter-spacing: .12em; line-height: 1; white-space: nowrap; text-shadow: 0 0 10px #f5b43c99, 0 0 26px #f5b43c55, 3px 3px 0 #1a0b2a; }
@keyframes p-spin-rev { to { rotate: -360deg; } }
@keyframes p-spin { to { rotate: 360deg; } }
@keyframes p-drift { 0% { transform: translate(-6%, 3%) scale(1); } 100% { transform: translate(6%, -3%) scale(1.08); } }
.decor-spin { animation: p-spin 24s linear infinite; }
.decor-text.rpg { font-family: "Press Start 2P", monospace; font-weight: 400; letter-spacing: .06em; color: #fff; text-shadow: 4px 4px 0 #0a0a3a, 0 0 14px #7fd4ff88; }
@keyframes p-tunnel { 0% { transform: translate(-50%, -50%) scale(.12) rotate(0deg); opacity: 0; } 18% { opacity: calc(.5 * var(--t-op)); } 70% { opacity: calc(.32 * var(--t-op)); } 100% { transform: translate(-50%, -50%) scale(1.9) rotate(150deg); opacity: 0; } }
@keyframes p-stars { 0% { transform: translate(-50%, -50%) scale(.45); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; } }
@keyframes p-pulse { 0%, 100% { scale: .86; opacity: .85; } 50% { scale: 1.1; opacity: 1; } }
@keyframes p-pulse-o { 0%, 100% { scale: .96; } 50% { scale: 1.04; } }
@keyframes p-crack { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes p-flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .p-swirl, .p-t, .p-stars, .p-core, .crack, .portal-spill, .p-scene, .decor-spin { animation: none; } .p-t:first-child { opacity: .8; transform: translate(-50%, -50%) scale(1); } }

/* ---- Depth layers (behind the windows) and the foreground (in front of the floor) ---- */
.depth { position: absolute; left: 0; right: 0; background-repeat: repeat-x; pointer-events: none; will-change: background-position; }
.fore-layer { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.depth.fore { filter: brightness(.5) saturate(1.15) blur(1px); }
@media (max-width: 700px) { .depth.fore { opacity: .85; } }

/* ?skytest: time-of-day slider */
.sky-test { position: absolute; top: 10px; left: 50%; translate: -50% 0; z-index: 8; display: flex; align-items: center; gap: 12px; padding: 8px 14px; border: 2px solid #b98169; background: #141329e8; color: #f6ce93; font: 900 11px monospace; letter-spacing: .08em; box-shadow: 4px 4px 0 #0b0a19aa; }
.sky-test input { width: min(320px, 45vw); accent-color: #ffd18b; }
.sky-test b { min-width: 130px; color: #fff; }
.decor-arc { position: absolute; z-index: 3; pointer-events: none; overflow: visible; }

/* time-of-day grade: a glow along the horizon (in the sky stack) and a faint tint over the room */
.tod-glow { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; }
.tod-room { position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: soft-light; }
.depth { transition: opacity .5s linear; }
.sky-test b { min-width: 190px; }
.tod-tint { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color; }

/* the time dial machine */
.dial-window { position: absolute; border-radius: 50%; overflow: hidden; pointer-events: none; background: #0b0a1a; }
.dial-wheel { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .25s ease-out; }
.dial-wheel.stand-in { border-radius: 50%; background:
  radial-gradient(circle at 50% 14%, #fff6c8 0 5%, #ffd257 6%, transparent 9%),
  radial-gradient(circle at 50% 86%, #f2f4ff 0 4%, transparent 5.5%),
  conic-gradient(from -45deg, #ff9fb8, #6fc3ff 25%, #74c8ff 32%, #ffb25a 50%, #ff6b4a 58%, #3a2b78 70%, #0d1240 80%, #0d1240 88%, #ff9fb8); }
.dial-knob-wrap { position: absolute; z-index: 2; }
.dial-knob { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; transition: transform .25s ease-out; z-index: 2; }
.turning .dial-knob, .turning .dial-wheel { transition: none; }
.turning .dial-knob { cursor: grabbing; }
.dial-knob.stand-in { border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fff2b8, #e3a83c 45%, #8a5a14 100%); box-shadow: 0 0 0 6px #5b3a10, 0 8px 18px #0008; }
.dial-knob.stand-in::before { content: ""; position: absolute; left: 46%; top: 6%; width: 8%; height: 34%; border-radius: 4px; background: #2a1404; }
.dial-readout { position: absolute; display: flex; align-items: center; justify-content: center; color: #9ff3ff; font-family: "Press Start 2P", monospace; letter-spacing: .04em; text-shadow: 0 0 8px #3fd6e0; pointer-events: none; white-space: nowrap; }
.dial-window.bezel { box-shadow: 0 0 0 8px #c98a2a, 0 0 0 12px #5b3a10, 0 0 24px 10px #3fd6e055; }
.dial-window.bezel::after { content: ""; position: absolute; left: 47%; top: -2%; border: 14px solid transparent; border-top: 22px solid #fff2b8; filter: drop-shadow(0 2px 2px #000); }
.lab-viewport.dragging-floor, .lab-viewport.dragging-floor * { cursor: grabbing !important; }

/* performance: depth strips slide by transform; off-screen portals sleep; phones skip some effects */
.depth { will-change: transform; }
.portal.asleep, .portal.asleep *, .portal-spill.asleep { animation-play-state: paused !important; }
.portal.asleep .p-tunnel, .portal.asleep .p-stars, .portal.asleep .p-sparks { visibility: hidden; }
.lite .p-t:nth-child(3) { display: none; }
.lite .decor-spin { animation: none; }

/* firelight over the horizon's lamps and torches: screen-blended, flickering out of step */
.fire-glow { mix-blend-mode: screen; animation: fire-a 2.3s ease-in-out infinite; }
.fire-glow.b { animation: fire-b 1.7s ease-in-out infinite; }
@keyframes fire-a { 0%, 100% { filter: brightness(1); } 30% { filter: brightness(1.35); } 55% { filter: brightness(.8); } 80% { filter: brightness(1.15); } }
@keyframes fire-b { 0%, 100% { filter: brightness(1.2); } 25% { filter: brightness(.85); } 60% { filter: brightness(1.4); } 85% { filter: brightness(.95); } }
@media (prefers-reduced-motion: reduce) { .fire-glow { animation: none; } }
.lite .fire-glow { animation-duration: 3.4s; }

/* owner 11-18 (player QoL): on a desktop browser the walk arrows sit on the left and right edges of the scene, halfway up,
   not together in the bottom-right corner. Phones keep the corner pair. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .lab-controls { top: 0; }
  .lab-arrows { border: 0; background: none; }
  .lab-arrows button { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 96px;
    border: 2px solid var(--lab-line) !important; background: var(--lab-panel); box-shadow: 4px 4px 0 #0b0a19; }
  .lab-arrows #left { left: 0; }
  .lab-arrows #right { right: 0; }
  .lab-arrows button:hover { background: #69516e; }
}

/* Quick travel: [1][2][3]... along the bottom, the stop's name pops up on hover (owner 11-18). Desktop only. */
.lab-index { display: none; }
@media (min-width: 900px) {
  .lab-index { pointer-events: auto; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border: 2px solid var(--lab-line); background: var(--lab-panel); }
  .lab-index button { position: relative; width: 30px; height: 30px; border: 1px solid var(--lab-line); background: #1c1530; color: #f6ce93; font: 900 11px monospace; cursor: pointer; padding: 0; }
  .lab-index button:hover, .lab-index button:focus-visible { background: #69516e; color: #fff; outline: none; }
  .lab-index button.on { background: var(--lab-gold); color: #1c1530; border-color: var(--lab-gold); }
  .lab-index button:hover::after, .lab-index button:focus-visible::after { content: attr(data-name); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 6px 10px; border: 2px solid var(--lab-gold); background: var(--lab-panel); color: #f6ce93; font: 900 10px monospace; letter-spacing: .06em; pointer-events: none; }
}

/* Soda machine drops (stand-ins until the can / chip-bag art lands). */
.soda-drop { position: absolute; pointer-events: none; transform: translate(-50%, -100%); filter: drop-shadow(0 6px 4px #0008); }
img.soda-drop { width: 120px; height: auto; }
.soda-drop.soda-crushable { pointer-events: auto; cursor: pointer; }
.soda-standin.can { width: 58px; height: 104px; border-radius: 12px / 8px; background: linear-gradient(90deg, #0003, #fff6 30%, #0000 45%, #0004), var(--can, #d33); box-shadow: inset 0 10px 0 #ddd, inset 0 -10px 0 #999; }
.soda-standin.c1 { --can: #2f7bff; } .soda-standin.c2 { --can: #2fbf55; } .soda-standin.c3 { --can: #ff9a1f; } .soda-standin.c4 { --can: #b04bff; }
.soda-standin.chips { width: 96px; height: 118px; border-radius: 12px 12px 10px 10px / 8px 8px 14px 14px; background: linear-gradient(90deg, #0003, #fff5 35%, #0000 50%), #f2b630; box-shadow: inset 0 12px 0 #c9302c, inset 0 -12px 0 #c9302c; }

/* Batch 18-19 (owner 11-18): elevator doors + dial + call panel, Library switches / nook / page flip / ladder, the rat, dust covers */
.elev-shaft { position: absolute; overflow: hidden; background: #140b06; pointer-events: none; }
.elev-car { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.55); transition: filter 1.2s; }
.elev-shaft.open .elev-car { filter: brightness(1); }
.elev-door { position: absolute; top: 0; width: 50.6%; height: 100%; object-fit: fill; transition: transform 1.35s cubic-bezier(.5,.05,.3,1); }
.elev-door.l { left: 0; } .elev-door.r { right: 0; }
.elev-shaft.open .elev-door.l { transform: translateX(-97%); } .elev-shaft.open .elev-door.r { transform: translateX(97%); }
.elev-sign, .elev-panel { position: absolute; z-index: 3; }
.elev-sign img:first-child, .elev-panel > img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.elev-needle { position: absolute; transition: transform 2.2s cubic-bezier(.4,.1,.25,1); filter: drop-shadow(2px 3px 2px #0008); pointer-events: none; }
.elev-floor { position: absolute; display: flex; align-items: center; justify-content: center; color: #ffd987; font: 700 30px 'Space Grotesk', sans-serif; letter-spacing: .14em; white-space: nowrap; text-shadow: 0 0 10px #ffb54a99, 2px 2px 0 #1a0b05; pointer-events: none; }
.elev-panel { z-index: 5; }
.elev-call { border-radius: 50%; }
.elev-hot { border-radius: 8px; }
.lib-patch, .lib-flip { position: absolute; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .25s; }
.lib-patch.on, .lib-flip.on { opacity: 1; transition: none; }
.lib-flip.on { filter: drop-shadow(0 0 16px #ffe7a8aa); }
.seg.lib-dim { filter: var(--inside, brightness(1)) brightness(.74) saturate(.9); transition: filter .4s; }
.lib-patch.lib-dim-patch { filter: var(--inside, brightness(1)) brightness(.74) saturate(.9); }
.lib-hot { z-index: 7; border-radius: 24px; }
.lib-nook { position: absolute; z-index: 3; clip-path: inset(0 50% 0 50%); transition: clip-path .7s cubic-bezier(.3,.1,.2,1); }
.lib-nook.open { clip-path: inset(0 0 0 0); }
.lib-nook > img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lib-grab { z-index: 7; border-radius: 30px; }
.lib-key-fly { position: absolute; z-index: 400; pointer-events: none; animation: key-fly 1.4s cubic-bezier(.3,.1,.2,1) forwards; }
@keyframes key-fly { 0% { transform: scale(1) rotate(0); opacity: 1; } 35% { transform: translateY(-160px) scale(1.5) rotate(-12deg); opacity: 1; filter: drop-shadow(0 0 30px #ffe08a); } 100% { transform: translate(260px, -900px) scale(.3) rotate(30deg); opacity: 0; } }
.lib-ladder { position: absolute; z-index: 6; padding: 0; border: 0; background: none; cursor: pointer; transition: left 1.7s cubic-bezier(.45,.05,.3,1); }
.lib-ladder img { width: 100%; height: 100%; pointer-events: none; }
.lib-ladder:hover img, .lib-ladder:focus-visible img { filter: drop-shadow(0 0 14px #ffd27b) brightness(1.08); }
.lib-ladder.rolling img { animation: ladder-wobble 1.7s ease-in-out; transform-origin: 50% 0; }
@keyframes ladder-wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-2.5deg); } 70% { transform: rotate(1.5deg); } 88% { transform: rotate(-.6deg); } }
.lib-ladder::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 20px); transform: translateX(-50%); width: max-content; padding: 14px 20px; border: 4px solid #f8bd74; background: #141529ed; color: #ffe2ac; font: 900 26px/1.2 monospace; opacity: 0; pointer-events: none; transition: opacity .16s; }
.lib-ladder:hover::after, .lib-ladder:focus-visible::after { opacity: 1; }
.rat { position: absolute; pointer-events: none; background-repeat: no-repeat; }
.rat-boom { position: absolute; pointer-events: none; }
.cover-cloth { position: absolute; left: -7%; bottom: -1%; width: 114%; height: 104%; object-fit: fill; z-index: 2; pointer-events: none; transform-origin: 50% 0; transition: transform .9s cubic-bezier(.3,.1,.2,1), opacity .9s; }
.item .marquee { z-index: 1; }
.item.peek .cover-cloth { transform: translateY(-70%) scaleY(.35); opacity: 0; }
a.item:hover .cover-cloth, button.item:hover .cover-cloth { filter: drop-shadow(0 0 14px #ffd27b) brightness(1.08); }
/* A hidden hotspot stays hidden (the generic .hot sets display: block): the nook's key can't be hovered or clicked
   until the book opens the shelf (owner 11-19). */
.item[hidden], .hot[hidden] { display: none !important; }

/* animated torches (owner 11-19): a window onto a frame strip, slid by transform in steps; a soft glow pulses behind */
.torch-set { position: absolute; z-index: 2; pointer-events: none; }
.torch { position: absolute; inset: 0; overflow: hidden; }
.torch.flip { transform: scaleX(-1); }
.torch img { position: absolute; left: 0; top: 0; max-width: none; animation: torch-run 1.3s steps(16) infinite; will-change: transform; }
@keyframes torch-run { to { transform: translateX(var(--run)); } }
/* torch light (owner 11-22): an uneven flicker on two layers at different speeds; bigger and brighter after dark (--tn) */
.torch-light { position: absolute; inset: 0; mix-blend-mode: screen; opacity: calc(.55 + .45 * var(--tn, 0)); transform: scale(calc(1 + .4 * var(--tn, 0))); transform-origin: 50% 30%; }
.torch-glow, .torch-halo { position: absolute; border-radius: 50%; animation: torch-glow 2.3s linear infinite; will-change: opacity, transform; }
.torch-halo { animation-name: torch-halo; }
@keyframes torch-glow { 0% { opacity: .78; transform: scale(.97); } 8% { opacity: .95; transform: scale(1.04); } 13% { opacity: .66; transform: scale(.94); }
  24% { opacity: .9; transform: scale(1.01); } 31% { opacity: .72; } 47% { opacity: 1; transform: scale(1.06); } 53% { opacity: .8; transform: scale(.98); }
  66% { opacity: .93; transform: scale(1.03); } 74% { opacity: .62; transform: scale(.93); } 86% { opacity: .88; transform: scale(1.02); } 100% { opacity: .78; transform: scale(.97); } }
@keyframes torch-halo { 0% { opacity: .7; transform: scale(1); } 17% { opacity: .9; transform: scale(1.05); } 29% { opacity: .6; transform: scale(.96); }
  45% { opacity: .82; } 58% { opacity: 1; transform: scale(1.07); } 69% { opacity: .66; transform: scale(.97); } 83% { opacity: .9; transform: scale(1.03); } 100% { opacity: .7; transform: scale(1); } }
/* indoors after dark (owner 11-22): the hall's art takes the inside grade (room-lab.js sets --inside); torches + portals keep their light.
   :where() keeps this at zero specificity so hover glows and the Library's dimming still win (they repeat var(--inside)). */
:where(.inside-grade .lab-world > :not(.torch-set, .portal-spill, .portal-motes, .layer), .inside-grade .lab-world > .layer > .seg, .inside-grade .lab-world > .layer > .portal, .inside-grade .torch-plate) { filter: var(--inside, none); }
.torch-plate { position: absolute; max-width: none; }
.torch-set.asleep * { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .torch img, .torch-glow, .torch-halo { animation: none; } }
.item.anim-strip { overflow: hidden; }
.item.anim-strip .sprite { right: auto; width: calc(100% * var(--frames)); max-width: none; animation: strip-run 1.3s steps(var(--frames)) infinite; }
@keyframes strip-run { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .item.anim-strip .sprite { animation: none; } }
