:root {
    --bg-dark: #0b0d14;
    --card-bg: #141724;
    --card-border: #222738;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --live-red: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.tv-header {
    background: #111420;
    border-bottom: 1px solid var(--card-border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--live-red);
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--live-red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--live-red);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.channel-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-box {
    font-size: 13px;
    color: var(--text-muted);
    background: #171b29;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-box strong {
    color: #fff;
    font-family: monospace;
    font-size: 14px;
}

/* Main Layout */
.tv-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 20px;
    max-width: 1700px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1024px) {
    .tv-container {
        grid-template-columns: 1fr;
    }
}

/* Player Stage */
.tv-stage-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
}

#yt-player-container, #yt-player-container iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
    pointer-events: none; /* Bloquea clics, barra de controles y adelanto/retroceso de YouTube */
    user-select: none;
}

/* Escudo protector transparente sobre la pantalla de transmisión */
.tv-screen-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    background: transparent;
    cursor: pointer;
}

/* Logo Overlay / Mosca */
.tv-watermark {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s;
    max-width: 120px;
}

.tv-watermark img {
    max-width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

.tv-watermark.pos-top-right { top: 24px; right: 28px; }
.tv-watermark.pos-top-left { top: 24px; left: 28px; }
.tv-watermark.pos-bottom-right { bottom: 24px; right: 28px; }
.tv-watermark.pos-bottom-left { bottom: 24px; left: 28px; }

.watermark-text {
    font-weight: 800;
    font-size: 16px;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--live-red);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Audio Banner Notice */
.audio-notice {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 20, 32, 0.95);
    border: 1px solid var(--primary);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 10px 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 30;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    font-size: 14px;
    font-weight: 600;
}

.audio-notice:hover {
    transform: translateX(-50%) scale(1.03);
    background: var(--primary);
}

.audio-notice.hidden {
    display: none;
}

/* Stage Info Bar */
.tv-meta-bar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.now-playing-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.now-playing-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.player-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: #1e2436;
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Sidebar / EPG Guide */
.tv-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
}

.epg-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
}

/* Now playing block */
.now-box {
    background: #0f121d;
    border: 1px solid #2d354a;
    border-left: 4px solid var(--live-red);
    border-radius: 8px;
    padding: 14px;
}

.now-box-badge {
    font-size: 11px;
    font-weight: 800;
    color: var(--live-red);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
}

.now-box-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.3;
}

.progress-track {
    background: #1e2436;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--live-red);
    width: 0%;
    transition: width 1s linear;
}

.progress-times {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Upcoming list */
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upcoming-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #0f121d;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    transition: transform 0.2s, border-color 0.2s;
}

.upcoming-item:hover {
    border-color: #3b4560;
    transform: translateX(4px);
}

.upcoming-thumb {
    width: 70px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.upcoming-info {
    flex: 1;
    min-width: 0;
}

.upcoming-title {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.upcoming-time {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.time-tag {
    color: var(--primary);
    font-weight: 700;
}

/* Offline state */
.offline-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #1a1e2e 0%, #0d0f17 100%);
    text-align: center;
    padding: 40px;
}

.offline-icon {
    font-size: 54px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.offline-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.offline-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
}

/* Espectadores en vivo */
.viewer-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Zócalo / Cinta de Noticias TV (Marquee Ticker Personalizable) */
.tv-ticker-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--ticker-height, 38px);
    background: var(--ticker-bg, rgba(10, 13, 20, 0.95));
    border-top: 2px solid var(--ticker-accent, var(--live-red));
    display: flex;
    align-items: center;
    z-index: 25;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.5);
    font-size: var(--ticker-font-size, 13px);
    transition: height 0.2s ease, font-size 0.2s ease;
}

/* Variaciones de Tamaño */
.tv-ticker-bar.size-sm {
    --ticker-height: 30px;
    --ticker-font-size: 11px;
}
.tv-ticker-bar.size-md {
    --ticker-height: 38px;
    --ticker-font-size: 13px;
}
.tv-ticker-bar.size-lg {
    --ticker-height: 46px;
    --ticker-font-size: 15px;
}
.tv-ticker-bar.size-xl {
    --ticker-height: 54px;
    --ticker-font-size: 17px;
}

/* Etiqueta / Tag */
.tv-ticker-tag {
    background: var(--ticker-accent, var(--live-red));
    color: var(--ticker-tag-color, #ffffff);
    font-size: calc(var(--ticker-font-size, 13px) * 0.88);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.35);
    user-select: none;
}

