/* ── Reset y capas base ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #04060f;
  font-family: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color: #dfe9ff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Webcam a pantalla completa, espejada como un espejo real */
#cam {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: saturate(0.75) brightness(0.8);
  z-index: 0;
}

/* Lienzo WebGL transparente sobre el video */
#stage { position: fixed; inset: 0; z-index: 1; }
#stage canvas { display: block; }

/* Capa de interfaz */
#ui { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#ui button { pointer-events: auto; }

/* ── HUD superior ───────────────────────────────────────────────── */
.hud-top {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}

.chip {
  background: rgba(6, 12, 30, 0.72);
  border: 1px solid rgba(255, 210, 74, 0.35);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  backdrop-filter: blur(6px);
}

#cam-status.ok    { border-color: rgba(0, 255, 170, 0.55); color: #8dffd9; }
#cam-status.error { border-color: rgba(255, 80, 100, 0.6);  color: #ff9aa8; }

.stats { display: grid; grid-template-columns: auto auto; gap: 2px 14px; text-align: right; }
.stats span   { opacity: 0.55; }
.stats strong { font-weight: 600; color: #ffe49a; min-width: 88px; display: inline-block; }

.fists { margin-top: 6px; font-size: 11px; opacity: 0.9; }
.fist-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin: 0 5px 0 10px; background: #33415e; vertical-align: middle;
  transition: background 0.1s, box-shadow 0.1s; }
.fist-dot.seen.left    { background: #0a5b66; }
.fist-dot.seen.right   { background: #661b53; }
.fist-dot.closed.left  { background: #00e5ff; box-shadow: 0 0 8px #00e5ff; }
.fist-dot.closed.right { background: #ff2fd0; box-shadow: 0 0 8px #ff2fd0; }

/* Etiquetas de los pads (alineadas con la escena por % de pantalla) */
.pad-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: rgba(223, 233, 255, 0.75);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* ── Controles inferiores ───────────────────────────────────────── */
.hud-bottom {
  position: absolute; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: center;
  padding: 0 12px;
}

.btn {
  background: rgba(6, 12, 30, 0.78);
  border: 1px solid rgba(255, 210, 74, 0.45);
  color: #dfe9ff;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit; font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
  backdrop-filter: blur(6px);
}
.btn:hover { border-color: #ffd24a; box-shadow: 0 0 14px rgba(255, 210, 74, 0.35); }

.btn.primary { border-color: #ffd24a; color: #ffe49a; }
.btn.primary.ready { border-color: #22ffaa; color: #8dffd9;
  box-shadow: 0 0 14px rgba(34, 255, 170, 0.3); }

/* Instrucción central antes de activar el audio */
.hint {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 14px; line-height: 1.9;
  letter-spacing: 0.08em;
  background: rgba(4, 8, 20, 0.66);
  border: 1px solid rgba(255, 210, 74, 0.3);
  border-radius: 16px;
  padding: 22px 30px;
  backdrop-filter: blur(8px);
}
.hint em { color: #ffe49a; font-style: normal; }
.hint.hidden { display: none; }
