/* Portrait on a phone or small tablet is a rotation prompt, never an alternate game layout.
   A tall but wide desktop window keeps the game: the stage just letterboxes. Keep in step with `portraitScreen` in controller.js.
   The prompt is a small scene of its own: the rainy window of the title, the silver title, and a gilt phone holding
   Holmes's sealed letter sideways. The phone turns by itself (and with a finger, rotate-fx.js), the letter comes upright. */
.orientation-notice{display:none}
@media(orientation:portrait) and (max-width:900px){
 #app{visibility:hidden}
 .orientation-notice{position:fixed;inset:0;z-index:100;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;overflow:hidden;
  padding:max(24px,env(safe-area-inset-top)) 28px max(24px,env(safe-area-inset-bottom));text-align:center;color:var(--paper);
  background:radial-gradient(ellipse 120% 70% at 50% 42%,#0000 0,#020504d9 78%),linear-gradient(#05090899,#050908d9),url(../assets/title-finestra-quiete.webp) 62% 50%/cover #080e10}
 .orientation-notice>*{position:relative}
 .orientation-notice h2{margin:0 0 10px;font:400 clamp(26px,7.4vw,34px)/1.15 var(--serif);color:#f1dfb4;letter-spacing:.02em;text-shadow:0 2px 18px #000}
 .orientation-notice h2::after{content:'';display:block;width:120px;height:1px;margin:12px auto 0;background:linear-gradient(90deg,#c6a56800,#c6a568,#c6a56800)}
}
/* Rain on the glass and the warm light of a lamp breathing in the room. */
.rot-rain{position:absolute!important;inset:-20% -10%;pointer-events:none;opacity:.32;
 background:repeating-linear-gradient(103deg,#0000 0 11px,#c9d6e033 11px 12px,#0000 12px 29px),repeating-linear-gradient(98deg,#0000 0 23px,#c9d6e022 23px 24px,#0000 24px 47px);
 background-size:160px 220px,230px 300px;animation:rot-rain .55s linear infinite}
@keyframes rot-rain{to{background-position:-40px 220px,-50px 300px}}
.rot-glow{position:absolute!important;left:50%;top:44%;width:150vw;height:90vw;translate:-50% -50%;pointer-events:none;
 background:radial-gradient(closest-side,#e0a85a2e,#e0a85a0d 55%,#0000);animation:rot-glow 4.2s ease-in-out infinite alternate}
@keyframes rot-glow{0%{opacity:.7}35%{opacity:1}55%{opacity:.82}100%{opacity:.95}}
.rot-logo{width:min(66vw,300px);margin:0 0 clamp(14px,4vh,34px);filter:drop-shadow(0 4px 18px #000)}
/* The stage: an arc of gold showing the turn, the phone, and the gloved hand that turns it. */
.rot-stage{--w:min(30vw,128px);width:calc(var(--w)*2.2);height:calc(var(--w)*2.2);display:grid;place-items:center;margin-bottom:clamp(16px,4vh,34px);touch-action:none}
.rot-arc{position:absolute;inset:6%;border-radius:50%;border:1px dashed #c6a56855;mask:conic-gradient(from 300deg,#000 0 85deg,#0000 85deg);animation:rot-arc 4.8s ease-in-out infinite}
.rot-arc::after{content:'';position:absolute;right:13%;top:6%;width:9px;height:9px;border:solid #e0c27f;border-width:1.5px 1.5px 0 0;rotate:150deg}
@keyframes rot-arc{0%,18%{opacity:0}30%,60%{opacity:1}75%,100%{opacity:0}}
.rot-device{position:relative;width:var(--w);height:calc(var(--w)*1.95);padding:7%;border-radius:calc(var(--w)*.16);cursor:grab;
 background:linear-gradient(145deg,#f3dba0,#a57a35 28%,#5a3d17 52%,#c8a160 74%,#6e4a1d);box-shadow:0 18px 40px #000c,0 0 0 1px #2a1a08,inset 0 0 0 1px #fff3;
 animation:rot-turn 4.8s cubic-bezier(.55,0,.25,1) infinite;transform:rotate(var(--turn,0deg))}
.rot-device::before{content:'';position:absolute;left:50%;top:3.2%;width:22%;height:1.6%;translate:-50% 0;border-radius:4px;background:#2a1a0a}
.rot-glass{position:relative;width:100%;height:100%;border-radius:calc(var(--w)*.1);overflow:hidden;display:grid;place-items:center;
 background:radial-gradient(ellipse at 30% 20%,#2c3a36,#0c1412 70%);box-shadow:inset 0 0 18px #000}
/* Holmes's letter: wider than the glass, so in portrait it can only lie sideways; turned, it reads as it should. */
.rot-letter{position:absolute;left:50%;top:50%;translate:-50% -50%;width:calc(var(--w)*1.32);aspect-ratio:752/475;rotate:90deg;background:url(../assets/ui/kit/ui-v2-busta-holmes.webp) center/contain no-repeat;filter:drop-shadow(0 4px 8px #000a)}
.rot-glint{position:absolute;left:48%;top:60%;width:22%;aspect-ratio:1;translate:-50% -50%;border-radius:50%;opacity:0;
 background:radial-gradient(closest-side,#ffe9b8cc,#ff9a5a55 45%,#0000);mix-blend-mode:screen;animation:rot-glint 4.8s ease-out infinite}
@keyframes rot-turn{0%,22%{--turn:0deg}48%,78%{--turn:-90deg}96%,100%{--turn:0deg}}
@keyframes rot-glint{0%,50%{opacity:0;scale:.4}58%{opacity:1;scale:1.25}74%,100%{opacity:0;scale:1}}
@property --turn{syntax:'<angle>';inherits:false;initial-value:0deg}
/* The gloved finger rests on the phone's lower right corner and pushes it round, travelling a short arc up and in. */
.rot-hand{position:absolute;left:58%;top:62%;width:calc(var(--w)*.5);transform-origin:30% 5%;opacity:0;pointer-events:none;filter:drop-shadow(0 6px 10px #000b);
 animation:rot-hand 4.8s cubic-bezier(.55,0,.25,1) infinite}
@keyframes rot-hand{0%,10%{opacity:0;translate:14% 18%;rotate:0deg}20%,22%{opacity:1;translate:0 0;rotate:0deg}48%{opacity:1;translate:34% -46%;rotate:-38deg}58%,100%{opacity:0;translate:40% -52%;rotate:-40deg}}
/* Held by a finger: the loop stops and the phone follows the finger (rotate-fx.js sets --turn). Turned all the way, the seal glows. */
.rot-stage.held .rot-device,.rot-stage.settling .rot-device,.rot-stage.settling .rot-hand,.rot-stage.settling .rot-arc,.rot-stage.held .rot-hand,.rot-stage.held .rot-arc,.rot-stage.held .rot-glint,.rot-stage.solved .rot-device,.rot-stage.solved .rot-hand,.rot-stage.solved .rot-arc{animation:none}
.rot-stage.held .rot-hand,.rot-stage.settling .rot-hand,.rot-stage.solved .rot-hand,.rot-stage.settling .rot-arc,.rot-stage.held .rot-arc,.rot-stage.solved .rot-arc{opacity:0}
.rot-stage.held .rot-device{cursor:grabbing}
.rot-stage.settling .rot-device{transition:--turn .55s cubic-bezier(.3,1.5,.5,1)}
.rot-stage.solved .rot-glint{animation:rot-glint-solved 1.4s ease-out both}
@keyframes rot-glint-solved{0%{opacity:0;scale:.4}25%{opacity:1;scale:1.5}100%{opacity:.55;scale:1.1}}
@media(prefers-reduced-motion:reduce){
 .rot-rain,.rot-glow,.rot-arc,.rot-hand,.rot-glint{animation:none}
 .rot-device{animation:none;--turn:-90deg}.rot-hand{opacity:0}.rot-arc{opacity:1}
}
