/* GPD Link web client. Colours: neutral dark glass + one accent; the PC's Noctalia palette replaces these after
   connecting (app.js sets --accent, --on-accent, --bg, --fg, --surface from the hello message). */
:root {
  --accent: #8fe3c0; --on-accent: #06281c; --bg: #0b0d0c; --fg: #e9eeea; --surface: #1a1f1c; --error: #ffb4ab;
  --glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --line: color-mix(in srgb, var(--fg) 12%, transparent);
  --dim: color-mix(in srgb, var(--fg) 62%, transparent);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
/* browsers without color-mix() (before 2023): plain translucent values, so nothing turns invisible */
@supports not (color: color-mix(in srgb, red, blue)) {
  :root { --glass: rgba(26, 31, 28, .86); --line: rgba(233, 238, 234, .14); --dim: rgba(233, 238, 234, .62); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--fg);
  font: 500 15px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- stage */
#stage { position: fixed; inset: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg) 0%, var(--bg) 60%);
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 7%, var(--bg)) 0%, var(--bg) 60%); }
#views { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.view { position: absolute; border-radius: 10px; overflow: hidden; background: #000;
  box-shadow: 0 18px 60px rgba(0,0,0,.55), 0 0 0 1px var(--line); transition: opacity .25s ease; }
.view canvas, .view video { display: block; width: 100%; height: 100%; }
.view video { object-fit: fill; pointer-events: none; background: #000; }
.view video::-webkit-media-controls { display: none !important; }
.view.wait { opacity: .35; }
.view .tag { position: absolute; left: 10px; bottom: 10px; padding: 5px 10px; border-radius: 999px; font-size: 12px;
  background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); }
body.single .view { border-radius: 0; box-shadow: none; }
body.single .view .tag { display: none; }
body.control.mouse #stage { cursor: crosshair; }
body.locked #stage { cursor: none; }
#cursor { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 2px solid var(--accent); box-shadow: 0 0 14px rgba(143, 227, 192, 0.7), inset 0 0 6px rgba(143, 227, 192, 0.5); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 0 6px color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: 0; transition: opacity .35s ease; pointer-events: none; will-change: transform; }
#cursor.on { opacity: .95; transition: none; }
/* trackpad: a steady arrow, tip on the point (2026-11-20) */
#cursor.arrow { width: 13px; height: 20px; margin: -2px 0 0 -2px; border: 0; border-radius: 0; box-shadow: none;
  /* the GPD's own cursor (macOS theme, 64 px Xcursor cropped, hotspot 6,6 -> 2,2 at this size) */
  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA6CAYAAADcKStOAAAIo0lEQVR42s3aXWwT2RUH8P94xjOOncQ2sddhgzFrQhYEu7RNq5YmUqSWSizSqqVSgrpQQV8AVaIqVaUU8YDEG29AQQKeECISWCAhqoD4CKWlpIUSEGRJoU34CASRLwcc7BnP3LmnD3snmoRAnBCSvdKV4kSJf3PuPWfuHAcYM4jIg2/ZkMT8VuEkAJ5NmzZ5e3t7vwMAdXV1igOdzSFXVlZqRCRZltWazWZ/DwBbt27VZhPnAeCNRqPFADyGYVwlIhoaGvoNAOzdu3fWcDIALRgMhgAUZbPZvxMR55zTixcvvgKADRs2+GYDJwMoKikpKQMQGh4ebqVvhsUYs1+8ePGr2VpWGYC/uLg4CiCayWT+SUTEGLMsy+KziVMABPx+fzmAuUNDQ9dFxBgR2ZZl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uG6iACAaElJySIAi7q7uy+4PrSw3KB0On3v4sWL2+Px+FIAIZFEzh1gQpgkEO7bhPSOi9AAhEKhUALAggMHDmwhIu4UZHFPbTt9+vQfACwXpSZRVlb2cTgcDorflzHNQxJLHAAQ0zSt0uv1Ls1kMl1ERP39/Vebmpp+C2AZgASASnEBUQClYstMGK2ptsBlgfP5fL4SwzBw4sSJVQDktWvXXgTAAHhDoZD18uVLA0AegCW+bwPgYk47zFl2VUTAL96UgsGg3+PxsKGhIQOAKb4/FkSFLMv7fJzo4LyBQMDr9/s9/f39lgvDXJiCQNMBGy9hMAYyadB0wNz/EuEulGOfO6f8h6cjSzEG9t7j/67eRDDvwcuIAAAAAElFTkSuQmCC") no-repeat 0 0 / 100% 100%; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); transition: none; }
