/* 90s Web Aesthetic */
:root {
    /* TV Screen position - adjust these to match background image */
    --tv-top: 50%;
    --tv-left: 50%;
    --tv-width: 500px;
    --tv-height: 380px;
    --tv-rotate-y: -2deg;
    --tv-rotate-x: 1deg;
    --tv-scale: 1;
}

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

body {
    font-family: 'VT323', monospace;
    background: #0a0a0a;
    overflow: hidden;
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><text y="24" font-size="24">👆</text></svg>'), auto;
}

.room-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: linear-gradient(135deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
}

.room-background {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Photorealistic room background */
.room-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Slightly moody lighting */
    filter: brightness(0.85) saturate(1.1) contrast(1.05);
}

/* Fallback gradient when no image */
.room-background:not(:has(img[src])), 
.room-background:has(img:not([src])),
.room-background:has(img[src=""]) {
    background: 
        /* Ambient room lighting */
        radial-gradient(ellipse at 50% 40%, rgba(80,60,100,0.3) 0%, transparent 50%),
        /* Wall texture */
        linear-gradient(180deg, #1a0a2e 0%, #2d1b4e 50%, #1a1025 100%);
}

/* Room ambient effects */
.room-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Subtle vignette for atmosphere */
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 2;
}

/* Screen glow on the room */
.room-background::after {
    content: '';
    position: absolute;
    top: 30%;
    left: 30%;
    width: 40%;
    height: 30%;
    background: radial-gradient(ellipse, rgba(100,120,255,0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 2;
    filter: blur(40px);
}

/* TV Container - positioned for room background integration */
.tv-container {
    position: absolute;
    /* Position from CSS variables - easy to adjust for background image */
    top: var(--tv-top);
    left: var(--tv-left);
    transform: 
        translate(-50%, -50%) 
        perspective(1000px) 
        rotateY(var(--tv-rotate-y)) 
        rotateX(var(--tv-rotate-x))
        scale(var(--tv-scale));
    z-index: 10;
    /* Subtle 3D perspective for realism */
    transform-style: preserve-3d;
}

.tv-frame {
    /* No frame styling - screen only mode for background image integration */
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.tv-screen {
    width: var(--tv-width);
    height: var(--tv-height);
    /* Black background so TV is visible even without video */
    background: #000;
    /* CRT curved screen - rounded corners to match TV in image */
    border-radius: 8% / 6%;
    overflow: hidden !important;
    position: relative;
    /* Keep below the room image edges */
    z-index: 5;
    /* Border to make it visible */
    border: 3px solid #222;
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.5);
}

/* Ensure iframe stays contained */
.tv-screen iframe {
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

/* iframe fills the TV screen */
#tv-video {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8% / 6%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Static effect */
.tv-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUAAAAAAAAAAAAAAAAAAAAAAADgKxmiAAAABnRSTlMAESIzRFVmd4extgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAKJJREFUOI3t0jEOwCAIBdCf2MGDuLp6/5M4UAewbTSmky8hPDCg7x1CDAAAAAD4N/CzOSCJPYKsRKqJkQJJ7JEchYjEkCJJKVJNjJQUKVKkSDVJShEp0iQpRKSJlxSfCqmLdM7QSZZ8YY/H9Q5hRi4AAAAAIJ+BTuZZRjoZAAAAAAAAAMC/4+bIpwPfOx4AAAAAAABAH8B3rl8bL7kA1aY47C4AAAAASUVORK5CYII=');
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    animation: static-flicker 0.1s infinite;
}

.tv-static.active {
    opacity: 0.3;
}

@keyframes static-flicker {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(5%, 5%); }
    30% { transform: translate(-5%, 5%); }
    40% { transform: translate(5%, -5%); }
    50% { transform: translate(-5%, 0); }
    60% { transform: translate(5%, 0); }
    70% { transform: translate(0, 5%); }
    80% { transform: translate(0, -5%); }
    90% { transform: translate(5%, 5%); }
    100% { transform: translate(0, 0); }
}

/* Channel indicator */
.channel-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 255, 0, 0.8);
    color: #000;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 101;
    opacity: 0;
    transition: opacity 0.3s;
    text-shadow: none;
}

.channel-indicator.show {
    opacity: 1;
}

/* TV Controls - hidden when using background image, shown as overlay */
.tv-controls {
    display: none; /* Hidden by default - TV is part of background */
}

/* Show controls only when no background image (fallback mode) */
.show-tv-controls .tv-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 0 20px;
}

.tv-brand {
    font-family: 'Arial Black', sans-serif;
    color: #silver;
    font-size: 20px;
    letter-spacing: 4px;
    background: linear-gradient(180deg, #e8e8e8 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tv-buttons {
    display: flex;
    gap: 10px;
}

.tv-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #4a4a4a, #2a2a2a);
    color: #00ff00;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 1px 2px rgba(255,255,255,0.2);
    transition: all 0.1s;
}

.tv-btn:hover {
    background: linear-gradient(145deg, #5a5a5a, #3a3a3a);
}

.tv-btn:active {
    transform: scale(0.95);
}

/* Remote hint - minimal and unobtrusive */
.remote-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    z-index: 100;
    backdrop-filter: blur(10px);
    opacity: 0.8;
    transition: opacity 0.3s;
}

.remote-hint:hover {
    opacity: 1;
}

.key {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    margin: 0 3px;
    font-family: 'VT323', monospace;
    font-size: 16px;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.6); }
}

/* VHS Stack - hidden when using photorealistic background */
.vhs-stack {
    display: none; /* Part of the background image now */
}

/* Show VHS only in fallback mode */
.show-decorations .vhs-stack {
    display: block;
    position: fixed;
    bottom: 100px;
    right: 50px;
    z-index: 50;
    transform: rotate(-5deg);
}

.vhs-tape {
    background: linear-gradient(90deg, #1a1a1a, #2d2d2d, #1a1a1a);
    color: #fff;
    padding: 8px 20px;
    margin-bottom: 5px;
    font-size: 12px;
    letter-spacing: 2px;
    border-radius: 3px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    position: relative;
}

.vhs-tape::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 15px;
    background: #333;
    border: 1px solid #555;
    border-radius: 2px;
}

.vhs-tape:nth-child(1) { background: linear-gradient(90deg, #2c1810, #4a2c1a, #2c1810); }
.vhs-tape:nth-child(2) { background: linear-gradient(90deg, #0a1628, #1a3050, #0a1628); }
.vhs-tape:nth-child(3) { background: linear-gradient(90deg, #1a0a20, #3a1a40, #1a0a20); }

/* Responsive */
@media (max-width: 800px) {
    .tv-screen {
        width: 90vw;
        height: 50vw;
    }
    
    .vhs-stack {
        display: none;
    }
}

/* Scanlines animation */
@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}
