:root{
  --bg:#121212;--surface:#1b1b1d;--surface2:#232326;--line:#2c2c30;
  --text:rgba(255,255,255,.87);--muted:rgba(255,255,255,.55);--faint:rgba(255,255,255,.38);
  --accent:#a6cf7f;--accent-ink:#16240c;--danger:#d98b7e;--online:#8fce74;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:var(--bg);font-synthesis:none;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);touch-action:manipulation}
button,input{font:inherit;color:inherit}
button,a,input{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.4}
a{color:inherit;text-decoration:none}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
h1,h2{margin:0;font-weight:600;letter-spacing:-.4px}
.hidden{display:none!important}
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}

.topbar{height:64px;padding:0 clamp(16px,4vw,40px);display:flex;align-items:center;gap:16px;border-bottom:1px solid var(--line);background:var(--surface)}
.brand{display:flex;align-items:center;gap:11px;font-size:19px;font-weight:700;letter-spacing:-.8px}
.brand-mark{width:34px;height:34px;display:grid;place-items:center;border-radius:10px;background:var(--accent);color:#12210a;font-size:26px;line-height:1;padding-bottom:4px;font-weight:800}
.brand-caption{display:block;font-size:8px;color:var(--faint);font-weight:600;letter-spacing:1.4px;margin-top:1px}
.conn-state{margin-left:auto;font-size:12px;color:var(--muted)}

main{max-width:1040px;margin:auto;padding:clamp(20px,4vw,40px) clamp(16px,4vw,40px)}

.dash-head{margin-bottom:22px}
.dash-head h1{font-size:clamp(22px,3vw,30px)}
.lead{font-size:13px;color:var(--muted);margin:8px 0 0;max-width:560px;line-height:1.6}

.devices{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.device{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;background:var(--surface);border:1px solid var(--line);border-radius:14px}
.device-left{display:flex;align-items:center;gap:12px;min-width:0}
.device-dot{width:9px;height:9px;border-radius:50%;background:var(--online);box-shadow:0 0 10px #8fce7455;flex-shrink:0}
.device-name{font-size:15px;font-weight:550;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.device-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}

.empty{margin-top:20px;display:flex;flex-direction:column;align-items:center;text-align:center;padding:48px 20px;border:1px dashed var(--line);border-radius:18px;background:var(--surface)}
.empty h2{font-size:18px;margin:22px 0 10px;color:var(--text)}
.empty p{font-size:13px;color:var(--muted);margin:0;max-width:380px;line-height:1.7}

.button{display:inline-flex;align-items:center;justify-content:center;gap:12px;border:0;border-radius:9px;font-size:13px;font-weight:600;padding:12px 18px}
.button.primary{background:var(--accent);color:var(--accent-ink)}
.button.primary:hover:not(:disabled){background:#b6dc90}
.button.secondary{background:var(--surface2);color:var(--text);border:1px solid var(--line)}
.button.secondary:hover:not(:disabled){background:#2b2b2f}
.button>span{font-size:16px;font-weight:400;line-height:1}
.button.small{padding:9px 14px;font-size:12px}
.ghost{background:transparent;border:1px solid var(--line);border-radius:9px;color:var(--muted);padding:9px 14px;font-size:12px;font-weight:550;display:inline-flex;align-items:center;gap:8px}
.ghost:hover{color:var(--text);border-color:#3a3a40}
.ghost.small{padding:8px 12px}
.ghost svg{width:16px;height:16px}
.icon-button{border:0;background:none;color:var(--muted);padding:5px;display:flex}
.icon-button:hover{color:var(--text)}
.icon-button svg{width:18px;height:18px}
.nav-key svg,#back svg,#fullscreen svg{fill:currentColor;stroke:none}
body.in-control .topbar{display:none}

.phone-illustration{width:78px;height:132px;border:1.4px solid #4a4a50;border-radius:15px;background:linear-gradient(150deg,#2a2a2e,#202024);position:relative;box-shadow:0 0 60px #a6cf7f12}
.phone-camera{position:absolute;left:31px;top:8px;width:16px;height:4px;border-radius:6px;background:#55555c}
.phone-bar{position:absolute;bottom:9px;left:24px;width:30px;height:3px;border-radius:5px;background:#4a4a50}
.phone-symbol{position:absolute;inset:0;display:grid;place-items:center;color:var(--accent);font-size:40px;font-weight:750;letter-spacing:-3px;padding-bottom:8px}
.phone-symbol>span{position:absolute;right:-11px;bottom:24px;font-size:18px;letter-spacing:0;background:var(--accent);color:#16240c;width:30px;height:30px;border:5px solid var(--surface);border-radius:50%;display:grid;place-items:center;font-weight:400}

.control{border:1px solid var(--line);border-radius:16px;background:var(--surface);overflow:hidden}
.screen-toolbar{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--line);background:var(--surface2)}
.screen-title{display:flex;align-items:center;gap:9px;font-size:13px;font-weight:550;min-width:0}
#control-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:40vw}
.status-dot{height:8px;width:8px;background:#5a5a60;border-radius:50%;flex-shrink:0}
.status-dot.active{background:var(--online);box-shadow:0 0 10px #8fce7455}
.screen-meta{display:flex;gap:14px;align-items:center;font-size:11px;color:var(--faint)}
.screen-stage{height:min(64vh,600px);min-height:360px;position:relative;background:radial-gradient(ellipse at 50% 38%,#20201f 0,#161616 55%,#111 100%);overflow:hidden;display:flex;align-items:center;justify-content:center}
.screen-stage:fullscreen{height:100vh;background:#0d0d0d}
.screen-stage:fullscreen video{max-height:100vh}
video{width:100%;height:100%;object-fit:contain;display:block;opacity:0;touch-action:none;user-select:none}
video.playing{opacity:1}
video.controllable{cursor:crosshair}
.placeholder{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;pointer-events:none;text-align:center;padding:20px}
.placeholder h2{color:var(--text);font-size:17px;font-weight:500;margin:22px 0 10px}
.placeholder p{color:var(--muted);font-size:12px;line-height:1.7;margin:0;max-width:320px}
.view-only{position:absolute;bottom:12px;left:50%;transform:translateX(-50%);white-space:nowrap;padding:8px 14px;background:#000000cc;color:var(--text);font-size:11px;border-radius:20px;pointer-events:none}
.android-nav{display:flex;justify-content:center;gap:40px;padding:14px 12px;border-bottom:1px solid var(--line);background:var(--surface)}
.nav-key{background:none;border:0;display:flex;align-items:center;gap:8px;color:var(--muted);font-size:10px;padding:6px}
.nav-key svg{height:19px;width:19px}
.nav-key:hover:not(:disabled){color:var(--accent)}
.text-form{padding:14px 16px;display:flex;gap:10px;border-bottom:1px solid var(--line)}
.text-form input{flex:1;min-width:0;padding:12px 13px;border:1px solid var(--line);background:var(--bg);border-radius:8px;font-size:13px;outline:none}
.text-form input:focus{border-color:#3a4a2c;box-shadow:0 0 0 3px #a6cf7f1f}
.text-form input::placeholder{color:var(--faint)}
.text-form button{width:auto;white-space:nowrap}
.status-line{min-height:20px;color:var(--muted);font-size:12px;line-height:1.5;padding:14px 16px}
.status-line.error{color:var(--danger)}

#control:fullscreen{height:100vh;border:0;border-radius:0;background:#000;display:flex;flex-direction:column}
#control:fullscreen .screen-toolbar{position:absolute;top:0;left:0;right:0;z-index:3;background:linear-gradient(#000000c0,#0000);border:0;color:#fff}
#control:fullscreen .screen-meta{color:#cfd6d0}
#control:fullscreen .icon-button{color:#fff}
#control:fullscreen .screen-stage{flex:1;height:auto;min-height:0}
#control:fullscreen .text-form,#control:fullscreen .status-line{display:none}
#control:fullscreen .android-nav{position:absolute;bottom:0;left:0;right:0;z-index:3;background:linear-gradient(#0000,#000000c0);border:0}
#control:fullscreen .nav-key{color:#eceff0}
#control:fullscreen .nav-key:disabled{opacity:.55}

body.immersive .topbar{display:none}
body.immersive main{max-width:none;padding:0}
body.immersive #control{position:fixed;inset:0;z-index:50;height:100vh;height:100dvh;border:0;border-radius:0;background:#000;display:flex;flex-direction:column}
body.immersive #control .screen-toolbar{position:absolute;top:0;left:0;right:0;z-index:3;background:linear-gradient(#000000cc,#0000);border:0;color:#fff}
body.immersive #control .screen-meta{color:#cfd6d0}
body.immersive #control .icon-button{color:#fff}
body.immersive #control .screen-stage{flex:1;height:auto;min-height:0}
body.immersive #control .text-form,body.immersive #control .status-line{display:none}
body.immersive #control .android-nav{position:absolute;bottom:0;left:0;right:0;z-index:3;background:linear-gradient(#0000,#000000cc);border:0}
body.immersive #control .nav-key{color:#eceff0}
body.immersive #control .nav-key:disabled{opacity:.55}

@media(max-width:640px){
  .topbar{height:56px}
  .device{padding:14px}
  .device-name{font-size:14px}
  .device-actions .ghost.small{display:none}
  #control-name{max-width:44vw}
  .screen-meta #route-value{display:none}
  body.in-control main{padding:0;max-width:none}
  body.in-control .control{border:0;border-radius:0;display:flex;flex-direction:column;min-height:100dvh}
  body.in-control .screen-stage{flex:1;height:auto;min-height:0}
  .android-nav{gap:30px;padding:10px}
  .text-form{padding:10px 12px}
  .status-line{padding:8px 12px;min-height:0}
}
@media(prefers-reduced-motion:no-preference){
  button,a,.ghost{transition:background .15s,border-color .15s,color .15s}
  .status-dot.active,.device-dot{animation:breathe 2.6s infinite}
  @keyframes breathe{50%{opacity:.6}}
}
