/* CRT-specific overlay and intro TV styling extracted from chromashift.css */

/* CRT Transition Overlay */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000; /* make outer area solid so only TV fills view */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#crt-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* UPDATED: Make CRT TV fill the entire screen and crop as needed (no background edge) */
#crt-tv {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    z-index: 1003;
    filter: drop-shadow(0 0 50px var(--neon-pink));
    transform: none;
}

/* Black "TV off" cover enlarged to cover the purple edges */
#crt-screen-off {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1350px;
    height: 90%;
    background: #000000;
    z-index: 1002;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.95);
}

/* RGB glitch effect centered in the TV screen area */
#glitch-effect {
    position: absolute;
    top: 50%;
    left: 45%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 1200px;
    height: 80%;
    z-index: 1002;
    mix-blend-mode: screen;
    animation: glitch-pulse 0.3s infinite;
    opacity: 0.09;
}

/* Power button (Chromashift.gif) on TV side panel */
#crt-power-button {
    position: absolute;
    z-index: 1004;
    right: 6%;
    top: 15%;
    width: 10%;
    max-width: 130px;
    transform: translateY(0);
    cursor: pointer;
    border-radius: 50%;
    box-shadow:
        0 0 20px rgba(255, 0, 255, 0.9),
        0 0 32px rgba(0, 0, 0, 0.95);
    border: 2px solid var(--dream-gold);
}

#crt-power-button:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 26px rgba(255, 0, 255, 1),
        0 0 40px rgba(0, 0, 0, 1);
}

/* NEW: Badges for uploaded images inside CRT overlay */
.crt-badge {
    position: absolute;
    z-index: 1005;
    max-width: 16%;
    opacity: 0.9;
    filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.9));
}

#crt-chroma-logo {
    /* Move to far top-left over the TV image */
    top: 4%;
    left: 4%;
}

#crt-bars-logo {
    /* Move to far bottom-right over the TV image */
    bottom: 4%;
    right: 4%;
}

/* Narrative box inside CRT overlay */
#prolog-text {
    position: absolute;
    top: 20%;
    left: 43%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 1000px;
    height: 60%;
    padding: 30px;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid var(--reality-red);
    color: var(--dream-gold);
    font-size: 18px;
    line-height: 1.6;
    text-align: center;
    z-index: 1001;
    animation: text-glitch 0.5s infinite;
    box-shadow: 0 0 30px var(--reality-red);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Structured text styles inside CRT overlay */
#prolog-text .crt-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
    text-shadow: 0 0 10px var(--dream-gold);
}

#prolog-text .crt-prolog {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--electric-cyan);
}

#prolog-text .crt-narrative {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ghost-white);
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 6px;
    max-height: none;
}

/* "WAKE UP" button inside the CRT overlay for the initial menu */
#wake-up-button {
    margin-top: 18px;
    padding: 10px 26px;
    background: linear-gradient(135deg, var(--reality-red), var(--neon-pink));
    border: none;
    color: var(--ghost-white);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 999px;
    cursor: pointer;
    box-shadow:
        0 0 14px rgba(255, 0, 85, 0.9),
        0 0 24px rgba(0, 0, 0, 0.9);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

#wake-up-button:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
        0 0 18px rgba(255, 0, 255, 0.9),
        0 0 30px rgba(0, 0, 0, 1);
}

#wake-up-button:active {
    transform: translateY(1px) scale(0.97);
    box-shadow:
        0 0 10px rgba(255, 0, 85, 0.7),
        0 0 20px rgba(0, 0, 0, 0.9);
}

#wake-up-button:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

@keyframes text-glitch {
    0%, 90%, 100% { transform: translateX(-50%) skew(0deg); }
    92% { transform: translateX(-50%) skew(-2deg); }
    94% { transform: translateX(-50%) skew(2deg); }
    96% { transform: translateX(-50%) skew(-1deg); }
}

/* Eye blink overlay */
#eye-blink {
    position: absolute;
    width: 300px;
    height: 150px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1004;
    opacity: 0;
}

#eye-blink.blink {
    animation: eye-blink-anim 0.6s ease-in-out;
}

@keyframes eye-blink-anim {
    0% { opacity: 0; }
    10% { opacity: 1; }
    15% { opacity: 1; }
    20% { opacity: 1; }
    30% { opacity: 1; }
    40% { opacity: 0; }
    100% { opacity: 0; }
}

#eyelid-top, #eyelid-bottom {
    transition: transform 0.15s ease-in-out;
}

#eye-blink.blink #eyelid-top {
    animation: eyelid-top-anim 0.6s ease-in-out;
}

#eye-blink.blink #eyelid-bottom {
    animation: eyelid-bottom-anim 0.6s ease-in-out;
}

@keyframes eyelid-top-anim {
    0%, 100% { transform: translateY(0); }
    15%, 30% { transform: translateY(50px); }
}

@keyframes eyelid-bottom-anim {
    0%, 100% { transform: translateY(0); }
    15%, 30% { transform: translateY(-50px); }
}

/* Mobile adjustments for CRT layout */
@media (max-width: 600px) {
    #crt-power-button {
        right: 4%;
        top: 18%;
        width: 16%;
    }

    #prolog-text {
        width: 90%;
        max-width: none;
        padding: 20px;
        font-size: 14px;
        top: 10%;
        height: 75%;
    }

    #crt-screen-off,
    #glitch-effect {
        width: 90%;
        max-width: none;
        height: 90%;
    }

    #glitch-effect {
        left: 45%;
    }

    /* NEW: Slightly smaller CRT badges on mobile, pinned near corners */
    .crt-badge {
        max-width: 24%;
    }

    /* Keep mobile positions consistent with new desktop layout */
    #crt-chroma-logo {
        top: 4%;
        left: 4%;
    }

    #crt-bars-logo {
        bottom: 4%;
        right: 4%;
    }
}