@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --bg-panel: #2a2a2a;
    --accent-primary: #00a8ff;
    --accent-secondary: #0099cc;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --text-led: #00ff41;
    --border-color: #4a4a4a;
    --border-light: #5a5a5a;
    --border-dark: #1a1a1a;
    --hover-bg: #3d3d3d;
    --selected-bg: #004466;
    --bevel-light: #4a4a4a;
    --bevel-dark: #1a1a1a;
    --button-raised: #3a3a3a;
    --button-inset: #1f1f1f;
    --error-color: #ff4444;
    --success-color: #00ff00;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.7);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #d0d0d0;
    --bg-secondary: #e0e0e0;
    --bg-tertiary: #e8e8e8;
    --bg-panel: #d8d8d8;
    --accent-primary: #0066cc;
    --accent-secondary: #0055aa;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6a6a6a;
    --text-led: #006600;
    --border-color: #aaaaaa;
    --border-light: #cccccc;
    --border-dark: #999999;
    --hover-bg: #d8d8d8;
    --selected-bg: #aaccff;
    --bevel-light: #f0f0f0;
    --bevel-dark: #b0b0b0;
    --button-raised: #e8e8e8;
    --button-inset: #c8c8c8;
    --error-color: #cc0000;
    --success-color: #00aa00;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    position: relative;
    scroll-behavior: smooth;
}

/* Agreement Notice Banner - Small notice at top */
.agreement-notice {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(145deg, rgba(0, 168, 255, 0.15), rgba(0, 140, 225, 0.15));
    border-bottom: 1px solid rgba(0, 168, 255, 0.3);
    padding: 0.3rem 1rem;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-secondary);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
}

.agreement-notice span {
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.agreement-notice-link {
    color: var(--accent-primary);
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-left: 0.25rem;
}

.agreement-notice-link:hover {
    color: #00b8ff;
    text-shadow: 0 0 4px rgba(0, 168, 255, 0.4);
}

.agreement-notice-link:active {
    color: #00a0e6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    padding-top: 1.75rem; /* Space for fixed agreement notice */
}

/* Theme Toggle - Retro Style */
.theme-toggle {
    position: fixed;
    top: calc(1rem + 1.75rem); /* Account for agreement notice height */
    right: 1rem;
    z-index: 1002; /* Above news button but below modals */
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 6px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.25),
        0 1px 3px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-family: 'Share Tech Mono', monospace;
}

.theme-toggle:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.theme-toggle:active {
    background: linear-gradient(145deg, var(--button-inset), var(--button-raised));
    border-style: inset;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
}

.theme-icon {
    transition: transform 0.3s ease;
}

/* Main Content - Cable Box Layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* When news panel is visible, switch to row layout for 50/50 split */
.main-content:has(.news-panel[style*="display: flex"]) {
    flex-direction: row;
    gap: 1.5rem;
    align-items: stretch;
    justify-content: center;
    height: calc(100vh - 2rem); /* Full height minus padding */
    overflow: hidden; /* Prevent main content scrolling when in split view */
    padding: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure child elements fill available height */
.main-content:has(.news-panel[style*="display: flex"]) > * {
    overflow: hidden;
}

/* On large screens, allow content to fill window */
@media (min-width: 1401px) {
    .main-content {
        padding: 2rem;
        gap: 2rem;
    }
}

@media (min-width: 1920px) {
    .main-content {
        padding: 2.5rem;
        gap: 2.5rem;
    }
}

/* Sidebars - Retro Panels */
.sidebar {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border-radius: 4px;
    padding: 1.25rem;
    overflow: visible;
    overflow-x: hidden;
    border: 3px outset var(--bevel-light);
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.1),
        inset -1px -1px 2px rgba(0, 0, 0, 0.3),
        3px 3px 6px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-dark);
    border-top: 1px solid var(--border-light);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Arial', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.channel-count {
    font-size: 0.75rem;
    color: var(--text-led);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    border: 1px inset var(--bevel-dark);
    font-family: 'Share Tech Mono', monospace;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Preset Channels - Retro Buttons */
.preset-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.preset-category h3 {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-family: 'Arial', sans-serif;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.preset-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.preset-channel {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.preset-channel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.preset-channel:hover::before {
    left: 100%;
}

.preset-grid-compact .preset-channel {
    padding: 1rem 0.75rem;
    gap: 0.5rem;
}

.preset-channel:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(0, 168, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(0, 168, 255, 0.4);
}

.preset-channel:active {
    background: linear-gradient(145deg, var(--button-inset), var(--button-raised));
    border-style: inset;
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px) scale(1);
}

.preset-channel:hover .preset-icon,
.preset-channel:hover .preset-fallback {
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(0, 168, 255, 0.5));
    transform: scale(1.1) rotate(2deg);
}

.preset-icon {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border: 2px inset var(--bevel-dark);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.preset-grid-compact .preset-icon {
    width: 64px;
    height: 64px;
    padding: 0.6rem;
}

.preset-fallback {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    width: 80px;
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px inset var(--bevel-dark);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0;
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Arial', sans-serif;
    position: relative;
    z-index: 1;
}

.preset-grid-compact .preset-fallback {
    width: 64px;
    height: 64px;
    font-size: 1.6rem;
}

.preset-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Arial', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.preset-channel:hover .preset-name {
    color: var(--accent-primary);
    text-shadow: 0 0 8px rgba(0, 168, 255, 0.6);
}

.preset-grid-compact .preset-name {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Permanent LIVE TV Preset */
.preset-live-tv {
    margin-bottom: 0;
    background: linear-gradient(145deg, #ff4444, #cc0000);
    border: 3px outset #ff6666;
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 68, 68, 0.4),
        inset 0 0 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* TV Garden in preset-channels-section (always visible) */
.preset-channels-section > .preset-live-tv {
    margin-bottom: 0;
    width: 100%;
}

.preset-live-tv:hover {
    background: linear-gradient(145deg, #ff5555, #dd1111);
    box-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 68, 68, 0.6),
        inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.preset-live-tv:active {
    border-style: inset;
    background: linear-gradient(145deg, #cc0000, #ff4444);
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 68, 68, 0.3);
}

.live-tv-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(145deg, #ff0000, #cc0000);
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 0.25rem 0.5rem;
    border: 2px outset #ff3333;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Share Tech Mono', monospace;
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.6),
        0 0 8px rgba(255, 0, 0, 0.5);
    z-index: 10;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 
            2px 2px 4px rgba(0, 0, 0, 0.6),
            0 0 8px rgba(255, 0, 0, 0.5);
    }
    50% {
        box-shadow: 
            2px 2px 4px rgba(0, 0, 0, 0.6),
            0 0 15px rgba(255, 0, 0, 0.8);
    }
}

.preset-live-tv .preset-name {
    color: white;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(255, 255, 255, 0.3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.preset-live-tv .preset-icon,
.preset-live-tv .preset-fallback {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    filter: brightness(1.2);
}

/* Player Section - Main Display */
.player-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.08),
        inset 0 -1px 2px rgba(0, 0, 0, 0.15);
    overflow: visible;
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Player section always uses column layout */
.player-section {
    flex-direction: column;
}

/* Player section content wrapper */
.player-section > .player-container {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
}

.player-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: flex 0.3s ease;
}

/* Player section should be relative for absolute positioning of news panel */
.player-section {
    position: relative;
}

/* M3U Input Section - Above Player */
.m3u-input-section {
    order: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 2px inset var(--bevel-dark);
    border-radius: 3px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.4);
    margin-bottom: 1rem;
    opacity: 0.85;
    transition: opacity 0.3s ease;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
}

.m3u-input-section:hover {
    opacity: 1;
}

/* Free Playlist Dropdown - Always Visible */
.m3u-input-section > .input-group:first-child {
    margin-bottom: 0;
}

/* Custom Options Toggle Button */
.m3u-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 1rem;
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: 'Arial', sans-serif;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 0.5rem;
}

.m3u-toggle-btn:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform: translate(1px, 1px);
}

.m3u-toggle-btn:active {
    background: linear-gradient(145deg, var(--button-inset), var(--button-raised));
    border-style: inset;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    transform: translate(2px, 2px);
}

.m3u-toggle-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.m3u-input-section.expanded .m3u-toggle-icon {
    transform: rotate(180deg);
}

/* Custom Options Content - Collapsible */
.m3u-input-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
}

.m3u-input-section .input-group {
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.m3u-input-section .input-group:last-child {
    margin-bottom: 0;
}

.m3u-input-section label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.m3u-input-section .divider {
    font-size: 0.7rem;
    margin: 0.5rem 0;
    opacity: 0.7;
}

/* TV Set Container */
.tv-set {
    position: relative;
    margin: 3.5rem auto;
    max-width: 100%;
    width: 100%;
}

/* On large screens, allow TV to grow but maintain aspect ratio */
@media (min-width: 1401px) {
    .tv-set {
        max-width: 90%;
    }
}

@media (min-width: 1920px) {
    .tv-set {
        max-width: 85%;
    }
}

/* TV Screen */
.player-wrapper {
    width: 100%;
    background: #000;
    border-radius: 4px;
    overflow: visible;
    aspect-ratio: 16/9;
    border: 4px inset #1a1a1a;
    position: relative;
    max-width: 100%;
    /* Inner screen border and glow */
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.9),
        inset 0 0 60px rgba(0, 0, 0, 0.6),
        inset 2px 2px 8px rgba(255, 255, 255, 0.05),
        /* Screen glow */
        0 0 15px rgba(0, 168, 255, 0.2),
        /* TV screen border */
        0 0 0 2px #0a0a0a,
        0 0 0 3px rgba(0, 168, 255, 0.1);
    padding-bottom: 0;
    /* CRT/Tube TV Effects */
    animation: tvFlicker 0.15s ease-in-out infinite;
    transform: translateZ(0);
}

