/* ==========================================================================
   LIVE (transmisiones en vivo) — pantalla completa vertical estilo TikTok
   Usado por live-transmitir.html (la modelo) y live.html (lista + visor).
   En celular ocupa toda la pantalla; en escritorio queda una columna 9:16 centrada.
   ========================================================================== */

:root {
    --live-rojo: #ff2d55;
    --live-rojo-osc: #d9153e;
    --live-vidrio: rgba(0, 0, 0, 0.45);
    --live-vidrio-fuerte: rgba(0, 0, 0, 0.7);
    --live-texto: #fff;
    --live-suave: rgba(255, 255, 255, 0.78);
    --live-borde: rgba(255, 255, 255, 0.18);
    --live-arriba: env(safe-area-inset-top, 0px);
    --live-abajo: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body.live-body {
    margin: 0;
    height: 100%;
    background: #0b0b10;
    color: var(--live-texto);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

[hidden] { display: none !important; }

/* ---------- Escena ---------- */
.live-escena {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    background: #000;
    overflow: hidden;
}

@media (min-width: 700px) {
    .live-escena {
        left: 50%;
        right: auto;
        width: min(100vw, calc(100dvh * 9 / 16));
        transform: translateX(-50%);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
    }
}

.live-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

.live-video--espejo { transform: scaleX(-1); } /* la vista previa de la camara frontal va en espejo; los espectadores la ven normal */

.live-degradado {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0, rgba(0, 0, 0, 0) 22%),
        linear-gradient(to top, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0) 40%);
}

/* ---------- Barra superior ---------- */
.live-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(var(--live-arriba) + 12px) 12px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    z-index: 5;
}

.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 62%;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    background: var(--live-vidrio);
    backdrop-filter: blur(6px);
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.live-chip__foto {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #333;
    flex: none;
    border: 2px solid var(--live-rojo);
}

.live-chip__texto { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.live-chip__nombre { font-weight: 800; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-chip__sub { font-size: 0.74rem; color: var(--live-suave); white-space: nowrap; }

.live-derecha { display: flex; align-items: center; gap: 8px; }

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--live-rojo);
    color: #fff;
    font-weight: 900;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

.live-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: live-pulso 1.2s ease-in-out infinite;
}

.live-contador {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--live-vidrio);
    font-weight: 700;
    font-size: 0.82rem;
}

.live-reloj { font-variant-numeric: tabular-nums; }
.live-reloj--poco { background: var(--live-rojo-osc); animation: live-parpadeo 1s steps(2, start) infinite; }

/* ---------- Botones redondos ---------- */
.live-icono {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--live-vidrio);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.2s;
    text-decoration: none;
}
.live-icono:active { transform: scale(0.92); }
.live-icono--rojo { background: var(--live-rojo); }
.live-icono--apagado { background: rgba(255, 255, 255, 0.9); color: #111; }

/* ---------- Lateral derecho (acciones) ---------- */
.live-lateral {
    position: absolute;
    right: 10px;
    bottom: calc(var(--live-abajo) + 84px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.live-lateral__num { font-size: 0.72rem; font-weight: 700; margin-top: -8px; text-shadow: 0 1px 3px #000; }

.live-corazon-btn {
    width: 54px;
    height: 54px;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #ff5f7e, var(--live-rojo));
    box-shadow: 0 4px 16px rgba(255, 45, 85, 0.5);
}

/* ---------- Corazones que flotan ---------- */
.live-corazones { position: absolute; right: 0; bottom: 0; width: 90px; height: 55%; pointer-events: none; z-index: 4; overflow: hidden; }

.live-flotante {
    position: absolute;
    bottom: calc(var(--live-abajo) + 90px);
    right: 22px;
    font-size: 1.6rem;
    animation: live-subir 2.4s ease-out forwards;
    will-change: transform, opacity;
}

/* ---------- Chat ---------- */
.live-chat {
    position: absolute;
    left: 10px;
    right: 80px;
    bottom: calc(var(--live-abajo) + 76px);
    max-height: 34%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 35%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 35%);
}

.live-msg {
    align-self: flex-start;
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 14px;
    background: var(--live-vidrio);
    font-size: 0.88rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    animation: live-entrar 0.25s ease-out;
}
.live-msg b { color: #ffd479; margin-right: 6px; font-weight: 800; }

/* ---------- Barra inferior (chat del espectador) ---------- */
.live-abajo {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px calc(var(--live-abajo) + 10px);
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 6;
}

.live-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 1px solid var(--live-borde);
    border-radius: 999px;
    background: var(--live-vidrio);
    color: #fff;
    padding: 0 16px;
    font-size: 16px; /* 16px evita el zoom automatico de iOS */
    outline: none;
}
.live-input::placeholder { color: rgba(255, 255, 255, 0.6); }
.live-input:focus { border-color: #fff; }

/* ---------- Paneles a pantalla completa ---------- */
.live-panel {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: calc(var(--live-arriba) + 24px) 24px calc(var(--live-abajo) + 24px);
    text-align: center;
    background: rgba(8, 8, 14, 0.82);
    backdrop-filter: blur(10px);
}

.live-panel--sin-fondo { background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0, rgba(0, 0, 0, 0) 60%); justify-content: flex-end; backdrop-filter: none; }

.live-panel h1, .live-panel h2 { margin: 0; font-size: 1.35rem; font-weight: 900; }
.live-panel p { margin: 0; color: var(--live-suave); line-height: 1.5; max-width: 34ch; }
.live-panel .live-ico-grande { font-size: 2.6rem; color: var(--live-rojo); }

.live-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--live-rojo);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, filter 0.2s;
    font-family: inherit;
}
.live-btn:active { transform: scale(0.97); }
.live-btn:hover { filter: brightness(1.08); }
.live-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.live-btn--vidrio { background: rgba(255, 255, 255, 0.16); }
.live-btn--grande { min-height: 56px; font-size: 1.1rem; padding: 0 34px; }
.live-btn--ancho { width: min(100%, 320px); }

.live-campo { width: min(100%, 320px); text-align: left; }
.live-campo label { display: block; font-size: 0.8rem; color: var(--live-suave); margin-bottom: 4px; }
.live-campo input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--live-borde);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0 14px;
    font-size: 16px;
    outline: none;
}

