/* Fun Room: the crazy scene, the locked red diary (classes start cz-). The painted diary (art/scene/diary-close.webp and
   diary-open.webp, Codex batch 37) covers the CSS one the moment it loads. */
.cz-stage{display:flex;flex-direction:column;align-items:center;padding:14px 0 0}
.cz-stage.game{padding-top:0}

/* ---- the closed diary (diary-close.webp, 900 x 643; the brass padlock's body is centred at 60.5% across, 46% down) ---- */
.cz-book{position:relative;width:106%;margin:0 -3%;aspect-ratio:900/643;transition:transform .5s cubic-bezier(.2,.8,.3,1),filter .5s}
.cz-stage.game .cz-book{width:64%;margin:0}
.cz-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;filter:drop-shadow(0 16px 20px rgba(0,0,0,.6))}
.cz-lock{position:absolute;left:60.5%;top:46%;width:64px;height:64px;transform:translate(-50%,-50%);border-radius:50%;z-index:2;-webkit-tap-highlight-color:transparent}
.cz-lock:disabled{pointer-events:none}
.cz-stage.game .cz-lock{width:44px;height:44px}
.cz-lock i{position:absolute;inset:8px;border-radius:50%;pointer-events:none}
.cz-lock:not(:disabled) i{background:radial-gradient(circle,rgba(255,236,160,.6),rgba(255,236,160,0) 68%);animation:czGlint 3s ease-in-out infinite}
@keyframes czGlint{0%,55%,100%{opacity:0;transform:scale(.7)}78%{opacity:1;transform:scale(1.15)}}
.cz-lock:active{transform:translate(-50%,-50%) scale(.92)}
.cz-book.unlocking{animation:czClick .42s ease-out}
.cz-book.sprung{animation:czClick .5s ease-out}
.cz-book.locking{animation:czLocked .5s ease-out}
@keyframes czClick{0%{transform:scale(1)}30%{transform:scale(1.04) rotate(-1.2deg)}60%{transform:scale(.99) rotate(.8deg)}100%{transform:none}}
@keyframes czLocked{0%{transform:scale(.94)}45%{transform:scale(1.02)}100%{transform:none}}
.cz-book.dim{filter:brightness(.42) saturate(.7)}

/* ---- the open diary (diary-open.webp, 1000 x 625): the handwriting sits on the left page (x 85..464, y 66..558 of the picture); the right page stays
   clean for the brass button that shuts it ---- */
.cz-open{position:relative;width:102%;margin:0 -1%;aspect-ratio:1000/625;animation:czOpenIn .5s cubic-bezier(.2,.8,.3,1) both}
.cz-open.closing{animation:czOpenOut .38s ease-in both}
@keyframes czOpenIn{0%{opacity:0;transform:scale(.7) rotateY(-50deg)}100%{opacity:1;transform:none}}
@keyframes czOpenOut{0%{opacity:1;transform:none}100%{opacity:0;transform:scale(.7) rotateY(-40deg)}}
.cz-page{position:absolute;left:10.5%;width:33%;top:12.5%;height:73%}
.cz-page textarea{position:absolute;inset:0;width:100%;height:100%;resize:none;border:0;outline:0;background:none;padding:0;overflow:hidden;
  font:italic 500 16px/21px "EB Garamond",Georgia,serif;color:#3b2410;caret-color:#7a1219;text-shadow:0 0 1px rgba(59,36,16,.25)}
.cz-count{position:absolute;right:0;bottom:-18px;font:600 12px var(--sans);color:rgba(90,50,16,.6)}
.cz-shut{position:absolute;right:11%;bottom:12%;z-index:2}

/* ---- a coworker's diary: three torn pages ---- */
.cz-q{margin:16px 0 8px;text-align:center}
.cz-pages{width:100%;display:flex;flex-direction:column;gap:12px;padding:4px 4px 24px}
.cz-torn{position:relative;display:block;width:100%;min-height:76px;padding:20px 20px 22px 22px;text-align:left;transform:rotate(var(--tilt,0deg));
  font:italic 500 20px/27px "EB Garamond",Georgia,serif;color:#3b2410;
  background:repeating-linear-gradient(180deg,transparent 0,transparent 26px,rgba(110,80,40,.2) 26px,rgba(110,80,40,.2) 27px),linear-gradient(#f7ecd0,#ecdcae);
  clip-path:polygon(0 3%,4% 0,10% 3%,17% 0,26% 2%,34% 0,45% 3%,55% 0,66% 2%,76% 0,86% 3%,94% 0,100% 2%,99% 40%,100% 62%,98% 100%,92% 97%,84% 100%,74% 97%,64% 100%,52% 97%,42% 100%,31% 97%,20% 100%,10% 97%,3% 100%,1% 70%,0 45%);
  filter:drop-shadow(0 6px 8px rgba(0,0,0,.5));transition:transform .2s,opacity .5s}
.cz-pages{filter:none}
.cz-torn span{display:block;position:relative}
.cz-torn:not(:disabled):active{transform:rotate(var(--tilt,0deg)) scale(.98)}
.cz-torn.crumple{animation:czCrumple .7s ease-in forwards;pointer-events:none}
@keyframes czCrumple{
  0%{transform:rotate(var(--tilt,0deg)) scale(1);opacity:1}
  35%{transform:rotate(7deg) scale(.55,.38) skewX(10deg);opacity:1;filter:brightness(.8)}
  100%{transform:rotate(12deg) translateY(30px) scale(.1);opacity:0;height:0;min-height:0;margin:-6px 0;padding:0}}
.cz-torn.gone{opacity:0;transform:scale(.9) translateY(8px);pointer-events:none;min-height:0;height:0;padding-top:0;padding-bottom:0;margin:-6px 0;overflow:hidden;transition:opacity .45s,transform .45s,height .6s .35s,margin .6s .35s,padding .6s .35s}
.cz-torn.gone.instant{transition:none}
.cz-torn.true{--tilt:0deg;transform:scale(1.03);background:repeating-linear-gradient(180deg,transparent 0,transparent 26px,rgba(110,80,40,.2) 26px,rgba(110,80,40,.2) 27px),linear-gradient(#fff6d6,#f6e3a8);
  filter:drop-shadow(0 0 14px rgba(255,210,90,.9)) drop-shadow(0 6px 8px rgba(0,0,0,.4))}
.cz-torn:disabled{cursor:default}

/* the gold sparkle when the lock springs open */
.cz-spark{position:absolute;left:60.5%;top:46%;width:0;height:0;pointer-events:none;z-index:3}
.cz-spark i{position:absolute;left:-4px;top:-4px;width:8px;height:8px;border-radius:50%;background:radial-gradient(#fff8d0,#ffd25a 60%,transparent 70%);box-shadow:0 0 8px #ffd25a;animation:czSpark 1.1s ease-out forwards}
.cz-spark i:nth-child(1){--x:-46px;--y:-40px}.cz-spark i:nth-child(2){--x:0;--y:-58px}.cz-spark i:nth-child(3){--x:46px;--y:-38px}
.cz-spark i:nth-child(4){--x:60px;--y:4px}.cz-spark i:nth-child(5){--x:40px;--y:44px}.cz-spark i:nth-child(6){--x:-6px;--y:56px}
.cz-spark i:nth-child(7){--x:-48px;--y:40px}.cz-spark i:nth-child(8){--x:-62px;--y:0}
@keyframes czSpark{0%{transform:translate(0,0) scale(.3);opacity:1}60%{opacity:1}100%{transform:translate(var(--x),var(--y)) scale(1.2);opacity:0}}