/* CRT Scanlines Effect */
.player-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: overlay;
    animation: scanlineMove 8s linear infinite;
}

/* CRT Screen Curvature Effect - Added via inner element */
.player-wrapper .crt-curvature-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 3;
    border-radius: 4px;
}

/* TV Flicker Animation */
@keyframes tvFlicker {
    0%, 100% { opacity: 1; }
    98% { opacity: 1; }
    99% { opacity: 0.99; }
}

/* Scanline Movement */
@keyframes scanlineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* CRT Screen Effect - Channel Change */
.player-wrapper.crt-effect {
    animation: channelStatic 0.6s steps(8, end) infinite,
               tvFlicker 0.15s ease-in-out infinite;
}

@keyframes channelStatic {
    0% { filter: brightness(0.95) contrast(1.05); }
    12.5% { filter: brightness(1.05) contrast(0.95); }
    25% { filter: brightness(0.98) contrast(1.02); }
    37.5% { filter: brightness(1.02) contrast(0.98); }
    50% { filter: brightness(0.96) contrast(1.04); }
    62.5% { filter: brightness(1.04) contrast(0.96); }
    75% { filter: brightness(0.99) contrast(1.01); }
    87.5% { filter: brightness(1.01) contrast(0.99); }
    100% { filter: brightness(1.0) contrast(1.0); }
}


/* Loading State - Tube TV Warm-up */
.player-wrapper.loading {
    animation: tvWarmup 2s ease-in-out;
    filter: brightness(0.1) contrast(0.5);
}

@keyframes tvWarmup {
    0% {
        filter: brightness(0.1) contrast(0.5) hue-rotate(0deg);
        opacity: 0.8;
    }
    50% {
        filter: brightness(0.6) contrast(0.8) hue-rotate(180deg);
        opacity: 0.9;
    }
    100% {
        filter: brightness(1.0) contrast(1.0) hue-rotate(0deg);
        opacity: 1;
    }
}

/* Ensure video.js container fits properly */
.player-wrapper .video-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding-bottom: 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* TV Controls Panel (Below Screen) */
.tv-controls-panel {
    background: linear-gradient(145deg, #2a2a2a 0%, #1f1f1f 50%, #2a2a2a 100%);
    border: 3px outset #3a3a3a;
    border-radius: 0 0 12px 12px;
    padding: 1.25rem 1.5rem;
    margin-top: -1px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.7),
        inset 2px 2px 8px rgba(255, 255, 255, 0.05),
        inset -2px -2px 8px rgba(0, 0, 0, 0.5),
        /* TV base shadow */
        0 10px 20px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 0, 0, 0.6);
    border-top: 2px inset #1a1a1a;
}

.tv-controls-panel .channel-display {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px inset #1a1a1a;
}

/* Retro TV Frame Effect - Outer Bezel */
.tv-set::before {
    content: '';
    position: absolute;
    top: -80px;
    left: -60px;
    right: -60px;
    bottom: -20px;
    background: 
        /* TV cabinet gradient */
        linear-gradient(145deg, 
            #3a3a3a 0%, 
            #2a2a2a 10%,
            #1f1f1f 25%,
            #2a2a2a 50%,
            #1f1f1f 75%,
            #2a2a2a 90%,
            #3a3a3a 100%
        );
    border-radius: 20px;
    border: 6px outset #4a4a4a;
    box-shadow: 
        /* Inner shadows for depth */
        inset 0 0 50px rgba(0, 0, 0, 0.9),
        inset 0 0 80px rgba(0, 0, 0, 0.7),
        inset 4px 4px 20px rgba(255, 255, 255, 0.1),
        inset -4px -4px 20px rgba(0, 0, 0, 0.8),
        /* Outer shadow for TV sitting on surface */
        0 20px 40px rgba(0, 0, 0, 1),
        0 0 60px rgba(0, 0, 0, 0.8),
        /* TV base shadow */
        0 25px 50px rgba(0, 0, 0, 0.9);
    z-index: -1;
    pointer-events: none;
    /* Prevent overflow on mobile */
    max-width: calc(100vw - 1rem);
    margin-left: auto;
    margin-right: auto;
}

/* Retro TV Screen Frame - Inner Bezel */
.player-wrapper::after {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    background: 
        /* Inner frame shadow */
        linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 20px, transparent calc(100% - 20px), rgba(0, 0, 0, 0.6) 100%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.6) 0%, transparent 20px, transparent calc(100% - 20px), rgba(0, 0, 0, 0.6) 100%),
        /* Screen curvature effect */
        radial-gradient(ellipse at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 2;
    border-radius: 8px;
    border: 3px inset #1a1a1a;
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.7),
        inset 2px 2px 10px rgba(255, 255, 255, 0.03),
        /* TV screen reflection */
        0 0 20px rgba(0, 168, 255, 0.1);
    opacity: 0.7;
}

/* Ensure video controls are above all overlays */
.player-wrapper .video-js .vjs-control-bar {
    z-index: 200 !important;
}

/* Ensure static overlay doesn't block controls */
.tv-static-overlay {
    z-index: 10;
    pointer-events: none;
    /* Ensure it's visible */
    display: none;
}

.tv-static-overlay.show {
    display: block !important;
}

.player-wrapper .video-js {
    z-index: 1;
    display: block !important;
    visibility: visible !important;
}

.player-wrapper .video-js .vjs-tech {
    z-index: 1;
    display: block !important;
    visibility: visible !important;
}

.player-wrapper .video-js video {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


/* TV Static/Noise Overlay - Shows when loading */
.tv-static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10;
    pointer-events: none;
    display: none;
    overflow: hidden;
}

.tv-static-overlay.show {
    display: block;
}

.static-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 15;
    pointer-events: none;
    display: none;
}

.tv-static-overlay.show .static-canvas {
    display: block;
}

/* Remove Tube TV effect in fullscreen */
.tv-set.fullscreen::before,
.tv-set.fullscreen::after,
.video-js.vjs-fullscreen .tv-set::before,
.video-js.vjs-fullscreen .tv-set::after,
.video-js:-webkit-full-screen .tv-set::before,
.video-js:-webkit-full-screen .tv-set::after,
.video-js:-moz-full-screen .tv-set::before,
.video-js:-moz-full-screen .tv-set::after,
.video-js:-ms-fullscreen .tv-set::before,
.video-js:-ms-fullscreen .tv-set::after {
    display: none;
}

.tv-set.fullscreen {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9998 !important;
}

.tv-set.fullscreen .player-wrapper {
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
}

.tv-set.fullscreen .tv-controls-panel {
    /* Allow visibility to be controlled by JS via .hidden class */
}

/* Video wrapper ensures proper layout */
.player-wrapper {
    position: relative;
    padding: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
}