.live-aviso {
    width: min(100%, 320px);
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--live-suave);
    text-align: left;
    line-height: 1.45;
}
.live-aviso b { color: #fff; }
.live-aviso--mal { background: rgba(255, 45, 85, 0.22); color: #ffd6de; }

.live-resumen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: min(100%, 320px); }
.live-resumen div { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.1); }
.live-resumen b { display: block; font-size: 1.5rem; }
.live-resumen span { font-size: 0.78rem; color: var(--live-suave); }

.live-sonido {
    position: absolute;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    z-index: 7;
    padding: 14px 22px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid var(--live-borde);
}

.live-toast {
    position: absolute;
    left: 50%;
    top: calc(var(--live-arriba) + 64px);
    transform: translateX(-50%);
    z-index: 12;
    max-width: 90%;
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid var(--live-borde);
}

/* ---------- Ventana pequena (apodo, reporte, confirmar) ---------- */
.live-modal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}
.live-modal__caja {
    width: 100%;
    max-width: 480px;
    padding: 18px 18px calc(var(--live-abajo) + 18px);
    border-radius: 22px 22px 0 0;
    background: #17171f;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: live-subir-hoja 0.22s ease-out;
}
.live-modal__caja h3 { margin: 0; font-size: 1.1rem; }
.live-modal__caja p { margin: 0; color: var(--live-suave); font-size: 0.9rem; line-height: 1.45; }
.live-opcion { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); cursor: pointer; font-size: 0.95rem; }
.live-opcion input { accent-color: var(--live-rojo); width: 18px; height: 18px; }
.live-fila { display: flex; gap: 10px; }
.live-fila > * { flex: 1; }

/* ---------- Pagina de lista (live.html sin id) ---------- */
.live-lista-pagina {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    background: radial-gradient(circle at 50% -20%, #3a1230 0, #0b0b10 55%);
    padding: calc(var(--live-arriba) + 16px) 16px 32px;
}
.live-lista-wrap { max-width: 980px; margin: 0 auto; }
.live-lista-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.live-lista-cab h1 { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.live-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.live-tarjeta {
    position: relative;
    display: block;
    aspect-ratio: 9 / 14;
    border-radius: 18px;
    overflow: hidden;
    background: #1b1b24;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease;
}
.live-tarjeta:hover { transform: translateY(-3px); }
.live-tarjeta img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-tarjeta__sombra { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0, rgba(0, 0, 0, 0) 55%); }
.live-tarjeta__badge { position: absolute; top: 10px; left: 10px; }
.live-tarjeta__esp { position: absolute; top: 10px; right: 10px; }
.live-tarjeta__info { position: absolute; left: 12px; right: 12px; bottom: 12px; }
.live-tarjeta__info b { display: block; font-size: 1rem; }
.live-tarjeta__info span { font-size: 0.8rem; color: var(--live-suave); }
.live-vacio { text-align: center; padding: 60px 16px; color: var(--live-suave); }
.live-vacio .live-ico-grande { font-size: 3rem; color: var(--live-rojo); display: block; margin-bottom: 12px; }

/* ---------- Animaciones ---------- */
@keyframes live-pulso { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes live-parpadeo { to { visibility: hidden; } }
@keyframes live-entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes live-subir { 0% { opacity: 1; transform: translate(0, 0) scale(0.6); } 100% { opacity: 0; transform: translate(var(--live-dx, -20px), -230px) scale(1.25); } }
@keyframes live-subir-hoja { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .live-badge::before, .live-reloj--poco, .live-flotante, .live-msg { animation: none; }
}