#cursor.arrow.on { opacity: 1; }

/* ---------- gate (connecting / approval / errors) and the server's plain pages */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); z-index: 5;
  transition: opacity .28s ease, visibility .28s; }
.gate.off { opacity: 0; visibility: hidden; pointer-events: none; }
/* one card, like a panel of this desktop: fixed size, so changing text never moves anything */
.card { width: min(340px, calc(100vw - 32px)); min-height: 196px; padding: 20px 20px 18px; border-radius: 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.45);
  display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; row-gap: 4px; align-content: start; }
.mark { grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gate h1 { margin: 2px 0 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.35; min-height: 2.7em; }
.bar { grid-column: 1 / -1; margin-top: 14px; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(233, 238, 234, .1); background: color-mix(in srgb, var(--fg) 10%, transparent); }
.bar i { display: block; width: 38%; height: 100%; border-radius: 2px; background: var(--accent); transform: translateX(-110%); animation: slide 1.5s cubic-bezier(.45,0,.3,1) infinite; will-change: transform; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(275%); } }
.gate.still .bar i { animation: none; transform: none; width: 100%; opacity: .28; }
@media (prefers-reduced-motion: reduce) { .bar i { animation-duration: 3s; } }
body.plain { display: block; }
@keyframes pulse { 0%, 100% { transform: scale(.82); opacity: .75; } 50% { transform: scale(1); opacity: 1; } }
.pill { grid-column: 1 / -1; justify-self: end; margin-top: 12px; min-height: 40px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 14px; }

/* ---------- dock */
#dock { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px;
  border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: 0 14px 44px rgba(0,0,0,.5); z-index: 4;
  transition: transform .32s cubic-bezier(.2,.9,.25,1), opacity .25s ease; max-width: calc(100vw - 16px); }
#dock.away { transform: translate(-50%, calc(100% + 30px)); opacity: 0; pointer-events: none; }
#dock button { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; transition: background .15s ease, color .15s ease, transform .1s ease; }
#dock button:active { transform: scale(.92); }
#dock button:hover { background: rgba(233, 238, 234, 0.09); background: color-mix(in srgb, var(--fg) 9%, transparent); }
#dock button.on { background: var(--accent); color: var(--on-accent); }
#dock svg, #sheet svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#b-sound:not(.on) .wave { opacity: .3; }
/* picture in picture: the hidden <video> that carries a canvas picture (WebCodecs / JPEG rungs) into the PiP window */
#pip-video { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }
#pip-video:fullscreen { width: 100%; height: 100%; opacity: 1; object-fit: contain; background: #000; }
/* the mse rung's own <video> floats on Firefox Android by going fullscreen: keep its shape (it is 'fill' in the page) */
.view video:fullscreen { object-fit: contain !important; width: 100vw; height: 100vh; }
@media (hover: hover) and (pointer: fine) { #dock { bottom: auto; top: 12px; } #dock.away { transform: translate(-50%, calc(-100% - 30px)); } }
#handle { position: fixed; left: 50%; bottom: calc(4px + var(--safe-b)); transform: translateX(-50%); width: 96px; height: 28px; z-index: 3; display: grid; place-items: center; }
#handle i { width: 44px; height: 5px; border-radius: 3px; background: rgba(233, 238, 234, 0.45); background: color-mix(in srgb, var(--fg) 45%, transparent); box-shadow: 0 1px 6px rgba(0,0,0,.6); }
@media (hover: hover) and (pointer: fine) { #handle { bottom: auto; top: 0; } }

/* ---------- small overlays */
#stats { position: fixed; left: calc(10px + env(safe-area-inset-left, 0px)); top: calc(10px + var(--safe-t)); z-index: 3; padding: 6px 11px; border-radius: 999px;
  font: 600 12px/1.2 ui-monospace, "JetBrains Mono", Menlo, monospace; font-variant-numeric: tabular-nums; color: var(--fg);
  background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border: 1px solid var(--line); pointer-events: none; }
#live { position: fixed; right: calc(10px + env(safe-area-inset-right, 0px)); top: calc(10px + var(--safe-t)); z-index: 3; display: flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px; border-radius: 999px; font-size: 12px; background: var(--glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 180, 171, 0.5);
  border: 1px solid color-mix(in srgb, var(--error) 50%, transparent); pointer-events: none; }
