/* Plasta — основа разметки: экраны, поток, верх потока, окна, тосты, экранный геймпад. Тема (цвета, стекло, шрифт,
   лобби) — plasta.css поверх этого файла. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #02040b; color: #e8ecf6; font: 15px/1.4 system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
body.streaming { overflow: hidden; background: #000; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 0.4em; border-radius: 5px; background: rgba(255, 255, 255, 0.1); font: 600 0.85em/1.6 ui-monospace, monospace; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn-primary { background: #2f6bff; border-color: transparent; color: #fff; }
.btn-danger { color: #ff8f99; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-wide { width: 100%; }
.btn-small { padding: 5px 10px; font-size: 13px; }

.view { min-height: 100%; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field input { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.25); color: inherit; font: inherit; }

/* поток: картинка во весь экран, звук отдельно */
#view-stream { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.stream-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stream-loader.gone { opacity: 0; pointer-events: none; }

/* верх потока: виден, пока двигают мышью (.hud-show); статистика — слева сверху, если включена */
.hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px; opacity: 0; transition: opacity 250ms; }
#view-stream.hud-show .hud-top { opacity: 1; }
.hud-menu-btn { width: 40px; height: 40px; padding: 0; font-size: 18px; }
:root:not(:fullscreen) .fs-out, :fullscreen .fs-in { display: none; }
.hud-stats { position: absolute; top: 56px; left: 12px; margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.6); font: 12px/1.45 ui-monospace, monospace; white-space: pre; pointer-events: none; }

/* окна */
.modal { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-open { display: flex; }
.modal-box { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; }
.modal-box h2 { margin: 0 0 12px; font-size: 20px; }
.modal-menu-box { display: grid; gap: 8px; }
.menu-net { display: grid; gap: 6px; margin: 6px 0; }
.menu-hint { opacity: 0.7; }
.help-table { display: grid; gap: 6px; }
.keyrow { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 12px; align-items: baseline; }
.help-note { opacity: 0.7; font-size: 13px; }
.mac-cmd { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.mac-cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); font-size: 12px; }
.chk { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 12px; }
.chk dt { opacity: 0.7; }
.chk dd { margin: 0; font-weight: 600; }
.chk-verdict[data-tone="good"] b { color: #5fe39b; }
.chk-verdict[data-tone="ok"] b { color: #ffd166; }
.chk-verdict[data-tone="bad"] b { color: #ff8f99; }

/* тосты — внизу по центру */
.toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 10px 18px; text-align: center; transition: opacity 400ms, transform 400ms; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* экранный геймпад: только на сенсорных экранах без геймпада (vpad.js) */
.vpad { position: absolute; inset: 0; z-index: 4; display: none; pointer-events: none; }
.vpad.on { display: block; }
.vpad > * { position: absolute; pointer-events: auto; touch-action: none; }
.vpad-btn { width: 52px; height: 52px; border-radius: 50%; font-size: 18px; display: grid; place-items: center; padding: 0; }
.vpad-stick-base { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; }
.vpad-stick-nub { width: 56px; height: 56px; border-radius: 50%; pointer-events: none; }
.vp-lstick { left: max(28px, env(safe-area-inset-left)); bottom: 28px; }
.vp-rstick { right: 190px; bottom: 28px; }
.vp-up { left: 124px; bottom: 236px; } .vp-down { left: 124px; bottom: 164px; }
.vp-left { left: 88px; bottom: 200px; } .vp-right { left: 160px; bottom: 200px; }
.vp-top { right: 74px; bottom: 166px; } .vp-bottom { right: 74px; bottom: 40px; }
.vp-west { right: 136px; bottom: 103px; } .vp-east { right: 12px; bottom: 103px; }
.vp-l1, .vp-l2, .vp-r1, .vp-r2 { width: 64px; height: 40px; border-radius: 12px; font-size: 14px; top: max(12px, env(safe-area-inset-top)); }
.vp-l2 { left: 16px; } .vp-l1 { left: 88px; } .vp-r1 { right: 88px; } .vp-r2 { right: 16px; }
.vp-create, .vp-pad, .vp-home, .vp-options { width: 40px; height: 40px; font-size: 15px; top: max(12px, env(safe-area-inset-top)); }
.vp-create { left: calc(50% - 92px); } .vp-pad { left: calc(50% - 44px); } .vp-home { left: calc(50% + 4px); } .vp-options { left: calc(50% + 52px); }
@media (max-height: 420px) {   /* телефон боком */
  .vpad-btn { width: 44px; height: 44px; }
  .vpad-stick-base { width: 110px; height: 110px; }
  .vp-up { bottom: 196px; } .vp-down { bottom: 136px; } .vp-left, .vp-right { bottom: 166px; }
  .vp-top { bottom: 140px; } .vp-west, .vp-east { bottom: 88px; } .vp-bottom { bottom: 36px; }
}
.topbar .seg-lang { margin-left: auto; }
.topbar { display: flex; align-items: center; gap: 12px; }
.footer { padding: 16px; text-align: center; font-size: 12px; opacity: 0.4; }