.player-wrapper video {
    width: 100%;
    height: calc(100% - 4em);
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Privacy Disclaimer Section */
.privacy-disclaimer {
    background: linear-gradient(145deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border: 2px solid rgba(255, 193, 7, 0.4);
    border-radius: 4px;
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.1),
        inset -1px -1px 2px rgba(0, 0, 0, 0.2),
        2px 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    z-index: 10;
}

.privacy-disclaimer-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.privacy-icon {
    flex-shrink: 0;
    color: rgba(255, 193, 7, 0.9);
    margin-top: 0.125rem;
}

.privacy-text {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.privacy-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.vpn-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    padding: 0.625rem 1rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vpn-button:hover {
    background: linear-gradient(145deg, #0099ff, #0066cc);
    border-color: var(--accent-primary);
    box-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.4),
        0 0 8px rgba(0, 168, 255, 0.3);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.vpn-button:active {
    border-style: inset;
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 0 8px rgba(0, 0, 0, 0.3);
    transform: translate(1px, 1px);
}

.vpn-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Preset Channels Section - Above Channel Guide */
.preset-channels-section {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 3px outset var(--bevel-light);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.1),
        inset -1px -1px 2px rgba(0, 0, 0, 0.3),
        3px 3px 6px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

/* TV Garden - Always Visible (Outside Collapsible Section) */
.preset-channels-section > .preset-live-tv {
    width: 100%;
    margin-bottom: 0;
}

/* Preset Toggle Button - More Noticeable and Dynamic */
.preset-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    border: 3px outset var(--bevel-light);
    border-radius: 4px;
    cursor: pointer;
    color: white;
    font-family: 'Arial', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(0, 168, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.preset-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.preset-toggle-btn:hover::before {
    left: 100%;
}

.preset-toggle-btn:hover {
    background: linear-gradient(145deg, #00b8ff, #00aaff);
    box-shadow: 
        3px 3px 8px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(0, 168, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.preset-toggle-btn:active {
    background: linear-gradient(145deg, #00a0e6, #0090d6);
    border-style: inset;
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.6);
    transform: translateY(0);
}

.preset-toggle-text {
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.preset-toggle-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.preset-channels-section.expanded .preset-toggle-icon {
    transform: rotate(180deg);
}

.preset-channels-section.expanded .preset-toggle-btn {
    background: linear-gradient(145deg, #00a0e6, #0090d6);
    box-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(0, 168, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.preset-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 0.5rem;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 2000px;
        transform: translateY(0);
    }
}

.preset-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.preset-category h3 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Channel Guide Below Player - Compact Cable Box Style */
.player-section .sidebar-right {
    order: 2;
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 0.75rem;
    flex: 0 0 auto;
    min-width: 0;
}

/* Compact sidebar header */
.player-section .sidebar-right .sidebar-header {
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
}

.player-section .sidebar-right .sidebar-header h2 {
    font-size: 0.9rem;
}

/* Compact view tabs and search */
.player-section .sidebar-right .view-tabs {
    margin-bottom: 0.6rem;
}

.player-section .sidebar-right .search-box {
    margin-bottom: 0.6rem;
    padding: 0.6rem;
}

.player-section .sidebar-right .search-box input,
.player-section .sidebar-right .search-box select {
    padding: 0.5rem;
    font-size: 0.85rem;
}

.player-section .sidebar-right .search-icon {
    left: 0.6rem;
    width: 18px;
    height: 18px;
}

.player-section .sidebar-right .search-box input {
    padding-left: 2.25rem;
}

/* Ensure channel guide has max height and scrolls internally */
.player-section .sidebar-right .channel-list {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

/* Mobile responsiveness for channel guide */
@media (max-width: 768px) {
    .player-section .sidebar-right .channel-list {
        max-height: 300px;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .channel-item {
        min-height: 64px;
        padding: 0.6rem 0.7rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .channel-item-name {
        font-size: 0.85rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }
    
    .channel-item-group {
        font-size: 0.72rem;
        line-height: 1.3;
    }
    
    .channel-num-display {
        font-size: 0.75rem;
        min-width: 44px;
        max-width: 44px;
        min-height: 44px;
        padding: 0.3rem 0.4rem;
    }
    
    .favorite-btn {
        min-width: 36px;
        max-width: 36px;
        min-height: 36px;
        max-height: 36px;
        padding: 0.35rem;
    }
    
    .favorite-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Custom scrollbar for channel list */
.player-section .sidebar-right .channel-list::-webkit-scrollbar {
    width: 8px;
}

.player-section .sidebar-right .channel-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border: 1px inset var(--bevel-dark);
    border-radius: 2px;
}

.player-section .sidebar-right .channel-list::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 1px outset var(--bevel-light);
    border-radius: 2px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Channel Display - LED Style (Inside TV Controls Panel) */
.tv-controls-panel .channel-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.channel-number-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: #000;
    border: 2px inset #333;
    border-radius: 3px;
    min-width: 80px;
    box-shadow: inset 0 0 10px rgba(0, 255, 65, 0.2);
}

.channel-number-display .label {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.channel-number-display .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-led);
    font-family: 'Share Tech Mono', monospace;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
    letter-spacing: 2px;
}

.channel-name-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.led-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-led);
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}

.channel-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

/* Channel Controls (Inside TV Controls Panel) */
.tv-controls-panel .channel-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.channel-nav-btn {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    color: var(--text-primary);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    touch-action: manipulation;
}

.channel-nav-btn:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    border-color: var(--accent-primary);
    box-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.5),
        0 0 8px rgba(0, 168, 255, 0.3);
    transform: translate(1px, 1px);
}

.channel-nav-btn:active {
    border-style: inset;
    background: linear-gradient(145deg, var(--button-inset), var(--button-raised));
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    transform: translate(2px, 2px);
}

.channel-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.channel-nav-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    transition: all 0.2s ease;
}

.channel-nav-btn:hover svg {
    stroke: var(--accent-primary);
    filter: drop-shadow(0 0 4px rgba(0, 168, 255, 0.5));
}

/* Channel Group Select Dropdown */
.channel-group-select {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 2px outset var(--bevel-light);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
    cursor: pointer;
    min-width: 120px;
    max-width: 150px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    padding-right: 2rem;
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.1),
        inset -1px -1px 2px rgba(0, 0, 0, 0.2),
        2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.channel-group-select:hover {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.15),
        inset -1px -1px 2px rgba(0, 0, 0, 0.25),
        3px 3px 6px rgba(0, 0, 0, 0.4);
}

.channel-group-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.15),
        inset -1px -1px 2px rgba(0, 0, 0, 0.25),
        0 0 8px rgba(0, 168, 255, 0.4);
}

.channel-group-select option {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Favorite button in channel controls - filled when favorited */
#favorite-btn.favorited {
    color: var(--accent-primary);
}

#favorite-btn.favorited svg {
    fill: var(--accent-primary);
    stroke: var(--accent-primary);
    filter: drop-shadow(0 0 6px rgba(0, 168, 255, 0.7));
}

#favorite-btn.favorited:hover {
    box-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(0, 168, 255, 0.5);
}

