/* HUD of the walk: cream paper, deep red and gold (the building's palette); round translucent buttons; phone-first. */
:root {
  --cream: #f7efdf; --paper: #fbf6ec; --paper2: #f1e6d0; --ink: #2b1d14; --muted: #7a6656;
  --red: #7d1f16; --red-deep: #561510; --gold: #d6a84a; --gold-light: #f2d38a; --gold-deep: #b98a2e;
  --glass: rgba(46, 20, 14, .62); --glass-strong: rgba(46, 20, 14, .82); --edge: rgba(242, 211, 138, .72);
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b0f0b; overscroll-behavior: none; font-family: var(--sans); color: var(--cream); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; padding: 0; }
button:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
[hidden] { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#hud > *, #hud button, #hud canvas { pointer-events: auto; }
#hud #toast { pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: .45rem; background: var(--glass); border: 1px solid var(--edge); border-radius: 2rem; padding: .38rem .8rem; color: var(--cream); box-shadow: 0 .2rem .8rem rgba(20, 6, 2, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#topLeft { position: absolute; left: calc(.8rem + var(--safe-l)); top: calc(.8rem + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; max-width: calc(100vw - 13rem); pointer-events: none; }
#topLeft > * { pointer-events: auto; }
.tl-row { display: flex; align-items: center; gap: .45rem; max-width: 100%; min-width: 0; }
#fps { flex: none; gap: .3rem; font-size: .8rem; pointer-events: none; }
#fps b { font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; font-weight: 700; color: #7be08a; }
#fps.mid b { color: #f2d38a; }
#fps.bad b { color: #ff7a6b; }
#fps span { opacity: .8; }
#fps em { font-style: normal; color: var(--gold-light); opacity: .85; }
#fps em:not(:empty)::before { content: '·'; margin-right: .3rem; color: var(--gold); }
#where { font-size: .86rem; max-width: 100%; min-width: 0; }
#where b { font-family: var(--serif); color: var(--gold-light); font-weight: 700; white-space: nowrap; }
#where span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#where span:not(:empty)::before { content: '·'; margin-right: .45rem; color: var(--gold); }
.clock { font-size: .8rem; }
.clock svg { width: 1.05rem; height: 1.05rem; color: var(--gold-light); }
.clock b { font-variant-numeric: tabular-nums; }
.clock em { font-style: normal; color: var(--gold-light); opacity: .9; }

#topRight { position: absolute; right: calc(.8rem + var(--safe-r)); top: calc(.8rem + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-end; gap: .55rem; pointer-events: none; }
#topRight > * { pointer-events: auto; }
#mapWrap { position: relative; width: 9.2rem; height: 9.2rem; border-radius: 1.2rem; overflow: visible; }
#minimap { width: 100%; height: 100%; border-radius: 1.2rem; border: 2px solid var(--edge); box-shadow: 0 .25rem 1rem rgba(20, 6, 2, .45); background: #e9dcc4; cursor: pointer; display: block; }
#north { position: absolute; left: 50%; top: -.55rem; transform: translateX(-50%); width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--red-deep); color: var(--gold-light); font: 700 .66rem/1.25rem var(--serif); text-align: center; border: 1px solid var(--edge); pointer-events: none; }
#sideBtns { display: flex; flex-direction: column; gap: .45rem; }

.round { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--glass); border: 1.5px solid var(--edge); display: grid; place-items: center; color: var(--cream); box-shadow: 0 .2rem .8rem rgba(20, 6, 2, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .2s, transform .1s; }
.round:active { transform: scale(.94); }
.round svg { width: 1.7rem; height: 1.7rem; }
.round.small { width: 2.75rem; height: 2.75rem; }
.round.small svg { width: 1.35rem; height: 1.35rem; }
.round.on { background: linear-gradient(180deg, var(--gold-light), var(--gold-deep)); color: var(--red-deep); border-color: #fff4d6; }
#soundBtn .snd-off, #soundBtn.muted .snd-on { display: none; }
#soundBtn.muted .snd-off { display: inline; }
#soundBtn.muted { opacity: .8; }

#bottomRight { position: absolute; right: calc(.9rem + var(--safe-r)); bottom: calc(1rem + var(--safe-b)); display: grid; grid-template-columns: auto auto; gap: .55rem; pointer-events: none; }
#bottomRight > * { pointer-events: auto; }

#joy { position: absolute; left: calc(1.4rem + var(--safe-l)); bottom: calc(1.4rem + var(--safe-b)); width: 8rem; height: 8rem; border-radius: 50%; background: radial-gradient(circle, rgba(46, 20, 14, .25), rgba(46, 20, 14, .5)); border: 1.5px solid var(--edge); touch-action: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 3.2rem; height: 3.2rem; margin: -1.6rem; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff8e6, #d9c19a); box-shadow: 0 .15rem .5rem rgba(0, 0, 0, .4); pointer-events: none; }

#act { position: absolute; left: 50%; bottom: calc(1.6rem + var(--safe-b)); transform: translateX(-50%); padding: .7rem 1.4rem; border-radius: 2rem; font-weight: 700; font-size: .95rem; color: var(--red-deep); background: linear-gradient(180deg, var(--gold-light), var(--gold)); box-shadow: 0 .2rem 0 var(--gold-deep), 0 .4rem 1.2rem rgba(20, 6, 2, .45); white-space: nowrap; max-width: calc(100vw - 2rem); overflow: hidden; text-overflow: ellipsis; }
#act kbd { font: 600 .7rem var(--sans); background: rgba(86, 21, 16, .15); border-radius: .3rem; padding: .05rem .35rem; margin-left: .4rem; }

#toast { position: absolute; left: 50%; top: calc(4.2rem + var(--safe-t)); transform: translateX(-50%); max-width: min(32rem, calc(100vw - 2rem)); background: var(--glass-strong); border: 1px solid var(--edge); color: var(--cream); padding: .55rem 1rem; border-radius: 1rem; font-size: .88rem; line-height: 1.4; text-align: center; opacity: 0; transition: opacity .3s; box-shadow: 0 .3rem 1rem rgba(20, 6, 2, .4); }
#toast.show { opacity: 1; }

/* the room card (department text) */
#roomCard { position: absolute; left: calc(.8rem + var(--safe-l)); top: calc(6.4rem + var(--safe-t)); width: min(19rem, calc(100vw - 12rem)); background: rgba(251, 246, 236, .95); color: var(--ink); border: 1px solid var(--gold); border-radius: 1rem; padding: .7rem .85rem .75rem; box-shadow: 0 .4rem 1.2rem rgba(20, 6, 2, .35); font-size: .82rem; line-height: 1.45; }
#roomCard .rc-h { display: flex; align-items: center; gap: .45rem; padding-right: 1.6rem; }
#roomCard .rc-h b { font: 700 .98rem var(--serif); color: var(--red-deep); }
#roomCard .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; }
#roomCard .rc-d { display: inline-block; margin: .3rem 0 .1rem; font-size: .68rem; font-weight: 700; color: var(--gold-deep); text-transform: uppercase; letter-spacing: .05em; }
#roomCard p { margin: .3rem 0 0; }
#roomCard ul { margin: .35rem 0 0; padding-left: 1.05rem; color: #4d3a2c; }
#roomCard .rc-m { display: none; font-style: normal; font-size: .72rem; color: var(--gold-deep); white-space: nowrap; }
#roomCard.mini { cursor: pointer; padding: .45rem .75rem; width: auto; max-width: min(19rem, calc(100vw - 12rem)); }
#roomCard.mini .rc-body { display: none; }
#roomCard.mini .rc-m { display: inline; }
#roomCard.mini .rc-h { padding-right: 1.5rem; }
#roomCard.mini .rc-h b { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#roomCard.mini .rc-x { top: .2rem; }
#roomCard .rc-x { position: absolute; right: .45rem; top: .4rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--paper2); color: var(--ink); font-size: .8rem; }
.it-desc { flex-basis: 100%; font-size: .82rem; color: #4d3a2c; line-height: 1.45; }
.it-desc p { margin: 0 0 .25rem; }
.it-desc ul { margin: 0 0 .4rem; padding-left: 1.1rem; }
.ab-t { margin: 0; font: 700 1.05rem var(--serif); color: var(--red); }
.ab-note { background: #fff3cf; border-radius: .6rem; padding: .5rem .7rem; font-size: .8rem !important; }
.ab-src { font-size: .78rem; color: var(--muted); }
.ab-src ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.ab-src a { color: var(--red); word-break: break-word; }

/* the floor switcher of the high view (a building section: roof on top) */
#floors { position: absolute; left: calc(.8rem + var(--safe-l)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: .3rem; background: var(--glass); border: 1px solid var(--edge); border-radius: 1.1rem; padding: .45rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#floors button { min-width: 6.4rem; padding: .48rem .7rem; border-radius: .7rem; font-size: .82rem; text-align: left; color: var(--cream); background: rgba(255, 255, 255, .06); }
#floors button.on { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--red-deep); font-weight: 700; }
#floors .fl-h { font: 700 .7rem var(--serif); color: var(--gold-light); padding: .1rem .3rem .2rem; letter-spacing: .02em; }

/* the panel inside a lift car */
#liftPanel { position: absolute; right: calc(5.2rem + var(--safe-r)); top: 50%; transform: translateY(-50%); width: 7.6rem; background: linear-gradient(180deg, #3c3a38, #232120); border: 1.5px solid #8d8a86; border-radius: 1rem; padding: .6rem; box-shadow: 0 .4rem 1.4rem rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: .5rem; color: #eee; }
#liftPanel header { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .7rem; color: #cfcac2; }
#liftPanel header b { font: 700 1.3rem/1 var(--sans); color: #ffb347; background: #0b0d10; border-radius: .35rem; padding: .2rem .45rem; min-width: 2.4rem; text-align: center; font-variant-numeric: tabular-nums; }
#liftBtns { display: grid; grid-template-columns: 1fr; gap: .35rem; }
#liftBtns button, .lp-open { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: 2rem; background: linear-gradient(180deg, #d9d6d0, #a9a59e); color: #222; font-size: .78rem; font-weight: 600; text-align: left; }
#liftBtns button i { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; background: #f4f1ea; border: 1px solid #77736c; flex: none; }
#liftBtns button.lit i { background: #ffb347; border-color: #ffd28a; box-shadow: 0 0 .6rem #ffb347; }
#liftBtns button.here { outline: 2px solid var(--gold-light); }
.lp-open { justify-content: center; font-weight: 800; letter-spacing: .1em; }

/* floating names over doors */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
body.cine #labels { opacity: 0; }   /* no room labels over the opening shots */
#labels { transition: opacity .6s; }
.lab { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap; font-size: .8rem; font-weight: 600; color: var(--cream); background: rgba(86, 21, 16, .78); border: 1px solid rgba(242, 211, 138, .6); border-radius: 1rem; padding: .22rem .62rem; box-shadow: 0 .15rem .5rem rgba(20, 6, 2, .4); will-change: transform, opacity; }
.lab.cut { background: rgba(251, 246, 236, .92); color: var(--red-deep); border-color: var(--gold); font-size: .74rem; transform: translate(-50%, -50%); }
.lab.cut small { display: block; font-weight: 500; font-size: .62rem; color: var(--muted); text-align: center; }

/* sheets */
.modal { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(30, 10, 6, .5); padding: calc(.8rem + var(--safe-t)) .8rem calc(.8rem + var(--safe-b)); }
.sheet { background: var(--paper); color: var(--ink); border-radius: 1.2rem; width: min(34rem, 100%); max-height: min(88vh, 52rem); overflow: auto; display: flex; flex-direction: column; box-shadow: 0 1rem 3rem rgba(20, 6, 2, .5); border: 1px solid #e3d3b2; -webkit-user-select: text; user-select: text; }
.sheet.wide { width: min(46rem, 100%); }
.sh-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; background: linear-gradient(180deg, var(--red), var(--red-deep)); color: var(--cream); border-radius: 1.2rem 1.2rem 0 0; }
.sh-head h2 { margin: 0; font: 700 1.12rem var(--serif); flex: 1; color: var(--gold-light); }
.sh-close { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: rgba(255, 255, 255, .12); font-size: 1.2rem; line-height: 1; color: var(--cream); flex: none; }
.sh-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; }
.sh-body p { margin: 0; font-size: .88rem; line-height: 1.55; }
.sh-note { font-size: .78rem !important; color: var(--muted); }
.tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: none; }
.tabs button { flex: none; padding: .45rem .8rem; border-radius: 2rem; background: var(--paper2); color: var(--ink); font-size: .82rem; font-weight: 600; border: 1px solid #e0cfae; }
.tabs button.on { background: var(--red); color: var(--gold-light); border-color: var(--red); }
.plan { width: 100%; border-radius: .8rem; background: #efe4cf; border: 1px solid #e0cfae; display: block; cursor: crosshair; }
.grp h3 { margin: .2rem 0 .35rem; font: 700 .8rem var(--serif); color: var(--red); text-transform: uppercase; letter-spacing: .04em; }
.item { display: flex; flex-direction: column; border-radius: .8rem; background: #fff; border: 1px solid #ecdfc4; margin-bottom: .35rem; overflow: hidden; }
.item > button.it-row { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; text-align: left; width: 100%; color: var(--ink); }
.item .dot { width: .8rem; height: .8rem; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.item .nm { flex: 1; min-width: 0; font-size: .9rem; font-weight: 600; }
.item .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.item .acts { display: flex; gap: .4rem; padding: 0 .7rem .65rem; flex-wrap: wrap; }
.btn { padding: .5rem .9rem; border-radius: 2rem; font-weight: 700; font-size: .82rem; background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--red-deep); box-shadow: 0 .14rem 0 var(--gold-deep); }
.btn.alt { background: var(--paper2); color: var(--ink); box-shadow: none; border: 1px solid #dfcca6; }
.btn small { font-weight: 500; opacity: .8; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr)); gap: .45rem; }
.presets button { padding: .6rem .5rem; border-radius: .8rem; background: var(--paper2); border: 1px solid #e0cfae; color: var(--ink); font-weight: 600; font-size: .84rem; }
.presets button b { display: block; font: 700 1rem var(--serif); color: var(--red); }
.presets button.on { background: var(--red); color: var(--cream); border-color: var(--red); }
.presets button.on b { color: var(--gold-light); }
.slide { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.slide input { flex: 1; accent-color: var(--red); }
.slide b { font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: right; font-family: var(--serif); color: var(--red); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; font-size: .86rem; align-items: center; }
.keys kbd { font: 600 .74rem var(--sans); background: var(--paper2); border: 1px solid #dcc8a2; border-bottom-width: 2px; border-radius: .35rem; padding: .12rem .45rem; white-space: nowrap; color: var(--ink); }
.chars { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.chars button { padding: .8rem; border-radius: .9rem; background: #fff; border: 1px solid #ecdfc4; text-align: left; color: var(--ink); }
.chars button b { display: block; font: 700 1.05rem var(--serif); color: var(--red); }
.chars button small { color: var(--muted); font-size: .76rem; }
.chars button.on { border: 2px solid var(--gold); background: #fff8e8; }

/* loading + opening (core/cine.js): a dark stage, a closed book with light in its pages, letterbox bars. Only transform
   and opacity move, so the animation stays smooth while the main thread builds the building */
#loading { position: fixed; inset: 0; z-index: 8; overflow: hidden; color: var(--cream); text-align: center; --bw: clamp(8.5rem, 30vmin, 15rem); --bh: calc(var(--bw) * 1.4); transition: opacity .6s; }
#loading.out { opacity: 0; pointer-events: none; }
.cn-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 46%, #3a1410 0%, #170806 52%, #070302 100%); transition: opacity .4s; }
.cn-stage { position: absolute; inset: 0; display: grid; place-items: center; perspective: 70rem; transition: transform 1.6s cubic-bezier(.62, 0, .9, .45), opacity .35s; }
.cn-halo { position: absolute; left: 50%; top: 50%; width: calc(var(--bw) * 3.2); height: calc(var(--bw) * 3.2); margin: calc(var(--bw) * -1.6) 0 0 calc(var(--bw) * -1.6); border-radius: 50%; background: radial-gradient(circle, rgba(255, 205, 120, .34) 0%, rgba(255, 170, 70, .12) 38%, rgba(255, 170, 70, 0) 68%); animation: cnPulse 3.2s ease-in-out infinite; }
.cn-book { position: relative; width: var(--bw); height: var(--bh); transform-style: preserve-3d; transform: rotateX(22deg) rotateY(-16deg) rotateZ(2deg); }
.cn-book > * { position: absolute; inset: 0; }
.cn-back { border-radius: .2rem .5rem .5rem .2rem; background: linear-gradient(90deg, #2a0b07, #5a1610 12%, #4a120c); transform: translateZ(-1.1rem); box-shadow: 1.2rem 1.6rem 3rem rgba(0, 0, 0, .65); }
.cn-pages { inset: .28rem .3rem .28rem .1rem; border-radius: .1rem .3rem .3rem .1rem; background: repeating-linear-gradient(90deg, #f6ecd2 0 .09rem, #e2d2ac .09rem .13rem), #f3e8cc; transform: translateZ(-.5rem); box-shadow: inset 1.4rem 0 1.6rem rgba(120, 80, 30, .35); }
.cn-glow { inset: -30%; border-radius: 50%; background: radial-gradient(circle, #fffbe9 0%, #ffe9b4 16%, rgba(255, 205, 120, .6) 32%, rgba(255, 180, 80, .28) 48%, rgba(255, 170, 70, .09) 60%, rgba(255, 170, 70, 0) 70%); transform: translateZ(-.3rem) scale(.55); opacity: .0; transition: opacity .7s ease-in, transform 1.6s cubic-bezier(.5, 0, .85, .4); }
.cn-leaf { inset: .3rem .32rem .3rem .1rem; border-radius: .1rem .3rem .3rem .1rem; background: linear-gradient(90deg, #d9c69a, #fbf3dc 14%, #f6ecd0); transform-origin: left center; transform: translateZ(-.2rem) rotateY(0deg); transition: transform 1.3s cubic-bezier(.4, .1, .2, 1); backface-visibility: visible; }
.cn-cover { transform-style: preserve-3d; transform-origin: left center; transform: rotateY(0deg); animation: cnBreathe 3.2s ease-in-out infinite; transition: transform 1.5s cubic-bezier(.5, .05, .2, 1); }
.cn-face, .cn-inside { position: absolute; inset: 0; border-radius: .2rem .5rem .5rem .2rem; backface-visibility: hidden; }
.cn-face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5em; font-size: calc(var(--bw) * .085); background: linear-gradient(100deg, #3a0d08 0%, #7a1f16 9%, #8a2a1d 45%, #641812 100%); box-shadow: inset 0 0 0 .14em rgba(0, 0, 0, .25), inset 0 0 0 .5em #7a1f16, inset 0 0 0 .58em rgba(242, 211, 138, .75), inset 0 0 0 .66em #7a1f16; }
.cn-face b { font: 700 1.18em/1.25 var(--serif); color: var(--gold-light); letter-spacing: .02em; text-shadow: 0 .08em .3em rgba(0, 0, 0, .45); }
.cn-face i { font: italic .72em var(--serif); color: rgba(246, 227, 189, .8); }
.cn-mark { width: 2.5em; height: 2.5em; border-radius: .6em; display: grid; place-items: center; font: 700 1.25em var(--serif); color: var(--gold-light); border: .1em solid var(--gold); background: rgba(0, 0, 0, .2); }
.cn-inside { transform: rotateY(180deg); background: linear-gradient(260deg, #e9dab4, #fbf3dc 20%, #f3e6c4); }
.cn-mote { position: absolute; left: 50%; top: 52%; width: .22rem; height: .22rem; border-radius: 50%; background: #ffe2a6; opacity: 0; animation: cnMote 4.5s linear infinite; }
.cn-mote.m1 { margin-left: -5.2rem; animation-delay: .2s; } .cn-mote.m2 { margin-left: 4.6rem; animation-delay: 1.3s; } .cn-mote.m3 { margin-left: -1.6rem; animation-delay: 2.4s; }
.cn-mote.m4 { margin-left: 6.8rem; animation-delay: 3.1s; } .cn-mote.m5 { margin-left: -7.4rem; animation-delay: 3.8s; }
.cn-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, #fffdf2 0%, #ffe9b8 42%, #f0b65e 100%); }
.cn-flash.bloom { animation: cnBloom 1.15s ease-in both; }
.cn-flash.cut { animation: cnCut .46s ease-out both; }
/* no solid letterbox bars (owner 23/11: they read as empty black gaps): the book screen is full-bleed; over the 3D shots
   only a soft shade fades in at the top and bottom edges */
.cn-bar { position: absolute; left: 0; right: 0; height: 16vh; opacity: 0; pointer-events: none; transition: opacity .9s; }
.cn-bar.top { top: 0; background: linear-gradient(180deg, rgba(5, 3, 2, .6), rgba(5, 3, 2, 0)); } .cn-bar.bot { bottom: 0; background: linear-gradient(0deg, rgba(5, 3, 2, .7), rgba(5, 3, 2, 0)); }
#loading.world .cn-bar { opacity: 1; }
.cn-title { position: absolute; left: 0; right: 0; bottom: 9vh; opacity: 0; transform: translateY(.6rem); transition: opacity .7s, transform .9s; pointer-events: none; text-shadow: 0 .12rem .8rem rgba(0, 0, 0, .7); }
.cn-title h1 { margin: 0; font: 700 clamp(1.5rem, 5vw, 2.6rem) var(--serif); color: var(--gold-light); letter-spacing: .04em; }
.cn-title p { margin: .3rem 0 0; font-size: .9rem; opacity: .9; }
.cn-load { position: absolute; left: 50%; bottom: 9vh; width: min(20rem, 70vw); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .45rem; transition: opacity .35s; }
.ld-bar { width: 100%; height: .2rem; border-radius: 1rem; background: rgba(255, 255, 255, .12); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold-light)); transition: width .3s; }
.ld-text { margin: 0; font-size: .78rem; opacity: .7; min-height: 1.2em; }
.cn-note { margin: 0; font-size: .74rem; opacity: .5; }
.cn-skip { position: absolute; right: 1.2rem; bottom: 1rem; font-size: .74rem; opacity: 0; transition: opacity .5s; pointer-events: none; text-shadow: 0 .1rem .4rem rgba(0, 0, 0, .8); }
/* the book opens: cover and leaves swing, the light grows and the stage pushes into it */
#loading.open .cn-cover { animation: none; transform: rotateY(-158deg); }
#loading.open .cn-leaf.l1 { transform: translateZ(-.2rem) rotateY(-150deg); transition-delay: .16s; }
#loading.open .cn-leaf.l2 { transform: translateZ(-.25rem) rotateY(-136deg); transition-delay: .3s; }
#loading.open .cn-leaf.l3 { transform: translateZ(-.3rem) rotateY(-118deg); transition-delay: .44s; }
#loading.open .cn-glow { opacity: 1; transform: translateZ(-.3rem) scale(9); }
#loading.open .cn-halo { animation: none; opacity: 1; }
#loading.open .cn-stage { transform: scale(2.7); }
#loading.open .cn-load { opacity: 0; }
#loading.open .cn-skip { opacity: .65; }
/* the world shows: only the bars, the flash and the title stay over the 3D picture */
#loading.world .cn-bg, #loading.world .cn-stage { opacity: 0; }
#loading.title .cn-title { opacity: 1; transform: none; }
#loading.end { pointer-events: none; }
#loading.end .cn-bar { opacity: 0; }
#loading.end .cn-title { opacity: 0; transition: opacity .9s .5s; }
#loading.end .cn-skip { opacity: 0; }
@keyframes cnBreathe { 0%, 100% { transform: rotateY(0deg); } 50% { transform: rotateY(-7deg); } }
@keyframes cnPulse { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes cnMote { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: .9; } 100% { opacity: 0; transform: translateY(-9rem) translateX(1.2rem) scale(1.1); } }
@keyframes cnBloom { 0% { opacity: 0; } 42% { opacity: 1; } 58% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cnCut { 0% { opacity: 0; } 28% { opacity: .92; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cn-cover, .cn-halo, .cn-mote { animation: none; } }
#fade { position: fixed; inset: 0; z-index: 6; background: #1b0f0b; opacity: 0; pointer-events: none; transition: opacity .35s; }
#fade.on { opacity: 1; }
#debug { position: fixed; left: .5rem; bottom: .5rem; z-index: 4; font: 11px/1.35 ui-monospace, Menlo, monospace; color: #fff; background: rgba(0, 0, 0, .55); padding: .4rem .55rem; border-radius: .4rem; white-space: pre; pointer-events: none; }

/* phones */
@media (max-width: 600px) {
  #act { bottom: calc(9.6rem + var(--safe-b)); }
  #roomCard { top: auto; bottom: calc(13.4rem + var(--safe-b)); width: calc(100vw - 1.6rem); max-height: 34vh; overflow: auto; font-size: .78rem; }
  #roomCard.mini { max-width: calc(100vw - 1.6rem); }
  #mapWrap { width: 7.4rem; height: 7.4rem; }
  .round { width: 3.1rem; height: 3.1rem; }
  .round svg { width: 1.5rem; height: 1.5rem; }
  .round.small { width: 2.5rem; height: 2.5rem; }
  #topLeft { max-width: calc(100vw - 10.2rem); }
  #where { font-size: .78rem; flex-wrap: wrap; row-gap: 0; }
  #where span { white-space: normal; }
  .tl-row { flex-direction: column; align-items: flex-start; }
  #fps { font-size: .72rem; padding: .28rem .65rem; }
  #liftPanel { right: calc(.8rem + var(--safe-r)); top: auto; bottom: calc(9.4rem + var(--safe-b)); transform: none; }
  #floors button { min-width: 5.4rem; padding: .42rem .55rem; font-size: .76rem; }
  #joy { width: 7.2rem; height: 7.2rem; }
}
@media (max-height: 500px) {
  #mapWrap { width: 6.6rem; height: 6.6rem; }
  #sideBtns { flex-direction: row; }
  #liftPanel { top: calc(.8rem + var(--safe-t)); transform: none; right: calc(12rem + var(--safe-r)); }
  #liftBtns { grid-template-columns: 1fr 1fr; }
  #liftPanel { width: 11rem; }
  #floors { top: auto; bottom: calc(1rem + var(--safe-b)); transform: none; left: calc(10rem + var(--safe-l)); flex-direction: row; flex-wrap: wrap; max-width: 50vw; }
  #floors button { min-width: auto; }
  #joy { width: 6.6rem; height: 6.6rem; }
}
