html, body { margin: 0; height: 100%; background: #0a0a1a; overflow: hidden; touch-action: none; }
#screen { display: block; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; color: #f8d848; font: 600 20px Menlo, Monaco, Consolas, monospace; }

#finder { position: fixed; inset: 0; background: rgba(8, 8, 24, .7); display: grid; place-items: start center; padding-top: 8vh; }
#finder[hidden] { display: none; }
.find-box { width: min(560px, 92vw); background: #141a4a; color: #fff; border: 4px solid #f4f4f4; outline: 4px solid #0a0a1a; box-shadow: inset 0 0 0 3px #141a4a, inset 0 0 0 5px #8890c8; padding: 18px; font: 600 16px Menlo, Monaco, Consolas, monospace; }
.find-box label { display: block; color: #f8d848; margin-bottom: 10px; }
#find-input { width: 100%; box-sizing: border-box; font: inherit; color: #fff; background: #0a0a1a; border: 2px solid #8890c8; padding: 8px 10px; outline: none; border-radius: 0; }
#find-input:focus { border-color: #f8d848; }
#find-results { list-style: none; margin: 10px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
#find-results li { display: grid; grid-template-columns: 1.4em 1fr auto; gap: 8px; padding: 6px 8px; cursor: pointer; }
#find-results li.on, #find-results li:hover { background: #2a3480; }
#find-results li.on .n { color: #f8d848; }
#find-results .k { color: #7ec8ff; }
#find-results .s { color: #a8b0e0; font-size: 13px; white-space: nowrap; }
#find-close { margin-top: 12px; font: inherit; font-size: 13px; color: #c8c8e8; background: none; border: 2px solid #8890c8; padding: 4px 10px; cursor: pointer; border-radius: 0; }

#pad { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none; }
#pad[hidden] { display: none; }
#pad button { pointer-events: auto; font: 700 18px Menlo, monospace; color: #fff; background: rgba(20, 26, 74, .7); border: 3px solid #f4f4f4; border-radius: 0; width: 52px; height: 52px; padding: 0; user-select: none; -webkit-user-select: none; touch-action: none; }
#pad button.on { background: #f8d848; color: #141a4a; }
#pad button.small { font-size: 11px; width: 44px; height: 32px; }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); }
.dpad [data-k=up] { grid-area: 1 / 2; } .dpad [data-k=left] { grid-area: 2 / 1; } .dpad [data-k=right] { grid-area: 2 / 3; } .dpad [data-k=down] { grid-area: 3 / 2; }
.ab { display: grid; grid-template-columns: 52px 52px; gap: 10px; align-items: end; }
.ab [data-k=A] { transform: translateY(-26px); }

/* Zoom panel: big and always in the same place on the map of Canada. */
#zoom { position: fixed; right: max(16px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 14px; background: #141a4a; border: 4px solid #f4f4f4; outline: 4px solid #0a0a1a; box-shadow: inset 0 0 0 3px #141a4a, inset 0 0 0 5px #8890c8, 6px 6px 0 rgba(0, 0, 0, .45); font: 700 12px Menlo, Monaco, Consolas, monospace; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#zoom[hidden] { display: none; }
#zoom button { width: 112px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; color: #141a4a; background: #f8d848; border: 4px solid #0a0a1a; border-radius: 0; box-shadow: inset -4px -4px 0 #c8a020, inset 4px 4px 0 #fff2a0; cursor: pointer; font: inherit; }
#zoom button b { font-size: 72px; line-height: 64px; }
#zoom button span { font-size: 16px; letter-spacing: .02em; }
#zoom button:hover { background: #ffe470; }
#zoom button:active, #zoom button.on { transform: translate(2px, 2px); box-shadow: inset 4px 4px 0 #c8a020; }
#zoom button:disabled { background: #50557a; color: #8890c8; box-shadow: none; cursor: default; transform: none; }
#zoom button:focus-visible { outline: 4px solid #7ec8ff; outline-offset: 2px; }
#zoom-levels { display: flex; flex-direction: column; align-items: center; gap: 5px; }
#zoom-levels button { width: 76px !important; height: 20px !important; background: #2a3480 !important; border: 3px solid #0a0a1a !important; box-shadow: none !important; }
#zoom-levels button.on { background: #7ef0a0 !important; transform: none; }
#zoom-levels button:hover { background: #8890c8 !important; }
#zoom-levels small { color: #f8d848; font-size: 20px; margin-top: 4px; }
@media (max-height: 620px) { #zoom { gap: 8px; padding: 10px; } #zoom button { width: 80px; height: 80px; } #zoom button b { font-size: 50px; line-height: 46px; } #zoom button span { font-size: 13px; } #zoom-levels button { width: 56px !important; height: 11px !important; } #zoom-levels small { font-size: 15px; } }

/* Inside a gallery: the room, its photo, and every exhibition and event hung on the wall. */
#gallery { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(6, 6, 20, .78); padding: 2vh 2vw; }
#gallery[hidden] { display: none; }
.gv-room { --wall: #f4f2ec; --ink: #1c1424; position: relative; width: min(1040px, 100%); max-height: 96vh; overflow: auto; background: var(--wall); background-image: linear-gradient(90deg, rgba(0,0,0,.035) 50%, transparent 50%); background-size: 32px 100%; color: var(--ink); border: 6px solid #0a0a1a; box-shadow: 0 0 0 4px #f4f4f4, 0 0 0 8px #0a0a1a, 10px 12px 0 8px rgba(0,0,0,.5); font: 600 15px/1.45 Menlo, Monaco, Consolas, monospace; outline: none; animation: gv-in .28s steps(4); }
@keyframes gv-in { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.gv-room.dark { --ink: #fbf6ea; }
.gv-close { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 2; font: 700 13px Menlo, monospace; color: #fff; background: #141a4a; border: 3px solid #0a0a1a; box-shadow: inset 0 0 0 2px #8890c8; padding: 8px 12px; cursor: pointer; }
.gv-close:hover { background: #2a3480; }
.gv-head { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 26px; padding: 30px 30px 10px; align-items: start; }
.gv-photo { background: #0a0a1a; border: 10px solid #5a3a20; box-shadow: inset 0 0 0 3px #c8a048, 0 6px 0 rgba(0,0,0,.25); padding: 0; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.gv-photo canvas, .gv-photo img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.gv-photo.house { background: #7ec0f0; }
.gv-photo.house canvas { object-fit: contain; width: 70%; height: 85%; }
.gv-kind { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
#gv-name { margin: 4px 0 8px; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.15; }
.gv-addr { margin: 0 0 10px; opacity: .85; }
.gv-stats { margin: 0 0 14px; font-size: 16px; }
.gv-stats b { background: #e04848; color: #fff; padding: 1px 7px; margin-right: 4px; }
.gv-stats .star { color: #b08a10; }
.gv-links { display: flex; flex-wrap: wrap; gap: 10px; }
.gv-links a { color: #141a4a; background: #f8d848; border: 3px solid #0a0a1a; box-shadow: inset -3px -3px 0 #c8a020; padding: 7px 12px; text-decoration: none; font-weight: 700; }
.gv-links a:hover { background: #ffe470; }
.gv-credit { margin: 12px 0 0; font-size: 11px; opacity: .6; }
.gv-wall-title { clear: both; margin: 18px 30px 6px; font-size: 18px; border-bottom: 3px dashed currentColor; padding-bottom: 6px; opacity: .9; }
.gv-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 34px 28px; padding: 22px 30px 40px; }
.gv-art { display: flex; flex-direction: column; align-items: stretch; }
.gv-frame { position: relative; background: #0a0a1a; border: 12px solid #6a4424; box-shadow: inset 0 0 0 3px #c8a048, 0 8px 0 rgba(0,0,0,.25); aspect-ratio: 4 / 3; overflow: hidden; }
.gv-art:nth-child(3n+2) .gv-frame { border-color: #2a2a2a; box-shadow: inset 0 0 0 3px #8a8a8a, 0 8px 0 rgba(0,0,0,.25); }
.gv-art:nth-child(3n) .gv-frame { border-color: #c8a048; box-shadow: inset 0 0 0 3px #f8e8a0, 0 8px 0 rgba(0,0,0,.25); }
.gv-frame canvas { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.gv-frame .badge { position: absolute; top: 8px; left: 8px; background: #e04848; color: #fff; font-size: 12px; font-weight: 800; padding: 2px 7px; border: 2px solid #0a0a1a; animation: gv-blink 1s steps(2) infinite; }
@keyframes gv-blink { 50% { background: #c02838; } }
.gv-plaque { margin: 14px 6px 0; background: #fbf8f0; color: #1c1424; border: 3px solid #0a0a1a; box-shadow: 3px 3px 0 rgba(0,0,0,.2); padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.gv-plaque h4 { margin: 0 0 6px; font-size: 15px; line-height: 1.25; }
.gv-plaque .when { margin: 0 0 6px; font-weight: 800; color: #2a4ab0; }
.gv-plaque .when.now { color: #b02030; }
.gv-plaque .desc { margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }
.gv-plaque .desc.open { display: block; }
.gv-plaque .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gv-plaque button, .gv-plaque a { font: 700 12px Menlo, monospace; color: #141a4a; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.gv-empty { grid-column: 1 / -1; text-align: center; padding: 30px 10px 10px; font-size: 16px; }
.gv-floor { height: 46px; background: repeating-linear-gradient(90deg, #8a5a32 0 60px, #7a4e2a 60px 62px), #8a5a32; border-top: 6px solid #5a3a20; }
@media (max-width: 640px) { .gv-head { grid-template-columns: 1fr; padding: 54px 16px 6px; } .gv-wall { padding: 16px; gap: 26px; } .gv-wall-title { margin: 12px 16px 4px; } }
