﻿/* Midnight Static TV Guide - 90s Retro Styling */

/* ========================================
   CUSTOMIZABLE VARIABLES - TWEAK THESE!
   ======================================== */
:root {
    /* Midnight Static signature palette */
    --tv-background: #000000;
    --grid-surface: linear-gradient(135deg, #000000 0%, #631BA8 100%);
    --header-gradient: linear-gradient(90deg, #631BA8 0%, #00B5FF 50%, #631BA8 100%);
    --time-marker-color: #F9D326;
    --time-divider-color: rgba(249, 211, 38, 0.45);
    --channel-badge-gradient: linear-gradient(180deg, #00B5FF 0%, #1CDE02 100%);
    --channel-badge-border: #FFFFFF;
    --channel-text-glow: rgba(0, 181, 255, 0.55);
    --program-blue: #00B5FF;
    --program-green: #1CDE02;
    --program-purple: #631BA8;
    --program-gold: #F9D326;
    --program-offline: #1a1a1a;
    --program-border: rgba(0, 181, 255, 0.35);
    --program-border-strong: rgba(255, 255, 255, 0.75);
    --text-primary: #FFFFFF;
    --text-secondary: #F9D326;
    --text-muted: #F57D0D;
    --text-color: var(--text-primary);
    --secondary-color: #F57D0D;
    --channel-scanline-color: rgba(28, 222, 2, 0.12);

    /* Layout metrics */
    --channel-row-height: 68px;
    --channel-info-width: 220px;
    --channel-name-width: calc(var(--channel-info-width) - 58px);
    --program-block-min-width: 120px;
    --time-slot-minutes: 30;
    --time-block-count: 5;

    /* Typography */
    --font-family-main: 'Share Tech Mono', monospace;
    --font-family-display: 'Orbitron', sans-serif;
    --font-size-channel-name: 13px;
    --font-size-channel-number: 15px;
    --font-size-program-title: 13px;
    --font-size-program-time: 11px;

    /* Transitions / effects */
    --transition-speed: 0.25s;
    --glow-strong: 0 0 14px rgba(0, 181, 255, 0.85);
    --glow-soft: 0 0 9px rgba(0, 181, 255, 0.55);

    /* Cable-guide raised blocks: light top/left edge + grey drop shadow */
    --guide-block-raised-shadow:
        inset 1px 1px 0 rgba(255, 255, 255, 0.3),
        inset -1px -1px 0 rgba(0, 0, 0, 0.55),
        2px 2px 0 rgba(40, 40, 40, 0.55),
        3px 3px 8px rgba(0, 0, 0, 0.42);
    --guide-block-raised-shadow-strong:
        inset 1px 1px 0 rgba(255, 255, 255, 0.36),
        inset -1px -1px 0 rgba(0, 0, 0, 0.62),
        3px 3px 0 rgba(35, 35, 35, 0.6),
        4px 4px 10px rgba(0, 0, 0, 0.48);

    /* Legacy blur hooks now default to crisp display */
    --blur-header-text: 0px;
    --blur-info-box: 0px;
    --blur-time-display: 0px;
    --blur-ticker: 0px;
    --blur-nav-instructions: 0px;
    --blur-logo: 0px;
    --blur-channel-row: 0px;
    --blur-channel-name: 0px;
    --blur-program-title: 0px;
    --blur-program-time: 0px;
    --blur-channel-number: 0px;

    /* Panel fade (loading.css + guide grid) */
    --panel-fade-top: rgba(42, 16, 85, 0.78);
    --panel-fade-mid: rgba(26, 14, 46, 0.52);
    --panel-fade-bottom: rgba(4, 18, 45, 0);
    --panel-fade-solid: rgba(26, 14, 46, 0.58);
    --logo-glow-color: rgba(180, 130, 255, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Loading/Landing Page Styles */
.loading-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    gap: 40px;
    padding: 40px;
}

.loading-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-logo {
    height: 120px;
    width: auto;
    filter: brightness(0) invert(1);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

.loading-logo.breathing {
    animation: logoBreath 2s ease-in-out infinite alternate;
}

@keyframes logoBreath {
    0% { 
        filter: drop-shadow(0 0 20px #57048f);
        transform: scale(1);
    }
    100% { 
        filter: drop-shadow(0 0 30px #57048f);
        transform: scale(1.05);
    }
}

.loading-tagline {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    opacity: 0.8;
}

.loading-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: 400px;
}

.loading-bar {
    width: 100%;
    height: 20px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(99, 27, 168, 0.85) 100%);
    border: 2px solid #00B5FF;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 181, 255, 0.3);
}

.loading-fill {
    height: 100%;
    background: linear-gradient(135deg, #00B5FF 0%, #631BA8 50%, #1CDE02 100%);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 181, 255, 0.5);
}

.loading-percentage {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 300px;
}

.loading-step {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 5px rgba(0, 181, 255, 0.3);
    transition: all 0.3s ease;
    opacity: 0.5;
}

.loading-step.active {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    opacity: 1;
    transform: translateX(10px);
}

.loading-step.completed {
    color: #1CDE02;
    text-shadow: 0 0 5px rgba(28, 222, 2, 0.6);
    opacity: 0.8;
}

.loading-animation {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-dots {
    display: flex;
    gap: 5px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

.loading-status {
    text-align: center;
    min-height: 20px;
}

.status-text {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
}

/* Responsive Design for Loading Page */
@media (max-width: 768px) {
    .loading-screen {
        gap: 30px;
    padding: 20px;
    }
    
    .loading-logo {
        height: 80px;
    }
    
    .loading-tagline {
        font-size: 16px;
        letter-spacing: 1px;
    }
    
    .loading-progress {
        min-width: 300px;
    }
    
    .loading-steps {
        min-width: 250px;
    }
}


body {
    font-family: var(--font-family-main);
    background: var(--tv-background);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* CRT Screen Effect */
.crt-screen {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
    overflow: hidden;
    padding: 0;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(28, 222, 2, 0.05) 2px,
        rgba(28, 222, 2, 0.05) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

.screen-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Header Styling */
.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    background: var(--header-gradient);
    border: none;
    border-radius: 0;
    box-shadow: none;
    text-shadow: none;
    min-height: 86px;
    margin: 0;
    position: relative;
}

.header-left {
    flex: 0 0 auto;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
}

.header-center {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    flex: 0 0 auto;
    max-width: 150px;
}

.header-center .logo {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
}

/* Breathing Effect */
.breathing {
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {
    0% { opacity: 0.8; text-shadow: 0 0 5px #57048f; }
    50% { opacity: 1; text-shadow: 0 0 15px rgba(255, 255, 255, 1); }
    100% { opacity: 0.8; text-shadow: 0 0 5px #57048f; }
}

.header-left .date-display {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    color: var(--text-color);
    text-shadow: 0 0 8px var(--channel-text-glow);
    filter: blur(var(--blur-header-text));
}

.header-right .signal-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.signal-bars {
    display: flex;
    gap: 3px;
    align-items: end;
}

.signal-bars .bar {
    width: 4px;
    background: #fff;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: signalPulse 2s ease-in-out infinite;
}

.signal-bars .bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.signal-bars .bar:nth-child(2) { height: 12px; animation-delay: 0.2s; }
.signal-bars .bar:nth-child(3) { height: 16px; animation-delay: 0.4s; }

@keyframes signalPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.signal-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--text-color);
    text-shadow: 0 0 5px var(--channel-text-glow);
    filter: blur(var(--blur-header-text));
}

/* Info Section */
.info-section {
    display: flex;
    gap: 20px;
    margin: 0;
    align-items: stretch;
    min-height: 260px;
}

.info-box, .commercial-box {
    flex: 1;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(99, 27, 168, 0.85) 100%);
    border: none;
    border-radius: 0;
    padding: 18px;
    box-shadow: none;
    filter: blur(var(--blur-info-box));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.commercial-box {
    align-items: center;
    overflow: hidden;
}

.info-title, .commercial-title {
    font-family: var(--font-family-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-shadow: none;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(180, 130, 255, 0.25);
    padding-bottom: 3px;
    filter: none;
}

.current-time {
    font-family: var(--font-family-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: none;
    margin-bottom: 14px;
    filter: none;
}

.timezone-info {
    font-family: var(--font-family-main);
    font-size: 11px;
    color: var(--text-muted);
    text-shadow: none;
    margin-bottom: 5px;
    opacity: 0.9;
    filter: none;
}

.current-program {
    font-family: var(--font-family-main);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: none;
    filter: none;
}

.current-channel {
    font-family: var(--font-family-main);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-shadow: none;
    margin-top: 2px;
}

.current-window {
    font-family: var(--font-family-main);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    letter-spacing: 0.4px;
}

.commercial-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    height: 100%;
}

.commercial-video-frame {
    position: relative;
    width: clamp(240px, 35vw, 420px);
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 4 / 3;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(0, 181, 255, 0.45);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.commercial-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.ticker-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* News Ticker */
.news-ticker {
    background: linear-gradient(90deg, rgba(42, 16, 85, 0.92) 0%, rgba(4, 18, 45, 0.88) 50%, rgba(42, 16, 85, 0.92) 100%);
    border: none;
    border-radius: 0;
    height: 35px;
    overflow: hidden;
    position: relative;
    box-shadow: none;
    margin: 0;
}

.ticker-content {
    display: inline-flex;
    align-items: center;
    height: 100%;
    width: max-content;
    max-width: none;
    white-space: nowrap;
    animation: scroll-ticker 20s linear infinite;
    will-change: transform;
}

.ticker-item {
    font-family: var(--font-family-main);
    font-size: 14px;
    color: var(--text-primary);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
    padding: 0;
    flex-shrink: 0;
    text-decoration: none;
    filter: blur(var(--blur-ticker));
}

a.ticker-item-link {
    color: inherit;
    cursor: pointer;
}

a.ticker-item-link:hover,
a.ticker-item-link:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.news-ticker:hover .ticker-content,
.news-ticker:focus-within .ticker-content {
    animation-play-state: paused;
}

.ticker-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 14px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    line-height: 1;
}

@keyframes scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--ticker-distance, 50%)));
    }
}

/* TV Guide Grid */
.tv-guide-container {
    flex: 1;
    background: var(--grid-surface);
    border: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    overflow: hidden;
    --guide-window-minutes: calc(var(--time-block-count) * var(--time-slot-minutes));
    --time-track-width: calc(var(--time-block-count) * 220px);
}

.time-header {
    position: sticky;
    top: 0;
    z-index: 6;
    background: linear-gradient(180deg, rgba(42, 16, 85, 0.88) 0%, rgba(4, 18, 45, 0.82) 100%);
}

.time-header-inner {
    display: grid;
    grid-template-columns: var(--channel-info-width) 1fr;
    align-items: stretch;
    border-bottom: 1px solid rgba(180, 130, 255, 0.22);
    width: 100%;
}

.time-label {
    font-family: var(--font-family-display);
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-align: center;
    padding: 6px 8px;
    border-right: 1px solid rgba(180, 130, 255, 0.22);
    text-transform: uppercase;
    text-shadow: var(--glow-soft);
    position: sticky;
    left: 0;
    z-index: 7;
    background: inherit;
    width: var(--channel-info-width);
    min-width: var(--channel-info-width);
}

.time-track-wrapper {
    position: relative;
    overflow: hidden;
}

.time-scale {
    display: grid;
    grid-template-columns: repeat(var(--time-block-count), minmax(0, 1fr));
    grid-auto-flow: column;
    grid-auto-rows: auto;
    position: relative;
    gap: 0;
    width: var(--time-track-width);
    min-width: var(--time-track-width);
    will-change: transform;
}

.time-marker {
    position: relative;
    font-family: var(--font-family-main);
    font-size: 12px;
    color: var(--time-marker-color);
    text-align: center;
    letter-spacing: 0.5px;
    padding-bottom: 6px;
}

.time-marker::before {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 11px;
    background: var(--time-divider-color);
}

.time-scale::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: -14px;
    left: 0;
    right: 0;
    background-image: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent calc(100% / var(--time-block-count)),
        var(--time-divider-color) calc(100% / var(--time-block-count)),
        var(--time-divider-color) calc(100% / var(--time-block-count) + 1px)
    );
    background-size: auto;
    opacity: 0.35;
    pointer-events: none;
}

.channels-container {
    display: block;
    max-height: calc((var(--channel-row-height) + 12px) * 5);
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-y pinch-zoom;
}

.channels-container::-webkit-scrollbar {
    display: none;
}

.channels-container::-webkit-scrollbar-thumb {
    background: transparent;
}

.channel-row {
    position: relative;
    display: grid;
    grid-template-columns: var(--channel-info-width) 1fr;
    background: rgba(26, 14, 46, 0.72);
    border: 1px solid rgba(180, 130, 255, 0.18);
    box-shadow: var(--guide-block-raised-shadow);
    backdrop-filter: none;
    transition: background var(--transition-speed) ease;
    cursor: pointer;
    margin-bottom: 8px;
    min-width: calc(var(--channel-info-width) + var(--time-track-width));
}

.channel-row:hover {
    transform: none;
    background: rgba(42, 16, 85, 0.78);
    box-shadow: var(--guide-block-raised-shadow-strong);
}

.channel-row.selected {
    outline: 1px solid rgba(196, 181, 253, 0.55);
    box-shadow: var(--guide-block-raised-shadow), inset 0 0 16px rgba(91, 33, 182, 0.25);
}

.channel-info {
    display: flex;
    align-items: stretch;
    border-right: 1px solid rgba(180, 130, 255, 0.18);
    position: relative;
    overflow: hidden;
    position: sticky;
    left: 0;
    z-index: 4;
    background: rgba(4, 18, 45, 0.72);
    width: var(--channel-info-width);
}

.channel-number-badge {
    width: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--channel-badge-gradient);
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: none;
}

.channel-number {
    font-family: var(--font-family-display);
    font-size: var(--font-size-channel-number);
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: none;
}

.channel-meta {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.channel-name {
    font-family: var(--font-family-main);
    font-size: var(--font-size-channel-name);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-shadow: var(--glow-soft);
}

.channel-name.multi-line {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.channel-name.single-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-name-top {
    font-weight: 600;
}

.channel-name-bottom {
    font-weight: 400;
}

.programs-row {
    position: relative;
    height: var(--channel-row-height);
    padding: 6px 0;
    overflow: hidden;
    width: var(--time-track-width);
    min-width: var(--time-track-width);
}

.channel-row::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: var(--channel-info-width);
    background-image: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent calc(100% / var(--time-block-count)),
        rgba(180, 130, 255, 0.08) calc(100% / var(--time-block-count)),
        rgba(180, 130, 255, 0.08) calc(100% / var(--time-block-count) + 1px)
    );
    background-size: auto;
    pointer-events: none;
}

.program-block {
    position: absolute;
    top: 6px;
    bottom: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 8px 14px;
    background: var(--program-blue);
    color: var(--text-primary);
    min-width: var(--program-block-min-width);
    box-shadow: var(--guide-block-raised-shadow);
    border: 1px solid var(--program-border);
    transition: border-color var(--transition-speed) ease, background var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.program-block:hover,
.program-block.selected {
    transform: none;
    box-shadow: var(--guide-block-raised-shadow-strong);
    border-color: var(--program-border-strong);
}

.program-block.weather-program {
    background: var(--program-purple);
}

.program-block.static-program {
    background: var(--program-green);
}

.program-block.shopping-program {
    background: var(--program-gold);
    color: var(--text-primary);
    text-shadow: none;
}

.program-block.offline-program {
    background: var(--program-offline);
    color: rgba(255, 255, 255, 0.6);
    border-style: dashed;
}

.program-block.now-playing {
    border: 2px solid #1CDE02 !important;
    box-shadow: var(--guide-block-raised-shadow), inset 0 0 10px rgba(28, 222, 2, 0.15);
    background: linear-gradient(135deg, rgba(28, 222, 2, 0.08) 0%, rgba(99, 27, 168, 0.25) 100%);
}

.program-block.stream-live {
    animation: none;
}

@keyframes pulse-live {
    0%, 100% { box-shadow: inset 0 0 14px rgba(91, 33, 182, 0.22); }
    50% { box-shadow: inset 0 0 18px rgba(139, 92, 246, 0.35); }
}

.program-title {
    font-family: var(--font-family-main);
    font-size: var(--font-size-program-title);
    font-weight: 600;
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
    margin-bottom: 4px;
}

.program-time {
    font-family: var(--font-family-main);
    font-size: var(--font-size-program-time);
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.program-duration {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: #F57D0D;
    margin-top: 1px;
    font-weight: bold;
    text-shadow: 0 0 2px var(--channel-text-glow);
}

/* Navigation Instructions */
.nav-instructions {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 12px 18px;
    margin: 0;
    background: linear-gradient(90deg, rgba(42, 16, 85, 0.88) 0%, rgba(4, 18, 45, 0.82) 50%, rgba(42, 16, 85, 0.88) 100%);
    border-top: 1px solid rgba(180, 130, 255, 0.2);
    box-shadow: none;
    text-transform: uppercase;
}

.nav-item {
    font-family: var(--font-family-display);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-shadow: var(--glow-soft);
}

@media (max-width: 1200px) {
    :root {
        --channel-info-width: 220px;
        --channel-name-width: calc(var(--channel-info-width) - 58px);
    }

    .channels-container {
        max-height: 560px;
    }
}

@media (max-width: 768px) {
    :root {
        --channel-row-height: 72px;
        --channel-info-width: 140px;
        --channel-name-width: calc(var(--channel-info-width) - 58px);
    }

    .tv-guide-container {
        padding: 14px 12px 10px;
        border-width: 2px;
        overflow-x: auto;
    }

    .time-header {
        overflow: hidden;
    }

    .channels-container {
        padding-right: 0;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: none;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .channels-container::-webkit-scrollbar {
        display: none;
    }

    .tv-guide-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .tv-guide-container::-webkit-scrollbar {
        display: none;
    }

    .time-header {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .time-header::-webkit-scrollbar {
        display: none;
    }

    .channel-row {
        grid-template-columns: var(--channel-info-width) 1fr;
        min-width: calc(var(--channel-info-width) + var(--time-track-width));
    }

    .channel-info {
        flex-direction: row;
        align-items: stretch;
        border-right: 1px solid rgba(0, 181, 255, 0.25);
        border-bottom: none;
        padding: 0;
        gap: 0;
        width: var(--channel-info-width);
    }

    .channel-name {
        text-align: left;
        width: 100%;
    }

    .guide-page .channel-name,
    .guide-page .channel-name.multi-line,
    .guide-page .channel-name.single-line {
        text-align: center;
    }

    .program-block {
        padding: 6px 14px 6px 12px;
    }

    .program-title {
        font-size: 12px;
    }

    .program-time {
        font-size: 10px;
    }

    .nav-instructions {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .time-header {
        display: block;
        align-items: stretch;
        min-width: 0;
        overflow: hidden;
        gap: 0;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .time-header::-webkit-scrollbar {
        display: none;
    }

    .time-header-inner {
        grid-template-columns: var(--channel-info-width) 1fr;
        min-width: 100%;
    }
    
    .time-label {
        flex: 0 0 var(--channel-info-width);
        border-right: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .time-scale {
        flex: 1 0 auto;
        display: flex;
        flex-wrap: nowrap;
        min-width: var(--time-track-width);
    }

    .time-marker {
        flex: 0 0 calc(var(--time-track-width) / var(--time-block-count));
        min-width: 0;
    }
}

@media (max-width: 540px) {
    :root {
        --channel-info-width: 120px;
        --channel-name-width: calc(var(--channel-info-width) - 56px);
    }

    .time-label {
        font-size: 11px;
    }

    .channel-number-badge {
        width: var(--channel-info-width);
    }

    .channel-slug {
        font-size: 10px;
    }

    .channel-name {
        font-size: 11px;
        letter-spacing: 0.4px;
    }

    .program-block {
        padding: 6px 10px 6px 10px;
    }
}

/* Channel View */
.channel-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.channel-view.hidden {
    display: none;
}

.channel-logo-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2001;
    animation: logoFade 4s ease-in-out infinite;
}

.logo-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    letter-spacing: 3px;
}

@keyframes logoFade {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.channel-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2001;
}

.control-btn {
    font-family: var(--font-family-display);
    font-size: 13px;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(0, 181, 255, 0.9) 0%, rgba(99, 27, 168, 0.95) 100%);
    border: 2px solid rgba(0, 181, 255, 0.55);
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    text-shadow: var(--glow-soft);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.65);
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(245, 125, 13, 0.95) 0%, rgba(99, 27, 168, 0.95) 100%);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

/* Mobile Portrait Layout - No Auto-Rotation */
@media (max-width: 768px) and (orientation: portrait) {
    /* Force portrait orientation - no rotation */
    html, body {
        min-height: 100vh;
        overflow-x: hidden;
        position: relative;
        width: 100%;
        transform: none;
    }
    
    .crt-screen {
        width: 100vw;
        height: 100vh;
        padding: 5px;
    display: flex;
        flex-direction: column;
    }
    
    .screen-content {
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 10px;
        gap: 8px;
    }
    
    /* Compact header for mobile portrait */
    .tv-header {
        min-height: 70px;
        padding: 10px 14px;
        gap: 10px;
        flex-shrink: 0;
    }
    
    .header-center .logo-container {
        gap: 6px;
    }
    
    .logo-image {
        height: 40px;
    }
    
    .logo-text {
        font-size: 12px;
    }
    
    .header-left .date-display {
        font-size: 14px;
    }
    
    .header-right .signal-status {
        scale: 0.8;
    }
    
    
    .news-ticker {
        height: 25px;
        font-size: 10px;
        flex-shrink: 0;
    }
    
    /* Info section adjustments */
    .info-section {
        flex-direction: column;
        gap: 14px;
        height: auto;
        min-height: auto;
    }
    
    .info-box {
        padding: 18px;
        min-height: 160px;
    }

    .commercial-box {
        display: none;
    }
    
    .info-title, .commercial-title {
        font-size: 11px;
    }
    
    .current-time {
        font-size: 20px;
    }
    
    .current-program {
        font-size: 12px;
    }
    
    /* Mobile TV Guide - keep horizontal grid with locked channel column */
    .tv-guide-container {
        flex: 1;
        padding: 8px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    
    .time-header {
        overflow: hidden;
        flex-shrink: 0;
    }
    
    .time-header-inner {
        display: grid;
        grid-template-columns: 100px 1fr;
        overflow: hidden;
        margin-bottom: 0;
        flex-shrink: 0;
        min-width: 0;
    }

    .time-track-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .time-label {
        width: 100px;
        min-width: 100px;
        font-size: 10px;
        flex-shrink: 0;
    }
    
    .time-marker {
        font-size: 9px;
    }
    
    .channels-container {
        display: block;
        flex: 1;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .channels-container::-webkit-scrollbar {
        display: none;
    }
    
    .channel-row {
        display: grid;
        grid-template-columns: 100px minmax(0, 1fr);
        min-height: 56px;
        margin-bottom: 3px;
        padding: 0;
        gap: 0;
    }
    
    .channel-info {
        width: 100px;
        min-width: 100px;
        padding: 4px 5px;
        position: sticky;
        left: 0;
        z-index: 4;
    }

    .programs-scroll {
        overflow-x: auto;
        min-width: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .programs-row {
        position: relative;
        height: 56px;
        min-height: 56px;
        padding: 3px 0;
    }
    
    .program-block {
        padding: 6px;
    }
    
    .program-title {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 2px;
    }
    
    .program-time {
        font-size: 8px;
    }
    
    /* Mobile navigation */
    .nav-instructions {
        gap: 15px;
        padding: 6px;
        flex-shrink: 0;
        font-size: 9px;
    }
    
    .nav-item {
        font-size: 9px;
    }
    
    .control-btn {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Mobile Landscape - Prevent auto-rotation */
@media (max-width: 768px) and (orientation: landscape) {
    /* Prevent auto-rotation by maintaining portrait-like proportions */
    .crt-screen {
        transform: rotate(0deg);
        height: 100vh;
        width: 100vw;
    }
    
    /* Keep the existing mobile styles but prevent landscape behavior */
    .tv-header {
        height: 60px;
        padding: 10px;
        gap: 10px;
    }
    
    .header-left .logo-container {
        gap: 8px;
    }
    
    .logo-image {
        height: 30px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .header-center .date-display {
    font-size: 16px;
    }
    
    .info-section {
        gap: 16px;
        height: auto;
    }
    
    .info-box, .commercial-box {
        padding: 18px;
        min-height: 160px;
    }
    
    .info-title, .commercial-title {
        font-size: 12px;
    }
    
    .current-time {
        font-size: 20px;
    }
    
    .tv-guide-container {
        padding: 10px;
    }
    
    .time-label {
        width: 100px;
        font-size: 12px;
    }
    
    .time-marker {
        font-size: 10px;
    }
    
    .channel-info {
        width: 100px;
        gap: 6px;
    }
    
    .channel-number {
        font-size: 10px;
        width: 18px;
    }
    
    .channel-logo {
        font-size: 9px;
        width: 35px;
    }
    
    .channel-name {
        font-size: 10px;
    }
    
    .program-block {
        padding: 6px;
        grid-column: var(--grid-start, 1) / span var(--grid-span, 1);
    }
    
    .program-title {
        font-size: 9px;
    }
    
    .program-time {
        font-size: 8px;
    }
    
    .nav-instructions {
        gap: 20px;
        padding: 8px;
    }
    
    .nav-item {
        font-size: 10px;
    }
    
    .control-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Glow Effects */
.tv-header, .info-box, .commercial-box, .tv-guide-container, .control-btn {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.tv-header:hover, .info-box:hover, .commercial-box:hover, .tv-guide-container:hover {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
}

/* Game Station Styles */
.game-station {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    color: #fff;
    font-family: 'VT323', monospace;
}

.game-header {
    background: linear-gradient(135deg, #631BA8 0%, #00B5FF 100%);
    border-bottom: 2px solid #00B5FF;
    padding: 20px;
    text-align: center;
}

.game-header h1 {
    font-size: 32px;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.game-header p {
    font-size: 16px;
    margin: 10px 0 0 0;
    opacity: 0.8;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.game-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(99, 27, 168, 0.85) 100%);
    border: 2px solid rgba(0, 181, 255, 0.6);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    background: linear-gradient(135deg, rgba(245, 125, 13, 0.25) 0%, rgba(99, 27, 168, 0.9) 100%);
    box-shadow: 0 0 20px rgba(0, 181, 255, 0.35);
    transform: scale(1.02);
}

.game-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.game-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #F9D326;
}

.game-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 15px;
}

.game-status {
    font-size: 12px;
    color: #1CDE02;
    text-shadow: 0 0 5px rgba(28, 222, 2, 0.6);
}

.game-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    z-index: 1000;
}

/* Channel View Styles */
.channel-view {
    position: relative;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    display: flex;
        flex-direction: column;
    justify-content: center;
    align-items: center;
}

.channel-logo-display {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: logoBlink 3s ease-in-out infinite;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    z-index: 1000;
}

.channel-logo-img {
    height: 60px;
    width: auto;
    filter: brightness(0) invert(1);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
}

.channel-name-display {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    margin-top: 10px;
    text-align: center;
}

@keyframes logoBlink {
    0%, 70% { opacity: 1; }
    75%, 95% { opacity: 0.3; }
    100% { opacity: 1; }
}

.channel-nav-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    z-index: 1000;
}

.nav-button {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(99, 27, 168, 0.85) 100%);
    border: 2px solid #00B5FF;
    border-radius: 0;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 181, 255, 0.3);
}

.nav-button:hover {
    background: linear-gradient(135deg, rgba(245, 125, 13, 0.3) 0%, rgba(99, 27, 168, 0.9) 100%);
    box-shadow: 0 0 20px rgba(0, 181, 255, 0.4);
    transform: scale(1.05);
}

.button-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #F9D326;
    text-shadow: 0 0 8px rgba(0, 181, 255, 0.5);
}

.channel-info-display {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(10, 10, 14, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0;
    padding: 14px 16px;
    box-shadow: none;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    z-index: 1000;
}

.channel-info-display .program-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
}

.channel-info-display .program-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #1CDE02;
    text-shadow: none;
}

.channel-info-display .program-channel-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: #fff;
    margin-top: 6px;
}

.channel-info-display .program-type {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 4px;
}

.program-title {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
}

.program-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
}

.program-type {
    font-family: 'VT323', monospace;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
    margin-top: 5px;
    opacity: 0.8;
}

/* Video Player Styles */
.channel-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Disable all video controls */
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Hide video controls completely */
.channel-video::-webkit-media-controls {
    display: none !important;
}

.channel-video::-webkit-media-controls-panel {
    display: none !important;
}

.channel-video::-webkit-media-controls-play-button {
    display: none !important;
}

.channel-video::-webkit-media-controls-timeline {
    display: none !important;
}

.channel-video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.channel-video::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

.channel-video::-webkit-media-controls-mute-button {
    display: none !important;
}

.channel-video::-webkit-media-controls-volume-slider {
    display: none !important;
}

.channel-video::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

.channel-video {
    /* Fill the screen; crop edges rather than letterboxing */
    object-fit: cover;
    object-position: center center;
    background: #000;
    z-index: 1;
}

.no-video-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
        text-align: center;
    color: #fff;
    font-family: 'Orbitron', monospace;
    z-index: 2;
}

.no-video-message h2 {
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.no-video-message p {
    font-size: 16px;
    opacity: 0.8;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
}

/* Logo Text Styling */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 210px;
    height: 100%;
    overflow: visible;
}

.logo-image {
    height: 56px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: brightness(0) invert(1) drop-shadow(0 0 18px rgba(0, 181, 255, 0.6));
    animation: logoBreath var(--logo-breath-speed) ease-in-out infinite alternate;
}

@keyframes logoBreath {
    0% { 
        filter: brightness(0) invert(1) drop-shadow(0 0 15px var(--logo-glow-color));
        transform: scale(1);
    }
    100% { 
        filter: brightness(0) invert(1) drop-shadow(0 0 25px var(--logo-glow-color));
        transform: scale(var(--logo-breath-scale));
    }
}

.logo-text {
    font-family: 'Orbitron', monospace;
        font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 10px #8b5cf6;
    letter-spacing: 2px;
}

/* CRT Scanlines Effect */
.crt-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        var(--scanline-color) 2px,
        var(--scanline-color) 4px
    );
    animation: scanlines var(--scanline-speed) linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Channel Row Scanlines */
.channel-row {
    position: relative;
    overflow: hidden;
    filter: blur(var(--blur-channel-row));
}

.channel-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        var(--channel-scanline-color) 1px,
        var(--channel-scanline-color) 2px
    );
    animation: channelScanlines var(--channel-scanline-speed) linear infinite;
}

@keyframes channelScanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(2px); }
}