#live span { width: 8px; height: 8px; border-radius: 50%; background: var(--error); animation: pulse 1.6s ease-in-out infinite; }
#toast { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); z-index: 6; padding: 10px 16px; border-radius: 14px; max-width: 86vw;
  background: var(--glass); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); text-align: center; }

/* ---------- on-screen keys */
#keys { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); z-index: 4; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; padding: 6px;
  width: min(430px, calc(100vw - 16px)); border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5); border: 1px solid var(--line); }
#keys button { height: 48px; border-radius: 13px; background: rgba(233, 238, 234, 0.08); background: color-mix(in srgb, var(--fg) 8%, transparent); font-size: 14px; font-weight: 600; }
#keys button:active { background: rgba(233, 238, 234, 0.22); background: color-mix(in srgb, var(--fg) 22%, transparent); }
#keys button.on { background: var(--accent); color: var(--on-accent); }
#typer { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; resize: none; }

/* ---------- sheet */
#sheet { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); z-index: 5; width: min(420px, calc(100vw - 16px));
  max-height: min(70vh, 560px); display: flex; flex-direction: column; border-radius: 24px; background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: rise .22s cubic-bezier(.2,.9,.25,1); touch-action: pan-y; }
@media (hover: hover) and (pointer: fine) { #sheet { bottom: auto; top: 80px; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px) scale(.97); } }
#sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 20px; }
#sheet h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
#sheet-close { width: 44px; height: 44px; border-radius: 50%; color: var(--dim); }
#sheet-body { padding: 4px 10px 12px; overflow-y: auto; display: grid; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 12px; border-radius: 16px; text-align: left; width: 100%;
  background: rgba(233, 238, 234, 0.06);
  background: color-mix(in srgb, var(--fg) 6%, transparent); }
