:root {
  --bg: #0b0f14;
  --bg-elev: #121821;
  --bg-elev2: #18212d;
  --line: #223041;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #35d07f;      /* live / ok */
  --accent-dim: #1c6b45;
  --warn: #f0b429;
  --bad: #f0506e;
  --brand: #5aa9ff;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, #16324a33, transparent),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0e141ccc, #0b0f14cc);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand .dot { color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: .85rem; font-family: var(--mono); }

/* ---------- Live badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; padding: .3rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live { color: var(--accent); border-color: var(--accent-dim); }
.badge.live .pip { background: var(--accent); box-shadow: 0 0 0 0 #35d07f88; animation: pulse 1.8s infinite; }
.badge.down { color: var(--bad); border-color: #6b1c2c; }
.badge.down .pip { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #35d07f66; } 70% { box-shadow: 0 0 0 7px #35d07f00; } 100% { box-shadow: 0 0 0 0 #35d07f00; } }

/* ---------- Buttons / inputs ---------- */
button, .btn {
  font: inherit; cursor: pointer; color: var(--text);
  background: var(--bg-elev2); border: 1px solid var(--line);
  padding: .6rem .95rem; border-radius: 10px; transition: border-color .15s, transform .05s;
}
button:hover { border-color: var(--brand); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent-dim); border-color: var(--accent); color: #eafff3; font-weight: 600; }
input {
  font: inherit; color: var(--text); background: #0c1219;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; width: 100%;
}
input:focus { outline: none; border-color: var(--brand); }
label { display: block; font-size: .78rem; color: var(--muted); margin: 0 0 .35rem; }

/* ---------- Login card ---------- */
.center { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 1.5rem; }
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem; width: 100%; max-width: 360px;
  box-shadow: 0 24px 60px -30px #000;
}
.card h1 { margin: 0 0 .25rem; font-size: 1.3rem; letter-spacing: -0.02em; }
.card .sub { color: var(--muted); font-size: .85rem; margin: 0 0 1.2rem; }
.field { margin-bottom: .9rem; }
.err { color: var(--bad); font-size: .82rem; min-height: 1.1em; margin-top: .2rem; }
.hint { color: var(--muted); font-size: .75rem; margin-top: 1rem; font-family: var(--mono); line-height: 1.5; }

/* ---------- Player ---------- */
.stage { max-width: 1100px; margin: 1.25rem auto; padding: 0 1.25rem; }
.videowrap {
  position: relative; background: #000; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9;
}
video { width: 100%; height: 100%; display: block; background: #000; }
.playerbar { display: flex; align-items: center; gap: .75rem; margin-top: .9rem; color: var(--muted); font-size: .85rem; }
.playerbar .ch { font-family: var(--mono); color: var(--text); }

/* ---------- Admin ---------- */
.grid { max-width: 1100px; margin: 1.25rem auto; padding: 0 1.25rem; display: grid; gap: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.tile { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.tile .k { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.tile .v { font-family: var(--mono); font-size: 1.9rem; font-weight: 600; margin-top: .35rem; letter-spacing: -0.02em; }
.tile .v small { font-size: .9rem; color: var(--muted); font-weight: 400; }

.panel { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1rem; letter-spacing: -0.01em; }
.switcher { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.switcher .field { flex: 1; min-width: 160px; margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
td.num { font-family: var(--mono); text-align: right; }
.tag { font-family: var(--mono); font-size: .72rem; padding: .15rem .5rem; border-radius: 6px; border: 1px solid var(--line); }
.tag.on { color: var(--accent); border-color: var(--accent-dim); }
.tag.off { color: var(--muted); }
.empty { color: var(--muted); padding: 1rem .5rem; font-size: .88rem; }
.toast { color: var(--accent); font-size: .82rem; min-height: 1.1em; }

/* Copiar URL (player) */
.copyrow { display: flex; gap: .5rem; }
.copyrow input { flex: 1; font-family: var(--mono); font-size: .82rem; }

/* Botón activar sonido (autoplay arranca muted) */
.unmute-btn {
  position: absolute; left: 50%; bottom: 3.4rem; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.05rem; border-radius: 999px;
  background: var(--accent-dim); border: 1px solid var(--accent); color: #eafff3;
  font-weight: 600; font-size: .9rem; cursor: pointer; z-index: 3;
  box-shadow: 0 10px 26px -8px #000; animation: fadeUp .3s ease;
}
.unmute-btn:hover { filter: brightness(1.08); }
.unmute-btn.gone { display: none; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Tabla de usuarios: controles compactos */
td button, .switcher select, select.mini {
  padding: .35rem .6rem; font-size: .8rem; border-radius: 8px;
}
select { font: inherit; color: var(--text); background: #0c1219; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
select.mini { padding: .35rem .5rem; }
td button { margin: .1rem .1rem; }
button.danger { border-color: #6b1c2c; color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.switcher .field select { width: 100%; }

/* Overlay de aviso sobre el video (evento no empezado / finalizado / en uso) */
.notice { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; backdrop-filter: blur(2px); z-index: 2; padding: 1rem; }
.notice.gone { display: none; }
.notice-box { text-align: center; max-width: 90%; }
.notice-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.notice-sub { color: var(--muted); font-size: .9rem; margin-top: .45rem; line-height: 1.5; }