/* Program Info Display */
.program-info {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(99, 27, 168, 0.9) 100%);
    border: 2px solid #00B5FF;
    border-radius: 10px;
    padding: 20px;
    min-width: 400px;
    max-width: 600px;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(0, 181, 255, 0.3);
    filter: blur(var(--blur-info-box));
}

.program-info.hidden {
    display: none;
}

.program-info-content {
    text-align: center;
}

.program-title-display {
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 700;
    color: #1CDE02;
    text-shadow: 0 0 10px rgba(28, 222, 2, 0.5);
    margin-bottom: 15px;
    filter: blur(var(--blur-info-box));
}

.program-details {
    display: flex;
        flex-direction: column;
    gap: 8px;
}

.program-channel {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #ffffff;
    font-weight: 700;
    filter: blur(var(--blur-info-box));
}

.program-time {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #F9D326;
    filter: blur(var(--blur-info-box));
}

.program-description {
    font-family: 'VT323', monospace;
    font-size: 12px;
    color: #ffffff;
    opacity: 0.8;
    margin-top: 10px;
    filter: blur(var(--blur-info-box));
}

/* Static Channel Program Styling */
.static-program,
.program-block.static-program {
    background: rgba(91, 33, 182, 0.82);
    border: 1px solid rgba(180, 130, 255, 0.35);
    box-shadow: var(--guide-block-raised-shadow);
}