.row.on { background: var(--accent); color: var(--on-accent); }
.row b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row small { color: var(--dim); font-size: 12px; }
.row.on small { color: inherit; opacity: .75; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: rgba(233, 238, 234, 0.06); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.seg button { height: 48px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.chip { min-width: 48px; height: 40px; padding: 0 12px; border-radius: 12px; background: rgba(233, 238, 234, 0.1); background: color-mix(in srgb, var(--fg) 10%, transparent); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip.danger { color: var(--error); }
.person { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(233, 238, 234, 0.06); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.person div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person b { flex: 1; }

/* ---------- picker: every source as a live thumbnail (first screen when there is a choice; the screen button) */
#picker { position: fixed; inset: 0; z-index: 5; overflow-y: auto; touch-action: pan-y; background: var(--bg);
  padding: calc(12px + var(--safe-t)) 16px calc(24px + var(--safe-b)); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
#picker header { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1100px; margin: 0 auto 14px; }
#picker h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
#picker header small { color: var(--dim); font-size: 13px; }
#picker-close { width: 44px; height: 44px; border-radius: 50%; color: var(--dim); flex: none; }
#tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 42vw), 1fr)); gap: 14px; max-width: 1100px; margin: 0 auto; }
@media (min-width: 700px) { #tiles { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; } }
.tile { display: grid; gap: 8px; text-align: left; border-radius: 16px; padding: 6px; transition: background .15s ease, transform .1s ease; }
.tile:active { transform: scale(.97); }
.tile:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.tile .pic { position: relative; aspect-ratio: 16 / 9; border-radius: 11px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0,0,0,.4); }
.tile.on .pic { box-shadow: 0 0 0 3px var(--accent), 0 10px 30px rgba(0,0,0,.4); }
.tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .25s ease; }
.tile .pic.has img { opacity: 1; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }
.tile .pic.has .ph { display: none; }
.tile .ph svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tile .cap { display: grid; padding: 0 4px; min-width: 0; }
.tile .cap b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .cap small { color: var(--dim); font-size: 12px; }
.tile.on .cap b { color: var(--accent); }
#hdmi-out { max-width: 1100px; margin: 22px auto 0; padding: 14px 16px; border-radius: 18px; display: grid; gap: 12px;
  background: rgba(233, 238, 234, 0.06); background: color-mix(in srgb, var(--fg) 6%, transparent); }
#hdmi-out .hrow { display: flex; align-items: center; gap: 12px; }
#hdmi-out .htitle { flex: 1; display: grid; min-width: 0; }
#hdmi-out .htitle small, #hdmi-out .hnote { color: var(--dim); font-size: 12px; }
#hdmi-out .hsels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#hdmi-out .hsel { display: grid; gap: 4px; font-size: 12px; color: var(--dim); }
#hdmi-out select { font: inherit; font-size: 15px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; height: 44px; padding: 0 10px; }
.switch { flex: none; width: 52px; height: 32px; border-radius: 16px; position: relative; background: color-mix(in srgb, var(--fg) 18%, transparent); transition: background .15s ease; }
.switch i { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--fg); transition: transform .18s ease; }
.switch.on { background: var(--accent); }
.switch.on i { transform: translateX(20px); background: var(--on-accent); }
.switch:disabled, #hdmi-out select:disabled { opacity: .5; }

/* ---------- floating (Android picture in picture shows the whole fullscreen page in a small window, 2026-11-21):
   just the picture, no controls */
@media (max-height: 260px) and (max-width: 520px) {
  #dock, #handle, #stats, #toast, #keys, #sheet, #picker, #live { display: none !important; }
  body.single .view { border-radius: 0; }
}

/* ---------- switching (2026-11-21): the live picture recedes behind the picker like Mission Control, and a chosen
   card grows into a soft splash that dissolves into the live picture */
#stage { transition: transform .45s cubic-bezier(.2,.9,.25,1), filter .45s ease; transform-origin: 50% 45%; }
body.picking #stage { transform: scale(.92); filter: blur(14px) brightness(.5) saturate(1.2); }
#picker { background: rgba(11, 13, 12, .55); background: color-mix(in srgb, var(--bg) 55%, transparent); }
.splash { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: grid; place-items: center; overflow: hidden;
  transition: opacity .4s ease; }
.splash .shot { position: absolute; object-fit: contain; background: #000; filter: blur(16px) saturate(1.25) brightness(.72); transform: scale(1.02);
  transition: filter .4s ease, transform .4s ease; }
.splash .capsule { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 14px; border-radius: 999px; max-width: calc(100vw - 48px);
  background: rgba(26, 31, 28, .9); background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(26px) saturate(1.6); backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0,0,0,.5); animation: pop .5s cubic-bezier(.2,.9,.25,1) .08s backwards; }
