﻿/* =====================================================================
   Screen tab (screen-stage track). Three layouts, chosen by main.js (layoutAll) on #v-screen:
     (default) portrait, one fixed layout like an extended desktop with a laptop touchpad:
               toolbar (40) · Screen 1 (the PC) · Screen 2's header line · Screen 2 (Zoom Lens / a window) · touchpad ·
               slim key row (paged) · slim tab bar. Both screens 16:9 and the same size (main.js sizePortrait).
     .land      real landscape: PC edge to edge against the notch side, rail in the other pillar
     .full      portrait phone, #stFrame laid out innerHeight x innerWidth and rotated 90deg (.flip = -90deg)
   Live video always sits on true black (--bg-video); nothing with backdrop-filter overlaps the canvas.
   ===================================================================== */

/* fallback tokens: zero specificity, so base.css (shell) wins wherever it defines them */
:where(:root){
  --bg-video:#000; --ink:rgba(10,10,14,.86);
  --glass-1:rgba(255,255,255,.045); --glass-2:rgba(255,255,255,.075); --glass-3:rgba(255,255,255,.12);
  --stroke:rgba(255,255,255,.08); --stroke-2:rgba(255,255,255,.14);
  --text-1:#F2F3FF; --text-2:#B6B9DC; --text-3:#8D91BC;
  --violet:#8B5CF6; --cyan:#22D3EE; --accent-text:#B9AEFF; --accent-ring:#8B7BFF;
  --grad-fill:linear-gradient(115deg,#7C3AED 0%,#5A55F0 50%,#0E7FA6 100%);
  --grad-soft:linear-gradient(180deg,rgba(139,92,246,.24),rgba(90,85,240,.12));
  --glow:0 10px 30px -8px rgba(124,92,255,.55),0 4px 14px -6px rgba(34,211,238,.35);
  --on-bg:rgba(139,92,246,.20); --on-stroke:rgba(167,139,250,.55);
  --good:#34D399; --warn:#FBBF24; --bad:#FB7185;
  --hi:inset 0 1px 0 rgba(255,255,255,.08);
  --key-shadow:inset 0 1px 0 rgba(255,255,255,.08),inset 0 -2px 0 rgba(0,0,0,.35),0 2px 0 rgba(0,0,0,.38);
  --key-shadow-down:inset 0 1px 3px rgba(0,0,0,.45),0 0 0 rgba(0,0,0,0);
  --ease-out:cubic-bezier(.22,1,.36,1); --ease-spring:cubic-bezier(.34,1.56,.64,1);
  --d-1:120ms; --d-2:220ms; --d-3:380ms;
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
  --nav-clear:86px;
  --bezel-edge:rgba(255,255,255,.15); --scr2-bg:#0d0d13;   /* the screens' frame edge, Screen 2 around a window */
}
/* the Screen tab's own (slimmer) tab bar: keeps every tab, clear of the home indicator */
#v-screen{--scr-nav-h:50px;--scr-nav-clear:calc(var(--nav-b) + var(--scr-nav-h) + 6px)}
body[data-view="screen"]:not(.scr-land):not(.scr-full) nav{height:50px;padding:4px}
body[data-view="screen"]:not(.scr-land):not(.scr-full) nav button{gap:3px}
body[data-view="screen"]:not(.scr-land):not(.scr-full) nav button svg{width:22px;height:22px}
body[data-view="screen"]:not(.scr-land):not(.scr-full) nav .tab-ind{top:4px;bottom:4px;left:4px;width:calc((100% - 8px) / var(--tabs,5));border-radius:22px}

/* ---------------------------------------------------------------- shell interplay */
body.scr-on header.dev,body.scr-on header{display:none}          /* the screen toolbar replaces the header */
body.scr-land nav,body.scr-full nav,body.scr-on.scr-typing nav{display:none}
body.scr-full,body.scr-land{background:var(--bg-video)}
body.scr-full #app,body.scr-land #app{padding-top:0}
body.scr-full .sheet-ghost{display:none}                          /* the exit ghost can't turn with the sheet */
/* toasts turn with full mode: centred on the PC's top edge (the phone's right edge, or left when flipped) */
body.scr-full #toast.toast{top:50%;left:calc(100% - 10px);right:auto;transform-origin:0 0;transform:rotate(90deg) translate3d(-50%,0,0)!important}
body.scr-full.scr-flip #toast.toast{left:10px;transform:rotate(-90deg) translate3d(-50%,0,0)!important}

#v-screen{overflow:hidden;overflow-wrap:normal}
#v-screen svg{fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
.scr-sprite{position:absolute;width:0;height:0;overflow:hidden}
#v-screen button{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* ---------------------------------------------------------------- toolbar (40px) */
.stool{flex:none;height:40px;padding:0 6px 0 4px;display:flex;align-items:center;gap:6px;min-width:0}
.winstrip{flex:1;min-width:0;height:38px;display:flex;align-items:center;gap:5px;overflow:hidden}
.winstrip:empty{display:none}
.stitle{flex:1;min-width:0;display:none;flex-direction:column;justify-content:center;padding-left:8px;line-height:1.15}
.winstrip:empty + .stitle{display:flex}
.stitle b{font:700 17px/1.2 var(--font-display,-apple-system,system-ui,sans-serif);letter-spacing:-.015em;color:var(--text-1);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stitle small{font-size:12px;font-weight:500;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  font-variant-numeric:tabular-nums;margin-top:2px}
.livechip{flex:none;height:32px;min-height:0;padding:0 11px 0 10px;border-radius:999px;display:flex;align-items:center;gap:6px;position:relative;
  background:var(--glass-1);border:1px solid var(--stroke);box-shadow:var(--hi);color:var(--text-1);
  font:700 14px/1 var(--font,-apple-system,system-ui,sans-serif);font-variant-numeric:tabular-nums}
.livechip::after{content:"";position:absolute;left:0;right:0;top:-4px;bottom:-4px}   /* 40px target */
.livechip small{font-size:12px;font-weight:500;color:var(--text-3)}
.livechip b:empty{display:none}
.led{width:8px;height:8px;border-radius:50%;flex:none;background:var(--text-3);display:inline-block}
.led.ok{background:var(--good);box-shadow:0 0 8px rgba(52,211,153,.7)}
.led.warn{background:var(--warn);box-shadow:0 0 8px rgba(251,191,36,.6)}
.led.off{background:var(--bad);animation:ledpulse 1.2s ease-in-out infinite}
@keyframes ledpulse{50%{opacity:.35}}
.fullpill{flex:none;height:32px;min-height:0;padding:0 13px 0 11px;border-radius:999px;display:flex;align-items:center;gap:6px;position:relative;
  background:var(--grad-fill);color:#fff;border:1px solid rgba(255,255,255,.18);box-shadow:var(--glow),inset 0 1px 0 rgba(255,255,255,.22);
  font:600 14px/1 var(--font,-apple-system,system-ui,sans-serif)}
.fullpill::after{content:"";position:absolute;left:0;right:0;top:-4px;bottom:-4px}
.fullpill svg{width:17px;height:17px;stroke-width:2.1}
#v-screen :is(.livechip,.fullpill,.rb,.rk,.kc2):active{transform:scale(.96)}

/* ---------------------------------------------------------------- Screen 1 (the PC view) */
/* width / height inline from main.js sizePortrait (16:9, the same as Screen 2); 2px from the phone's edges */
.stage{flex:none;position:relative;margin:2px auto 0;width:calc(100% - 4px);height:212px;min-height:0}
.stframe{position:absolute;inset:0}
#screenWrap{position:absolute;inset:0;overflow:hidden;background:var(--bg-video);touch-action:none;border-radius:8px;
  -webkit-user-select:none;user-select:none;contain:layout paint}
#screenWrap::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:6;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08)}
#screenWrap.grabbing::after{box-shadow:inset 0 0 0 2px var(--accent-ring)}
#screen{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;-webkit-user-drag:none;image-rendering:auto}
#v-screen .placeholder{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  color:var(--text-3);font-size:14px;text-align:center;padding:20px}
/* corner buttons over the PC: opaque ink (no blur over the live canvas) */
.stexp,.stfit{position:absolute;bottom:0;width:48px;height:48px;min-height:0;padding:0;border:0;background:none;box-shadow:none;display:grid;place-items:center;z-index:7}
.stexp{right:0}
.stfit{right:40px}
.stexp span,.stfit span{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:var(--ink);
  border:1px solid rgba(255,255,255,.14);color:#fff;font:700 12px/1 var(--font,-apple-system,system-ui,sans-serif);transition:transform var(--d-1) var(--ease-out)}
.stexp:active,.stfit:active{transform:none;background:none}
.stexp:active span,.stfit:active span{transform:scale(.9)}
.stexp svg{width:17px;height:17px;stroke-width:2.1}
/* what the Lens pad shows, outlined on the overview. No giant dimming shadow: as a moving layer it would need a
   huge GPU backing store on iPhone (DPR 3) and repaint on every cursor move. */
.lensbox{position:absolute;left:0;top:0;width:10px;height:10px;border:1.5px solid rgba(103,232,249,.95);border-radius:4px;
  pointer-events:none;z-index:2;will-change:transform;box-shadow:0 0 0 1px rgba(0,0,0,.5),inset 0 0 0 1px rgba(0,0,0,.35)}
#v-screen .fps{position:absolute;left:8px;top:8px;height:auto;font:600 11px/1.3 var(--font,-apple-system,system-ui,sans-serif);color:#fff;
  background:var(--ink);border:1px solid rgba(255,255,255,.1);padding:4px 8px;border-radius:999px;font-variant-numeric:tabular-nums;
  z-index:7;pointer-events:none;max-width:calc(100% - 16px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#v-screen .fps.off{background:rgba(160,30,50,.9)}

/* PC cursor: true scale (size + hotspot from main.js placeGlyph), white fill + dark outline, never hidden */
.pcur{position:absolute;left:0;top:0;width:11px;height:16px;pointer-events:none;z-index:4;will-change:transform;display:none}
.pcur.on{display:block}
.pcur svg{display:block;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 .5px 1px rgba(0,0,0,.55))}
/* transient locator ring: transform/opacity only; dark outer + inner strokes so it reads on white */
.locring{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;z-index:5;will-change:transform}
.locring i{position:absolute;left:-20px;top:-20px;width:40px;height:40px;border-radius:50%;opacity:0;
  border:2px solid var(--cyan);box-shadow:0 0 0 1.5px rgba(0,0,0,.65),inset 0 0 0 1.5px rgba(0,0,0,.5)}
.locring i{display:none}
.locring:is(.ping,.ping2) i{display:block}
.locring.ping i{animation:locping .85s var(--ease-out) both}
.locring.ping2 i{animation:locping .85s var(--ease-out) 2 both}
@keyframes locping{0%{transform:scale(2.4);opacity:0}25%{opacity:1}100%{transform:scale(.45);opacity:0}}

#v-screen .ripple{position:absolute;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;pointer-events:none;z-index:5;
  border:2px solid rgba(255,255,255,.9);background:rgba(139,123,255,.30);animation:rip .42s var(--ease-out) forwards}
#v-screen .ripple.right{border-color:var(--warn);background:rgba(251,191,36,.28)}
#v-screen .ripple.snap{border-color:var(--good);background:rgba(52,211,153,.32);width:30px;height:30px;margin:-15px 0 0 -15px}
@keyframes rip{from{transform:scale(.35);opacity:1}to{transform:scale(1.25);opacity:0}}

/* precision loupe (hold on the PC view); lives in #stFrame so it turns with full mode */
.sloupe{position:absolute;left:0;top:0;width:132px;height:132px;border-radius:50%;overflow:hidden;z-index:30;pointer-events:none;
  border:3px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.5),0 10px 28px rgba(0,0,0,.6);background:#000;will-change:transform}
.sloupe canvas{width:100%;height:100%;display:block}
.sloupe::before,.sloupe::after{content:"";position:absolute;left:50%;top:50%;background:var(--cyan);box-shadow:0 0 0 1px rgba(0,0,0,.6)}
.sloupe::before{width:22px;height:2px;margin:-1px 0 0 -11px}
.sloupe::after{width:2px;height:22px;margin:-11px 0 0 -1px}
.sloupe.grab{border-color:var(--accent-ring)}
#loupe{display:none!important}   /* legacy fixed loupe outside the view: replaced by .sloupe */

/* ---------------------------------------------------------------- Screen 2: its header line (#deckTabs) + #lens
   #lens is a pager (winpages.js): page 0 = the Zoom Lens (#lensPage: live magnifier + trackpad), pages 1.. = the PC's
   windows (.wp-tab). Width / height inline from main.js sizePortrait (the same as Screen 1). */
.deck{flex:none;display:flex;flex-direction:column;gap:2px;margin:3px auto 0;width:calc(100% - 4px);min-width:0}
.lens{flex:none;height:212px;min-height:0;position:relative;border-radius:8px;overflow:hidden;background:var(--bg-video);touch-action:none;contain:layout paint}
.lens::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:8;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.1),inset 0 0 22px rgba(0,0,0,.45)}
/* the two screens read as monitors of one extended desktop: the same black panel, a fine light edge, a soft drop */
#screenWrap,#lens{box-shadow:0 0 0 1px var(--bezel-edge),0 14px 26px -18px rgba(0,0,0,.95);
  transition:box-shadow var(--d-3) var(--ease-out)}