/* Hide channel controls and Video.js control bar in fullscreen */
.tv-controls-panel,
.video-js .vjs-control-bar {
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* Fullscreen: hide controls after fade */
.video-js.vjs-fullscreen .tv-controls-panel.hidden,
.video-js.vjs-fullscreen.vjs-user-inactive .vjs-control-bar,
.video-js:-webkit-full-screen .tv-controls-panel.hidden,
.video-js:-webkit-full-screen.vjs-user-inactive .vjs-control-bar,
.video-js:-moz-full-screen .tv-controls-panel.hidden,
.video-js:-moz-full-screen.vjs-user-inactive .vjs-control-bar,
.video-js:-ms-fullscreen .tv-controls-panel.hidden,
.video-js:-ms-fullscreen.vjs-user-inactive .vjs-control-bar {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure controls are visible when not hidden */
.video-js.vjs-fullscreen .tv-controls-panel:not(.hidden),
.video-js.vjs-fullscreen:not(.vjs-user-inactive) .vjs-control-bar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Fallback for browsers that don't support :has() */
.video-js.vjs-fullscreen .channel-controls.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* News Section at Top */
.news-section-top {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Integrated into main content flow */
    background: transparent;
    border: none;
    padding: 0;
}

/* When news panel is visible, take 50% width and full height */
.main-content:has(.news-panel[style*="display: flex"]) .news-section-top {
    width: 50%;
    max-width: 50%;
    margin-bottom: 0;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* News button should stay visible and properly sized */
.main-content:has(.news-panel[style*="display: flex"]) .news-toggle-btn {
    flex-shrink: 0;
    width: auto;
}

/* Play button should stay visible and properly sized */
.main-content:has(.news-panel[style*="display: flex"]) .play-toggle-btn {
    flex-shrink: 0;
    width: auto;
}

/* Player section takes other 50% when news is visible */
.main-content:has(.news-panel[style*="display: flex"]) .player-section {
    width: 50%;
    max-width: 50%;
    flex: 0 0 50%;
    flex-shrink: 0;
    min-height: 0;
    height: 100%;
}

/* News Button - Next to News Panel */
.news-toggle-btn {
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    border: 2px outset var(--bevel-light);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.25),
        0 1px 3px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    z-index: 1001; /* Above content, below theme toggle */
}

.news-toggle-btn:hover {
    background: linear-gradient(145deg, #00b8ff, #00aaff);
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(0, 168, 255, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.news-toggle-btn:active {
    border-style: inset;
    transform: translateY(0);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.news-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.news-btn-text {
    white-space: nowrap;
}

/* Play Button - Dynamic Gaming Style */
.play-toggle-btn {
    background: linear-gradient(145deg, #ff6b35, #f7931e);
    border: 2px outset var(--bevel-light);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 
        0 2px 8px rgba(255, 107, 53, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    z-index: 1001;
    text-decoration: none;
    overflow: hidden;
    animation: playButtonPulse 2s ease-in-out infinite;
}

/* Animated glow effect for Play button */
.play-toggle-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.play-toggle-btn:hover::before {
    opacity: 1;
    animation: playButtonGlow 1.5s ease-in-out infinite;
}

.play-toggle-btn:hover {
    background: linear-gradient(145deg, #ff7b45, #ffa500);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 6px 16px rgba(255, 107, 53, 0.5),
        0 3px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 20px rgba(255, 107, 53, 0.4);
    animation: playButtonHover 0.3s ease-out;
}

.play-toggle-btn:active {
    border-style: inset;
    transform: translateY(0) scale(0.98);
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 3px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 107, 53, 0.6);
    animation: playButtonPress 0.2s ease-out;
}

.play-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.play-toggle-btn:hover .play-icon {
    transform: rotate(15deg) scale(1.1);
    animation: playIconBounce 0.6s ease-in-out infinite;
}

.play-toggle-btn:active .play-icon {
    transform: rotate(-10deg) scale(0.95);
}

.play-btn-text {
    white-space: nowrap;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.play-toggle-btn:hover .play-btn-text {
    transform: translateX(2px);
    animation: playTextShimmer 1s ease-in-out infinite;
}

/* Keyframe Animations for Play Button */
@keyframes playButtonPulse {
    0%, 100% {
        box-shadow: 
            0 2px 8px rgba(255, 107, 53, 0.3),
            0 1px 3px rgba(0, 0, 0, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
    50% {
        box-shadow: 
            0 2px 12px rgba(255, 107, 53, 0.4),
            0 1px 3px rgba(0, 0, 0, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 0 10px rgba(255, 107, 53, 0.2);
    }
}

@keyframes playButtonGlow {
    0%, 100% {
        transform: rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: rotate(180deg);
        opacity: 0.6;
    }
}

@keyframes playButtonHover {
    0% {
        transform: translateY(-3px) scale(1.05);
    }
    50% {
        transform: translateY(-4px) scale(1.06);
    }
    100% {
        transform: translateY(-3px) scale(1.05);
    }
}

@keyframes playButtonPress {
    0% {
        transform: translateY(0) scale(0.98);
    }
    50% {
        transform: translateY(1px) scale(0.97);
    }
    100% {
        transform: translateY(0) scale(0.98);
    }
}

@keyframes playIconBounce {
    0%, 100% {
        transform: rotate(15deg) scale(1.1) translateY(0);
    }
    50% {
        transform: rotate(15deg) scale(1.15) translateY(-2px);
    }
}

@keyframes playTextShimmer {
    0%, 100% {
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
    50% {
        text-shadow: 
            0 1px 2px rgba(0, 0, 0, 0.3),
            0 0 8px rgba(255, 255, 255, 0.5);
    }
}

/* News Panel - Fully Integrated into main UI */
.news-panel {
    flex: 1;
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    background: #f5f5f5;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideInSmooth 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    position: relative;
    z-index: 1;
    margin: 0;
    box-sizing: border-box;
    /* Newspaper style background */
}

/* When in split view, news panel takes full height of its container */
.main-content:has(.news-panel[style*="display: flex"]) .news-panel {
    max-height: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    /* Match padding with player section (1.5rem) to maintain same width */
    padding: 0;
    /* Newspaper style background */
    border: none;
    background: #f5f5f5;
    border-radius: 0;
    box-shadow: none;
    /* Smooth transition when expanding */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override animation when expanding in split view */
.main-content:has(.news-panel[style*="display: flex"]) .news-panel.expanding {
    animation: expandSmoothSplit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes expandSmoothSplit {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 100%;
        transform: translateY(0);
    }
}

/* In split view, limit content height to show articles */
.main-content:has(.news-panel[style*="display: flex"]) .news-panel-content {
    max-height: calc(100% - 120px);
    padding: 1.5rem;
    background: #f5f5f5;
}

/* Ensure news items match the width of player container content */
/* Player section has 1.5rem padding, so content width should match */
.main-content:has(.news-panel[style*="display: flex"]) .news-item {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.news-panel[style*="display: flex"] {
    display: flex !important;
}

/* Smooth expansion animation */
.news-panel.expanding {
    animation: expandSmooth 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Smooth collapse animation */
.news-panel.collapsing {
    animation: collapseSmooth 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes expandSmooth {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 400px;
        transform: translateY(0);
    }
}

@keyframes collapseSmooth {
    from {
        opacity: 1;
        max-height: 400px;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
}

@keyframes slideInSmooth {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.news-panel.minimized {
    width: auto;
    max-width: 300px;
    max-height: 60px;
    min-width: 200px;
}

.news-panel.minimized .news-panel-content {
    display: none;
}

/* Newspaper Header */
.newspaper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 3px double #000;
    background: #fff;
    flex-shrink: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Prevent overlap */
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
}

.newspaper-masthead {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.newspaper-title {
    font-family: 'Times New Roman', serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.1;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.newspaper-title .boogle-link {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.newspaper-title .boogle-link:hover {
    color: #0066cc;
    text-decoration: underline;
}

.newspaper-date {
    font-family: 'Times New Roman', serif;
    font-size: 0.9rem;
    color: #333;
    font-style: italic;
    text-transform: capitalize;
}

.news-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    flex-shrink: 0;
    box-shadow: none;
    margin-bottom: 0.75rem;
}

.news-panel-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Arial', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.news-panel-controls {
    display: flex;
    gap: 0.4rem;
}

.news-control-btn {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    padding: 0.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 28px;
    min-height: 28px;
}

.news-control-btn:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 
        0 3px 6px rgba(0, 168, 255, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.news-control-btn:active {
    border-style: inset;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(0, 0, 0, 0.3);
    transform: translate(1px, 1px);
}

/* Newspaper Content - Clean Traditional Layout */
.newspaper-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    min-height: 0;
    background: #f5f5f5;
    /* Limit height to show content */
    max-height: 600px;
    /* Ensure scrolling works properly */
    -webkit-overflow-scrolling: touch;
    /* Traditional newspaper layout - single column with clear spacing */
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    /* Prevent overlapping */
    position: relative;
    clear: both;
    /* Traditional newspaper spacing */
    line-height: 1.6;
    /* Ensure articles stack properly */
    gap: 0;
}

.news-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    min-height: 0;
    /* Limit height to show 5-6 articles at a time */
    /* Each article is ~60px + 8px margin = 68px, 6 articles = ~408px + padding */
    max-height: 420px;
    /* Ensure scrolling works properly */
    -webkit-overflow-scrolling: touch;
    /* Center align news items */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.news-panel-content::-webkit-scrollbar {
    width: 8px;
}

.news-panel-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border: 1px inset var(--bevel-dark);
    border-radius: 2px;
}

.news-panel-content::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 1px outset var(--bevel-light);
    border-radius: 2px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.news-loading,
.news-empty {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.news-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Loading indicator that appears while keeping existing news visible */
.news-loading-indicator {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border-bottom: 2px solid var(--accent-primary);
    padding: 0.5rem;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-bottom-color: var(--accent-primary);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% {
        border-bottom-color: rgba(0, 168, 255, 0.6);
        box-shadow: 0 2px 8px rgba(0, 168, 255, 0.4);
    }
}

.news-loading-indicator .news-loading {
    padding: 0.75rem;
    margin: 0;
    font-size: 0.8rem;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.news-loading-indicator .news-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Newspaper Article Items - Clean Traditional Layout */
.newspaper-content .news-item {
    background: #fff;
    border: none;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    padding: 0.5rem 0;
    margin: 0 0 1.25rem 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: none;
    /* Traditional newspaper layout - clean block flow */
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Prevent overflow */
    overflow: visible;
    /* Prevent any overlapping */
    position: relative;
    clear: both;
    float: none;
    /* Allow article to expand vertically */
    min-height: auto;
    height: auto;
    /* Ensure proper stacking */
    z-index: 1;
    /* Traditional newspaper spacing */
    gap: 1rem;
}

.newspaper-content .news-item.headline {
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
    margin-bottom: 1.75rem;
    /* Prevent border overlap */
    position: relative;
    z-index: 1;
}

.newspaper-content .news-item:hover {
    background: #f9f9f9;
    border-bottom-color: #999;
}

/* Thumbnail - Small square next to headline */
.newspaper-content .news-item-thumbnail {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Ensure thumbnail fits within boundaries */
    box-sizing: border-box;
    /* Prevent overlap - clear positioning */
    position: relative;
    clear: both;
    display: block;
    flex-shrink: 0;
    order: 1;
    /* Small square thumbnail */
    border: 1px solid #ddd;
    background: #f0f0f0;
}

.newspaper-content .news-item-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    /* Ensure image fits within boundaries */
    box-sizing: border-box;
    /* Prevent image from overlapping */
    position: relative;
    clear: both;
}

/* Headline articles get slightly larger thumbnails */
.newspaper-content .news-item.headline .news-item-thumbnail {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
}

/* Content - Next to thumbnail, never overlaps */
.newspaper-content .news-item-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    /* Prevent overlapping - clear positioning */
    position: relative;
    clear: both;
    /* Ensure content doesn't overflow */
    overflow: visible;
    /* Clear spacing */
    padding: 0;
    margin: 0;
    /* Next to thumbnail */
    order: 2;
    gap: 0.5rem;
}

/* Title - Smaller text, no overlap */
.newspaper-content .news-item-title {
    font-family: 'Times New Roman', serif;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: 700;
    color: #000;
    line-height: 1.3;
    margin: 0 0 0.375rem 0;
    padding: 0;
    text-transform: none;
    letter-spacing: 0;
    /* Allow title to wrap and expand vertically */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    /* Ensure text fits within boundaries - prevent overlap */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: none;
    line-clamp: 2;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    clear: both;
    /* Prevent text from overlapping */
    z-index: 1;
    white-space: normal;
}

.newspaper-content .news-item.headline .news-item-title {
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 0.375rem;
    /* Force multi-line display - show at least 2 lines */
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: none;
    line-clamp: 2;
}

/* Description - Smaller text, no overlap */
.newspaper-content .news-item-description {
    font-family: 'Times New Roman', serif;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    line-height: 1.4;
    color: #333;
    margin: 0 0 0.375rem 0;
    padding: 0;
    text-align: left;
    /* Prevent text overlap */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: none;
    line-clamp: 2;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    clear: both;
    /* Force multi-line display - show at least 2 lines */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Meta - Smaller text, no overlap */
.newspaper-content .news-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Times New Roman', serif;
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    color: #666;
    margin: 0.5rem 0 0 0;
    padding: 0.5rem 0 0 0;
    border-top: 1px solid #eee;
    /* Prevent overlap */
    position: relative;
    clear: both;
    width: 100%;
    box-sizing: border-box;
    /* Ensure text doesn't wrap awkwardly */
    flex-wrap: wrap;
    gap: 0.5rem;
}

.newspaper-content .news-item-source {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.newspaper-content .news-item-date {
    font-style: italic;
    white-space: nowrap;
}

/* Responsive adjustments for different screen sizes */
@media (max-width: 768px) {
    .newspaper-content {
        padding: 1rem;
    }
    
    .newspaper-content .news-item {
        margin-bottom: 1.25rem;
        gap: 1rem;
        padding: 0.75rem 0;
        min-height: auto;
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .newspaper-content .news-item.headline {
        margin-bottom: 1.75rem;
        padding-bottom: 1rem;
    }
    
    .newspaper-content .news-item-thumbnail {
        width: 65px;
        height: 65px;
        min-width: 65px;
        min-height: 65px;
        flex-shrink: 0;
    }
    
    .newspaper-content .news-item.headline .news-item-thumbnail {
        width: 75px;
        height: 75px;
        min-width: 75px;
        min-height: 75px;
    }
    
    .newspaper-content .news-item-content {
        flex: 1 1 0%;
        min-width: 0;
        max-width: calc(100% - 75px - 1rem);
        gap: 0.5rem;
        box-sizing: border-box;
    }
    
    .newspaper-content .news-item.headline .news-item-content {
        max-width: calc(100% - 75px - 1rem);
    }
    
    .newspaper-content .news-item-title {
        font-size: clamp(0.75rem, 2.5vw, 0.9rem);
        line-height: 1.35;
        margin-bottom: 0.375rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item.headline .news-item-title {
        font-size: clamp(0.8rem, 3vw, 0.95rem);
        line-height: 1.3;
        margin-bottom: 0.5rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item-description {
        font-size: clamp(0.65rem, 2vw, 0.75rem);
        line-height: 1.4;
        margin-bottom: 0.375rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item-meta {
        font-size: clamp(0.6rem, 1.5vw, 0.7rem);
        margin-top: 0.375rem;
        padding-top: 0.375rem;
    }
}

@media (max-width: 480px) {
    .newspaper-content {
        padding: 0.875rem;
    }
    
    .newspaper-content .news-item {
        margin-bottom: 1rem;
        gap: 0.75rem;
        padding: 0.75rem 0;
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        /* Prevent border overlap */
        position: relative;
    }
    
    .newspaper-content .news-item.headline {
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid #000;
    }
    
    .newspaper-content .news-item-thumbnail {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        flex-shrink: 0;
    }
    
    .newspaper-content .news-item.headline .news-item-thumbnail {
        width: 70px;
        height: 70px;
        min-width: 70px;
        min-height: 70px;
    }
    
    .newspaper-content .news-item-content {
        flex: 1 1 0%;
        min-width: 0;
        max-width: calc(100% - 70px - 0.75rem);
        gap: 0.5rem;
        box-sizing: border-box;
    }
    
    .newspaper-content .news-item.headline .news-item-content {
        max-width: calc(100% - 70px - 0.75rem);
    }
    
    .newspaper-content .news-item-title {
        font-size: clamp(0.7rem, 3vw, 0.85rem);
        line-height: 1.3;
        margin-bottom: 0.25rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item.headline .news-item-title {
        font-size: clamp(0.75rem, 3.5vw, 0.9rem);
        line-height: 1.25;
        margin-bottom: 0.375rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item.headline .news-item-content {
        max-width: calc(100% - 80px - 0.75rem);
    }
    
    .newspaper-content .news-item-description {
        font-size: clamp(0.6rem, 2.5vw, 0.7rem);
        line-height: 1.35;
        margin-bottom: 0.25rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }
    
    .newspaper-content .news-item-meta {
        font-size: clamp(0.55rem, 2vw, 0.65rem);
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        margin-top: 0.375rem;
        padding-top: 0.375rem;
        border-top: 1px solid #eee;
    }
}

/* Additional mobile optimizations for very small screens and touch devices */
@media (max-width: 360px) {
    .newspaper-content .news-item {
        padding: 1rem 0;
        margin-bottom: 1.75rem;
    }
    
    .newspaper-content .news-item-title {
        font-size: clamp(0.65rem, 3.5vw, 0.8rem);
        line-height: 1.3;
        white-space: normal;
    }
    
    .newspaper-content .news-item.headline .news-item-title {
        font-size: clamp(0.7rem, 4vw, 0.85rem);
        line-height: 1.25;
        white-space: normal;
    }
    
    .newspaper-content .news-item-description {
        font-size: clamp(0.55rem, 3vw, 0.65rem);
        line-height: 1.35;
        white-space: normal;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .newspaper-content .news-item {
        padding: 1rem 0;
        margin-bottom: 1.5rem;
    }
    
    .newspaper-content .news-item-title {
        line-height: 1.5;
        white-space: normal;
    }
    
    .newspaper-content .news-item-description {
        line-height: 1.6;
        white-space: normal;
    }
}

/* News Items - Compact Cable Box Style (matching channel items) */
.news-item {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 60px;
    max-height: 60px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.news-item:hover {
    background: rgba(0, 168, 255, 0.1);
    border-left-color: var(--accent-secondary);
    border-left-width: 4px;
    transform: translateX(3px);
    box-shadow: none;
}

.news-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Arial', sans-serif;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.news-item-description {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    flex: 1;
    min-height: 0;
}

.news-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--text-tertiary);
    font-family: 'Arial', sans-serif;
    flex-shrink: 0;
}

.news-item-source {
    font-weight: 600;
    color: var(--accent-primary);
}

/* M3U Input Section styles defined above */

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input[type="text"],
.input-group input[type="file"],
.input-group select {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px inset var(--bevel-dark);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Arial', sans-serif;
    transition: border-color 0.3s ease;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.5),
        0 0 5px rgba(0, 168, 255, 0.3);
}

.input-group input[type="file"] {
    cursor: pointer;
}

.input-group input[type="file"]::file-selector-button {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    color: var(--text-primary);
    border: 2px outset var(--bevel-light);
    padding: 0.5rem 1rem;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 1rem;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.input-group input[type="file"]::file-selector-button:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.input-group input[type="file"]::file-selector-button:active {
    border-style: inset;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.playlist-selector {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px inset var(--bevel-dark);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b0b0b0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    font-family: 'Arial', sans-serif;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.playlist-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.5),
        0 0 5px rgba(0, 168, 255, 0.3);
}

.playlist-selector option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.playlist-selector optgroup {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-panel);
}

/* Divider */
.divider {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0.75rem 0;
    position: relative;
    font-family: 'Arial', sans-serif;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 2rem);
    height: 1px;
    background: var(--border-color);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Buttons - 3D Retro Style */
.btn {
    padding: 0.75rem 1.5rem;
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Arial', sans-serif;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.btn-primary {
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(145deg, #00b8ff, #00aaff);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform: translate(1px, 1px);
}

.btn-primary:active {
    border-style: inset;
    background: linear-gradient(145deg, var(--accent-secondary), var(--accent-primary));
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    transform: translate(2px, 2px);
}

.btn-secondary {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform: translate(1px, 1px);
}

.btn-secondary:active {
    border-style: inset;
    background: linear-gradient(145deg, var(--button-inset), var(--button-raised));
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    transform: translate(2px, 2px);
}

/* View Tabs - Cable Box Style */
.view-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-dark);
    border-top: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.view-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: linear-gradient(145deg, var(--button-inset), var(--bg-tertiary));
    border: 2px inset var(--bevel-dark);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.view-tab:hover {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--button-inset));
    color: var(--text-primary);
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.view-tab.active {
    background: linear-gradient(145deg, var(--selected-bg), #005577);
    color: var(--text-led);
    border: 2px outset var(--bevel-light);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

/* Search/Filter - Enhanced Prominent Style */
.search-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border: 3px outset var(--bevel-light);
    border-radius: 6px;
    box-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: subtlePulse 3s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 
            2px 2px 6px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            2px 2px 8px rgba(0, 0, 0, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.15),
            0 0 12px rgba(0, 168, 255, 0.15);
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--accent-primary);
    z-index: 1;
    pointer-events: none;
    opacity: 0.7;
    transition: all 0.3s ease;
    animation: searchIconPulse 2s ease-in-out infinite;
}

@keyframes searchIconPulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    background: var(--bg-tertiary);
    border: 2px outset var(--bevel-light);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Arial', sans-serif;
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.5),
        0 0 0 rgba(0, 168, 255, 0);
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-panel);
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(0, 168, 255, 0.4),
        0 0 20px rgba(0, 168, 255, 0.2);
    transform: translateY(-1px);
}

.search-box input:focus ~ .search-icon,
.search-box:focus-within .search-icon {
    opacity: 1;
    color: var(--accent-primary);
    transform: scale(1.1);
    animation: none;
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 3px;
    transition: all 0.2s ease;
    z-index: 1;
}

.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.search-clear-btn:active {
    transform: scale(0.95);
}

.search-box select {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px outset var(--bevel-light);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Arial', sans-serif;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-box select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.5),
        0 0 8px rgba(0, 168, 255, 0.3);
}

.search-box select:hover {
    background: var(--bg-panel);
    border-color: var(--accent-primary);
}

/* Channel List - Compact Cable Box Grid */
.channel-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Compact grid on smaller screens */
@media (max-width: 768px) {
    .channel-list {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        max-height: 400px;
    }
    
    .channel-item {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-height: 64px;
    }
}

@media (max-width: 480px) {
    .channel-list {
        max-height: 300px;
        gap: 0.5rem;
    }
    
    .channel-item {
        min-height: 60px;
        padding: 0.55rem 0.65rem;
    }
    
    .channel-item-name {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    .channel-num-display {
        min-width: 40px;
        max-width: 40px;
        min-height: 40px;
        font-size: 0.7rem;
    }
    
    .favorite-btn {
        min-width: 36px;
        max-width: 36px;
        min-height: 36px;
        max-height: 36px;
    }
}

/* Main content scrollbar only */
.main-content::-webkit-scrollbar {
    width: 12px;
}

.main-content::-webkit-scrollbar-track {
    background: var(--bg-panel);
    border: 1px inset var(--bevel-dark);
    border-radius: 2px;
}

.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    border: 1px outset var(--bevel-light);
    border-radius: 2px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

/* Channel Items - Compact Cable Box Style */
.channel-item {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.6rem;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    min-height: 56px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    touch-action: pan-y;
}

.channel-item:hover {
    background: linear-gradient(145deg, var(--hover-bg), var(--bg-tertiary));
    border-color: var(--accent-primary);
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.4),
        0 0 8px rgba(0, 168, 255, 0.2);
    transform: translateY(-1px);
}

@media (min-width: 769px) {
    .channel-item:hover {
        transform: translateX(2px);
    }
}

.channel-item.active {
    background: linear-gradient(145deg, var(--selected-bg), #005577);
    border: 2px outset var(--accent-primary);
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(0, 168, 255, 0.4);
    transform: translateX(2px);
}

.channel-item.active .channel-item-name {
    color: var(--text-led);
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

.channel-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.channel-num-display {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-led);
    font-family: 'Share Tech Mono', monospace;
    background: #000;
    padding: 0.35rem 0.5rem;
    border: 1px inset #333;
    border-radius: 2px;
    min-width: 48px;
    max-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: inset 0 0 5px rgba(0, 255, 65, 0.1);
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.4);
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.1rem;
}

.channel-item-content {
    flex: 1;
    min-width: 0;
    overflow: visible;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    justify-content: flex-start;
    padding-top: 0.1rem;
}

.favorite-btn {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    cursor: pointer;
    padding: 0.4rem;
    min-width: 36px;
    max-width: 36px;
    min-height: 36px;
    max-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.1s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
    box-sizing: border-box;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    align-self: flex-start;
    margin-top: 0.1rem;
}

[data-theme="light"] .favorite-btn {
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
}

.favorite-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    transition: all 0.2s ease;
}

.favorite-btn:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    border-color: var(--accent-primary);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    transform: translate(1px, 1px);
}

.favorite-btn:active {
    border-style: inset;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.4);
    transform: translate(2px, 2px);
}

.favorite-btn.favorited {
    color: #ffaa00;
    background: linear-gradient(145deg, #664400, #553300);
    border-color: #ffaa00;
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.4),
        0 0 8px rgba(255, 170, 0, 0.4);
}

.favorite-btn.favorited svg {
    filter: drop-shadow(0 0 4px rgba(255, 170, 0, 0.6));
}

.channel-item-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Arial', sans-serif;
}

.channel-item-group {
    font-size: 0.7rem;
    color: var(--text-secondary);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.3;
    margin-top: 0.15rem;
    font-family: 'Arial', sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-family: 'Arial', sans-serif;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Error State */
.error {
    background: rgba(255, 68, 68, 0.15);
    border: 2px inset var(--error-color);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 3px;
    margin: 1rem 0;
    font-family: 'Arial', sans-serif;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Success State */
.success {
    background: rgba(0, 255, 0, 0.15);
    border: 2px inset var(--success-color);
    color: var(--success-color);
    padding: 1rem;
    border-radius: 3px;
    margin: 1rem 0;
    font-family: 'Arial', sans-serif;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Footer - Retro Style */
.footer {
    padding: 1.5rem 2rem;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-tertiary));
    border-top: 3px outset var(--bevel-light);
    margin-top: auto;
    box-shadow: 
        inset 1px 1px 2px rgba(255, 255, 255, 0.1),
        inset -1px -1px 2px rgba(0, 0, 0, 0.3);
}

.disclaimer {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-align: center;
    line-height: 1.5;
    opacity: 0.8;
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Arial', sans-serif;
}

[data-theme="light"] .disclaimer {
    color: var(--text-secondary);
}

/* User Agreement Section */
.user-agreement-section {
    max-width: 900px;
    margin: 0 auto;
}

.agreement-toggle {
    width: 100%;
    background: linear-gradient(145deg, var(--button-raised), var(--button-inset));
    border: 2px outset var(--bevel-light);
    border-radius: 3px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.1s ease;
    text-align: left;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.agreement-toggle:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    border-color: var(--accent-primary);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform: translate(1px, 1px);
}

.agreement-toggle:active {
    border-style: inset;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    transform: translate(2px, 2px);
}

.agreement-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.agreement-content {
    margin-top: 1rem;
    padding: 1.5rem;
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    border: 2px inset var(--bevel-dark);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: 'Arial', sans-serif;
}

.agreement-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.agreement-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agreement-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.agreement-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.agreement-content::-webkit-scrollbar {
    width: 10px;
}

.agreement-content::-webkit-scrollbar-track {
    background: var(--bg-panel);
    border: 1px inset var(--bevel-dark);
    border-radius: 2px;
}

.agreement-content::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-panel));
    border: 1px outset var(--bevel-light);
    border-radius: 2px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.agreement-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

/* Video.js Custom Styles - Retro */
.video-js {
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    z-index: 1;
    padding: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
}

/* Ensure video controls are always visible and on top (non-fullscreen) */
.video-js:not(.vjs-fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) .vjs-control-bar {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    height: 4em !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85)) !important;
    border-top: 2px outset var(--bevel-light) !important;
}

/* Fullscreen: Control bar with solid background at bottom of screen (overlays video) */
.video-js.vjs-fullscreen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-webkit-full-screen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-moz-full-screen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-ms-fullscreen:not(.vjs-user-inactive) .vjs-control-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 4em !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.95)) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 10000 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Fullscreen: Hide control bar when user is inactive */
.video-js.vjs-fullscreen.vjs-user-inactive .vjs-control-bar,
.video-js:-webkit-full-screen.vjs-user-inactive .vjs-control-bar,
.video-js:-moz-full-screen.vjs-user-inactive .vjs-control-bar,
.video-js:-ms-fullscreen.vjs-user-inactive .vjs-control-bar {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

/* Fullscreen: Show control bar when user is active */
.video-js.vjs-fullscreen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-webkit-full-screen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-moz-full-screen:not(.vjs-user-inactive) .vjs-control-bar,
.video-js:-ms-fullscreen:not(.vjs-user-inactive) .vjs-control-bar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Ensure video element fills container completely (non-fullscreen) */
.player-wrapper video,
.video-js:not(.vjs-fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) video,
.video-js:not(.vjs-fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) .vjs-tech {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 4em) !important;
    object-fit: contain !important;
    z-index: 1 !important;
}

/* Fullscreen: Video fills entire screen, controls at bottom */
.video-js.vjs-fullscreen,
.video-js:-webkit-full-screen,
.video-js:-moz-full-screen,
.video-js:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
}

/* Fullscreen: Video fills entire screen by default */
.video-js.vjs-fullscreen video,
.video-js.vjs-fullscreen .vjs-tech,
.video-js:-webkit-full-screen video,
.video-js:-webkit-full-screen .vjs-tech,
.video-js:-moz-full-screen video,
.video-js:-moz-full-screen .vjs-tech,
.video-js:-ms-fullscreen video,
.video-js:-ms-fullscreen .vjs-tech {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    background: #000 !important;
}

/* When controls are visible, video still fills screen but controls overlay */
.video-js.vjs-fullscreen.controls-visible video,
.video-js.vjs-fullscreen.controls-visible .vjs-tech,
.video-js:-webkit-full-screen.controls-visible video,
.video-js:-webkit-full-screen.controls-visible .vjs-tech,
.video-js:-moz-full-screen.controls-visible video,
.video-js:-moz-full-screen.controls-visible .vjs-tech,
.video-js:-ms-fullscreen.controls-visible video,
.video-js:-ms-fullscreen.controls-visible .vjs-tech {
    height: 100vh !important;
}

/* Ensure video fills container height in non-fullscreen - no padding creating gaps */
.video-js:not(.vjs-fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) {
    padding-bottom: 0 !important;
}

/* Ensure control bar sits at the bottom of the video container */
.video-js .vjs-control-bar {
    margin-top: 0 !important;
}

/* Ensure all controls are visible (except progress bar which is hidden) */
.video-js .vjs-play-control,
.video-js .vjs-volume-control,
.video-js .vjs-fullscreen-control,
.video-js .vjs-time-control,
.video-js .vjs-menu-button,
.video-js .vjs-picture-in-picture-control {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 101 !important;
    position: relative !important;
}


/* Hide progress bar completely - all rules override any show attempts */
.video-js .vjs-progress-control,
.video-js .vjs-progress-holder,
.video-js:not(.vjs-fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) .vjs-progress-holder,
.video-js.vjs-fullscreen .vjs-progress-holder,
.video-js:-webkit-full-screen .vjs-progress-holder,
.video-js:-moz-full-screen .vjs-progress-holder,
.video-js:-ms-fullscreen .vjs-progress-holder,
.video-js.vjs-fullscreen:not(.vjs-user-inactive) .vjs-progress-holder,
.video-js:-webkit-full-screen:not(.vjs-user-inactive) .vjs-progress-holder,
.video-js:-moz-full-screen:not(.vjs-user-inactive) .vjs-progress-holder,
.video-js:-ms-fullscreen:not(.vjs-user-inactive) .vjs-progress-holder,
.video-js.vjs-fullscreen.vjs-user-inactive .vjs-progress-holder,
.video-js:-webkit-full-screen.vjs-user-inactive .vjs-progress-holder,
.video-js:-moz-full-screen.vjs-user-inactive .vjs-progress-holder,
.video-js:-ms-fullscreen.vjs-user-inactive .vjs-progress-holder {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

.video-js .vjs-play-progress {
    z-index: 103 !important;
}

/* Ensure control bar items are clickable */
.video-js .vjs-control {
    cursor: pointer !important;
    min-width: 3em !important;
    z-index: 101 !important;
}

.video-js .vjs-big-play-button {
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border: 3px outset var(--bevel-light);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.6);
}

.video-js .vjs-big-play-button:hover {
    background: linear-gradient(145deg, #00b8ff, #00aaff);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

.video-js .vjs-big-play-button:active {
    border-style: inset;
    box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.6);
}

.video-js .vjs-control-bar {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
    border-top: 2px outset var(--bevel-light);
}

/* Ensure fullscreen button is visible */
.video-js .vjs-fullscreen-control {
    display: flex !important;
    cursor: pointer;
    order: 100;
}

.video-js .vjs-fullscreen-control .vjs-icon-placeholder::before {
    content: '⛶';
    font-size: 1.4rem;
    line-height: 3em;
}

/* Popout button styling */
.video-js .vjs-popout-button {
    display: flex !important;
    cursor: pointer;
    order: 99;
    width: 3em;
    color: var(--text-primary);
    font-family: Arial, sans-serif;
}

.video-js .vjs-popout-button:hover {
    color: var(--accent-primary);
}

.video-js .vjs-popout-button .vjs-icon-placeholder::before {
    content: '⤢';
    font-size: 1.4rem;
    line-height: 3em;
}

.video-js .vjs-play-progress,
.video-js .vjs-volume-level {
    background: var(--accent-primary);
    box-shadow: 0 0 4px rgba(0, 168, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .tv-set {
        margin: 2.5rem auto;
        max-width: 95%;
    }
    
    .tv-set::before {
        top: -50px;
        left: -35px;
        right: -35px;
        bottom: -20px;
        border-width: 4px;
        border-radius: 14px;
        max-width: calc(100% + 70px);
    }
}

/* Large Desktop Screens */
@media (min-width: 1600px) {
    .tv-set {
        max-width: 88%;
    }
    
    .tv-controls-panel {
        padding: 1.5rem 2rem;
    }
    
    .channel-controls {
        gap: 1rem;
    }
    
    .channel-nav-btn {
        width: 52px;
        height: 52px;
    }
    
    .channel-nav-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* Extra Large Screens */
@media (min-width: 2560px) {
    .tv-set {
        max-width: 75%;
    }
    
    .main-content {
        padding: 3rem;
        gap: 3rem;
    }
    
    .tv-controls-panel {
        padding: 2rem 2.5rem;
    }
    
    .channel-display {
        gap: 1.5rem;
    }
    
    .channel-number-display {
        min-width: 100px;
        padding: 1rem 1.25rem;
    }
    
    .channel-number-display .number {
        font-size: 2rem;
    }
    
    .led-text {
        font-size: 1.3rem;
    }
}

@media (max-width: 1200px) {
    .main-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .sidebar-left {
        order: 2;
        max-height: 400px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .player-section {
        order: 1;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        flex-direction: column;
    }
    
    .player-section > .player-container {
        flex: 1 1 auto;
        max-width: 100%;
    }
    
    /* On smaller screens, when news is visible, use top/bottom split */
    .main-content:has(.news-panel[style*="display: flex"]) {
        flex-direction: column;
        height: calc(100vh - 2rem);
        overflow: hidden;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .news-section-top {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .news-toggle-btn {
        position: static;
        width: auto;
        max-width: 100%;
        margin-bottom: 0;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .play-toggle-btn {
        position: static;
        width: auto;
        max-width: 100%;
        margin-bottom: 0;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .player-section {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        padding: 1rem;
    }
    
    /* Ensure news panel fills its container on smaller screens */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel {
        height: 100%;
        max-height: 100%;
        flex: 1;
    }
    
    /* Limit content height on smaller screens too */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel-content {
        max-height: 420px;
    }
    
    .news-panel {
        flex: 1 1 auto;
        max-width: 100%;
        order: 3;
        margin-top: 1rem;
    }
    
    .news-toggle-btn {
        position: fixed;
        top: calc(1rem + 1.75rem);
        right: 1rem;
        z-index: 1001;
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }
    
    .news-panel {
        top: calc(1rem + 3rem);
        right: 1rem;
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        max-height: calc(100vh - 6rem);
    }

    .player-section .sidebar-right {
        order: 2;
        margin-top: 1.5rem;
        max-height: none;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .preset-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.6rem;
    }

    .channel-item {
        min-height: 58px;
        padding: 0.5rem 0.6rem;
    }
    
    .channel-item-name {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }
    
    .channel-num-display {
        font-size: 0.75rem;
        min-width: 42px;
        max-width: 42px;
        min-height: 42px;
        padding: 0.3rem 0.4rem;
    }
    
    .favorite-btn {
        min-width: 36px;
        max-width: 36px;
        min-height: 36px;
        max-height: 36px;
        padding: 0.35rem;
    }
    
    .favorite-btn svg {
        width: 16px;
        height: 16px;
    }

    .channel-list {
        max-height: 400px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .theme-toggle {
        top: 0.75rem;
        right: 0.75rem;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        z-index: 1001;
    }

    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* On tablets and smaller, when news is visible, use top/bottom split */
    .main-content:has(.news-panel[style*="display: flex"]) {
        flex-direction: column;
        height: calc(100vh - 2rem);
        overflow: hidden;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .news-section-top {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .player-section {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        padding: 0.75rem;
    }
    
    /* Ensure news panel fills its container */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel {
        height: 100%;
        max-height: 100%;
        flex: 1;
    }
    
    /* Limit content height to show 5-6 articles on tablets */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel-content {
        max-height: 420px;
    }

    .sidebar {
        padding: 1rem;
        border-radius: 3px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Improve mobile channel guide readability */
    .player-section .sidebar-right {
        padding: 0.75rem;
        margin-top: 1rem;
    }
    
    .player-section .sidebar-right .sidebar-header {
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
    }
    
    .player-section .sidebar-right .sidebar-header h2 {
        font-size: 1rem;
    }
    
    .player-section .sidebar-right .view-tabs {
        margin-bottom: 0.75rem;
        gap: 0.4rem;
    }
    
    .player-section .sidebar-right .view-tab {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }
    
    .player-section .sidebar-right .search-box {
        margin-bottom: 0.75rem;
        padding: 0.65rem;
    }
    
    .player-section .sidebar-right .search-box input {
        font-size: 0.9rem;
        padding: 0.65rem 0.65rem 0.65rem 2.5rem;
    }
    
    .player-section .sidebar-right .search-box select {
        font-size: 0.9rem;
        padding: 0.65rem;
    }

    .preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
    }
    
    .preset-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
    }

    .preset-channel {
        padding: 1rem 0.75rem;
    }

    .preset-icon {
        width: 56px;
        height: 56px;
    }

    .preset-fallback {
        width: 56px;
        height: 56px;
        font-size: 1.4rem;
    }

    .preset-name {
        font-size: 0.85rem;
    }

    .tv-set {
        margin: 1.5rem auto;
        max-width: calc(100% - 2rem);
        width: 100%;
    }
    
    .player-wrapper {
        aspect-ratio: 16/9;
        min-height: 250px;
    }
    
    .player-wrapper::before {
        top: -30px;
        left: -20px;
        right: -20px;
        bottom: -30px;
        border-width: 3px;
        border-radius: 10px;
        max-width: calc(100vw - 1rem);
    }
    
    .player-wrapper::after {
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        border-width: 2px;
    }
    
    .player-section {
        padding: 0.75rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .channel-item {
        min-height: 56px;
        padding: 0.5rem 0.6rem;
    }
    
    .channel-item-header {
        gap: 0.5rem;
    }
    
    .channel-item-content {
        gap: 0.2rem;
    }
    
    .channel-num-display {
        font-size: 0.7rem;
        min-width: 40px;
        max-width: 40px;
        min-height: 40px;
        padding: 0.3rem 0.4rem;
    }
    
    .favorite-btn {
        min-width: 36px;
        max-width: 36px;
        min-height: 36px;
        max-height: 36px;
        padding: 0.35rem;
    }
    
    .favorite-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .channel-item-name {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        line-height: 1.35;
    }
    
    .channel-item-group {
        font-size: 0.65rem;
        line-height: 1.25;
    }

    .m3u-input-section {
        padding: 0.75rem;
    }

    .input-group label {
        font-size: 0.85rem;
    }

    .playlist-selector,
    .input-group input[type="text"] {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .view-tabs {
        margin-bottom: 0.75rem;
    }

    .view-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .search-box {
        margin-bottom: 1rem;
    }

    .search-box input,
    .search-box select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .channel-list {
        max-height: 350px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    /* Ensure player wrapper has proper dimensions on mobile */
    .player-wrapper {
        position: relative !important;
        width: 100% !important;
        min-height: 200px !important;
        height: auto !important;
        display: block !important;
        visibility: visible !important;
        overflow: visible !important;
    }
    
    .tv-set {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .player-section .player-container {
        position: relative !important;
        width: 100% !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .player-wrapper .video-js {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .player-wrapper .video-js video,
    .player-wrapper .video-js .vjs-tech {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100% - 4em) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .player-wrapper .video-js .vjs-control-bar {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 4em !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 200 !important;
    }
    
    .news-toggle-btn {
        position: static;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        z-index: 1;
        width: auto;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .play-toggle-btn {
        position: static;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        z-index: 1;
        width: auto;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .play-icon {
        width: 18px;
        height: 18px;
    }
    
    .theme-toggle {
        top: calc(0.5rem + 1.75rem);
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
        z-index: 1002;
    }
    
    .news-section-top {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
        padding: 0;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .news-section-top {
        position: static;
        width: 100%;
        max-width: 100%;
        height: 50%;
    }

    .footer {
        padding: 1rem;
    }

    .disclaimer {
        font-size: 0.7rem;
        margin-bottom: 1rem;
    }

    .agreement-toggle {
        font-size: 0.85rem;
        padding: 0.65rem 0.85rem;
    }

    .agreement-content {
        padding: 1rem;
        font-size: 0.8rem;
        max-height: 400px;
    }

    .agreement-content h3 {
        font-size: 1.1rem;
    }

    .agreement-content h4 {
        font-size: 0.95rem;
        margin-top: 1.25rem;
    }

    .main-content {
        padding: 0.25rem;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* On mobile devices, when news is visible, use top/bottom split */
    .main-content:has(.news-panel[style*="display: flex"]) {
        flex-direction: column;
        height: calc(100vh - 1rem);
        overflow: hidden;
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .news-section-top {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-content:has(.news-panel[style*="display: flex"]) .player-section {
        width: 100%;
        max-width: 100%;
        flex: 0 0 50%;
        flex-shrink: 0;
        height: 50%;
        min-height: 0;
        padding: 0.5rem;
    }
    
    /* Ensure news panel fills its container on mobile */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel {
        height: 100%;
        max-height: 100%;
        flex: 1;
    }
    
    /* Limit content height to show 5-6 articles on mobile */
    .main-content:has(.news-panel[style*="display: flex"]) .news-panel-content {
        max-height: 420px;
    }

    .sidebar {
        padding: 0.75rem;
        border-radius: 3px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
        position: relative;
        z-index: 1;
    }
    
    /* Ensure privacy disclaimer is visible above preset channels on mobile */
    .sidebar-right .privacy-disclaimer {
        position: relative !important;
        z-index: 10 !important;
        margin-bottom: 1.5rem !important;
        margin-top: 0 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        order: -1 !important; /* Ensure it appears before preset-channels-section */
    }
    
    .sidebar-right .preset-channels-section {
        position: relative !important;
        z-index: 1 !important;
        margin-top: 0 !important;
        margin-bottom: 1.5rem !important;
        order: 0 !important; /* Ensure it appears after privacy-disclaimer */
    }
    
    .sidebar-right .preset-live-tv {
        position: relative !important;
        z-index: 1 !important;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }

    .sidebar-header h2 {
        font-size: 1.1rem;
    }

    .channel-count {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }

    .preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.6rem;
    }
    
    .preset-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 0.5rem;
    }

    .preset-channel {
        padding: 0.9rem 0.6rem;
    }

    .preset-icon {
        width: 50px;
        height: 50px;
    }

    .preset-fallback {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .preset-name {
        font-size: 0.75rem;
    }
    
    .preset-channel:hover {
        transform: translateY(-2px) scale(1.01);
    }

    .preset-category h3 {
        font-size: 0.7rem;
        margin-bottom: 0.75rem;
    }

    .player-section {
        padding: 1rem;
    }

    .tv-set {
        min-height: 200px;
        border-radius: 3px;
        margin: 1rem auto;
        max-width: calc(100% - 1.5rem);
        width: 100%;
    }
    
    .tv-set::before {
        top: -20px;
        left: -15px;
        right: -15px;
        bottom: -8px;
        border-width: 2px;
        border-radius: 8px;
        max-width: calc(100% + 30px);
    }
    
    .player-wrapper::after {
        top: -6px;
        left: -6px;
        right: -6px;
        bottom: -6px;
        border-width: 1px;
    }
    
    .tv-controls-panel {
        padding: 1rem;
    }
    
    .player-section {
        padding: 0.5rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .player-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .m3u-input-section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .channel-info {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .channel-display {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .channel-controls {
        flex-wrap: wrap;
    }

    .channel-number-display {
        min-width: 60px;
        padding: 0.5rem 0.6rem;
    }

    .channel-number-display .number {
        font-size: 1.5rem;
    }

    .led-text {
        font-size: 1rem;
    }

    .channel-info {
        padding: 0.75rem;
    }

    .channel-info h3 {
        font-size: 1.1rem;
    }

    .channel-info p {
        font-size: 0.85rem;
    }

    .m3u-input-section {
        padding: 0.75rem;
    }

    .input-group {
        gap: 0.4rem;
    }

    .input-group label {
        font-size: 0.8rem;
    }

    .playlist-selector,
    .input-group input[type="text"],
    .input-group select {
        font-size: 0.85rem;
        padding: 0.55rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .divider {
        font-size: 0.75rem;
        margin: 0.75rem 0;
    }

    .view-tabs {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }

    .view-tab {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
        gap: 0.35rem;
    }

    .view-tab span {
        font-size: 1rem;
    }

    .search-box {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .search-box input,
    .search-box select {
        font-size: 0.85rem;
        padding: 0.55rem;
    }

    .channel-item {
        padding: 0.65rem 0.7rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-height: 64px;
    }
    
    .channel-item-header {
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .channel-item-content {
        gap: 0.25rem;
        padding-top: 0.15rem;
    }
    
    .channel-num-display {
        font-size: 0.75rem;
        min-width: 42px;
        max-width: 42px;
        min-height: 42px;
        padding: 0.35rem 0.4rem;
    }
    
    .favorite-btn {
        min-width: 40px;
        max-width: 40px;
        min-height: 40px;
        max-height: 40px;
        padding: 0.4rem;
        margin-top: 0.15rem;
    }
    
    .favorite-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .channel-item-name {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        line-height: 1.4;
    }
    
    .channel-item-group {
        font-size: 0.7rem;
        line-height: 1.3;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar-left,
    .sidebar-right {
        max-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tv-set {
        min-height: 180px;
        max-width: calc(100% - 1rem);
        margin: 1rem auto;
        width: 100%;
    }
    
    .tv-set::before {
        top: -15px;
        left: -10px;
        right: -10px;
        bottom: -8px;
        max-width: calc(100% + 20px);
    }
}

/* iOS/Safari specific fixes for video player visibility */
@supports (-webkit-touch-callout: none) {
    .player-wrapper {
        min-height: 250px !important;
        height: auto !important;
        /* Fallback for aspect-ratio on iOS Safari - ensure proper height */
        aspect-ratio: 16/9 !important;
        position: relative !important;
        overflow: visible !important;
        padding: 0 !important;
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* If aspect-ratio not supported, use padding-bottom method */
    @supports not (aspect-ratio: 16/9) {
        .player-wrapper {
            aspect-ratio: auto !important;
            padding-bottom: 56.25% !important; /* 16:9 aspect ratio fallback */
        }
    }
    
    .player-wrapper .video-js {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .player-wrapper .video-js video,
    .player-wrapper .video-js .vjs-tech {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100% - 4em) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .player-wrapper .video-js .vjs-control-bar {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 4em !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 200 !important;
    }
    
    .tv-set {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        visibility: visible !important;
        margin: 1rem auto !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .favorite-btn {
        min-width: 48px;
        max-width: 48px;
        min-height: 48px;
        max-height: 48px;
    }

    .favorite-btn svg {
        width: 22px;
        height: 22px;
    }

    .channel-item {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .btn {
        min-height: 44px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .view-tab {
        min-height: 40px;
    }
    
    .main-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .tv-set {
        max-width: calc(100vw - 1rem);
        width: 100%;
    }
}
