/* The grip belongs to the world. Opening the phone brings its screen into a
   readable, unscaled close-up with the same frame throughout the task. */
.game.phone-focused .phone-rig{inset:78px auto auto 50%;width:min(340px,calc(100vw - 28px));height:min(620px,calc(100svh - 98px));transform:translateX(-50%);transform-origin:50% 0;z-index:24;transition:transform .35s,opacity .25s}
.game.phone-focused .phone-assembly{transform:none}
.game.phone-focused .hand-phone-art{opacity:0;visibility:hidden;transition:opacity .25s,visibility 0s .25s}
.game.phone-focused .phone{inset:0;width:100%;height:100%;border:3px solid #8d77a7;border-radius:32px;background:#332c3c;padding:10px 7px 15px;box-shadow:4px 5px 0 #2b2338;transform:none}
.game.phone-focused .phone-screen{display:flex;flex-direction:column;min-height:0;border-radius:20px;overflow:hidden}
.game.phone-focused .phone-status{flex-shrink:0;height:19px;font-size:10px;padding:5px 15px 0}
.game.phone-focused .phone-app{flex-shrink:0;height:44px;margin:0 12px;gap:6px;font-size:16px;border-bottom:1px solid #e4dbe9}
.game.phone-focused .phone-app>span{margin-left:auto}.game.phone-focused .camera-dot{display:none}
.game.phone-focused .phone-close{position:static;display:flex;align-items:center;gap:5px;min-height:44px;margin:0 auto 0 0;padding:5px 6px 5px 0;transform:none;background:none;box-shadow:none;border:0;border-radius:6px;font-size:13px;white-space:nowrap;color:#634281;letter-spacing:0}
.game.phone-focused .phone-close span{font-size:26px;margin:0;line-height:1;font-weight:700}
.game.phone-focused .phone-alarm{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;justify-content:center;padding:16px 20px 24px}
.game.phone-focused .phone-alarm strong{font-size:31px;line-height:1.2}
.game.phone-focused .phone-alarm p{font-size:14px;line-height:1.5;margin:6px 0 20px}
.game.phone-focused #accept-mission{min-height:48px;flex-shrink:0}
.game.phone-focused .phone-mission{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-bottom:10px}
.game.phone-focused .phone-task{padding:12px 14px 10px}
.game.phone-focused .phone-task small{font-size:11px;font-weight:800}
.game.phone-focused .phone-task strong{font-size:22px;line-height:1.2;font-weight:900;overflow-wrap:break-word}
.game.phone-focused .camera{height:clamp(90px,20svh,160px);margin:0 12px;border-radius:12px}
.game.phone-focused .camera-caption{font-size:12px;line-height:1.35;background:linear-gradient(0deg,#342746a8,transparent);inset:auto 0 0;padding:14px 8px 8px}
.game.phone-focused .live-label{font-size:10px}
.game.phone-focused .scan-brackets{top:50%;transform:translate(-50%,-50%)}
.game.phone-focused .scan-button{min-height:46px;margin:10px 12px 0;width:calc(100% - 24px);font-size:14px;font-weight:900;padding:10px 12px;line-height:1.3}
.game.phone-focused .phone-feedback{width:auto;min-height:34px;padding:7px 14px;font-size:12px;font-weight:700;line-height:1.4;text-align:center;justify-content:center;overflow-wrap:break-word}
.game.phone-focused .step-tracker{margin:5px 14px 0;padding-top:9px;gap:9px;align-items:center}
.game.phone-focused .step-tracker>div:nth-child(2){display:flex;align-items:center;justify-content:space-between;flex:1;gap:8px}
.game.phone-focused .step-tracker small{font-size:12px;font-weight:800}
.game.phone-focused .step-tracker strong{font-size:23px;line-height:1.2}
.game.phone-focused .step-symbol svg{width:20px;height:23px}
.offline-entry{margin:10px 9px 0;padding:9px 0 4px;border-top:1px solid #d9cce3;width:112px}
.offline-entry p{font-size:11px;line-height:1.4;margin:0 0 8px;color:#725985}.offline-entry b{color:#4c3267;font-weight:900}
.offline-entry button{font:inherit;font-size:11px;font-weight:900;min-height:44px;width:100%;border:0;border-radius:10px;background:#ffe38b;color:#4b315f;padding:8px;line-height:1.35}
.offline-entry .camera-return{background:#eee4f3;color:#634281}
.game.phone-focused .offline-entry{flex-shrink:0;display:grid;grid-template-columns:minmax(0,1fr) 132px;gap:10px;align-items:center;width:auto;margin:0;padding:12px;background:#f1e9f5;border-top:1px solid #e1d3ea}
.game.phone-focused .offline-entry p{font-size:12px;line-height:1.4;margin:0}.game.phone-focused .offline-entry button{font-size:12px;min-height:48px;padding:8px 10px}
.game.phone-focused .phone-focus-shade{z-index:22}
.game.phone-focused .game-tools,.game.phone-focused .hud{z-index:27}
.game.phone-focused:not(.phone-game-mode) .phone-rig:focus-within .phone-screen{outline:none}
/* Mini-games share the close-up frame; their own back bar stays in view. */
.game.phone-game-mode .phone-status,.game.phone-game-mode .phone-app,.game.phone-game-mode #phone-alarm,.game.phone-game-mode #phone-mission,.game.phone-game-mode .offline-entry{display:none}
.game.phone-game-mode .phone-screen{display:block}
.game.phone-game-mode #phone-close{display:none}
.epilogue .room-art{top:0}
@media(max-height:660px){.game.phone-focused .phone-task{padding:8px 12px}.game.phone-focused .phone-task strong{font-size:20px}.game.phone-focused .camera{height:90px}.game.phone-focused .phone-feedback{padding:5px 12px;min-height:30px}.game.phone-focused .step-tracker{padding-top:6px;margin-top:3px}.game.phone-focused .offline-entry{padding:9px 12px}.game.phone-focused .phone-alarm{padding:8px 16px 16px}.game.phone-focused .phone-alarm .task-icon{display:none}}
@media(max-height:460px) and (min-width:601px){.game.phone-focused .phone-rig{top:16px;height:calc(100svh - 32px);width:330px}.game.phone-focused .phone-alarm{justify-content:flex-start}.game.phone-focused .phone-alarm strong{font-size:26px}.game.phone-focused .phone-alarm p{margin:2px 0 10px;font-size:13px}}
@media(prefers-reduced-motion:reduce){.game.phone-focused .phone-rig{transition:none}}

.game.phone-focused .guide-bubble{opacity:0;visibility:hidden}

.game.phone-focused .phone-focus-shade{pointer-events:auto}
/* On short landscapes the world HUD uses the side gutters, clear of the app. */
@media(max-height:460px) and (min-width:601px){
 .game.phone-focused .hud{left:12px;top:16px}.game.phone-focused .hud .location,.game.phone-focused .timer-ring{display:none}
 .game.phone-focused .timer{padding:9px;gap:6px}.game.phone-focused .timer-icon{font-size:22px}.game.phone-focused .timer strong{font-size:23px}.game.phone-focused .timer small{font-size:10px}
 .game.phone-focused .game-tools{top:16px;right:12px;flex-direction:column;gap:5px}
 .game.phone-focused .phone-task{padding:6px 12px}.game.phone-focused .camera{height:70px}.game.phone-focused .scan-brackets{height:50px;width:70px}
}
@media(min-width:1050px) and (min-height:461px){.game.phone-focused .phone-rig{left:auto;right:clamp(24px,5vw,100px);transform:none}}
/* Focus changes are animated by JS (FLIP) with transform only; no CSS transition may fight it. */
.phone-rig.flip{transition:none!important}
.hand-phone-art{transition:opacity .25s}
@media(max-height:460px) and (min-width:601px){
 .game.phone-focused .step-tracker{padding-inline:10px;padding-bottom:4px}
 .game.phone-focused .hud{flex-direction:column;align-items:flex-start;gap:6px}
}
/* Portrait tablets: the held phone is smaller and sits in the corner, clear of the mascot and the door labels. */
@media(min-width:601px) and (max-width:1000px){.phone-rig{right:-30px;bottom:-78px;transform:scale(.64)}}
/* Sideways phones: the held phone sits lower and further right, so it never covers the painted doors (game.css's short-landscape rule is overridden above). */
@media(max-height:460px) and (min-width:601px) and (max-width:1000px){.phone-rig{right:-40px;bottom:-112px;transform:scale(.5)}}
/* ---- 25 Kas: the phone brought forward has a real phone's proportions (about 9:19) on computers and tablets, as tall as
   the screen allows; on a phone held upright it is the whole screen, like an app. #game keeps these above wake.css. ---- */
#game.phone-focused .phone-rig{--ph:min(760px,calc(100svh - 98px));height:var(--ph);width:min(calc(var(--ph) * .474),calc(100vw - 28px))}
/* In bed the card keeps its old height (620 px at most): taller, it would cover Ponçik on the blanket and push him aside. */
#game.bed-view.phone-focused .phone-rig{--ph:min(620px,calc(100svh - 98px))}
@media(max-aspect-ratio:1/1) and (min-width:601px){#game.bed-view.phone-focused .phone-rig{--ph:min(620px,calc(100svh - 98px - 26svh))}}
@media(max-height:460px) and (min-width:601px){#game.phone-focused .phone-rig{height:calc(100svh - 32px);width:330px}}
/* The task screen: the camera takes the room the tall screen gives, the rest keeps its size (the list scrolls if it must). */
#game.phone-focused .phone-mission:not([hidden]){display:flex;flex-direction:column}
#game.phone-focused .phone-mission>*{flex-shrink:0}
/* The camera's size never depends on the text around it (a longer caption or feedback line must not rescale the picture). */
#game.phone-focused .phone-mission>.camera{flex:0 0 auto;height:clamp(90px,calc(var(--ph) * .43),330px);min-height:0;max-height:none}
@media(max-height:460px) and (min-width:601px){#game.phone-focused .phone-mission>.camera{height:90px}}
#game.phone-focused .phone-mission>.camera[hidden]{display:none}
/* Sideways phones: the screen is short; the status row goes so the scan key stays in view above the mini-game entry. */
@media(max-height:460px) and (min-width:601px){#game.phone-focused .phone-status{display:none}}
@media(max-width:600px){
 #game.phone-focused .phone-rig{inset:0;width:100%;height:100%;transform:none;border-radius:0}
 #game.phone-focused .phone{border:0;border-radius:0;padding:0;box-shadow:none;background:#faf6ee}
 /* the HUD row (time left, tools) is the app's top bar; the content starts under it and clear of the notch and home bar */
 #game.phone-focused .phone-screen{border-radius:0;padding:calc(64px + env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
 #game.phone-focused .phone-status{display:none}
 #game.phone-focused .hud,#game.phone-focused .game-tools{top:calc(13px + env(safe-area-inset-top))}
 #game.phone-focused .games-panel{top:calc(64px + env(safe-area-inset-top));bottom:env(safe-area-inset-bottom)}
 #game.phone-focused .phone-app{margin:0 16px}
 #game.phone-focused .phone-task{padding:14px 16px 10px}
 #game.phone-focused .phone-mission>.camera{margin:0 16px;height:clamp(140px,46svh,360px)}
 #game.phone-focused .scan-button{margin:12px 16px 0;width:calc(100% - 32px);min-height:50px}
 #game.phone-focused .step-tracker{margin:6px 16px 0}
 #game.phone-focused .offline-entry{padding:12px 16px}
}
/* The camera: the reticle sits in the middle of the picture, where the chosen object is (scene.js centres the crop on it);
   with an object chosen it is that object's size (game.js gives its width and height in painting pixels: --ow, --oh). */
.camera{container-type:size}
.camera .scan-brackets{top:50%;left:50%;transform:translate(-50%,-50%)}
.camera.has-target .scan-brackets{--k:max(100cqw / 290,100cqh / 210);width:min(calc(var(--k) * var(--ow) + 14px),100cqw - 8px);height:min(calc(var(--k) * var(--oh) + 14px),100cqh - 8px)}
/* Waiting on the network: a small ring in the pressed button, only when the wait passes 300 ms; nothing for a quick one. */
@keyframes busy-spin{to{transform:rotate(360deg)}}
#begin .choice-arrow,#wake-up,#accept-mission{position:relative}
#begin .choice-arrow::after,#wake-up::after,#accept-mission::after{content:'';position:absolute;top:50%;width:18px;height:18px;margin-top:-9px;border-radius:50%;border:2.5px solid currentColor;border-right-color:transparent;opacity:0;pointer-events:none;animation:busy-spin .9s linear infinite paused;transition:opacity .15s}
#begin .choice-arrow::after{left:50%;margin-left:-9px;border-color:#3e285c;border-right-color:transparent}
#wake-up::after,#accept-mission::after{right:18px}
#begin[aria-busy=true] .choice-arrow::after,#wake-up[aria-busy=true]::after,#accept-mission[aria-busy=true]::after{opacity:1;animation-play-state:running;transition:opacity .2s .3s}
#begin[aria-busy=true] .choice-arrow{color:transparent;transition:color .15s .3s}
/* A room picture still on its way when the eyes close for a door: the same ring, alone, over the lids. */
.load-hint{position:fixed;left:50%;top:50%;z-index:2147483600;width:30px;height:30px;margin:-15px;border-radius:50%;border:3px solid #fffaf1;border-right-color:transparent;box-shadow:0 0 0 4px #2b223a40;opacity:0;pointer-events:none;animation:busy-spin .9s linear infinite paused;transition:opacity .2s}
.load-hint.on{opacity:.9;animation-play-state:running;transition:opacity .2s .3s}
/* On the full-screen app the HUD keys sit on the app's paper: a light lilac fill keeps them reading as keys. */
@media(max-width:600px){#game.phone-focused .timer,#game.phone-focused .game-tools .tool{background:#efe7f4;box-shadow:none}}
/* Aiming the camera (game.js): the picture on the phone brought forward is dragged like a live view; the reticle shows the
   chosen object's name; a one-time hint says the camera can be moved. */
#game.phone-focused:not(.phone-game-mode) .camera{cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
#game.phone-focused .camera.aiming{cursor:grabbing}
.scan-brackets{transition:width .15s ease,height .15s ease}
.camera.aiming .scan-brackets{transition:none}
.aim-label{position:absolute;left:50%;bottom:calc(100% + 5px);transform:translateX(-50%);padding:2px 9px;border-radius:8px;background:#ffd43c;color:#3e285c;font-size:11px;font-weight:900;line-height:1.5;white-space:nowrap;opacity:0;transition:opacity .15s;pointer-events:none}
.camera.has-target .aim-label:not(:empty){opacity:1}
.aim-hint{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:7px 13px;border-radius:99px;background:#2b223acc;color:#fff;font-size:13px;font-weight:900;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .3s}
.camera.aim-hint-on .aim-hint{opacity:1;animation:aim-nudge 1.6s ease-in-out infinite}
@keyframes aim-nudge{0%,100%{transform:translate(-50%,-50%)}25%{transform:translate(calc(-50% - 10px),-50%)}75%{transform:translate(calc(-50% + 10px),-50%)}}
/* After the scan: the task's state in place of the camera (game.js #task-done). */
.task-done{display:flex;align-items:center;gap:12px;margin:4px 10px 0;padding:12px;border-radius:12px;background:#e5f3ec;color:#2d6a55}
.task-done[hidden]{display:none}
.task-done-mark{flex-shrink:0;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#2d6a55;color:#fff;font-size:18px;font-weight:900}
.task-done strong{display:block;font-size:16px;font-weight:1000;line-height:1.2}
.task-done small{display:block;margin-top:3px;font-size:12px;font-weight:700;line-height:1.4;color:#3f6f5e}
#game.phone-focused .task-done{margin:6px 12px 0;padding:16px}
#game.phone-focused .task-done-mark{width:44px;height:44px;font-size:22px}
#game.phone-focused .task-done strong{font-size:20px}
#game.phone-focused .task-done small{font-size:13px}
@media(max-width:600px){#game.phone-focused .task-done{margin:8px 16px 0}}
/* The end (game.js): the app's finish screen on the phone brought forward, before the curtain. */
.phone-reward{display:none}
.game.reward-phone .phone-reward{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:20px;text-align:center;color:#342746}
.game.reward-phone .phone-mission,.game.reward-phone .offline-entry,.game.reward-phone #phone-alarm,.game.reward-phone #phone-close{display:none!important}
.reward-check{display:grid;place-items:center;width:64px;height:64px;margin-bottom:10px;border-radius:50%;background:#2d6a55;color:#fff;font-size:32px;font-weight:900;animation:reward-pop .45s cubic-bezier(.2,1.4,.4,1) both}
.phone-reward small{font-size:15px;font-weight:900;color:#2d6a55}
.phone-reward strong{font-size:38px;line-height:1.1;font-weight:1000;letter-spacing:-.03em}
.phone-reward p{margin:8px 0 0;font-size:13px;font-weight:800;color:#6a5578;font-variant-numeric:tabular-nums}
@keyframes reward-pop{from{transform:scale(.4);opacity:0}to{transform:none;opacity:1}}