.static-program:hover,
.static-program.selected,
.program-block.static-program:hover,
.program-block.static-program.selected {
    background: rgba(107, 33, 168, 0.88);
    border-color: rgba(196, 181, 253, 0.55);
    box-shadow: var(--guide-block-raised-shadow-strong);
    transform: none;
    filter: none !important;
}

.static-program .program-title,
.program-block.static-program .program-title {
    color: var(--text-primary);
    text-shadow: none;
}

.static-program .program-time,
.program-block.static-program .program-time {
    color: var(--text-muted);
    text-shadow: none;
}

/* Shopping Channel Program */
.shopping-program,
.program-block.shopping-program {
    background: rgba(140, 95, 45, 0.88);
    border: 1px solid rgba(180, 130, 255, 0.28);
    box-shadow: var(--guide-block-raised-shadow);
}

.shopping-program:hover,
.shopping-program.selected,
.program-block.shopping-program:hover,
.program-block.shopping-program.selected {
    background: rgba(160, 110, 55, 0.92);
    border-color: rgba(196, 181, 253, 0.45);
    box-shadow: var(--guide-block-raised-shadow-strong);
    transform: none;
    filter: none !important;
}

.shopping-program .program-title,
.program-block.shopping-program .program-title {
    color: var(--text-primary);
    text-shadow: none;
}