/* the extended display (main.js xdCue, while Screen 2 is a window page): the screen that has the cursor, a slightly
   brighter edge. A cue only: box-shadow, nothing moves. (Before .wp-drop below: a held drag's accent edge wins.) */
#v-screen #screenWrap.xcur,#v-screen #lens.xcur{box-shadow:0 0 0 1px rgba(255,255,255,.34),0 14px 26px -18px rgba(0,0,0,.95)}
/* a held drag over a screen: its edge lights up too (the accent outline inside is winpages.css .wp-drop) */
#v-screen :is(#screenWrap.wp-drop,#lens.wp-drop,#lens.wp-grab){box-shadow:0 0 0 1px var(--accent-ring),0 0 20px -4px var(--accent-ring),0 14px 26px -18px rgba(0,0,0,.95)}
/* the screens' numbers, like Windows' "Identify": bottom-left, under the cursor glyph */
.xnum{position:absolute;left:6px;bottom:6px;z-index:3;min-width:18px;height:18px;padding:0 5px;border-radius:6px;display:grid;place-items:center;
  background:var(--ink);border:1px solid rgba(255,255,255,.2);color:#fff;font:700 10.5px/1 var(--font,-apple-system,system-ui,sans-serif);
  font-variant-numeric:tabular-nums;pointer-events:none;opacity:.9}
