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

body {
    background-color: #121212;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* TV Container & Frame */
.tv-container {
    position: relative;
    width: 80vw;
    max-width: 900px;
}

.tv-frame {
    background-color: #222;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 0 0 10px #333,
        0 0 20px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* TV Screen */
.tv-screen {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background-color: #000;
    overflow: hidden;
    border: 2px solid #111;
    border-radius: 10px;
}

#player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Static overlay */
.static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjc1IiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIiBmaWx0ZXI9InVybCgjYSkiIG9wYWNpdHk9Ii4wNSIvPjwvc3ZnPg==');
    background-size: cover;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: lighten;
}

.static-overlay.active {
    opacity: 1;
    animation: static-animation 0.5s steps(10) infinite;
}

@keyframes static-animation {
    0% {
        background-position: 0 0;
        opacity: 0.8;
    }
    20% {
        background-position: 20% 20%;
        opacity: 0.7;
    }
    40% {
        background-position: -15% 35%;
        opacity: 0.9;
    }
    60% {
        background-position: 35% -10%;
        opacity: 0.8;
    }
    80% {
        background-position: -25% -25%;
        opacity: 0.9;
    }
    100% {
        background-position: 15% 35%;
        opacity: 0.8;
    }
}

/* Scanlines effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.2) 1px,
        rgba(0, 0, 0, 0.2) 2px
    );
    z-index: 2;
    pointer-events: none;
    opacity: 0.5;
}

/* TV power effects */
.tv-off {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 4;
    transition: opacity 0.3s ease-out;
    opacity: 1;
}

.tv-on {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background-color: #fff;
    border-radius: 50%;
    z-index: 5;
    opacity: 0;
    transition: all 0.2s ease-out;
}

.tv-powered-on .tv-off {
    opacity: 0;
}

.tv-powering-on .tv-on {
    opacity: 1;
    transform: translate(-50%, -50%) scale(20);
    transition: all 0.3s ease-out;
}

/* TV Controls */
.tv-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 0 10px;
}

.tv-power-button {
    width: 30px;
    height: 30px;
    background-color: #333;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.power-indicator {
    width: 10px;
    height: 10px;
    background-color: #555;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.tv-powered-on .power-indicator {
    background-color: #f00;
    box-shadow: 0 0 5px #f00, 0 0 10px #f00;
}

.tv-channel-display {
    background-color: #000;
    color: #f00;
    padding: 5px 15px;
    border-radius: 5px;
    font-family: 'Digital', monospace;
    font-size: 24px;
    box-shadow: inset 0 0 5px rgba(255, 0, 0, 0.5);
}

/* Volume indicator and knob container */
.knob-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.volume-indicator {
    font-family: monospace;
    font-size: 8px;
    color: #0f0;
    margin-top: 5px;
    background-color: #111;
    padding: 2px 4px;
    border-radius: 2px;
    border: 1px solid #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.volume-indicator.off {
    color: #666;
    text-decoration: line-through;
}

/* Update TV knobs */
.tv-knobs {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.knob {
    width: 25px;
    height: 25px;
    background-color: #666;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.knob::after {
    content: '';
    display: block;
    width: 2px;
    height: 10px;
    background-color: #222;
    margin: 0 auto;
    transform-origin: bottom center;
}

.volume-knob::after {
    transform: translateY(2px) rotate(45deg);
}

.channel-knob::after {
    transform: translateY(2px) rotate(-30deg);
}

/* Back button */
.back-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

.back-button a {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f00;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.back-button a:hover {
    background-color: #c00;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tv-container {
        width: 95vw;
    }
    
    .tv-frame {
        padding: 15px;
    }
    
    .tv-controls {
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .tv-channel-display {
        font-size: 18px;
        padding: 3px 10px;
    }
    
    .tv-knobs {
        gap: 10px;
    }
    
    .knob {
        width: 20px;
        height: 20px;
    }
}

/* Message overlay */
.message-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 15px 25px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 18px;
    z-index: 10;
    border: 1px solid #444;
}

/* Volume knob muted state */
.volume-knob.muted {
    opacity: 0.7;
}

/* Attribution */
.attribution {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    font-family: Arial, sans-serif;
}

.attribution a {
    color: #999;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Title overlay for displaying video titles */
.title-overlay {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    z-index: 4;
    opacity: 1;
    transition: opacity 1s ease-out;
}

/* Play button for browsers that block autoplay */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    font-size: 16px;
    cursor: pointer;
    z-index: 5;
}

.play-button:hover {
    background: rgba(50, 50, 50, 0.8);
}

/* Message overlay styling */
.message-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 16px;
    text-align: center;
    z-index: 4;
}
