/* NexusCast Remote — estilos compartidos (login, switch del telefono, casteo en laptop) */
:root {
  --bg: #07090d;
  --panel: #0e131b;
  --panel-2: #141b26;
  --line: #222b39;
  --line-2: #2d3849;
  --text: #e9eef6;
  --muted: #8794a8;
  --dim: #5b677a;
  --accent: #19d3ff;
  --accent-ink: #00141a;
  --live: #ff2d46;
  --ok: #22c55e;
  --warn: #f5a524;
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --team-red: #ff3b4e;
  --team-blue: #2f80ff;
  --team-green: #22c55e;
  --team-yellow: #ffd23f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.35 var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ controles base */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; letter-spacing: .01em; user-select: none; touch-action: manipulation;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:active { transform: scale(.97); }
a.btn { text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.on { background: rgba(25, 211, 255, .14); border-color: var(--accent); color: var(--accent); }
.btn.danger { border-color: rgba(255, 45, 70, .5); color: #ff8a98; }
.btn.live-on { background: rgba(255, 45, 70, .16); border-color: var(--live); color: #ff9aa6; }
.btn:disabled { opacity: .4; pointer-events: none; }
.icon-btn { width: 40px; min-height: 36px; padding: 0; }

.seg { display: flex; gap: 0; padding: 3px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.seg legend { display: none; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 34px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.seg input:checked + span, .seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.bad::before { background: var(--live); }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }

/* ------------------------------------------------------------ login */
.login-page { display: grid; place-items: center; min-height: 100%; padding: 16px; background: radial-gradient(1200px 600px at 20% -10%, rgba(25, 211, 255, .10), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .12em; }
.brand span { color: var(--muted); font-size: 13px; }
.login-card form { display: grid; gap: 12px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.login-card input:not([type="radio"]) { height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 16px; text-transform: none; letter-spacing: 0; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-dest label { text-transform: none; letter-spacing: 0; font-size: 13px; }
.login-error { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(255, 45, 70, .12); color: #ff8a98; }

/* ------------------------------------------------------------ switch (telefono en horizontal) */
.switch { height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto auto 1fr; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

.topbar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.onair { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--panel-2); font-weight: 800; letter-spacing: .08em; font-size: 12px; }
.onair .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.onair.live { background: var(--live); color: #fff; }
.onair.live .dot { background: #fff; animation: pulse 1.2s infinite; }
.onair.stopping { background: var(--warn); color: #1a1000; }
.onair time { font-family: var(--mono); font-weight: 600; letter-spacing: 0; }
@keyframes pulse { 50% { opacity: .25; } }
.topbar .spacer { flex: 1; }

/* Banco de salas (como los bancos de un switcher de TV) */
.rooms { flex: 1; display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rooms::-webkit-scrollbar { display: none; }
.room {
  flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 0; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); text-align: left; touch-action: manipulation;
}
.room b { display: flex; align-items: center; gap: 5px; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.room b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.room.up b::before { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.room small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.room.on { border-color: var(--live); background: rgba(255, 45, 70, .14); box-shadow: inset 0 0 0 1px var(--live); }
.room.on small { color: #ffb3bd; }
.room-empty { align-self: center; color: var(--muted); font-size: 12px; }

/* Camara que esta en otra sala */
.cam.elsewhere { opacity: .55; }
.cam .where { position: absolute; z-index: 1; top: 6px; right: 6px; padding: 2px 7px; border-radius: 6px; background: rgba(245, 165, 36, .9); color: #1a1000; font-weight: 800; font-size: 10px; letter-spacing: .05em; }
.topbar .pills { display: flex; gap: 4px; }

.auto-switch { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border-radius: 8px; background: var(--panel-2); font-weight: 800; font-size: 12px; letter-spacing: .08em; user-select: none; }
.auto-switch input { appearance: none; position: relative; width: 40px; height: 22px; margin: 0; border-radius: 99px; background: var(--line-2); transition: background .15s; }
.auto-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.auto-switch input:checked { background: var(--accent); }
.auto-switch input:checked::after { transform: translateX(18px); }

.stage { display: grid; grid-template-columns: 1fr minmax(270px, 34%); gap: var(--gap); min-height: 0; padding: var(--gap); }
.cams { display: grid; grid-template-rows: 1fr auto; gap: var(--gap); min-height: 0; }

.cam-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); grid-auto-rows: 1fr; gap: var(--gap); min-height: 0; }
.cam {
  position: relative; display: block; min-height: 0; padding: 0; overflow: hidden;
  border: 2px solid var(--line); border-radius: var(--radius); background: #000 center/cover no-repeat;
  text-align: left; user-select: none; touch-action: manipulation; -webkit-touch-callout: none;
}
.cam::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 38%, transparent 60%, rgba(0, 0, 0, .75)); pointer-events: none; }
.cam .tag { position: absolute; z-index: 1; top: 6px; left: 6px; display: flex; gap: 4px; align-items: center; }
.cam .num { padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .65); font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.cam .air { display: none; padding: 2px 7px; border-radius: 6px; background: var(--live); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: .08em; }
.cam .auto { padding: 2px 6px; border-radius: 6px; background: rgba(25, 211, 255, .2); color: var(--accent); font-weight: 700; font-size: 10px; letter-spacing: .06em; }
.cam .info { position: absolute; z-index: 1; left: 8px; right: 8px; bottom: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.cam .info small { display: block; color: #c3cbd8; font-weight: 500; font-size: 11px; }
.cam.selected { border-color: var(--accent); }
.cam.live { border-color: var(--live); box-shadow: 0 0 0 1px var(--live), 0 0 18px rgba(255, 45, 70, .35); }
.cam.live .air { display: inline-block; }
.cam.offline { background-image: none !important; }
.cam.offline .info { color: var(--dim); }
.cam .offline-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-weight: 700; font-size: 12px; letter-spacing: .08em; }
.cam.pressing { transform: scale(.98); }

.layout-bar { display: flex; gap: var(--gap); align-items: center; min-width: 0; }
.layout-bar .seg { flex: 0 0 auto; }
.layout-bar .seg button { min-width: 40px; padding: 0 8px; }
/* Ventanas del formato actual: se elige una y luego se toca la camara que va ahi */
.slots { flex: 1; display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.slots::-webkit-scrollbar { display: none; }
.slot {
  flex: 1 1 0; min-width: 58px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  height: 40px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel);
  text-align: left; touch-action: manipulation;
}
.slot small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.slot b { font-size: 13px; letter-spacing: .02em; white-space: nowrap; }
.slot.on { border-color: var(--accent); background: rgba(25, 211, 255, .12); box-shadow: inset 0 0 0 1px var(--accent); }
.slot.on small { color: var(--accent); }
.ticker { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.ticker span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.ticker .btn { min-height: 30px; padding: 0 10px; font-size: 12px; }

.side { display: grid; grid-template-rows: auto 1fr; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; height: 40px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 700; font-size: 13px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tab { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 10px; overflow-y: auto; }

.side h3 { margin: 0; font-size: 15px; }
.side .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.modes .btn { min-height: 38px; padding: 0 6px; font-size: 13px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list .group { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-left: 4px solid var(--team, var(--line-2)); border-radius: 8px; background: var(--panel-2); font-weight: 600; font-size: 13px; }
.chip.dead { opacity: .45; text-decoration: line-through; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.row { display: flex; gap: 6px; align-items: center; }
.row > * { flex: 1; }
.empty { padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); color: var(--muted); font-size: 12px; text-align: center; }

/* Musica */
.track { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; }
.track img, .track .noart { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.track b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.track span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.transport { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 6px; }
.transport .btn { min-height: 44px; font-size: 18px; }
.vol { display: grid; grid-template-columns: 64px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.vol output { text-align: right; font-family: var(--mono); }
.playlist { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); text-align: left; font-weight: 600; font-size: 13px; }
.playlist img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; background: var(--line); }
.playlist span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Directo */
.live-status { display: grid; gap: 4px; padding: 12px; border-radius: var(--radius-sm); background: var(--panel-2); text-align: center; }
.live-status b { font-size: 20px; letter-spacing: .06em; }
.live-status time { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.live-status small { color: var(--muted); }
.hold {
  position: relative; overflow: hidden; min-height: 64px; border: 0; border-radius: var(--radius);
  background: var(--panel-2); color: var(--text); font-weight: 800; letter-spacing: .06em; font-size: 15px;
  box-shadow: inset 0 0 0 2px var(--line-2); user-select: none; touch-action: none; -webkit-touch-callout: none;
}
.hold::before { content: ""; position: absolute; inset: 0; width: calc(var(--p, 0) * 100%); background: rgba(255, 255, 255, .14); }
.hold span { position: relative; }
.hold.start { background: #0f2a18; box-shadow: inset 0 0 0 2px var(--ok); color: #8ef0b0; }
.hold.stop { background: #2a0f14; box-shadow: inset 0 0 0 2px var(--live); color: #ff9aa6; }
.hold:disabled { opacity: .35; filter: grayscale(1); }
.hint { color: var(--dim); font-size: 11px; text-align: center; }

/* Avisos */
.toast { position: fixed; z-index: 50; left: 50%; top: 54px; transform: translateX(-50%); max-width: 80vw; padding: 10px 14px; border-radius: 10px; background: #1b2230; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-weight: 600; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.err { background: #3a121a; color: #ffb3bd; }
.banner { padding: 4px 8px; background: var(--warn); color: #1a1000; font-weight: 700; font-size: 12px; text-align: center; }

.rotate { position: fixed; z-index: 100; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: var(--bg); text-align: center; }
.rotate .phone { width: 46px; height: 78px; border: 3px solid var(--accent); border-radius: 10px; animation: turn 1.8s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 820px) { .switch .rotate { display: flex; } }

/* Telefonos chicos en horizontal (alto < 380px) */
@media (max-height: 380px) {
  .topbar { height: 40px; }
  .onair { height: 28px; }
  .auto-switch, .room { height: 30px; }
  .stage { gap: 6px; padding: 6px; }
  .tabs button { height: 34px; }
  .btn { min-height: 36px; }
}
@media (max-width: 960px) { .topbar .pills { display: none; } }

/* ------------------------------------------------------------ casteo (laptop) */
.cast { display: grid; grid-template-rows: auto 1fr; height: 100dvh; }
.cast-main { display: grid; grid-template-columns: 1fr 340px; gap: 12px; min-height: 0; padding: 12px; }
.cast-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.program { position: relative; flex: 0 0 auto; width: 100%; aspect-ratio: 16 / 9; max-height: 64vh; border: 1px solid var(--line); border-radius: var(--radius); background: #000; overflow: hidden; }
.room-pill { padding: 4px 10px; border-radius: 8px; background: rgba(255, 45, 70, .14); border: 1px solid var(--live); color: #ffb3bd; font-weight: 800; font-size: 12px; letter-spacing: .05em; white-space: nowrap; }
.sound-toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Tablero de la sala al aire */
.cast-dash { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.6fr); gap: 12px; }
.dash-leaders { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.nexus-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.nx { padding: 8px 10px; border-left: 4px solid var(--team); border-radius: 8px; background: var(--panel-2); }
.nx.dead { opacity: .45; }
.nx-head { display: flex; align-items: center; gap: 6px; }
.nx-head b { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nx-head .tag { padding: 1px 5px; border-radius: 4px; background: var(--line-2); font-size: 10px; font-weight: 800; }
.nx-hp { font-family: var(--mono); font-weight: 700; font-size: 13px; }
.nx-bar { height: 6px; margin: 6px 0 4px; border-radius: 6px; background: var(--line); overflow: hidden; }
.nx-bar i { display: block; height: 100%; background: var(--team); transition: width .4s; }
.nx small { color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table.stats { width: 100%; border-collapse: collapse; font-size: 13px; }
table.stats th { padding: 4px 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: right; white-space: nowrap; }
table.stats th:first-child, table.stats td.team-cell { text-align: left; }
table.stats td { padding: 6px; border-top: 1px solid var(--line); text-align: right; font-family: var(--mono); }
table.stats td.team-cell { font-family: var(--font); font-weight: 700; border-left: 3px solid var(--team); }
table.stats td.best { color: var(--accent); font-weight: 800; }
.leaders { margin: 0; padding: 0; list-style: none; counter-reset: pos; }
.leaders li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-left: 3px solid var(--team, var(--line-2)); border-radius: 6px; background: var(--panel-2); margin-bottom: 6px; counter-increment: pos; }
.leaders li::before { content: counter(pos); width: 18px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.leaders li.sub::before { content: none; }
.leaders li span { flex: 1; font-weight: 600; }
.leaders li b { font-family: var(--mono); }
.other-rooms { display: flex; flex-direction: column; gap: 8px; }
.other-room { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: var(--panel-2); }
.other-room > div { flex: 1; min-width: 0; }
.other-room small { display: block; color: var(--muted); font-size: 11px; }
.feed-card { flex: 1; min-height: 160px; }

/* Avisos de acción en otras salas (casteo y switch) */
.xalerts { position: fixed; z-index: 60; top: 56px; right: 12px; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.xalert {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border: 1px solid var(--warn); border-radius: 12px;
  background: #241a08; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); pointer-events: auto; animation: xa-in .25s ease-out;
}
.xa-icon { font-size: 22px; }
.xa-body { flex: 1; min-width: 0; }
.xa-body small { display: block; color: var(--warn); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.xa-body b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xa-go { min-height: 34px; font-size: 12px; white-space: nowrap; }
.xa-close { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; }
@keyframes xa-in { from { transform: translateY(-8px); opacity: 0; } }
.program iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.program .empty { position: absolute; inset: 0; display: grid; place-items: center; border: 0; }
.cast-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.card { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card h4 { margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.mic-frame { width: 100%; height: 180px; border: 0; border-radius: 8px; background: var(--bg); }
.feed { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; font-size: 13px; }
.feed div { padding: 6px 8px; border-left: 3px solid var(--line-2); border-radius: 4px; background: var(--panel-2); }
.feed div.hot { border-left-color: var(--live); }
@media (max-width: 1100px) { .cast-dash { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .cast-main { grid-template-columns: 1fr; } }