#v-screen:is(.land,.full) .xnum,#app.typing #v-screen .xnum{display:none}
.lens.dragging::after{box-shadow:inset 0 0 0 2px var(--accent-ring),inset 0 0 30px rgba(0,0,0,.5)}
/* the Lens is page 0 of the deck's pager: winpages.js slides it sideways against the window tabs (.wp-tab) */
.lpage{position:absolute;inset:0;z-index:1;background:var(--bg-video)}
/* own css px size (main.js lens.resize), centred: while the screens glide between layouts it neither stretches nor jumps */
#lensCv{position:absolute;inset:0;margin:auto;width:100%;height:100%;display:block}
.lens .pcur{z-index:4}
.lens .ink,#v-screen .ink{position:absolute;z-index:7;height:30px;display:flex;align-items:center;gap:6px;padding:0 11px;border-radius:999px;pointer-events:none;
  background:var(--ink);border:1px solid rgba(255,255,255,.13);font:600 12px/1 var(--font,-apple-system,system-ui,sans-serif);color:var(--text-1);white-space:nowrap;
  transition:opacity var(--d-3) var(--ease-out)}
#v-screen .ink b{font-weight:700}
#v-screen .ink em{font-style:normal;color:var(--text-2);font-weight:500}
#v-screen .ink svg{width:15px;height:15px;stroke-width:2}
.lzoom{left:8px;top:8px}
.lzoom.quiet{opacity:0}
.lhint{left:32px;bottom:6px;max-width:calc(100% - 78px);overflow:hidden;text-overflow:ellipsis}   /* right of the "2" */
#v-screen .lhint.gone,#v-screen .lens.classicmode .lhint{display:none}   /* beats #v-screen .ink{display:flex} */
.classic{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  color:var(--text-3);font-size:13px;text-align:center;line-height:1.6;pointer-events:none;padding-right:36px;
  background:radial-gradient(rgba(255,255,255,.06) 1px,transparent 1.5px) 0 0/18px 18px,var(--bg-2,#0C0C22)}
.classic svg{width:26px;height:26px;color:var(--text-3)}
.classic b{color:var(--text-2);font-size:15px;font-weight:600}
.lens.classicmode .classic{display:flex}
.lens.classicmode #lensCv,.lens.classicmode .lzoom,.lens.classicmode #curLens,.lens.classicmode #ringLens{display:none}
.lens.classicmode::after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.1)}
.lens.classicmode.dragging::after{box-shadow:inset 0 0 0 2px var(--accent-ring)}
.strip{position:absolute;top:0;right:0;bottom:0;width:36px;z-index:7;display:flex;flex-direction:column;align-items:center;
  justify-content:space-between;padding:12px 0;color:var(--text-2);
  background:linear-gradient(90deg,rgba(8,8,20,0),rgba(8,8,20,.7) 45%);border-left:1px solid rgba(255,255,255,.07)}
