:root { --paper: #f3eee6; --night: #171311; --ink: #2a2420; --brass: #c79552; --serif: "Cormorant Garamond", "Cormorant Fallback", Georgia, serif; --sans: Jost, "Jost Fallback", system-ui, sans-serif; --gap: max(16px, env(safe-area-inset-left)); --low: max(16px, env(safe-area-inset-bottom)); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; margin: 0; overflow: hidden; overscroll-behavior: none; background: var(--night); color: var(--paper); font: 400 1rem/1.5 var(--sans); }
button, a { font: 500 1rem/1 var(--sans); color: inherit; touch-action: manipulation; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #c3d2f7; outline-offset: 3px; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
#view:active { cursor: grabbing; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
body:not(.is-touch) .for-touch, .is-touch .for-mouse { display: none !important; }

/* opening */
#intro { position: fixed; inset: 0; z-index: 5; display: grid; align-items: end; transition: opacity .7s, visibility .7s; }
#intro > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#intro::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(75deg, rgba(23, 19, 17, .92), rgba(23, 19, 17, .55) 45%, rgba(23, 19, 17, 0) 75%); }
#intro > div { position: relative; z-index: 1; max-width: 620px; padding: clamp(24px, 5vw, 72px); }
.is-walking #intro { opacity: 0; visibility: hidden; }
h1 { margin: 0; font: 500 clamp(2.9rem, 6.4vw, 5.4rem)/.95 var(--serif); letter-spacing: -.025em; text-wrap: balance; }
#intro p { max-width: 46ch; margin: 20px 0 28px; font-size: 1.1rem; }
#start { min-height: 52px; min-width: 220px; padding: 0 28px; border: 0; background: var(--paper); color: var(--ink); font-size: 1.1rem; }
#start:disabled { background: rgba(243, 238, 230, .2); color: var(--paper); cursor: progress; }
.track { display: block; width: 220px; height: 3px; margin-top: 10px; background: rgba(243, 238, 230, .2); }
.track i { display: block; height: 100%; background: var(--brass); transform: scaleX(0); transform-origin: 0 0; }
.is-ready .track { visibility: hidden; }
#intro .how { margin: 22px 0 14px; font-size: 1rem; }
.how b { font-weight: 500; color: #ecc894; }
#intro a { display: inline-block; padding: 12px 0; }
#intro small { display: block; margin-top: 8px; color: #cfc5b8; font-size: .9rem; }

/* while walking */
.hud { position: fixed; z-index: 2; opacity: 0; visibility: hidden; transition: opacity .4s; }
.is-walking .hud { opacity: 1; visibility: visible; }
header.hud { inset: max(14px, env(safe-area-inset-top)) var(--gap) auto; display: flex; justify-content: space-between; pointer-events: none; }
header.hud > div { display: flex; gap: 8px; }
header.hud a, header.hud button { pointer-events: auto; }
.back, header.hud button, .modes button, #offer, #card-close, #close-places, #close-keys, .atlas-top button, .atlas-zoom button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; background: rgba(23, 19, 17, .82); color: var(--paper); text-decoration: none; white-space: nowrap; transition: background .2s; }
.back { padding-left: 10px; }
#open-places { gap: .28em; }
header.hud #full { width: 44px; padding: 0; }
.back:hover, header.hud button:hover, .modes button:hover, .atlas-top button:hover, .atlas-zoom button:hover { background: rgba(59, 50, 45, .95); }
#open-map { left: var(--gap); bottom: var(--low); width: 168px; height: 168px; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: 0 0 0 3px rgba(23, 19, 17, .82); }
#open-map:hover { box-shadow: 0 0 0 3px var(--paper); }
#map { display: block; width: 100%; height: 100%; border-radius: 50%; }
#open-map kbd { position: absolute; right: 4px; bottom: 4px; border: 0; background: var(--night); color: var(--paper); }
.modes { left: 50%; bottom: var(--low); display: flex; transform: translateX(-50%); }
.modes [aria-pressed="true"], .seg [aria-pressed="true"] { background: var(--paper) !important; color: var(--ink); }
#offer { left: calc(50% + 70px); top: 60%; min-height: 52px; background: var(--brass); color: #20170d; }
#offer:hover { background: #dcae6f; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 1.5px solid currentColor; font: 500 .95rem/1 var(--sans); }
#help { left: 50%; top: max(18px, env(safe-area-inset-top)); margin: 0; padding: 8px 16px; background: rgba(23, 19, 17, .72); transform: translateX(-50%); pointer-events: none; text-align: center; white-space: nowrap; }
.is-walking #help.done { opacity: 0; transition-duration: 1.2s; }
#dot { left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(23, 19, 17, .55); pointer-events: none; }
body:not(.is-locked) #dot, body[data-mode="look"] #dot, body[data-mode="fly"] #dot { display: none; }
#mark { position: fixed; z-index: 2; left: 0; top: 0; display: grid; justify-items: center; gap: 8px; margin: 0; pointer-events: none; font-size: .95rem; font-weight: 500; text-shadow: 0 1px 4px #171311, 0 0 2px #171311; }
#mark span { padding: 4px 8px; background: rgba(23, 19, 17, .72); line-height: 1; text-shadow: none; }
#mark i { width: 15px; height: 15px; background: #e8b25f; box-shadow: 0 0 0 2px var(--night); transform: rotate(45deg); }
body:not(.is-walking) #mark { display: none; }
#stick, #pads { display: none; }
#toast { position: fixed; z-index: 7; left: 50%; top: 84px; margin: 0; padding: 12px 20px; background: var(--paper); color: var(--ink); transform: translateX(-50%); }
#card { right: var(--gap); bottom: var(--low); width: 340px; background: var(--night); }
#card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
#card div { padding: 16px 20px 20px; }
#card h2 { margin: 0; font: 500 1.7rem/1.1 var(--serif); }
#card p { margin: 8px 0 16px; }
#card-close { background: var(--paper); color: var(--ink); }

#hour { right: var(--gap); bottom: var(--low); display: block; width: 240px; padding: 10px 16px 12px; background: rgba(23, 19, 17, .82); }
#hour span { display: flex; justify-content: space-between; font-weight: 500; }
#hour input { display: block; width: 100%; height: 22px; margin: 6px 0 0; -webkit-appearance: none; appearance: none; background: linear-gradient(90deg, #1f5fb8, #3aa08a 22%, #e9e2c8 48%, #eab040 72%, #c8391a) center / 100% 6px no-repeat; cursor: pointer; }
#hour input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 22px; border: 0; background: var(--paper); }
#hour input::-moz-range-thumb { width: 16px; height: 22px; border: 0; border-radius: 0; background: var(--paper); }
[data-mode="look"] #hour { display: none !important; }

/* places */
#places, #keys { touch-action: pan-y; }
#places { position: fixed; inset: 0; z-index: 4; overflow: auto; padding: 20px clamp(16px, 4vw, 64px) 48px; background: rgba(23, 19, 17, .95); overscroll-behavior: contain; }
#close-places, #close-keys { position: sticky; top: 0; z-index: 1; float: right; background: var(--paper); color: var(--ink); }
#list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px clamp(20px, 4vw, 64px); max-width: 1280px; margin: 0 auto; clear: none; }
#list h3 { margin: 0 0 8px; font: 500 clamp(1.5rem, 2.2vw, 2rem)/1.1 var(--serif); }
#list h3 small { margin-left: 10px; color: #e0b981; font: 400 1rem/1 var(--sans); }
#list section:not(.details) button { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; border-bottom: 1px solid rgba(243, 238, 230, .22); background: none; text-align: left; font-size: 1.1rem; }
#list button:hover { color: #ecc894; }
.details { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 18px 14px; }
.details h3 { grid-column: 1 / -1; }
.details button { display: block; padding: 0; border: 0; background: none; text-align: left; line-height: 1.25; }
.details img { display: block; width: 100%; height: auto; margin-bottom: 8px; filter: grayscale(1) brightness(.6); transition: filter .3s; }
.details .is-found img, .details button:hover img { filter: none; }
#fade { position: fixed; inset: 0; z-index: 3; background: var(--night); opacity: 0; pointer-events: none; transition: opacity .32s; }
#fade.on { opacity: 1; }

/* the list of controls */
#keys { position: fixed; inset: 0; z-index: 4; overflow: auto; padding: 20px clamp(16px, 4vw, 64px) 48px; background: rgba(23, 19, 17, .93); overscroll-behavior: contain; }
.sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px clamp(20px, 4vw, 64px); max-width: 1280px; margin: clamp(0px, 9vh, 90px) auto 0; }
.sheet h3 { margin: 0 0 12px; font: 500 clamp(1.5rem, 2.2vw, 2rem)/1.1 var(--serif); }
.sheet dl { margin: 0; }
.sheet dl > div { display: grid; grid-template-columns: 124px 1fr; align-items: center; gap: 14px; min-height: 46px; padding: 8px 0; border-bottom: 1px solid rgba(243, 238, 230, .16); line-height: 1.3; }
.sheet dt { display: flex; flex-wrap: wrap; gap: 4px; }
.sheet dd { margin: 0; }
.for-touch.sheet dl > div { grid-template-columns: 1fr; gap: 2px; }
.for-touch.sheet dt { color: #ecc894; font-weight: 500; }

/* the whole map */
#atlas { position: fixed; inset: 0; z-index: 4; background: var(--night); }
#atlas-view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.atlas-top { position: absolute; inset: max(14px, env(safe-area-inset-top)) var(--gap) auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; pointer-events: none; }
.atlas-top button { pointer-events: auto; }
.atlas-top p { margin: 0; padding: 10px 16px; background: rgba(23, 19, 17, .82); }
.seg { display: flex; }
#atlas-close { background: var(--paper); color: var(--ink); }
#atlas-close:hover { background: #fff; }
.atlas-zoom { position: absolute; left: var(--gap); bottom: var(--low); display: flex; gap: 2px; }
.atlas-zoom button[aria-label] { width: 44px; padding: 0; font-size: 1.5rem; }
#atlas-fly { margin-left: 8px; }
.legend { position: absolute; left: 50%; bottom: var(--low); display: flex; gap: 18px; margin: 0; padding: 10px 16px; background: rgba(23, 19, 17, .82); list-style: none; transform: translateX(-50%); pointer-events: none; }
.legend li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend i { width: 11px; height: 11px; }
.l-place { border-radius: 50%; background: #b4552d; box-shadow: 0 0 0 1px var(--paper); }
.l-door { background: #c3d2f7; }
.l-detail { transform: scale(.8); border-radius: 50%; background: #fff; }
.l-mark { transform: rotate(45deg) scale(.9); background: #e8b25f; }

@media (max-width: 1100px) {
  .legend, .atlas-top p { display: none; }
  #help { top: calc(max(14px, env(safe-area-inset-top)) + 60px); }
}
@media (max-width: 760px) {
  body:not(.is-touch) :is(#list, .sheet) { grid-template-columns: 1fr; }
  #intro::before { background: linear-gradient(0deg, rgba(23, 19, 17, .95) 35%, rgba(23, 19, 17, 0)); }
  body:not(.is-touch) #open-map { width: 104px; height: 104px; bottom: calc(var(--low) + 64px); }
  body:not(.is-touch) #open-keys { display: none; }
  body:not(.is-touch) #hour { bottom: calc(var(--low) + 64px); width: 190px; }
}
@media (max-height: 560px) {
  #intro { overflow: auto; }
  #intro p, #intro .how { margin: 10px 0; }
  h1 { font-size: 2.4rem; }
}

/* phones and tablets, always across: the left thumb walks, the right one looks and presses */
.is-touch { --right: max(18px, env(safe-area-inset-right)); --left: max(18px, env(safe-area-inset-left)); }
.is-touch.is-walking { position: fixed; left: 0; top: 0; width: var(--w); height: var(--h); }
.is-touch.is-turned { --left: max(18px, env(safe-area-inset-top)); --right: max(18px, env(safe-area-inset-bottom)); --low: max(14px, env(safe-area-inset-left)); transform: translateX(var(--h)) rotate(90deg); transform-origin: 0 0; }
.is-touch #intro { overflow: auto; }
.is-touch :is(header.hud, .atlas-top) { inset: 12px var(--right) auto var(--left); }
.is-touch header.hud { justify-content: flex-start; gap: 8px; right: auto; }
.is-touch :is(.modes, .wide, #dot) { display: none; }
.is-touch :is(header.hud a, header.hud button) { padding: 0 14px; font-size: .95rem; }
.is-touch :is(header.hud .back, header.hud #full) { width: 44px; padding: 0; gap: 0; font-size: 0; }
.is-touch #open-map { left: auto; right: var(--right); top: 12px; bottom: auto; width: 108px; height: 108px; }
.is-touch #hour { right: auto; left: calc(var(--left) + 276px); top: 12px; bottom: auto; width: 176px; min-height: 44px; padding: 4px 12px; }
.is-touch #hour span { font-size: .85rem; line-height: 1.2; }
.is-touch #hour input { margin: 0; }
.is-touch #help { top: 72px; padding: 6px 14px; font-size: .95rem; }
.is-touch #toast { top: 64px; white-space: nowrap; }
.is-touch #offer { left: calc(50% + 46px); top: 52%; min-height: 48px; max-width: 24%; padding: 8px 16px; line-height: 1.2; white-space: normal; }
.is-touch #stick { display: block; left: calc(var(--left) + 88px); top: calc(var(--h) - 92px); width: 116px; height: 116px; margin: -58px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 50%; background: rgba(23, 19, 17, .2); pointer-events: none; transition: opacity .25s; }
.is-touch #stick i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: rgba(255, 255, 255, .72); }
.is-touch #stick::before { content: ''; position: absolute; left: 50%; top: -30px; width: 15px; height: 15px; margin-left: -8px; border: solid #fff; border-width: 2.5px 0 0 2.5px; opacity: .55; transform: rotate(45deg); }
.is-touch #stick.is-far, .is-auto #stick { border-color: #e8b25f; }
.is-touch #stick.is-far::before, .is-touch.is-auto #stick::before { border-color: #e8b25f; opacity: 1; }
.is-touch #pads { display: block; inset: 0; pointer-events: none; }
#pads button { position: absolute; right: calc(var(--right) + var(--x)); bottom: calc(var(--low) + var(--y)); display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 1.5px solid rgba(255, 255, 255, .45); border-radius: 50%; background: rgba(23, 19, 17, .46); color: #fff; pointer-events: auto; touch-action: none; }
#pads svg { width: 30px; height: 30px; }
#pads button.down, #pads [aria-pressed="true"] { border-color: #fff; background: rgba(243, 238, 230, .92); color: var(--ink); }
[data-do="prone"] { --x: 0px; --y: 0px; }
[data-do="crouch"] { --x: 64px; --y: 0px; }
[data-do="jump"] { --x: 0px; --y: 66px; }
[data-do="zoom"] { --x: 68px; --y: 66px; }
[data-do="view"] { --x: 128px; --y: 0px; }
#pads [data-do="free"] { --x: 4px; --y: 132px; width: 46px; height: 46px; }
#pads :is([data-do="left"], [data-do="right"]) { right: auto; left: var(--left); bottom: auto; top: 72px; width: 46px; height: 46px; }
#pads [data-do="right"] { left: calc(var(--left) + 56px); }
[data-mode="look"] :is(#stick, #pads) { display: none !important; }
[data-mode="fly"] #pads :is([data-do="prone"], [data-do="left"], [data-do="right"], [data-do="free"], [data-do="zoom"]) { display: none; }
[data-pose="prone"] #pads :is([data-do="left"], [data-do="right"]) { display: none; }
.is-touch #card { left: var(--left); right: auto; bottom: 12px; display: grid; grid-template-columns: 118px 1fr; width: 390px; }
.is-touch #card img { height: 100%; aspect-ratio: auto; }
.is-touch #card div { padding: 12px 14px; }
.is-touch #card h2 { font-size: 1.35rem; }
.is-touch #card p { margin: 4px 0 10px; font-size: .95rem; line-height: 1.35; }
.is-touch :is(#places, #keys, #intro) { touch-action: pan-y; }
.is-touch.is-turned :is(#places, #keys) { touch-action: none; }
.is-touch :is(#places, #keys) { padding: 14px var(--right) 32px var(--left); }
.is-touch #list, .is-touch .sheet { gap: 22px 28px; margin-top: 0; }
.is-touch .legend, .is-touch .atlas-top p { display: none; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; } }