.splash .capsule div { display: grid; min-width: 0; }
.splash .capsule b { font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splash .capsule small { color: var(--dim); font-size: 12px; }
.splash .ring { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(233, 238, 234, .16);
  border: 2.5px solid color-mix(in srgb, var(--fg) 16%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.splash.out { opacity: 0; }
.splash.out .shot { filter: none; transform: none; }
.splash.out .capsule { transform: scale(.96); transition: transform .3s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }
@media (prefers-reduced-motion: reduce) { #stage, .splash, .splash .shot { transition: none; } .splash .ring { animation-duration: 2s; } }

/* ---- desk: several sources as one desktop (2026-11-21) ---- */
.view .dclose, .view .dgrip { display: none; }
body.desk .view { border-radius: 12px; transition: left .38s cubic-bezier(.2,.9,.25,1), top .38s cubic-bezier(.2,.9,.25,1),
  width .38s cubic-bezier(.2,.9,.25,1), height .38s cubic-bezier(.2,.9,.25,1), opacity .25s ease; }
body.desk .view.moving { transition: none; box-shadow: 0 26px 80px rgba(0,0,0,.65), 0 0 0 2px var(--accent); }
body.desk .view .tag { top: 8px; bottom: auto; left: 8px; padding: 7px 12px 7px 12px; font-weight: 600; touch-action: none;
  cursor: grab; user-select: none; -webkit-user-select: none; z-index: 2; }
body.desk .view .dclose { display: grid; place-items: center; position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border-radius: 50%; font-size: 18px; line-height: 1; color: var(--fg); z-index: 2;
  background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); }
body.desk .view .dclose:active { transform: scale(.9); }
body.desk .view .dgrip { display: block; position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; touch-action: none; z-index: 2;
  cursor: nwse-resize; background: linear-gradient(135deg, transparent 55%, color-mix(in srgb, var(--fg) 55%, transparent) 56%, color-mix(in srgb, var(--fg) 55%, transparent) 60%,
  transparent 61%, transparent 70%, color-mix(in srgb, var(--fg) 55%, transparent) 71%, color-mix(in srgb, var(--fg) 55%, transparent) 75%, transparent 76%); opacity: .8; }
#desk-bar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5); border: 1px solid var(--line);
  box-shadow: 0 14px 44px rgba(0,0,0,.5); animation: rise .22s cubic-bezier(.2,.9,.25,1); }
#desk-bar button { height: 34px; padding: 0 14px; border-radius: 999px; font: 600 13px/1 Inter, ui-sans-serif, system-ui, sans-serif; color: var(--fg); }
#desk-bar #desk-add { width: 34px; padding: 0; font-size: 18px; }
#desk-bar button:active { transform: scale(.94); background: color-mix(in srgb, var(--fg) 10%, transparent); }
#picker .pk-actions { display: flex; align-items: center; gap: 4px; }
#picker-select { height: 36px; padding: 0 14px; border-radius: 999px; font: 600 14px/1 Inter, ui-sans-serif, system-ui, sans-serif; color: var(--accent); }
.tile .check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; z-index: 2;
  border: 2px solid rgba(255,255,255,.85); background: rgba(0,0,0,.25); transition: background .18s ease, transform .18s cubic-bezier(.2,.9,.25,1); }
.tile.on .check { background: var(--accent); border-color: var(--accent); transform: scale(1.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%2306281c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat; }
#picker-bar { position: sticky; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; justify-content: center; margin-top: 18px; }
#picker-open { height: 48px; padding: 0 26px; border-radius: 999px; font: 650 15px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 14px 44px rgba(0,0,0,.45); animation: lift .22s cubic-bezier(.2,.9,.25,1); }
@keyframes lift { from { opacity: 0; transform: translateY(10px) scale(.97); } }
#picker-open:disabled { background: color-mix(in srgb, var(--fg) 12%, transparent); color: var(--dim); box-shadow: none; }
#picker-open:active:not(:disabled) { transform: scale(.96); }

/* ---------- boot screen (boot.js): black, the desktop's pixel stars and shooting stars, the PC's wallpaper dimmed.
   The same layer is drawn by every hop of a QR load, so nothing pops in and out; the app removes it once. */
.boot { position: fixed; inset: 0; z-index: 50; background: #000; overflow: hidden; pointer-events: none;
  transition: opacity .45s cubic-bezier(.2,.9,.25,1); }
.boot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0;
  transition: opacity .6s ease; }
.boot.bg img { opacity: 1; }
.boot canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.boot .bcap { position: absolute; left: 50%; bottom: calc(48px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 48px); background: none; border: 0;
  color: rgba(240, 240, 240, .78); font: 500 13px/1.2 Inter, system-ui, sans-serif; letter-spacing: -.005em; white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .9); }