.strip svg{width:16px;height:16px;stroke-width:2.2}
.strip i{flex:1;width:4px;margin:8px 0;border-radius:2px;background:repeating-linear-gradient(180deg,rgba(255,255,255,.28) 0 2px,transparent 2px 10px)}
.strip.on{background:linear-gradient(90deg,rgba(8,8,20,0),rgba(50,36,110,.82) 45%);color:#fff}

/* ---------------------------------------------------------------- touchpad (#tpad, main.js touchpad)
   Under Screen 2, the rest of the height (main.js keeps it >= 144px / 112px on short phones). A matte surface with a
   fine grain, like a laptop's glass pad; the hint stays faint while idle; the contact glow follows the finger. */
.tpad{flex:1 1 auto;min-height:0;margin:6px 4px 0;position:relative;overflow:hidden;border-radius:16px;touch-action:none;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;contain:layout paint;
  background:radial-gradient(rgba(255,255,255,.045) .8px,transparent 1.2px) 0 0/12px 12px,
    linear-gradient(180deg,rgba(150,140,255,.075),rgba(150,140,255,.03) 60%,rgba(150,140,255,.05)),var(--bg-2,#0C0C22);
  border:1px solid rgba(255,255,255,.09);box-shadow:inset 0 1px 0 rgba(255,255,255,.07),inset 0 -1px 0 rgba(0,0,0,.35),0 12px 24px -18px rgba(0,0,0,.9);
  transition:border-color var(--d-2),box-shadow var(--d-2)}
.tpad.dragging{border-color:var(--accent-ring);box-shadow:inset 0 0 0 1px var(--accent-ring),inset 0 0 26px rgba(139,123,255,.18),0 12px 24px -18px rgba(0,0,0,.9)}
/* hold, then slide: the hold arms the drag ("Slide to drag"), the button goes down with the slide ("Left button held");
   Drag lock (.dragging without .armed) holds it from the start */
.tpad.dragging::before{content:"Left button held";position:absolute;left:50%;top:8px;transform:translateX(-50%);z-index:3;height:22px;padding:0 10px;
  border-radius:999px;display:flex;align-items:center;background:var(--on-bg);border:1px solid var(--on-stroke);color:#fff;
  font:600 11px/1 var(--font,-apple-system,system-ui,sans-serif);white-space:nowrap;pointer-events:none}
#v-screen .tpad.dragging.armed:not(.held)::before{content:"Slide to drag"}
.tp-hint{position:absolute;inset:0 34px 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px 10px;
  color:var(--text-3);font:500 11.5px/1.3 var(--font,-apple-system,system-ui,sans-serif);text-align:center;pointer-events:none;
  opacity:.55;transition:opacity var(--d-3) var(--ease-out)}
.tp-hint b{display:flex;align-items:center;gap:6px;margin-bottom:2px;color:var(--text-2);font-size:12.5px;font-weight:600;letter-spacing:.01em}
.tp-hint svg{width:16px;height:16px;stroke-width:1.9}
.tp-hint span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tpad.touching .tp-hint,.tpad.dragging .tp-hint{opacity:.12}
.tp-touch{position:absolute;left:-34px;top:-34px;width:68px;height:68px;border-radius:50%;pointer-events:none;z-index:1;opacity:0;visibility:hidden;will-change:transform;
  background:radial-gradient(circle,rgba(160,148,255,.30),rgba(160,148,255,.10) 45%,rgba(160,148,255,0) 70%);
  transition:opacity var(--d-2) var(--ease-out),visibility 0s linear var(--d-2)}
.tpad.touching .tp-touch{opacity:1;visibility:visible;transition:opacity var(--d-1) var(--ease-out),visibility 0s}
.tp-strip{position:absolute;top:7px;right:6px;bottom:7px;width:26px;z-index:2;border-radius:13px;display:flex;flex-direction:column;align-items:center;
  justify-content:space-between;padding:8px 0;color:var(--text-3);background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.06);
  transition:background-color var(--d-2),color var(--d-2)}
.tp-strip svg{width:14px;height:14px;stroke-width:2.2}
.tp-strip i{flex:1;width:3px;margin:6px 0;border-radius:2px;background:repeating-linear-gradient(180deg,rgba(255,255,255,.22) 0 2px,transparent 2px 8px)}
.tp-strip.on{background:rgba(110,90,255,.28);color:#fff;border-color:var(--on-stroke)}
#v-screen .tpad .ripple{z-index:2}

/* ---------------------------------------------------------------- the slim key row (44px; a pager, volume and ⌨ fixed at the right)
   page 0 = [Left] [Right] [←] [→] [Enter]; swipe it for all four arrows, the modifiers, the app's keys, Drag lock + navigation
   (dots below). Row B (#keysB: arrows, ⌫, Enter) only shows while typing. */
.keydeck{flex:none;display:flex;flex-direction:column;gap:6px;margin:6px 4px var(--scr-nav-clear);min-width:0;position:relative}
.krow{display:flex;gap:5px;min-width:0;height:44px}
.kpager{flex:1;min-width:0;position:relative;overflow:hidden;touch-action:none;contain:layout paint}
.kpage{position:absolute;inset:0;display:flex;gap:5px;will-change:transform}
#v-screen .kpage .k{flex:1 1 0!important;min-width:0!important;padding:0 3px;font-size:12.5px}
.krow.ka{position:relative}
.kdots{position:absolute;left:0;right:135px;bottom:-5px;height:4px;display:flex;justify-content:center;gap:4px;pointer-events:none}
.kdots i{width:4px;height:4px;border-radius:50%;background:rgba(255,255,255,.22);transition:background-color var(--d-2),transform var(--d-2)}
.kdots i.on{background:var(--accent-text);transform:scale(1.25)}
.kdots.mods i:nth-child(2):not(.on){background:var(--cyan);box-shadow:0 0 5px var(--cyan)}   /* a modifier is latched */
/* keycap look comes from base.css .k (.on = latched, .lock = locked, .down = pressed) */
#v-screen .krow .k{flex:none;min-width:44px;height:44px}
#v-screen .krow .k svg{width:19px;height:19px}
#v-screen .krow.ka>.k{width:40px;min-width:40px}   /* volume, ⌨: always here, the pages keep the room */
#v-screen .kpage .k.enter{flex:1.6 1 0!important;gap:5px;color:var(--text-1)}
#v-screen .kpage .k.enter svg{width:16px;height:16px}
/* Left / Right / Drag: icon over a small label */
#v-screen .k.mk{flex-direction:column;gap:3px;color:var(--text-1)}
#v-screen .k.mk svg{width:18px;height:18px}
#v-screen .k.mk span{font:600 10px/1 var(--font,-apple-system,system-ui,sans-serif);color:var(--text-2);letter-spacing:.01em}
#v-screen .k.mk.held{color:#fff;background:var(--on-bg);border-color:var(--on-stroke);transform:translateY(2px);box-shadow:var(--key-shadow-down)}
#v-screen .k.mk.held span,#v-screen .k.mk.on span{color:#fff}
#v-screen .k.mk.drag.on::after{display:none}
.kb2 .k{flex:1 1 0!important;min-width:0!important;padding:0}
.kb2 .k.enter{flex:1.9 1 0!important;gap:6px;color:var(--text-1)}
.kb2 .k.enter svg{width:18px;height:18px}
#keysB{display:none}
#app.typing #keysB{display:flex}
.krow .kbk{min-width:44px!important;width:44px;padding:0!important;color:var(--accent-text)}
.krow .kbk.on{color:#fff;background:var(--on-bg);border-color:var(--on-stroke)}
.krow .kbk.on::after{display:none}

/* ---------------------------------------------------------------- typing (iOS keyboard up): Screen 1 + the modifiers
   page of the slim row with row B under it (Screen 2 and the touchpad step aside) */
#app.typing #v-screen:not(.land):not(.full) :is(.stool,.deck,.tpad){display:none}
#app.typing #v-screen:not(.land):not(.full) .stage{flex:1;height:auto!important;width:auto!important;margin:6px 6px 0}
#app.typing #v-screen .keydeck{margin-bottom:6px}
#app.typing #v-screen .stexp{display:none}
#app.typing #keysA [data-k="backspace"]{display:none}   /* row B has it right below: one Backspace while typing */

/* ---------------------------------------------------------------- landscape + full: shared frame */
#v-screen.land,#v-screen.full{background:var(--bg-video)}
#v-screen:is(.land,.full) :is(.stool,.deck,.tpad,.keydeck,.coach){display:none}
#app.typing #v-screen.land .keydeck{display:flex;flex-direction:row;gap:6px;margin:6px max(8px,var(--safe-r,0px)) 6px max(8px,var(--safe-l,0px))}
#app.typing #v-screen.land .krow{flex:1 1 0}
#app.typing #v-screen.land :is(.band,.pillar){display:none}
#v-screen:is(.land,.full) .stage{flex:1;margin:0;width:auto!important;height:auto!important}
#v-screen.land .stframe{position:absolute;inset:0;background:var(--bg-video)}
#v-screen.full .stframe{position:fixed;left:50%;top:50%;right:auto;bottom:auto;z-index:40;background:var(--bg-video);
  transform:translate(-50%,-50%) rotate(90deg)}
#v-screen.full.flip .stframe{transform:translate(-50%,-50%) rotate(-90deg)}
#v-screen:is(.land,.full) #screenWrap{right:auto;bottom:auto;border-radius:6px}
#v-screen:is(.land,.full) :is(.stexp,.lensbox){display:none!important}
#v-screen:is(.land,.full) .stfit{right:0}

/* band: the rail (2 columns x 7 rows of 44px), next to the image, clear of the home indicator */
.band,.pillar{display:none}
#v-screen:is(.land,.full) .band{display:block;position:absolute;top:0;bottom:0;touch-action:none;
  background:radial-gradient(120% 60% at 50% 50%,rgba(110,90,255,.12),transparent 70%),var(--bg-video)}
#v-screen.land .pillar{display:block;position:absolute;top:0;bottom:0}
.rail{position:absolute;left:var(--pad-a,6px);right:var(--pad-b,6px);top:0;bottom:var(--pad-bot,0px);margin:auto 0;height:344px;
  display:grid;grid-template-columns:repeat(2,44px);grid-template-rows:repeat(3,44px) auto;gap:6px;justify-content:center;align-content:center;
  transition:opacity var(--d-3) var(--ease-out)}
.rail.idle .rb{opacity:.3}
.rail.idle .dpad{opacity:.62}                       /* L2: arrows + Enter stay readable while the tools rest */
.rail .dpad{transition:opacity var(--d-3) var(--ease-out)}
.rail .rb{transition:opacity var(--d-3) var(--ease-out),transform var(--d-1) var(--ease-out),background-color var(--d-2)}
.rail.hold{opacity:0;pointer-events:none}
.rb{width:44px;height:44px;min-height:0;padding:0;border-radius:50%;display:grid;place-items:center;
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.11);box-shadow:var(--hi);color:var(--text-1);
  transition:transform var(--d-1) var(--ease-out),background-color var(--d-2)}