.shopping-program .program-time,
.program-block.shopping-program .program-time {
    color: var(--text-muted);
    text-shadow: none;
}

/* Remote control button styles removed - only game controllers supported */

/* QR Code Modal */
/* QR modal styles removed - only game controllers supported */

.qr-close-button {
    background: #F57D0D;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.qr-close-button:hover {
    background: #ff8c5a;
    transform: scale(1.05);
}

/* Unified top bar + now playing / preview panel */
.top-bar {
    display: flex;
    flex-direction: column;
    background: var(--header-gradient);
    border: none;
    border-bottom: 1px solid rgba(180, 130, 255, 0.2);
    overflow: hidden;
    flex-shrink: 0;
}

.top-bar .news-ticker {
    border: none;
    margin: 0;
    border-radius: 0;
}

.info-section.nowplay-preview {
    display: flex;
    margin: 0;
    height: 300px;
    min-height: 300px;
    max-height: 300px;
    flex: 0 0 300px;
    gap: 0;
    background: linear-gradient(
        to right,
        rgb(72, 22, 118) 0%,
        rgb(52, 18, 92) 22%,
        rgb(28, 10, 48) 38%,
        rgb(12, 4, 20) 46%,
        #000000 52%,
        #000000 100%
    );
    border: none;
    overflow: hidden;
}

