/* =========================================================================
   DEFINIENDO /tv — MODO TEATRO FULLSCREEN (YOUTUBE LIVE + CHAT EN VIVO)
   ========================================================================= */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body.df-tv-body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #020202;
    color: #efefef;
    font-family: 'Anonymous Pro', monospace;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.df-tv-grain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
}
.df-tv-grain::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='turbulence' baseFrequency='3' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation: dfTvGrain 0.2s infinite steps(4);
    opacity: 0.06;
    mix-blend-mode: overlay;
}
@keyframes dfTvGrain {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-4%, 4%); }
    50%  { transform: translate(4%, -4%); }
    75%  { transform: translate(-4%, -4%); }
    100% { transform: translate(0, 0); }
}

.df-tv-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #020202;
}

/* TOPBAR */
.df-tv-topbar {
    height: 52px;
    flex: 0 0 52px;
    background: #070707;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.df-tv-top-left,
.df-tv-top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.df-tv-back-btn,
.df-tv-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #efefef;
    padding: 6px 11px;
    border-radius: 2px;
    font-family: 'Anonymous Pro', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
}
.df-tv-back-btn:hover,
.df-tv-ghost-btn:hover {
    border-color: #efefef;
    background: rgba(255, 255, 255, 0.05);
}
.df-tv-sep {
    color: #444;
    font-size: 13px;
}
.df-tv-title {
    font-size: 13px;
    font-weight: 700;
    color: #e5e5e5;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.df-tv-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}
.df-tv-pill.is-live {
    background: rgba(255, 48, 48, 0.12);
    border: 1px solid rgba(255, 48, 48, 0.45);
    color: #ff5c5c;
}
.df-tv-pill.is-test {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #efefef;
}
.df-tv-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff3b3b;
    animation: dfTvPulse 1.4s infinite ease-in-out;
}
@keyframes dfTvPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.85); }
}

/* STANDBY */
.df-tv-standby {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.df-tv-standby-card {
    width: 100%;
    max-width: 460px;
    background: #070707;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 2px solid #efefef;
    border-radius: 2px;
    padding: 34px 28px;
    text-align: center;
}
.df-tv-standby-logo {
    width: 185px;
    max-width: 70%;
    height: auto;
    display: block;
    margin: 0 auto 22px auto;
}
.df-tv-standby-kicker {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: #777;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.df-tv-standby-text {
    margin: 0 0 24px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #d6d6d6;
}
.df-tv-standby-btn,
.df-tv-btn-white {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #efefef;
    color: #020202;
    border: 1px solid #efefef;
    padding: 9px 16px;
    border-radius: 2px;
    font-family: 'Anonymous Pro', monospace;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}
.df-tv-standby-btn:hover,
.df-tv-btn-white:hover {
    background: #ffffff;
}

/* SPLIT TEATRO DESKTOP */
.df-tv-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    width: 100%;
}
.df-tv-stage {
    flex: 1 1 auto;
    min-width: 0;
    background: #020202;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.df-tv-player-frame {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.df-tv-player-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.df-tv-no-video {
    text-align: center;
    padding: 36px;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 2px;
    color: #999;
    font-size: 14px;
}

/* PANEL DERECHO DE CHAT (MISMO LENGUAJE QUE FEEDBACK DE PROYECTOS) */
.df-tv-chat-panel {
    width: 360px;
    flex: 0 0 360px;
    background: #070707;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.df-tv-main.is-chat-hidden .df-tv-chat-panel {
    display: none;
}

.df-tv-chat-head {
    height: 44px;
    flex: 0 0 44px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.df-tv-chat-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #999;
    text-transform: uppercase;
}
.df-tv-clear-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #888;
    padding: 3px 8px;
    font-family: 'Anonymous Pro', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    border-radius: 2px;
}
.df-tv-clear-btn:hover {
    border-color: #ff5555;
    color: #ff6666;
}

.df-tv-chat-stream {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #262626 transparent;
}
.df-tv-chat-empty {
    margin: auto 0;
    text-align: center;
    font-size: 12px;
    color: #555;
    letter-spacing: 0.5px;
}

.df-tv-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.df-tv-msg:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.df-tv-msg-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.df-tv-msg-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}
.df-tv-msg-author {
    font-size: 12px;
    font-weight: 700;
    color: #efefef;
}
.df-tv-msg-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #020202;
    background: #efefef;
    padding: 1px 5px;
    border-radius: 2px;
    text-transform: uppercase;
}
.df-tv-msg-time {
    font-size: 10.5px;
    color: #666;
}
.df-tv-msg-del {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #666;
    font-family: 'Anonymous Pro', monospace;
    font-size: 10px;
    cursor: pointer;
    padding: 0 2px;
}
.df-tv-msg-del:hover {
    color: #ff5555;
}
.df-tv-msg-body {
    font-size: 13.5px;
    line-height: 1.5;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-word;
    padding-left: 28px;
}

/* COMPOSER / LOGIN GATE */
.df-tv-chat-footer {
    flex: 0 0 auto;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)) 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #050505;
}
.df-tv-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.df-tv-chat-input {
    flex: 1 1 auto;
    min-height: 38px;
    max-height: 108px;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 2px;
    color: #ffffff;
    font-family: 'Anonymous Pro', monospace;
    font-size: 13.5px;
    line-height: 1.4;
    padding: 8px 10px;
    resize: none;
    outline: none;
}
.df-tv-chat-input:focus {
    border-color: rgba(255, 255, 255, 0.35);
}
.df-tv-chat-submit {
    height: 38px;
    background: #efefef;
    color: #020202;
    border: none;
    border-radius: 2px;
    padding: 0 13px;
    font-family: 'Anonymous Pro', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    flex-shrink: 0;
}
.df-tv-chat-submit:disabled {
    opacity: 0.45;
    cursor: default;
}
.df-tv-chat-err {
    margin-top: 6px;
    font-size: 11px;
    color: #ff6666;
}

.df-tv-login-gate {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.df-tv-login-gate p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: #a8a8a8;
}
.df-tv-login-actions {
    display: flex;
    gap: 8px;
}
.df-tv-login-actions > a {
    flex: 1 1 0;
    text-align: center;
    justify-content: center;
}

/* MOBILE: VIDEO 16:9 FIJO ARRIBA + CHAT SCROLLEABLE ABAJO */
@media (max-width: 991px) {
    .df-tv-desk-only {
        display: none !important;
    }
    .df-tv-topbar {
        padding: 0 12px;
        height: 48px;
        flex: 0 0 48px;
    }
    .df-tv-title {
        font-size: 12px;
    }
    .df-tv-main {
        flex-direction: column;
    }
    .df-tv-stage {
        flex: 0 0 auto;
        width: 100%;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .df-tv-player-frame {
        border: none;
        border-radius: 0;
    }
    .df-tv-chat-panel {
        width: 100%;
        flex: 1 1 auto;
        border-left: none;
    }
    .df-tv-chat-input {
        font-size: 16px;
    }
}