/* Reloj Digital en el Zócalo */
.tv-ticker-clock {
    background: var(--ticker-clock-bg, #111827);
    color: var(--ticker-clock-color, #38bdf8);
    font-size: var(--ticker-font-size, 13px);
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.12);
    user-select: none;
    letter-spacing: 0.5px;
}

.tv-ticker-track {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.tv-ticker-text {
    display: inline-block;
    padding-left: 100%;
    animation: tv-marquee var(--ticker-duration, 26s) linear infinite;
    color: var(--ticker-text-color, #f8fafc);
    font-size: var(--ticker-font-size, 13px);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Velocidades de Desplazamiento */
.tv-ticker-bar.speed-slow .tv-ticker-text { animation-duration: 40s; }
.tv-ticker-bar.speed-normal .tv-ticker-text { animation-duration: 26s; }
.tv-ticker-bar.speed-fast .tv-ticker-text { animation-duration: 16s; }

@keyframes tv-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

@media (max-width: 640px) {
    .tv-ticker-bar {
        --ticker-height: 32px !important;
        --ticker-font-size: 11px !important;
    }
    .tv-ticker-tag {
        padding: 0 10px;
        letter-spacing: 0.5px;
    }
    .tv-ticker-clock {
        padding: 0 8px;
    }
}

/* ========================================================
   Cápsulas Dinámicas HTML5 (El Tiempo & A Continuación)
   ======================================================== */
.capsule-stage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 21;
    display: none;
    align-items: center;
    justify-content: center;
    background: #000;
}

.capsule-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 40px;
    box-sizing: border-box;
    position: relative;
    user-select: none;
    animation: capsuleFadeIn 0.5s ease-out;
}

@keyframes capsuleFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.weather-bg {
    background: radial-gradient(circle at 80% 20%, #1e3a8a 0%, #0f172a 60%, #020617 100%);
}

.upnext-bg {
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f172a 70%, #020617 100%);
}

.capsule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 12px;
}

.capsule-badge {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 1px;
}

.capsule-badge.blue {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #93c5fd;
}

.capsule-location {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.capsule-clock {
    font-size: 15px;
    font-weight: 800;
    color: #93c5fd;
    font-family: monospace;
}

/* Clima */
.weather-main-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 10px 0;
}

.weather-hero {
    display: flex;
    align-items: center;
    gap: 20px;
}

.weather-hero-icon {
    font-size: 70px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.weather-hero-data {
    display: flex;
    flex-direction: column;
}

.weather-temp {
    font-size: 64px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -2px;
}

.weather-temp span {
    font-size: 32px;
    color: #38bdf8;
    margin-left: 2px;
}

.weather-condition {
    font-size: 18px;
    color: #cbd5e1;
    font-weight: 600;
    margin-top: 4px;
}

.weather-meta-pills {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weather-pill {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.pill-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.pill-val {
    font-size: 15px;
    color: #fff;
}

/* Pronóstico 3 días */
.weather-forecast-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 8px;
}

.forecast-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.forecast-day {
    font-size: 13px;
    font-weight: 700;
    color: #93c5fd;
    text-transform: uppercase;
}

.forecast-icon {
    font-size: 26px;
}

.forecast-temps {
    display: flex;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.f-max { color: #f87171; }
.f-min { color: #38bdf8; }

.forecast-desc {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.capsule-footer-bar {
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 8px;
    text-align: center;
}

/* A Continuación */
.upnext-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex: 1;
}

.upnext-title-tag {
    font-size: 18px;
    font-weight: 900;
    color: #38bdf8;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.upnext-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    border-radius: 14px;
    padding: 16px 20px;
    max-width: 650px;
    width: 100%;
}

.upnext-thumb-wrap {
    position: relative;
    width: 180px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #38bdf8;
}

.upnext-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upnext-time-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,0.85);
    color: #38bdf8;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.upnext-info {
    flex: 1;
    min-width: 0;
}

.upnext-program-title {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.upnext-program-sub {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .capsule-screen { padding: 16px; }
    .weather-temp { font-size: 40px; }
    .weather-hero-icon { font-size: 42px; }
    .upnext-card { flex-direction: column; text-align: center; }
    .upnext-thumb-wrap { width: 140px; }
}


