/* Página de directo de los juegos de richi.codes (/directo/<slug>). En OBS o TikTok LIVE Studio
   solo se ve el juego, a pantalla completa; en el navegador, el panel de ajustes al lado. */
:root {
  color-scheme: dark;
  --bg: #0a0e22;
  --card: #11162e;
  --line: rgba(255, 255, 255, .14);
  --ink: #f2f4fa;
  --muted: #9aa3bd;
  --orange: #ff5200;
  --teal: #00d4aa;
  --red: #ff6b7d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  overflow: hidden;
}
body.obs { background: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#stage { --h: 100dvh; position: relative; flex: 1 1 auto; height: var(--h); min-width: 0; display: flex; align-items: center; justify-content: center; }
#game { display: block; border: 0; width: min(100%, calc(var(--h) * 9 / 16)); height: auto; aspect-ratio: 9 / 16; background: #000; }
/* En OBS / LIVE Studio la fuente ya es vertical: el juego la llena entera. */
body.obs #game { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
#pill {
  position: absolute; top: 12px; left: 12px; margin: 0; padding: 6px 12px; border-radius: 999px;
  background: rgba(9, 13, 30, .85); border: 1px solid var(--line); font-size: 13px; font-weight: 700;
}
#pill[hidden] { display: none; }

#setup {
  flex: 0 0 380px; height: 100dvh; overflow-y: auto; padding: 24px 22px 32px;
  background: var(--card); border-left: 1px solid var(--line);
}
#setup[hidden] { display: none; }
.kicker { margin: 0; font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); }
h1 { margin: 8px 0 6px; font-size: 26px; line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; }
h2 { margin: 0 0 8px; font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: #c9cede; }
.lead { margin: 0 0 18px; color: var(--muted); text-wrap: pretty; }
section { padding: 16px 0; border-top: 1px solid var(--line); }
.note { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.steps { margin: 10px 0 12px; padding-left: 20px; color: #c9cede; font-size: 14px; }
.steps li + li { margin-top: 4px; }
.conn { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.conn[data-state="on"] .dot { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.conn[data-state="off"] .dot { background: var(--red); }
.conn[data-state="wait"] .dot { background: #ffd36b; }

.field { margin-bottom: 10px; }
label { display: block; font-size: 13px; font-weight: 700; color: #c9cede; margin-bottom: 4px; }
input[type="number"], input[type="text"] {
  width: 100%; font: 600 16px/1.2 inherit; font-family: inherit; color: var(--ink);
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .2); border-radius: 10px; padding: 9px 11px;
}
input[aria-invalid="true"] { border-color: var(--red); }
#obs-url { font: 500 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.err { margin: 4px 0 0; color: var(--red); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.summary { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.saved { margin: 6px 0 0; font-size: 13px; color: var(--teal); min-height: 1.2em; }

button {
  font: 800 15px/1 inherit; font-family: inherit; min-height: 42px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  color: var(--ink); background: transparent; border: 1px solid rgba(255, 255, 255, .26);
  touch-action: manipulation; transition: scale .12s ease-out, background-color .12s ease-out;
}
button:hover { background: rgba(255, 255, 255, .06); }
button:active { scale: .97; }
#apply, #copy { background: var(--orange); border-color: var(--orange); color: #fff; width: 100%; }
#apply:hover, #copy:hover { background: #ff6a24; }
.tests { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tests button { font-size: 14px; }
.tests button:last-child { grid-column: 1 / -1; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.foot { margin: 16px 0 0; font-size: 12px; color: #7a829c; }

@media (max-width: 820px) {
  body { flex-direction: column; overflow: auto; }
  #stage { --h: 78dvh; flex: none; }
  #setup { flex: none; height: auto; overflow: visible; border-left: 0; border-top: 1px solid var(--line); padding: 20px 16px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
/* OBS / LIVE Studio: la fuente suele ser estrecha (1080×1920), pero ahí no hay panel. */
body.obs #stage { --h: 100dvh; flex: 1 1 auto; }
