:root {
  --bg: #0f172a; --panel: #1e293b; --text: #e2e8f0; --muted: #94a3b8;
  --accent: #38bdf8; --ok: #22c55e; --warn: #f59e0b; --err: #ef4444;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
button {
  background: var(--accent); color: #0f172a; border: 0; border-radius: 8px;
  padding: 10px 16px; font-weight: 600; cursor: pointer; font-size: 15px;
}
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--muted); }
button.danger { background: var(--err); color: white; padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .4; cursor: not-allowed; }
input, select {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid #334155;
  background: #0b1220; color: var(--text); font-size: 15px;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
label.check input { width: auto; margin-top: 3px; }

.stage { position: relative; background: black; border-radius: 12px; overflow: hidden; }
.stage video, .stage canvas {
  width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1);
}
.stage canvas { position: absolute; inset: 0; }

/* ----- Enrolamiento ----- */
.admin { max-width: 1200px; margin: 0 auto; padding: 20px; }
.admin header { display: flex; justify-content: space-between; align-items: center; }
.admin h1 { font-size: 22px; margin: 0; }
.grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 16px; }
.panel { background: var(--panel); border-radius: 12px; padding: 16px; }
.admin .stage { aspect-ratio: 16 / 9; }
.hint { margin-top: 8px; color: var(--muted); min-height: 20px; }
.thumbs { display: flex; gap: 6px; margin-top: 10px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; transform: scaleX(-1); border: 2px solid var(--ok); }
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.msg { margin-top: 10px; padding: 8px 10px; border-radius: 8px; display: none; }
.msg.ok { display: block; background: #14532d; }
.msg.err { display: block; background: #7f1d1d; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px; border-bottom: 1px solid #334155; }
th { color: var(--muted); font-weight: 500; }
.tag { padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.tag.ok { background: #14532d; } .tag.no { background: #7f1d1d; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* ----- Tótem ----- */
body.totem { height: 100vh; overflow: hidden; }
.totem .stage { position: fixed; inset: 0; border-radius: 0; }
.totem .overlay {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 36px 24px 48px;
  text-align: center; background: linear-gradient(transparent, rgba(0,0,0,.85) 35%);
}
.totem .title { font-size: clamp(28px, 4.5vw, 56px); font-weight: 700; }
.totem .subtitle { font-size: clamp(18px, 2.4vw, 30px); color: #cbd5e1; margin-top: 10px; }
.totem .brand { position: fixed; top: 20px; left: 24px; font-weight: 700; letter-spacing: .5px; opacity: .85; }
.totem .totem-id { position: fixed; top: 20px; right: 24px; color: var(--muted); font-size: 14px; }
.totem .frame {
  position: fixed; top: 50%; left: 50%; width: min(42vw, 52vh); aspect-ratio: 3 / 4;
  transform: translate(-50%, -58%); border: 4px dashed rgba(255,255,255,.35); border-radius: 50%;
  transition: border-color .2s;
}
.totem[data-state="ok"] .frame { border: 6px solid var(--ok); }
.totem[data-state="fail"] .frame { border: 6px solid var(--err); }
.totem[data-state="busy"] .frame { border-color: var(--accent); }
.totem[data-state="ok"] .title { color: var(--ok); }
.totem[data-state="fail"] .title { color: #fca5a5; }