.info-section.nowplay-preview .info-box,
.info-section.nowplay-preview .commercial-box {
    background: transparent;
    border: none;
    box-shadow: none;
    align-items: stretch;
    justify-content: flex-start;
    height: auto;
}

.info-section.nowplay-preview .info-box {
    flex: 1;
    padding: 18px 20px;
    border-right: none;
}

.info-section.nowplay-preview .commercial-box {
    flex: 1.15;
    padding: 0;
    position: relative;
    overflow: hidden;
    background: #000;
}

.info-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 34%);
    gap: 16px;
    align-items: stretch;
    width: 100%;
}

.info-body.has-poster {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 38%);
}

.info-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    width: 100%;
    align-items: flex-start;
}

.program-poster-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    min-height: 0;
}

.program-poster-frame[hidden] {
    display: none !important;
}

.program-poster-frame img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.info-body.has-channel-graphic {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 1.45fr);
    gap: 10px;
}

.info-body.has-channel-graphic .program-poster-frame.channel-graphic {
    width: 100%;
    min-width: 0;
    max-width: none;
    justify-content: center;
    align-items: center;
    align-self: center;
}

.info-body.has-channel-graphic .program-poster-frame.channel-graphic img {
    max-height: 100%;
    max-width: min(280px, 92%);
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
}