.rb svg{width:21px;height:21px}
.rb.txt{font:700 13px/1 var(--font,-apple-system,system-ui,sans-serif);letter-spacing:-.01em}
#v-screen .rb.on{background:var(--on-bg);border-color:var(--on-stroke);color:#fff}
/* d-pad + Enter in the lower half of the rail */
.dpad{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,44px);grid-template-rows:repeat(4,44px);gap:6px;margin-top:0}
.rk{width:44px;height:44px;min-height:0;padding:0;border-radius:12px;display:grid;place-items:center;position:relative;
  background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);box-shadow:var(--key-shadow);color:var(--text-1);
  font:600 13px/1 var(--font,-apple-system,system-ui,sans-serif);transition:transform var(--d-1) var(--ease-out),box-shadow var(--d-1)}
.rk svg{width:20px;height:20px}
.rk:active,.rk.down{transform:translateY(2px)!important;box-shadow:var(--key-shadow-down)}
.rk.d-volumedown{grid-column:1;grid-row:1}
.rk.d-volumeup{grid-column:2;grid-row:1}
.rk.d-left{grid-column:1;grid-row:2}
.rk.d-right{grid-column:2;grid-row:2}
.rk.d-up{grid-column:1;grid-row:3}
.rk.d-down{grid-column:2;grid-row:3}
.rk.d-enter{grid-column:1/-1;grid-row:4;width:94px;display:flex;align-items:center;justify-content:center;gap:5px}
.rk.d-enter svg{width:17px;height:17px}
.rk.d-enter span{font-size:13px}
/* landscape: only More + the keyboard, volume, left / right on the rail, then a slim touchpad to the bottom */
.lpad{display:none}
#v-screen.land #rail{top:6px;bottom:auto;margin:0;height:auto;grid-template-rows:44px auto;align-content:start}   /* (ids: over the .stat rules below) */
#v-screen.land .rail :is([data-act="exit"],[data-act="keys"],[data-act="mode"],[data-act="zoom"]){display:none}
#v-screen.land .dpad{grid-template-rows:44px 44px}
#v-screen.land .dpad :is(.d-up,.d-down,.d-enter){display:none}
#v-screen.land #tpadL{display:block;position:absolute;left:max(6px,calc(50% - 47px));right:max(6px,calc(50% - 47px));top:156px;bottom:calc(var(--pad-bot,0px) + 6px);margin:0;flex:none;border-radius:14px}
#v-screen.land .band.stat #tpadL{bottom:calc(var(--pad-bot,0px) + 30px)}
.vstat{display:none;position:absolute;left:0;right:0;bottom:calc(var(--pad-bot,0px) + 10px);flex-direction:column;align-items:center;gap:3px;
  font:700 13px/1 var(--font,-apple-system,system-ui,sans-serif);font-variant-numeric:tabular-nums;color:var(--text-1);pointer-events:none}
