/* The PNG object is the window; wheel and pinned papers share its raw square. */
.safe-puzzle-modal,.safe-note-modal{box-sizing:border-box;margin:auto;padding:0;border:0;border-radius:0;background:transparent;color:#eadcc4;box-shadow:none;font-family:inherit;overscroll-behavior:contain;overflow:visible}
.safe-puzzle-modal{width:min(760px,100vw);max-width:100vw;max-height:100dvh}
.safe-puzzle-modal::backdrop,.safe-note-modal::backdrop{background:#07090fe8}
.safe-puzzle-modal [hidden],.safe-note-modal [hidden],.safe-gate-message[hidden]{display:none!important}
.safe-puzzle-shell{position:relative;display:flex;flex-direction:column;align-items:center;width:100%;padding-top:50px;background:none}
.safe-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.safe-cabinet{position:relative;flex:none;width:min(650px,calc(100dvh - 100px),114vw);aspect-ratio:var(--safe-art-ratio,1);margin:0;isolation:isolate}
.safe-cabinet-art{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none;-webkit-user-select:none;filter:drop-shadow(0 16px 15px #0009)}
.safe-close{display:grid;place-items:center;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#111218b3;color:#e5d1ac;font-family:inherit;font-size:32px;line-height:1;cursor:pointer;text-shadow:0 2px 3px #000;box-shadow:0 2px 8px #0004;transition:color .18s,background .18s}
.safe-cabinet>.safe-close{position:absolute;left:86%;top:0;z-index:20;transform:translate(-50%,-3px)}
.safe-close:hover{color:#ffe5a7;background:#29232be6}
.safe-puzzle-modal button:focus-visible,.safe-note-modal button:focus-visible{outline:2px solid #e1b765;outline-offset:4px}
.safe-dial{position:absolute;left:var(--safe-dial-x,50%);top:var(--safe-dial-y,46.7%);z-index:6;box-sizing:border-box;width:var(--safe-dial-width,28%);min-width:52px;aspect-ratio:1;transform:translate(-50%,-50%);margin:0;padding:0;border:0;border-radius:50%;background:transparent;box-shadow:none;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
.safe-dial img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;transform-origin:var(--safe-wheel-pivot-x,49.92%) var(--safe-wheel-pivot-y,48.48%);transform:translate(calc(50% - var(--safe-wheel-pivot-x,49.92%)),calc(50% - var(--safe-wheel-pivot-y,48.48%))) rotate(var(--safe-wheel-rotation,0deg));filter:drop-shadow(0 3px 2px #08090ba0);will-change:transform}
.safe-dial-assisted img{transition:transform .55s cubic-bezier(.2,.6,.25,1)}
.safe-dial-dragging{cursor:grabbing}.safe-dial:disabled{cursor:default}
.safe-direction-controls{position:absolute;inset:0;z-index:8;pointer-events:none}
.safe-direction-controls button{position:absolute;top:var(--safe-dial-y,46.7%);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;width:clamp(48px,13vw,72px);min-width:44px;min-height:60px;margin:0;padding:3px 0;border:0;border-radius:0;background:none;box-shadow:none;color:#d5b27a;cursor:pointer;pointer-events:auto;touch-action:manipulation;transform:translate(-50%,-50%);transition:color .18s,opacity .18s}
.safe-direction-controls button[data-direction="-1"]{left:14%}
.safe-direction-controls button[data-direction="1"]{left:86%}
.safe-direction-controls button svg{display:block;width:100%;max-width:58px;height:auto;overflow:visible;filter:drop-shadow(0 2px 2px #000d);transition:transform .18s}
.safe-direction-controls button span{font-family:inherit;font-size:clamp(10px,2.55vw,12px);font-weight:600;line-height:1.25;text-shadow:0 2px 3px #000,0 0 8px #000;white-space:nowrap}
.safe-direction-controls button:hover{color:#ffe0a0}
.safe-direction-controls button[data-direction="-1"]:hover svg{transform:translateX(-2px)}
.safe-direction-controls button[data-direction="1"]:hover svg{transform:translateX(2px)}
.safe-direction-controls button:active svg{transform:scale(.93)}
.safe-direction-controls button:disabled{opacity:.28;cursor:default}
/* Compact brass signals clear the wheel's upper arc and the reminder paper. */
.safe-stage-lights{position:absolute;left:50%;top:-28px;z-index:7;display:flex;align-items:flex-start;justify-content:center;gap:18px;transform:translate(-50%,-50%)}
.safe-stage-light{display:flex;flex-direction:column;align-items:center;gap:2px;color:#b4a185;font-size:9px;line-height:1;text-shadow:0 1px 2px #000}
.safe-stage-light i{box-sizing:border-box;display:grid;place-items:center;width:clamp(14px,3.6vw,20px);height:clamp(14px,3.6vw,20px);border:1.5px solid #a4844c;border-radius:50%;background:#22252a;box-shadow:inset 0 2px 3px #000d,0 1px 2px #0008;color:#e5dfb6;font:12px/1 sans-serif;font-style:normal;transition:background .22s,box-shadow .22s}
.safe-stage-light[data-state=correct] i{background:#638355;border-color:#c7b67b;color:#fff1c9;box-shadow:inset 0 1px 3px #26391a,0 0 10px #a8c76b66}
.safe-stage-light[data-state=wrong] i{background:#8d4035;border-color:#d18e5e;color:#ffe3c5;animation:safe-lock-wrong .3s ease-out 3}
/* Each pinned note retains its original portrait 2:3 proportions. */
.safe-attached-notes{position:absolute;inset:0;z-index:10;pointer-events:none}
.safe-attached-note,.safe-reference-note{position:absolute;left:var(--note-x,50%);top:var(--note-y,72%);box-sizing:border-box;width:var(--note-width,13%);min-width:48px;aspect-ratio:2/3;transform:translate(-50%,-50%) rotate(var(--note-angle,-4deg));margin:0;padding:0;border:0;border-radius:0;background:var(--safe-paper-image) center/100% 100% no-repeat;color:#554536;cursor:pointer;pointer-events:auto;filter:drop-shadow(1px 3px 2px #0008);touch-action:manipulation;transition:filter .18s}
.safe-attached-note:hover,.safe-reference-note:hover{filter:drop-shadow(1px 4px 3px #000a) brightness(1.05)}
.safe-attached-note .safe-note-drawing{position:absolute;inset:13% 12% 12%;display:grid;place-items:center;width:auto;height:auto;min-width:0;min-height:0}
.safe-attached-note .safe-note-drawing svg{display:block;width:100%;height:100%;max-height:none;overflow:visible;opacity:.87;transform:rotate(1deg)}
.safe-attached-note .safe-note-order{position:absolute;top:8%;left:11%;margin:0;color:#66543e;opacity:.3;font:italic clamp(5px,1.4vw,8px)/1 Georgia,serif;letter-spacing:0;white-space:nowrap;transform:rotate(-3deg)}
.safe-attached-note[data-order="2"] .safe-note-order{top:auto;bottom:8%;left:auto;right:10%;transform:rotate(3deg)}
.safe-reference-note{z-index:9;width:var(--note-width,14%);min-width:48px}
.safe-reference-note .safe-reference-pictures{position:absolute;inset:14% 10% 12%;display:grid;grid-template-columns:1fr;grid-template-rows:repeat(3,minmax(0,1fr));align-items:center;justify-items:center;gap:4%;pointer-events:none}
.safe-reference-note .safe-reference-pictures img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;image-rendering:pixelated;filter:sepia(.55) saturate(.45);opacity:.9}
.safe-open-button,.safe-hint-button,.safe-opened-result button{box-sizing:border-box;min-height:44px;margin:0;padding:8px 12px;border:1px solid #b58c50;border-radius:5px;background:linear-gradient(#88623b,#5c3c28);box-shadow:inset 0 1px #efd39a33,0 3px 5px #0007;color:#f5dfb4;font-family:inherit;font-size:13px;font-weight:600;line-height:1.2;cursor:pointer;touch-action:manipulation;transition:background .18s,color .18s,opacity .18s}
.safe-open-button{position:absolute;left:50%;top:88.5%;z-index:12;width:27%;min-width:102px;transform:translate(-50%,-50%);font-family:inherit;font-size:clamp(12px,2.9vw,15px);font-weight:700;letter-spacing:.025em}
.safe-open-button:hover,.safe-opened-result button:hover{background:linear-gradient(#a27a49,#744b2f);color:#fff0cf}
.safe-open-button:active{transform:translate(-50%,calc(-50% + 1px))}
.safe-open-button:disabled{opacity:.5;cursor:default}
.safe-hint-button{position:absolute;left:76%;top:88.5%;z-index:12;width:19%;min-width:74px;padding:7px 3px;border-color:transparent;background:transparent;box-shadow:none;color:#cdb78f;font-family:inherit;font-size:clamp(10px,2.4vw,12px);font-weight:400;text-decoration:underline;text-underline-offset:3px;text-shadow:0 2px 3px #000}
.safe-hint-button:hover{color:#ffe1a5;background:none}
.safe-feedback{position:absolute;left:50%;top:97%;z-index:15;width:82%;max-width:440px;margin:0;padding:0;transform:translateX(-50%);color:#edb398;font-size:clamp(11px,2.9vw,14px);line-height:1.45;text-align:center;text-shadow:0 2px 3px #000,0 0 9px #000;overflow-wrap:anywhere;pointer-events:none}
.safe-feedback:empty{display:none}
.safe-puzzle-modal[data-opened=true] .safe-cabinet{width:min(600px,60dvh,104vw)}
.safe-puzzle-modal[data-opened=true] .safe-feedback{display:none}
.safe-puzzle-modal[data-opened=true] .safe-attached-note{left:var(--note-open-x,31%);top:var(--note-open-y,var(--note-open-fallback-y,30%));width:var(--note-open-width,10%);transform:translate(-50%,-50%) rotate(var(--note-open-angle,var(--note-angle,-4deg)))}
.safe-puzzle-modal[data-opened=true] .safe-attached-note:nth-child(1){--note-open-fallback-y:30%}
.safe-puzzle-modal[data-opened=true] .safe-attached-note:nth-child(2){--note-open-fallback-y:50%}
.safe-puzzle-modal[data-opened=true] .safe-attached-note:nth-child(3){--note-open-fallback-y:70%}
.safe-opened-result{position:relative;max-width:min(420px,calc(100vw - 36px));margin:-2px 0 0;padding:0 8px 16px;text-align:center;text-shadow:0 2px 5px #000}
.safe-opened-result h3{margin:0 0 10px;color:#e9c783;font-size:clamp(19px,4.7vw,25px);line-height:1.3;letter-spacing:.065em}
.safe-opened-result p{margin:0 0 17px;color:#e2d2b8;font-size:clamp(12px,3.1vw,15px);line-height:1.65}
.safe-opened-result button{min-width:160px;font-family:inherit;font-size:13px}
/* Full-size papers use the raw 2:3 ratio, including in a short viewport. */
.safe-note-modal{width:fit-content;max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);color:#544537}
.safe-note-modal>.safe-close{position:absolute;right:-10px;top:-12px;z-index:3}
.safe-note-paper{box-sizing:border-box;position:relative;width:min(360px,calc(100vw - 44px),56dvh);aspect-ratio:2/3;margin:0;padding:0;background:var(--safe-paper-image) center/100% 100% no-repeat;filter:drop-shadow(0 12px 16px #0008);transform:rotate(-1.3deg);color:#544537}
.safe-note-paper>.safe-note-order{position:absolute;top:8%;left:13%;margin:0;color:#66543e;opacity:.29;font:italic clamp(10px,2.8vw,14px)/1 Georgia,serif;letter-spacing:1px;transform:rotate(-4deg)}
.safe-note-paper[data-order="2"]>.safe-note-order{top:auto;bottom:8%;left:auto;right:13%;transform:rotate(3deg)}
.safe-note-paper>.safe-note-drawing{position:absolute;inset:14% 12% 14%;display:grid;place-items:center;min-width:0;min-height:0}
.safe-note-paper>.safe-note-drawing>svg{display:block;width:100%;height:100%;max-height:100%;overflow:visible;transform:rotate(1.5deg);opacity:.86}
.safe-note-paper[data-kind=reference]>.safe-note-drawing,.safe-note-modal[data-kind=reference] .safe-note-drawing{inset:13% 11% 12%;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:18px}
.safe-note-paper[data-kind=reference] h3,.safe-note-paper[data-kind=reference] p,.safe-note-modal[data-kind=reference] h3,.safe-note-modal[data-kind=reference] p{margin:0;font:600 clamp(17px,4.2vw,22px)/1.35 Georgia,serif;text-align:center}
.safe-note-paper .safe-reference-pictures{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:end;gap:8px;width:100%;margin:0}
.safe-note-paper .safe-reference-pictures figure{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:0;margin:0;padding:0;border:0;background:none}
.safe-note-paper .safe-reference-pictures img{display:block;width:100%;height:clamp(65px,17dvh,130px);object-fit:contain;image-rendering:pixelated;filter:sepia(.5) saturate(.5);opacity:.9}
.safe-note-paper .safe-reference-pictures figcaption{margin-top:9px;color:#5b4836;font:clamp(10px,2.5vw,13px)/1.3 Georgia,serif;text-align:center;overflow-wrap:anywhere}
.safe-note-paper[data-kind=hint]>.safe-note-drawing,.safe-note-modal[data-kind=hint] .safe-note-drawing{inset:15% 11% 13%;display:flex;align-items:center;justify-content:center}
.safe-exact-hint{width:100%;color:#554233;font-family:Georgia,serif;line-height:1.55;text-align:left}
.safe-exact-hint h3{margin:0 0 20px;font-size:clamp(19px,5vw,25px);font-weight:600;text-align:center}
.safe-exact-hint ol{margin:0;padding-left:27px;font-size:clamp(16px,4.5vw,22px)}
.safe-exact-hint li{padding-left:4px;margin:14px 0}.safe-exact-hint strong{font-weight:700}
.safe-gate-message{position:fixed;z-index:1900;right:max(18px,env(safe-area-inset-right));top:max(90px,calc(env(safe-area-inset-top) + 30px));display:grid;grid-template-columns:78px 1fr;align-items:center;gap:12px;width:min(340px,calc(100vw - 36px));box-sizing:border-box;background:linear-gradient(110deg,#2d2530f5,#191922f5);border:1px solid #786043;border-radius:10px;padding:13px 26px 13px 9px;box-shadow:0 6px 24px #0006;animation:safe-toast-in .4s ease-out}
.safe-gate-message img{width:78px;height:110px;object-fit:contain;object-position:bottom;align-self:end}.safe-gate-message p{font-size:13px;line-height:1.65;color:#e3d2b3;margin:0}.safe-gate-message button{position:absolute;top:3px;right:5px;background:none;border:0;color:#ad947b;font-size:23px;cursor:pointer;width:25px;height:28px}
.safe-gate-message[data-portrait=false]{grid-template-columns:1fr;padding:22px 36px 24px 22px;border-top-color:#bb8b50;background:radial-gradient(ellipse at top left,#52313a80,transparent 80%),linear-gradient(120deg,#2a242e,#181922)}
.safe-gate-message img[hidden]{display:none}
.notice-lifetime{position:absolute;bottom:0;left:0;right:0;height:4px;overflow:hidden;background:#100e16;border-radius:0 0 9px 9px}
.notice-lifetime>span{display:block;width:100%;height:100%;background:linear-gradient(90deg,#a74454,#e49b50,#f4cc7d);transform-origin:left center;box-shadow:0 0 7px #df995b66}
.safe-gate-message:has(.notice-lifetime){overflow:hidden;padding-bottom:19px}
.safe-world-hit{position:absolute;padding:0;border:0;background:transparent;cursor:pointer;touch-action:manipulation;box-shadow:none;pointer-events:auto}
.safe-world-hit:focus-visible{outline:2px solid #d7ae6d;outline-offset:3px;border-radius:4px}
.asset-editor-open .safe-world-hit{pointer-events:none}
@keyframes safe-lock-wrong{50%{box-shadow:0 0 13px #bc573888}}
@keyframes safe-toast-in{from{opacity:0;transform:translateX(14px)}to{opacity:1;transform:translateX(0)}}
@media(max-width:580px){
 .safe-stage-light{font-size:8px}
 .safe-cabinet>.safe-close{top:-3px}
 .safe-gate-message{top:75px;grid-template-columns:67px 1fr;gap:8px;width:min(315px,calc(100vw - 28px));right:14px}.safe-gate-message img{width:67px;height:95px}.safe-gate-message p{font-size:12px}
}
@media(max-height:500px){
 .safe-puzzle-shell{padding-top:44px;padding-bottom:40px}
 .safe-cabinet{width:min(650px,calc(100dvh - 105px),114vw)}
 .safe-direction-controls button{width:54px;min-height:52px;gap:1px}.safe-direction-controls button svg{max-width:40px}.safe-direction-controls button span{font-size:10px}
 .safe-stage-lights{top:-25px;gap:16px}.safe-stage-light i{width:16px;height:16px}.safe-stage-light{font-size:8px}
 .safe-attached-note{min-width:36px}.safe-attached-note::after{content:"";position:absolute;inset:-4px}
 .safe-reference-note{min-width:38px}.safe-reference-note::after{content:"";position:absolute;inset:-3px}
 .safe-open-button{top:98%;min-width:90px;font-size:11px;min-height:44px}.safe-hint-button{left:80%;top:98%;min-width:65px;font-size:10px;min-height:44px}
 .safe-feedback{top:calc(100% + 24px);width:min(440px,calc(100vw - 36px))}
 .safe-puzzle-modal[data-opened=true] .safe-puzzle-shell{padding-top:0;padding-bottom:0}
 .safe-puzzle-modal[data-opened=true] .safe-cabinet{width:min(420px,57dvh)}
 .safe-opened-result{padding-bottom:8px}.safe-opened-result h3{font-size:17px;margin-bottom:5px}.safe-opened-result p{font-size:11px;line-height:1.4;margin-bottom:9px}.safe-opened-result button{min-height:44px;padding:6px 12px;font-size:11px}
}
@media(max-height:500px) and (orientation:landscape){
 .safe-puzzle-modal[data-opened=true] .safe-puzzle-shell{flex-direction:row;justify-content:center;gap:16px}
 .safe-puzzle-modal[data-opened=true] .safe-cabinet{width:min(600px,86dvh,56vw)}
 .safe-opened-result{flex:none;max-width:min(270px,36vw);margin:0;padding:0 3px}
}
@media(prefers-reduced-motion:reduce){.safe-puzzle-modal *,.safe-note-modal *,.safe-gate-message{animation:none!important;transition:none!important}}
