* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: #eaf6f2;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { background: radial-gradient(ellipse at 50% 35%, #12302c 0, #071513 45%, #020605 100%); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #7dffd8; outline-offset: 2px; }

/* Cámara a pantalla completa (solo cuando se usa la cámara de este equipo) */
#video { position: fixed; inset: 0; width: 100vw; height: 100dvh; object-fit: cover; filter: brightness(.8) saturate(.85); opacity: 0; transition: opacity .5s; }
#video.activo { opacity: 1; }
#video.espejo { transform: scaleX(-1); }
#escena, #trazos { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; }
#escena { touch-action: none; }
#trazos { pointer-events: none; }

.manipula { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4;
  border: 1px solid rgba(125, 255, 216, .6); background: rgba(4, 20, 17, .55); color: #c9fff0; border-radius: 999px;
  padding: 14px 26px; font-size: 1.05rem; font-weight: 600; letter-spacing: .04em; white-space: nowrap;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 24px rgba(125, 255, 216, .18); }
.manipula:hover { background: rgba(10, 40, 34, .7); }
.manipula[hidden] { display: none; }
.salir { position: fixed; top: calc(16px + env(safe-area-inset-top)); right: 16px; z-index: 4; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(125, 255, 216, .4); background: rgba(4, 20, 17, .5); color: #c9fff0; }
.salir[hidden] { display: none; }

.pista { position: fixed; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom)); margin: 0; z-index: 3; text-align: center;
  font-size: .85rem; letter-spacing: .06em; color: rgba(210, 255, 240, .85); text-shadow: 0 1px 4px rgba(0, 0, 0, .8); pointer-events: none; transition: opacity .6s; padding: 0 16px; }
.pista.oculta { opacity: 0; }
body.manos .pista { bottom: calc(24px + env(safe-area-inset-bottom)); }

.panel { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; background: rgba(0, 6, 5, .6); overflow: auto; }
.panel[hidden] { display: none; }
.ventana { position: relative; width: 100%; max-width: 560px; background: rgba(6, 22, 19, .92); border: 1px solid rgba(125, 255, 216, .3);
  border-radius: 20px; padding: 22px; box-shadow: 0 0 40px rgba(125, 255, 216, .12); }
.ventana h2 { margin: 0 0 4px; font-weight: 600; letter-spacing: .02em; color: #c9fff0; }
.sub { margin: 0 0 16px; color: rgba(234, 246, 242, .65); }
.cerrar { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); }
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .opciones { grid-template-columns: 1fr; } }
.opcion { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px;
  border: 1px solid rgba(125, 255, 216, .25); background: rgba(125, 255, 216, .05); min-height: 44px; }
.opcion:hover, .opcion.activa { border-color: rgba(125, 255, 216, .8); background: rgba(125, 255, 216, .12); }
.opcion .ico { font-size: 1.6rem; }
.opcion span:last-child { font-size: .9rem; color: rgba(234, 246, 242, .65); }
.remoto { display: flex; gap: 16px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.remoto[hidden] { display: none; }
.qr { background: #fff; padding: 8px; border-radius: 12px; line-height: 0; flex: 0 0 auto; }
.qr svg { width: 168px; height: 168px; display: block; }
.datos { flex: 1 1 200px; min-width: 0; }
.datos p { margin: 0 0 8px; font-size: .92rem; color: rgba(234, 246, 242, .75); }
.datos a { color: #7dffd8; word-break: break-all; }
.codigo b { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: .2em; color: #fff; }
.estado-sala { font-weight: 600; }
.estado-sala.ok { color: #7dffd8 !important; }
.error { margin: 14px 0 0; color: #ffb4b4; }