.vstat small{font-size:10.5px;font-weight:600;color:var(--text-3)}
#v-screen.land .band.stat .vstat{display:flex;flex-direction:row;justify-content:center;gap:5px;bottom:calc(var(--pad-bot,0px) + 8px)}
#v-screen.land .band.stat .rail{bottom:calc(var(--pad-bot,0px) + 26px)}
.fhint{position:absolute;top:50%;left:6px;right:6px;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center;
  gap:6px;text-align:center;color:var(--text-2);font-size:12px;line-height:1.3;pointer-events:none;animation:fhint var(--d-3) var(--ease-out)}
.fhint b{color:var(--text-1);font-size:13px}
.fhint svg{width:22px;height:22px;color:var(--accent-text)}
@keyframes fhint{from{opacity:0;transform:translateY(-50%) scale(.94)}}
.landwin{position:absolute;left:50%;top:10px;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;align-items:center}
#v-screen.land .pillar .vstat{display:flex}
#v-screen:is(.land,.full) .fps{white-space:normal;border-radius:10px;font-size:10px;line-height:1.35;max-width:220px}

/* sheets opened from full mode turn with the PC so they read the right way up */
.sheet.scr-rot{left:50%!important;top:50%!important;right:auto!important;bottom:auto!important;width:100vh;height:100vw!important;
  transform:translate(-50%,-50%) rotate(90deg)}