.boot .bcap span { overflow: hidden; text-overflow: ellipsis; }
.boot .ring { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .14);
  border-top-color: var(--accent, #52d98b); animation: spin .8s linear infinite; }
.boot.out { opacity: 0; }
body.booting #gate, body.booting #dock, body.booting #handle, body.booting #stats, body.booting #live, body.booting #toast { visibility: hidden; }
body.plain.booting { background: #000; }
/* waiting / problem states on the boot screen (2026-11-21): centred like a lock screen, glass button */
.boot .bcap, .boot .bmsg { transition: opacity .35s ease, transform .45s cubic-bezier(.2,.9,.25,1); }
.boot .bmsg { position: absolute; left: 50%; top: 46%; transform: translate(-50%, calc(-50% + 10px)); width: min(330px, calc(100vw - 48px));
  display: flex; flex-direction: column; align-items: center; text-align: center; opacity: 0; pointer-events: none;
  color: #fff; font-family: Inter, system-ui, sans-serif; text-shadow: 0 1px 14px rgba(0, 0, 0, .65); }
.boot.msg .bmsg { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.boot.msg .bcap { opacity: 0; transform: translateX(-50%) translateY(6px); }
.boot .bmark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 18px;
  background: rgba(255, 255, 255, .12); border: .5px solid rgba(255, 255, 255, .2);
  -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.boot .bmark svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; opacity: .92; }
.boot .bmsg h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 640; letter-spacing: -.02em; }
.boot .bmsg p { margin: 8px 0 0; font-size: 15px; line-height: 1.42; color: rgba(240, 240, 240, .74); letter-spacing: -.005em; }
.boot .bmsg p:empty { display: none; }
.boot .bmsg button { margin-top: 24px; min-width: 148px; height: 46px; padding: 0 26px; border-radius: 23px; cursor: pointer;
  font: 600 15px/1 Inter, system-ui, sans-serif; letter-spacing: -.01em; color: #fff; text-shadow: none;
  background: rgba(255, 255, 255, .16); border: .5px solid rgba(255, 255, 255, .26);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .18s cubic-bezier(.2,.9,.25,1), background .18s ease; -webkit-tap-highlight-color: transparent; }
.boot .bmsg button:active { transform: scale(.95); background: rgba(255, 255, 255, .24); }
.boot .bmsg button[hidden] { display: none; }
#gate { display: none; }
@media (prefers-reduced-motion: reduce) { .boot, .boot img, .boot .bcap, .boot .bmsg { transition: none; } }

/* ---------- dock groups (2026-11-21): input | screens · Exposé · sound | more. Seldom-used things live in a small
   glass panel that springs up from the ⋯ button. */
#dock .dgroup { display: flex; gap: 2px; padding: 0; border-radius: 999px; transition: background .2s ease; }
#dock .dgroup:has(button.on) { background: color-mix(in srgb, var(--fg) 7%, transparent); }
#dock .dsep { width: 1px; height: 22px; margin: 0 5px; background: var(--line); flex: none; }
#dock .dsep[hidden] { display: none; }
#dock button[hidden], #dock-more button[hidden], #dock-ws button[hidden] { display: none; }
#dock > button, #dock .dgroup > button { animation: dockin .32s cubic-bezier(.2,.9,.25,1) both; }
@keyframes dockin { from { transform: scale(.6); opacity: 0; } }
#b-more.on { background: color-mix(in srgb, var(--fg) 14%, transparent) !important; color: var(--fg) !important; }
#dock-more, #dock-ws { position: fixed; left: 50%; bottom: calc(76px + var(--safe-b)); z-index: 4; display: grid; grid-template-columns: repeat(2, 76px); gap: 6px;
  padding: 8px; border-radius: 24px; background: var(--glass); -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: 0 14px 44px rgba(0,0,0,.5);
  transform: translateX(-50%) translateY(10px) scale(.92); transform-origin: 50% 100%; opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.2,.9,.25,1), opacity .2s ease; }
