:root{color-scheme:dark;--lime:#7ED957;--ink:#050706;--panel:#0A0F0C;--navy:#152420;--green:#304844;--white:#F6F9F2;--gray:#93A39A;--gold:#A9E08F;--amber:#F2B33D;--edge:#ffffff24;--head:56px;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{margin:0;background:var(--ink);color:var(--white);overflow:hidden;-webkit-font-smoothing:antialiased}
button,a{-webkit-tap-highlight-color:transparent;font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:3px solid var(--lime);outline-offset:3px}
main,#homeview,#room,#tour{height:100vh;height:100dvh}
#entry{height:100vh;height:100dvh;position:relative}

/* header */
header{position:fixed;inset:0 0 auto;z-index:20;height:var(--head);display:flex;justify-content:space-between;align-items:center;padding:0 12px;pointer-events:none}
header>*{pointer-events:auto}
.logo{background:none;border:0;padding:6px;border-radius:6px;line-height:0}
.logo img{display:block;width:132px;height:auto;mix-blend-mode:screen}
.tools{display:flex;gap:6px}
.tool{width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--edge);border-radius:50%;background:#080a0c99;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.tool svg{width:20px;height:20px;fill:none;stroke:var(--white);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.tool.txt{font-size:13px;font-weight:600;letter-spacing:.06em}
.tool:hover{border-color:var(--lime)}
#sound .on{display:none}#sound[aria-pressed=true] .on{display:inline}#sound[aria-pressed=true] .off{display:none}
#sound[aria-pressed=true] svg{stroke:var(--lime)}

/* entrance */
#doors{height:100%;display:flex;flex-direction:column;background:#000}
.door{position:relative;flex:1 1 0;min-width:0;min-height:0;border:0;padding:0;overflow:hidden;background:#000;text-align:left;transition:flex-grow .7s cubic-bezier(.6,0,.2,1),opacity .5s}
.door i{position:absolute;inset:0;background:var(--img) var(--pos,center)/cover;transition:transform 1.2s cubic-bezier(.2,.6,.2,1);transform:scale(1.04)}
.door::after{content:"";position:absolute;inset:0;background:#040605;opacity:.62;animation:lit 8s infinite;animation-delay:calc(var(--i)*2s);transition:opacity .4s}
@keyframes lit{0%,30%,100%{opacity:.62}8%,20%{opacity:.08}}
.door:hover::after,.door:focus-visible::after,.door:active::after,.door.chosen::after{opacity:0;animation:none}
.door:hover i,.door:focus-visible i,.door:active i{transform:scale(1.09)}
.door:focus-visible{outline-offset:-5px;z-index:2}
.door b{position:absolute;left:16px;bottom:14px;z-index:1;font-size:13px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;text-shadow:0 1px 12px #000;padding-bottom:7px}
.door b::after{content:"";position:absolute;left:0;bottom:0;height:2px;width:22px;background:var(--lime);transition:width .4s}
.door:hover b::after,.door:focus-visible b::after{width:100%}
.door em{position:absolute;right:16px;bottom:22px;z-index:1;display:flex;gap:5px}
.door em s{width:8px;height:8px;border-radius:50%;background:var(--lime)}
.door em s.o{background:var(--amber)}
#entry.opening .door{flex-grow:.0001;opacity:0}
#entry.opening .door.chosen{flex-grow:30;opacity:1}
#entry.opening .door b,#entry.opening .door em{opacity:0;transition:opacity .2s}

/* room */
#room{display:grid;grid-template-rows:56dvh minmax(0,1fr);transition:grid-template-rows .6s}
#room.end{grid-template-rows:33dvh minmax(0,1fr)}
#stage{position:relative;overflow:hidden;background:#000;min-height:0}
#stage::before{content:"";position:absolute;inset:0 0 auto;height:110px;z-index:3;background:linear-gradient(#000a,#0000);pointer-events:none}
#photo{position:absolute;inset:0;transition:filter .9s,transform 1.1s cubic-bezier(.3,.1,.2,1);transform-origin:50% 60%}
#cam{position:absolute;left:0;top:0;width:768px;height:512px;transform-origin:0 0;transition:transform 1.5s cubic-bezier(.3,.1,.2,1);will-change:transform}
#cam.snap{transition:none}
#shot,#fx{position:absolute;inset:0;width:100%;height:100%;display:block}
#room[data-view=plan] #photo{filter:blur(9px) brightness(.24) saturate(.55);transform:perspective(900px) rotateX(16deg) scale(1.14)}
#plan{position:absolute;inset:var(--head) 0 46px;width:100%;height:calc(100% - var(--head) - 46px);opacity:0;transform:scale(1.14);transition:opacity .7s,transform 1s cubic-bezier(.3,.1,.2,1);pointer-events:none}
#room[data-view=plan] #plan{opacity:1;transform:none}
#spot{position:absolute;inset:0;z-index:4;border:0;background:none;padding:0}
#spot:focus-visible{outline-offset:-6px}
#hint{position:absolute;left:50%;bottom:18px;translate:-50% 0;padding:8px 14px;border-radius:99px;background:#080a0ccc;border:1px solid var(--lime);font-size:13px;font-weight:600;letter-spacing:.04em;white-space:nowrap;animation:late .5s 3.5s both}
#tag{position:absolute;left:12px;bottom:12px;z-index:5;display:flex;align-items:center;gap:8px;max-width:calc(100% - 24px);padding:7px 12px 7px 10px;border-radius:99px;background:#080a0cd9;border:1px solid var(--edge);font-size:12.5px;font-weight:600;letter-spacing:.02em}
#tag i{flex:none;width:8px;height:8px;border-radius:50%;background:var(--gray)}
#tag[data-tone=ok]{border-color:var(--lime)}#tag[data-tone=ok] i{background:var(--lime)}
#tag[data-tone=open]{border-color:var(--amber)}#tag[data-tone=open] i{background:var(--amber)}

/* panel */
#panel{position:relative;z-index:6;min-height:0;overflow-y:auto;background:var(--panel);border-top:1px solid var(--edge);padding:16px 18px 22px;display:flex;flex-direction:column;gap:12px}
#pips{display:flex;list-style:none;margin:-13px 0 -13px -17px;padding:0;align-items:center}
#room.end #pips{display:none}
#pips button{width:44px;height:44px;border:0;background:none;display:grid;place-items:center;border-radius:50%}
#pips button::before{content:"";width:10px;height:10px;border-radius:50%;border:1.5px solid #ffffff55}
#pips button.now::before{border-color:var(--lime);transform:rotate(45deg);border-radius:2px;background:var(--lime)}
#pips button.g::before{border-color:var(--lime);background:var(--lime)}
#pips button.o::before{border-color:var(--amber);background:var(--amber)}
#pips button:disabled{cursor:default}
#line{margin:0;font-size:21px;line-height:1.24;font-weight:600;letter-spacing:-.012em;text-wrap:balance;outline:none}
#choices{display:grid;gap:9px}
#choices button{min-height:56px;padding:12px 14px;text-align:left;font-size:16px;line-height:1.3;font-weight:500;border:1px solid var(--edge);border-radius:10px;background:#ffffff0a;transition:border-color .2s,background .2s}
#choices button:hover,#choices button:focus-visible{border-color:var(--lime);background:#7ed95714}
#next,#buildgo{align-self:flex-start;min-height:50px;padding:0 20px;display:inline-flex;align-items:center;gap:8px;border:0;border-radius:10px;background:var(--lime);color:#0b1a06;font-size:16px;font-weight:700;text-decoration:none}
#next::after{content:"→"}
.late{animation:late .5s both;animation-delay:var(--hold,1.3s)}
@keyframes late{from{opacity:0;visibility:hidden;transform:translateY(8px)}to{opacity:1;visibility:visible;transform:none}}

/* ending */
#ending{display:flex;flex-direction:column;gap:12px}
#carry{margin:0;font-size:15px;line-height:1.45;color:#c9d0d6}
#trace{list-style:none;margin:2px 0 0;padding:0;display:grid;gap:7px}
#trace button{width:100%;display:grid;grid-template-columns:1fr auto;gap:2px 10px;align-items:center;text-align:left;padding:10px 12px;border:1px solid var(--edge);border-left:3px solid var(--lime);border-radius:8px;background:#ffffff08}
#trace button.o{border-left-color:var(--amber)}
#trace button:hover,#trace button:focus-visible{border-color:var(--lime)}
#trace .k{font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--gray)}
#trace .v{grid-column:1;font-size:14.5px;line-height:1.3}
#trace .re{grid-row:1/3;grid-column:2;font-size:12px;font-weight:600;color:var(--lime);white-space:nowrap}
.acts{display:flex;flex-wrap:wrap;gap:9px;margin-top:2px}
#keep{min-height:50px;padding:0 18px;border:1px solid var(--white);border-radius:10px;background:none;font-size:16px;font-weight:600}
#keep[aria-pressed=true]{border-color:var(--lime);color:var(--lime)}
#mscline,#fiction{margin:0;font-size:13px;line-height:1.5;color:var(--gray)}
#mscline a{color:var(--white)}
#otherh{margin:6px 0 -4px;font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--gray)}
#others{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
#others button{position:relative;aspect-ratio:3/2;border:1px solid var(--edge);border-radius:8px;overflow:hidden;padding:0;background:var(--img) center/cover}
#others button::after{content:"";position:absolute;inset:0;background:linear-gradient(#0000 35%,#000c)}
#others button span{position:absolute;left:8px;right:6px;bottom:6px;z-index:1;font-size:10.5px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;text-align:left;overflow:hidden;text-overflow:ellipsis}
#others button:hover,#others button:focus-visible{border-color:var(--lime)}

/* shared scene marks: anything with data-on/data-off fades with its flag */
[data-on],[data-off]{opacity:0;transition:opacity .6s}
[data-on].on,[data-off].on{opacity:1}
.actor{display:none}
.draw{stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.9s ease .15s,opacity .3s}
.draw.on{stroke-dashoffset:0}
.ping{transform-box:fill-box;transform-origin:center;animation:ping 1.7s ease-out infinite}
@keyframes ping{from{transform:scale(.5);stroke-opacity:1}to{transform:scale(1.9);stroke-opacity:0}}
.blink{animation:blink 1.1s steps(2) infinite}
@keyframes blink{50%{opacity:.15}}
.breathe{animation:breathe 4.5s ease-in-out infinite alternate}
@keyframes breathe{from{opacity:.35}to{opacity:.9}}

/* photo overlay */
#fx .ring circle{fill:none;stroke:var(--lime);stroke-width:2.5}
#fx .ring .c{fill:var(--lime);stroke:none}
#fx .ring .h{fill:#7ed95722;stroke-width:1.5}
#fx .steam ellipse{fill:#fff;opacity:0;animation:steam 5s linear infinite}
#fx .steam ellipse:nth-child(2){animation-delay:1.7s}#fx .steam ellipse:nth-child(3){animation-delay:3.3s}
@keyframes steam{0%{opacity:0;transform:translateY(20px)}30%{opacity:.26}100%{opacity:0;transform:translate(14px,-70px) scale(1.6)}}
#fx .matte{fill:#1c0d07;fill-opacity:.62;mix-blend-mode:multiply;transition:opacity 1.6s}
#fx .trail{fill:none;stroke:#eaf6ff;stroke-opacity:.5;stroke-width:3.5;stroke-linecap:round;transition:stroke-dashoffset 2.6s ease .5s,opacity .3s}
#fx .trail.t2{stroke-width:6;stroke-opacity:.45}
#fx .puddle ellipse{fill:#eef8ff;fill-opacity:.4}
#fx .prints ellipse{fill:#140904;fill-opacity:.6}
#fx .glow{mix-blend-mode:screen}

/* plan */
#plan text{font:600 10px Inter,system-ui,sans-serif;letter-spacing:.09em;fill:#aab3ab;text-transform:uppercase}
#plan .mid{text-anchor:middle}
#plan .solid{fill:#ffffff0d;stroke:#ffffff33;stroke-width:1}
#plan .glass{fill:#9fd0ff0a;stroke:#9fd0ff55;stroke-width:1}
#plan .wall{fill:none;stroke:#ffffff4d;stroke-width:1.5}
#plan .floor{fill:#ffffff0a}
#plan .lane{stroke:#e8c33a;stroke-width:1.5;stroke-opacity:.75}
#plan .zebra{fill:#ffffff3d}
#plan .ppl{fill:var(--white);stroke:#0b0e10;stroke-width:1}
#plan .you{fill:var(--lime);stroke:#081006;stroke-width:1.5}
#plan .youl{fill:var(--lime)}
#plan .lead{fill:none;stroke:var(--lime);stroke-width:2.5}
#plan .truck{fill:#f2c230;stroke:#141005;stroke-width:1}
#plan .load{fill:#b98d5a;stroke:#3a2a16;stroke-width:1}
#plan .dark{fill:#141005}
#plan .blind{fill:var(--amber);fill-opacity:.36}
#plan .sight{fill:var(--lime);fill-opacity:.2}
#plan .ghost{fill:none;stroke:var(--white);stroke-opacity:.5;stroke-width:1.5}
#plan .miss{fill:none;stroke:var(--amber);stroke-width:2.2}
#plan .am{fill:var(--amber)}#plan .li{fill:var(--lime)}
#plan .stopl{stroke:#fff;stroke-width:4}
#plan .gate{stroke:var(--lime);stroke-width:4.5;stroke-linecap:round}
#plan .skid{stroke:#000;stroke-opacity:.8;stroke-width:3;stroke-linecap:round}
#plan .track{fill:none;stroke:var(--white);stroke-opacity:.3;stroke-width:1.2;stroke-dasharray:2 4}
#plan .eq{fill:none;stroke:var(--amber);stroke-width:2;stroke-dasharray:6 5}
#plan .new{fill:none;stroke:var(--lime);stroke-width:2.6;stroke-dasharray:7 4}
#plan .amline{fill:none;stroke:var(--amber);stroke-width:2.4;stroke-linecap:round}
#plan .liline{fill:none;stroke:var(--lime);stroke-width:2.4;stroke-linecap:round}
#plan .wide{fill:none;stroke:var(--lime);stroke-opacity:.3;stroke-width:26;stroke-linecap:round}
#plan .barr{fill:#f26b1d;stroke:#fff;stroke-width:1}
#plan .cone{fill:#f26b1d}
#plan .pour{fill:#ffffff14;stroke:#ffffff59;stroke-width:1;stroke-dasharray:3 3}
#plan .loader{fill:#f26b1d;stroke:#1a0a02;stroke-width:1}
#plan .wet{fill:#bfe6ff;fill-opacity:.38;stroke:#bfe6ff;stroke-opacity:.7;stroke-width:1}
#plan .water{fill:none;stroke:#bfe6ff;stroke-width:4;stroke-linecap:round}
#plan .cyc{fill:none;stroke:var(--white);stroke-width:2;animation:blink 1s steps(2) infinite}
#plan .sign{fill:#f5c518;stroke:#1b1300;stroke-width:1}
#plan .box{fill:#b98d5a;stroke:#3a2a16;stroke-width:1}
#plan .zone{fill:#7ed9571a;stroke:var(--lime);stroke-width:1.6;stroke-dasharray:5 4}
#plan .exit{fill:var(--lime)}
#plan .cart{fill:#8fb7ff;stroke:#0b1220;stroke-width:1}
#plan .mail{fill:#ffffff14;stroke:var(--white);stroke-width:1.2}
#plan .wh{fill:#fff}

@media (max-height:700px) and (max-width:899px){#room{grid-template-rows:50dvh minmax(0,1fr)}#room.end{grid-template-rows:28dvh minmax(0,1fr)}#line{font-size:19px}#choices button{min-height:50px;padding:9px 13px;font-size:15.5px}#panel{gap:10px;padding-top:14px}}
/* desktop and landscape */
@media (min-width:900px){
  :root{--head:72px}
  header{padding:0 22px}
  .logo img{width:170px}
  #doors{flex-direction:row}
  .door b{left:24px;bottom:28px;font-size:14px}
  .door em{right:auto;left:24px;bottom:64px}
  #room,#room.end{grid-template-rows:none;grid-template-columns:minmax(0,1fr) 460px}
  #panel{border-top:0;border-left:1px solid var(--edge);padding:calc(var(--head) + 28px) 40px 40px;justify-content:center;gap:18px}
  #room.end #panel{justify-content:flex-start;padding-top:calc(var(--head) + 10px);gap:13px}
  #line{font-size:30px;line-height:1.16}
  #room.end #line{font-size:26px}
  .tools{position:relative}
  #tag{left:22px;bottom:22px;font-size:14px}
  #plan{inset:var(--head) 0 66px;height:calc(100% - var(--head) - 66px)}
  #choices button{font-size:18px;min-height:62px;padding:14px 18px}
  #next,#buildgo,#keep{font-size:17px;min-height:54px}
  #carry{font-size:17px}#trace .v{font-size:16px}#trace .k,#otherh{font-size:11.5px}#trace .re{font-size:13.5px}#mscline,#fiction{font-size:14px}#others button span{font-size:11.5px}
  #hint{bottom:28px;font-size:14px}
}
@media (max-height:520px) and (min-width:600px){
  #room,#room.end{grid-template-rows:none;grid-template-columns:minmax(0,1fr) 46%}
  #panel{border-top:0;border-left:1px solid var(--edge);padding-top:calc(var(--head) + 4px)}
  #doors{flex-direction:row}
}
@media (hover:hover) and (min-width:900px){.door:hover,.door:focus-visible{flex-grow:1.55}}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:.01ms!important;transition-delay:0s!important}
  .door::after{opacity:.3}
  #room[data-view=plan] #photo{transform:none}
  #plan{transform:none}
  .late,#hint{opacity:1;visibility:visible}
}