.program-description {
    font-family: var(--font-family-main);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.78);
    margin-top: 6px;
    line-height: 1.35;
}

.info-section.nowplay-preview .commercial-content {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.info-section.nowplay-preview .commercial-video-frame,
.info-section.nowplay-preview .weather-preview-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    border: none;
    box-shadow: none;
}

.info-section.nowplay-preview .commercial-video {
    /* Fit the whole video inside the frame; black fills leftover space */
    object-fit: contain;
    background: #000;
}

.weather-preview-frame {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px 18px 18px;
    text-align: center;
    background: linear-gradient(135deg, rgba(99, 27, 168, 0.95) 0%, rgba(245, 125, 13, 0.75) 100%);
}

.weather-preview-frame[hidden],
.commercial-video-frame[hidden] {
    display: none !important;
}

.weather-preview-location {
    font-family: var(--font-family-display);
    font-size: 11px;
    letter-spacing: 0.8px;
    color: #fff;
    margin-bottom: 8px;
}

.weather-preview-temp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 42px;
    color: #fff;
    text-shadow: 0 0 12px rgba(0, 181, 255, 0.6);
}

.weather-preview-condition,
.weather-preview-details {
    font-family: var(--font-family-main);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 6px;
}

.preview-panel-title,
.info-section.nowplay-preview .commercial-title {
    position: absolute;
    top: 12px;
    left: 16px;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: none;
    font-size: 15px;
    letter-spacing: 1px;
}

.tv-guide-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 18px 14px;
    margin-top: auto;
    background: linear-gradient(90deg, rgba(99, 27, 168, 0.85) 0%, rgba(0, 0, 0, 0.92) 50%, rgba(99, 27, 168, 0.85) 100%);
    border-top: 1px solid rgba(0, 181, 255, 0.35);
}

.footer-copy,
.footer-social {
    font-family: var(--font-family-main);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.footer-social a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer-social a:hover {
    color: var(--text-secondary);
}

.footer-sep {
    margin: 0 8px;
    color: rgba(255, 255, 255, 0.45);
}

.program-block .program-time {
    color: var(--program-green);
}
