/* Room scene: a fixed-size stage that scales to fit the window. */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: #0a0806;
    font-family: 'Jersey 10', monospace;
    -webkit-font-smoothing: none;
}

.stage, .sides {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 960px;
    height: 620px;
    transform: translate(-50%, -50%) scale(var(--s, 1));
    border: 2px solid #000;
    image-rendering: pixelated;
}

.stage {
    --ink: #120a06;
    overflow: hidden;
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
}

/* The furniture art is drawn at one art pixel per 2 stage pixels, so every size and offset here is even. */
.wall, .floor { position: absolute; left: 0; right: 0; }
.wall { top: 0; height: var(--floor); background: url(/images/room/skirting.svg) 0 100% / 96px 12px repeat-x, url(/images/room/rail.svg) 0 0 / 16px 8px repeat-x, url(/images/room/wall.svg) 0 0 / 48px 48px; }
.floor { top: var(--floor); bottom: 0; background: url(/images/room/floor.svg) 0 0 / 960px 126px no-repeat; }

.obj { position: absolute; display: block; color: inherit; text-decoration: none; }
.sprite { position: absolute; }
.sprite img { display: block; width: 100%; height: 100%; }
[data-title] { cursor: default; }
a[data-title] { cursor: pointer; }
[data-title]:hover, [data-title]:focus-visible, [data-title].touring { outline: 2px solid #ffdf7f; outline-offset: 2px; z-index: 5; }

.plate, .case .tag { display: flex; align-items: center; justify-content: center; color: #fde9cb; background: center / 100% 100% no-repeat; font-size: 20px; }
.plate { background-image: url(/images/room/plate.svg); letter-spacing: 2px; }
.shelf { background: url(/images/room/shelf.svg) center / 100% 100% no-repeat; }

/* Window: the frame art has a transparent opening and the skyline shows through it. */
.window { background: url(/images/room/window.svg) 0 0 / 100% 100% no-repeat, 12px 10px / 134px 124px no-repeat; }
.day .window { background-image: url(/images/room/window.svg), url(/images/room/skyline-day.svg); }
.night .window { background-image: url(/images/room/window.svg), url(/images/room/skyline-night.svg); }

/* Portrait */
.portrait { padding: 12px; background: url(/images/room/portrait-frame.svg) center / 100% 100% no-repeat; }
.portrait img { display: block; width: 100%; height: 100%; }

/* Cork board: each piece is art with live text on it. */
.board { left: 182px; top: 16px; width: 234px; height: 224px; line-height: 20px; background: url(/images/room/cork.svg) center / 100% 100% no-repeat; }
.board .piece { position: absolute; display: block; text-decoration: none; background: center / 100% 100% no-repeat; }
.board .text { position: absolute; }
.board .seg { white-space: nowrap; }
.board .card { left: 14px; top: 14px; width: 206px; height: 60px; color: #2a261e; background-image: url(/images/room/board-card.svg); }
.board .logo { position: absolute; left: 30px; top: 8px; width: 44px; height: 44px; background: url(/images/room/sandstone.svg) center / 100% 100% no-repeat; }
.board .card .text { left: 84px; top: 10px; width: 92px; }
.board .old { left: 14px; top: 80px; width: 130px; height: 48px; color: #6b5637; background-image: url(/images/room/board-oldcard.svg); }
.board .old .text { left: 10px; top: 4px; width: 108px; }
.board .note { left: 14px; top: 134px; width: 206px; height: 76px; color: #2f5d8c; background-image: url(/images/room/board-note.svg); }
.board .note .text { left: 20px; top: 12px; width: 180px; }

/* Bookcase and game shelf: each row ends 2px inside the shelf below it, so the item outlines share the shelf's ink line. */
.case { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; background: center / 100% 100% no-repeat; }
.case.books { padding-bottom: 12px; background-image: url(/images/room/bookcase.svg); }
.case.games { background-image: url(/images/room/gameshelf.svg); }
.case .row { flex: 1; display: flex; align-items: flex-end; padding: 0 6px; overflow: hidden; }
.case.games .row { justify-content: center; gap: 6px; padding: 0; }
.case .sp { flex: none; width: calc(8px + min(var(--n), 6) * 2px); height: var(--sh); margin-right: -2px; background: var(--c); border: 2px solid var(--ink); box-shadow: inset 2px 0 0 var(--c-light), inset 0 -8px 0 var(--c-dark); }
.case img { flex: none; width: 48px; height: 48px; border: 2px solid var(--ink); }
.case .tag { position: absolute; left: calc(50% - 32px); top: -18px; width: 64px; height: 28px; background-image: url(/images/room/label.svg); }
.c0 { --c: #a33b3b; --c-light: #cf5f55; --c-dark: #6e2430; } .c1 { --c: #2f5d8c; --c-light: #4f86b8; --c-dark: #1d3a5f; }
.c2 { --c: #3f7a4a; --c-light: #62a05c; --c-dark: #25503a; } .c3 { --c: #c9a13c; --c-light: #ecc965; --c-dark: #8f6b25; }
.c4 { --c: #6b4a8c; --c-light: #9070b3; --c-dark: #432d5e; } .c5 { --c: #5fa3c7; --c-light: #8cc6e0; --c-dark: #3c7494; }
.c6 { --c: #2f7f80; --c-light: #4fa9a3; --c-dark: #1c5058; } .c7 { --c: #b8612e; --c-light: #dc8a4c; --c-dark: #7d3d20; }
.c8 { --c: #3a3f52; --c-light: #5c6480; --c-dark: #232638; } .c9 { --c: #8c3a5e; --c-light: #b85c80; --c-dark: #5c2440; }
.c10 { --c: #7a7f3a; --c-light: #a3a85a; --c-dark: #4f5324; } .c11 { --c: #a8825a; --c-light: #cba77c; --c-dark: #73563a; }

/* Desk and computer: the screen text sits on the glass area of the monitor art. */
.desk { background: url(/images/room/desk.svg) center / 100% 100% no-repeat; }
.monitor { background: url(/images/room/monitor.svg) center / 100% 100% no-repeat; }
.monitor .screen { position: absolute; left: 12px; top: 12px; width: 184px; height: 120px; display: flex; flex-direction: column; padding: 4px 6px; color: #7be07b; font-size: 20px; overflow: hidden; }
.monitor .bar { padding: 0 4px; color: #06140a; background: #7be07b; line-height: 20px; }
.monitor .repo { display: flex; justify-content: space-between; padding: 0 4px; line-height: 20px; white-space: nowrap; border-bottom: 2px solid #1f5a2a; }
.monitor .repo b { font-weight: 400; color: #ffdf7f; }
.star { display: inline-block; width: 14px; height: 14px; margin-right: 6px; background: url(/images/room/star.svg) center / 100% 100% no-repeat; }

/* Floor objects */
.rug { background: url(/images/room/rug.svg) center / 100% 100% no-repeat; }
.ball { animation: bounce 1.2s steps(6) infinite alternate; }
@keyframes bounce { to { transform: translateY(-48px); } }
.zzz { position: absolute; left: 18%; bottom: 100%; color: #fff; font-size: 20px; animation: zzz 2.4s steps(4) infinite; }
@keyframes zzz { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(16px, -24px); opacity: 0; } }
.glow { position: absolute; pointer-events: none; background: radial-gradient(closest-side, #ffe08a55, transparent); }
.shade { position: absolute; inset: 0 0 100px; pointer-events: none; background: radial-gradient(ellipse at 50% 60%, transparent 40%, #05030a99 100%); }

/* Camera move between the room and a shelf page. The script sets the origin and --zoom so that the furniture fills the window. */
@media (prefers-reduced-motion: no-preference) {
    .leave body { animation: zoom 500ms cubic-bezier(0.5, 0, 0.9, 0.6) forwards; }
    [data-from] body { animation: zoom 500ms cubic-bezier(0.5, 0, 0.9, 0.6) reverse backwards; }
}
@keyframes zoom { 55% { opacity: 1; } to { transform: var(--zoom); opacity: 0; } }

/* Dialog box and panels (version B) */
.dialog { position: absolute; left: 0; right: 0; bottom: 0; height: 100px; padding: 8px 20px; color: #f3ead2; background: #1b2430; border-top: 2px solid #000; box-shadow: inset 0 0 0 2px #f3ead2, inset 0 0 0 4px #0d131b; font-size: 20px; }
.dialog b { display: block; font-weight: 400; font-size: 40px; line-height: 0.9; color: #ffdf7f; }
.tour { position: absolute; right: 16px; top: 12px; padding: 0 8px; color: #1b2430; background: #ffdf7f; border: 0; font: inherit; font-size: 20px; line-height: 24px; cursor: pointer; }
.pointer { position: absolute; left: 0; top: 0; width: 18px; height: 26px; z-index: 30; pointer-events: none; background: url(/images/room/cursor.svg) 0 0 / 100% 100% no-repeat; }
.panel { position: absolute; left: 120px; right: 120px; top: 40px; bottom: 120px; padding: 20px 28px; z-index: 20; overflow: auto; color: #f3ead2; background: #1b2430; border: 2px solid #000; box-shadow: inset 0 0 0 2px #f3ead2, inset 0 0 0 4px #0d131b, 0 0 0 2000px #000000a0; font-size: 20px; line-height: 1.1; }
.panel[hidden] { display: none; }
.panel h2 { margin-bottom: 12px; font-weight: 400; font-size: 40px; color: #ffdf7f; }
.panel h1 { display: none; }
.panel p, .panel ul { margin-bottom: 12px; }
.panel ul { padding-left: 24px; }
.panel a { color: #8cc6e0; }
.panel .close { position: absolute; right: 16px; top: 12px; padding: 0 8px; color: #1b2430; background: #ffdf7f; border: 0; font: inherit; font-size: 20px; cursor: pointer; }
.panel .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.panel .card { display: block; padding: 8px 10px; color: #f3ead2; text-decoration: none; background: #2a3646; border: 2px solid #f3ead2; }
.panel .card b { display: block; font-weight: 400; font-size: 20px; color: #7be07b; }
.panel .card:hover { border-color: #ffdf7f; }

/* Side areas: the building from outside, in stage coordinates. The transparent border gives .sides the same origin as the stage content.
   One storey is 656px: the stage, a 10px cut wall, and a 16px stone band. Tall pieces start at a multiple of 656px (-1968px). */
.sides { border-color: transparent; pointer-events: none; }
.sides i { position: absolute; }
.sides .sky { left: -2880px; top: -1968px; width: 6720px; height: 4592px; background: url(/images/room/side-far-day.svg) 0 2488px / 480px 180px repeat-x, linear-gradient(to bottom, #5aa9d6 2100px, #7dbfe2 2100px, #7dbfe2 2250px, #a3d3ea 2250px, #a3d3ea 2400px, #c9e6f0 2400px, #c9e6f0 2668px, #8399b1 2668px); }
.night .sides .sky { background: url(/images/room/side-far-night.svg) 0 2488px / 480px 180px repeat-x, url(/images/room/side-stars.svg) 0 0 / 240px 240px, linear-gradient(to bottom, #0b1030 2100px, #131a45 2100px, #131a45 2250px, #1d2458 2250px, #1d2458 2400px, #2a2f6a 2400px, #2a2f6a 2668px, #14183a 2668px); }
.sides .bricks { left: -480px; top: -1968px; width: 1920px; height: 4592px; border: solid #120a06; border-width: 0 4px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 626px, #120a06 626px, #120a06 628px, #b9ad94 628px, #b9ad94 630px, #8d8478 630px, #8d8478 642px, #5d554c 642px, #5d554c 644px, #120a06 644px, #120a06 646px, transparent 646px, transparent 656px), url(/images/room/side-brick.svg) 0 0 / 128px 64px; }
.night .sides .bricks::after { content: ''; position: absolute; inset: 0; background: #0b103070; }
.sides .cut { left: -12px; top: -12px; width: 980px; height: 640px; background: #8d8478; border: 2px solid #120a06; box-shadow: inset 2px 2px 0 #b9ad94, inset -2px -2px 0 #5d554c; }
.sides .escape { left: -180px; top: -1968px; width: 160px; height: 4592px; background: url(/images/room/side-escape.svg) 0 0 / 160px 656px repeat-y; }
.sides .pipe { left: 976px; top: -1968px; width: 10px; height: 4592px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 150px, #15131c 150px, #15131c 156px, transparent 156px, transparent 164px), linear-gradient(to right, #4a5068 2px, #232638 2px, #232638 8px, #15131c 8px); }
.sides .windows { top: -1968px; width: 96px; height: 4592px; background: url(/images/room/side-windows-day.svg) 0 0 / 96px 1312px repeat-y; }
.night .sides .windows { background-image: url(/images/room/side-windows-night.svg); }
.sides .w1 { left: 1010px; background-position-y: 656px; }
.sides .w2 { left: 1240px; }
.sides .w3 { left: -360px; }