#dock-more.open, #dock-ws.open { transform: translateX(-50%); opacity: 1; pointer-events: auto; }
#dock-more button, #dock-ws button { height: 64px; border-radius: 16px; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--fg);
  font: 500 11px/1 Inter, system-ui, sans-serif; letter-spacing: -.005em; transition: background .15s ease, transform .1s ease; }
#dock-more button::after, #dock-ws button::after { content: attr(title); opacity: .75; }
#dock-more button:active, #dock-ws button:active { transform: scale(.94); }
#dock-more button:hover, #dock-ws button:hover { background: color-mix(in srgb, var(--fg) 9%, transparent); }
#dock-more button.on, #dock-ws button.on { background: var(--accent); color: var(--on-accent); }
#dock-more svg, #dock-ws svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { #dock-more { bottom: auto; top: 70px; transform-origin: 50% 0; transform: translateX(-50%) translateY(-10px) scale(.92); } #dock-more.open { transform: translateX(-50%); } }
.boot .bmark { color: #fff; }

/* ---- desk title bars (2026-11-21): above each tile, never on the picture. Traffic lights + name (the grab area). ---- */
body.desk .view .tag, body.desk .view .dclose, body.desk .view .dgrip { display: none; }
.dbar { position: absolute; display: flex; align-items: center; gap: 8px; padding: 0 8px; box-sizing: border-box;
  border-radius: 10px 10px 0 0; background: color-mix(in srgb, var(--bg, #111) 78%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line); border-bottom: 0; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  transition: left .38s cubic-bezier(.2,.9,.25,1), top .38s cubic-bezier(.2,.9,.25,1), width .38s cubic-bezier(.2,.9,.25,1); }
.dbar[hidden], .dgrip2[hidden] { display: none; }
.dbar.moving { transition: none; cursor: grabbing; }
.dlights { display: flex; gap: 7px; flex: none; }
.dl { width: 13px; height: 13px; padding: 0; border-radius: 50%; border: 0; position: relative; flex: none;
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.25); }
.dl::before { content: ''; position: absolute; inset: -8px; }          /* a finger-sized target around the small light */
.dl-close { background: #ff5f57; } .dl-min { background: #febc2e; } .dl-max { background: #28c840; }
.dl:active { filter: brightness(.8); }
.dname { flex: 1; min-width: 0; text-align: center; font: 600 12px/1 Inter, ui-sans-serif, system-ui, sans-serif; color: var(--fg);
  opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
body.desk .view { border-radius: 0 0 10px 10px; }
.dgrip2 { position: absolute; width: 22px; height: 22px; touch-action: none; cursor: nwse-resize;
  border-right: 3px solid color-mix(in srgb, var(--fg) 60%, transparent); border-bottom: 3px solid color-mix(in srgb, var(--fg) 60%, transparent);
  border-radius: 0 0 9px 0; box-sizing: border-box; }
.dgrip2::before { content: ''; position: absolute; inset: -10px; }
#desk-bar .dmin { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--fg) 10%, transparent); }
#desk-bar button { white-space: nowrap; }
#cursor.arrow.feed { opacity: .45; }
#dock-ws { grid-template-columns: repeat(3, 76px); }
@media (hover: hover) and (pointer: fine) { #dock-ws { bottom: auto; top: 70px; transform-origin: 50% 0; transform: translateX(-50%) translateY(-10px) scale(.92); } #dock-ws.open { transform: translateX(-50%); } }

:root{--accent:#91e47c;--on-accent:#013a00;--error:#ffb4ab;--bg:#10150e;--fg:#dfe4d8;--surface:#1c211a;}