.sheet.scr-rot.flip{transform:translate(-50%,-50%) rotate(-90deg)}
.sheet.scr-rot>div{max-height:calc(100% - 12px);max-width:560px}

/* keys sheet */
.scr-keys{display:flex;flex-direction:column;gap:10px;min-width:0}
.scr-keys h4{margin:6px 0 0;font:600 13px/1.2 var(--font,-apple-system,system-ui,sans-serif);color:var(--text-2)}
.scr-keys .g{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.scr-keys .g.c3{grid-template-columns:repeat(3,minmax(0,1fr))}
.scr-keys .g.c6{grid-template-columns:repeat(6,minmax(0,1fr))}
.kc2{height:46px;min-height:0;padding:0 4px;border-radius:12px;display:flex;align-items:center;justify-content:center;gap:6px;position:relative;
  background:var(--glass-1);border:1px solid var(--stroke);box-shadow:var(--key-shadow);color:var(--text-1);
  font:600 13px/1.1 var(--font,-apple-system,system-ui,sans-serif);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.kc2 svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
.kc2:active,.kc2.down{transform:translateY(2px)!important;box-shadow:var(--key-shadow-down)}
.kc2.on{color:#fff;background:var(--on-bg);border-color:var(--on-stroke)}
.kc2.lock{color:#fff;background:var(--on-bg);border-color:var(--accent-ring)}
.kc2.on::after,.kc2.lock::after{content:"";position:absolute;top:6px;right:6px;width:5px;height:5px;border-radius:50%;background:var(--cyan);box-shadow:0 0 6px var(--cyan)}
.sheet.scr-rot .scr-keys .g{grid-template-columns:repeat(6,minmax(0,1fr))}
.sheet.scr-rot .scr-keys .g.c6{grid-template-columns:repeat(12,minmax(0,1fr))}
.scr-find{margin:4px 0 14px}
.scr-find svg{width:20px;height:20px}

/* first-run coach (markup owned by the shell; base.css styles the card) */
#v-screen .coach{position:fixed;inset:0;z-index:45;background:rgba(5,5,16,.9);display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:12px;padding:24px;text-align:left}
#v-screen .coach>div{display:grid;grid-template-columns:auto 1fr;gap:10px 16px;font-size:15px;max-width:340px}
#v-screen .coach b{color:var(--accent-text);font-weight:600;white-space:nowrap}
#v-screen .coach.hidden{display:none}

#kb{position:fixed;left:-1000px;top:0;width:10px;height:10px;opacity:0;font-size:16px}

/* short phones (SE, 667pt): slimmer rows and gaps, so the screens give up as little as they must for the touchpad */
@media (max-height:700px) and (orientation:portrait){
  .stool{height:38px}
  .stage{margin-top:1px}
  .deck{margin-top:2px;gap:1px}
  .tpad{margin-top:5px}
  .keydeck{gap:5px;margin-top:5px}
  .krow,#v-screen .krow .k{height:40px}
  #v-screen{--scr-nav-h:48px}
  body[data-view="screen"]:not(.scr-land):not(.scr-full) nav{height:48px}
  .tp-hint{gap:2px;font-size:11px}
}

@media (prefers-reduced-motion:reduce){
  .locring.ping i,.locring.ping2 i{animation-duration:.01s}
  #v-screen .ripple,.fhint{animation:none}
  .rail,.rail .rb,.rail .dpad,#v-screen .ink{transition:none}
  #screenWrap,#lens,.tpad,.tp-hint,.tp-touch{transition:none}
}
