* {
    /* Sets the custom cursor for every element, overriding defaults on links/buttons */
    cursor: url('../images/darkred.png'), auto !important;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('../images/darkbgsimple.png') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Press Start 2P', cursive, Arial, sans-serif;
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    /* Disable text highlighting */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ and Edge */
    user-select: none; /* Standard syntax */
}

#main-content {
    padding-top: 120px;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: filter 0.3s ease-in-out;
}

#main-content.blur {
    filter: blur(5px);
}

img {
    /* Prevents images from being draggable */
    -webkit-user-drag: none;
}

.logo {
    position: absolute;
    top: 20px;
    left: 50%;
    /* The translateZ(0) helps stabilize rendering and prevent jitter */
    transform: translateX(-50%) translateZ(0);
    z-index: 2100;
    max-width: 80vw;
    width: 400px;
    height: auto;
    opacity: 0;
    transition: opacity 0.5s ease-in, filter 0.3s ease-in-out;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    animation: hover 3s ease-in-out infinite;
}

.logo:hover {
    filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 15px #fff);
}

@keyframes hover {
    0% {
        transform: translate(-50%, 0) translateZ(0);
    }
    50% {
        transform: translate(-50%, -10px) translateZ(0);
    }
    100% {
        transform: translate(-50%, 0) translateZ(0);
    }
}

.logo.visible {
    opacity: 1;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.switch-container {
    text-align: center;
    font-family: 'Press Start 2P', cursive;
}

.switch-label {
    color: #fff;
    font-size: 16px;
    font-weight: normal;
    text-shadow: 2px 2px 0px #000;
    margin-bottom: 25px;
    display: block;
    line-height: 1.4;
}

.passcode-box {
    display: block;
    margin: 20px auto;
    padding: 12px 10px;
    width: 220px;
    background: #222;
    border: 3px solid #fff;
    border-radius: 0;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: none;
    caret-color: #fff;
}

.passcode-box::placeholder {
     color: #888;
     font-family: 'Press Start 2P', cursive;
     font-size: 14px;
     opacity: 0.8;
}

.passcode-box:focus {
    border-color: #FFFF00;
    box-shadow: 0 0 0 3px rgba(255, 255, 0, 0.5);
}

.submit-btn {
    display: block;
    margin: 25px auto 15px auto;
    padding: 12px 20px;
    background: #D30000;
    border: 3px solid #500000;
    border-radius: 0;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    transition: none;
    position: relative;
    top: 0;
    left: 0;
     text-shadow: 1px 1px 0px #500000;
}

.submit-btn:hover {
    background: #FF4444;
    border-color: #800000;
     text-shadow: 1px 1px 0px #800000;
}

.submit-btn:active {
    background: #B00000;
    border-color: #300000;
    top: 2px;
    left: 1px;
     text-shadow: none;
}

.error-message {
    color: #FF5555;
    font-size: 12px;
    margin-top: 10px;
    text-shadow: 1px 1px 0px #000;
    min-height: 1.5em;
    font-family: 'Press Start 2P', cursive;
}

.cartoon-switch {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 60px;
    margin-top: 15px;
}

.cartoon-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-lever {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #666;
    border: 4px solid #333;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    transition: background 0.3s;
}

.switch-lever:before {
    position: absolute;
    content: "";
    width: 50px;
    height: 70px;
    left: 5px;
    top: -15px;
    background: #ccc;
    border: 4px solid #999;
    border-radius: 8px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    transform: rotate(-20deg);
    transition: transform 0.3s ease;
}

input:checked + .switch-lever {
    background: #ff4444;
}

input:checked + .switch-lever:before {
    transform: rotate(20deg);
    left: 55px;
    background: #fff;
}

.tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    width: 100%;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease-in;
    box-sizing: border-box;
}

.tv-grid.visible {
    opacity: 1;
}

.tv-button {
    position: relative;
    width: 200px;
    height: 150px;
    text-decoration: none;
    perspective: 1000px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tv-button:hover {
    transform: scale(1.05) translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.9);
}

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

.tv {
    width: 100%;
    height: 100%;
    background: #111;
    border: 10px solid #222;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
    animation: tvFlicker 1.5s infinite alternate;
}

.screen {
    width: 100%;
    height: 100%;
    background: url('https://64.media.tumblr.com/b85f7d06171a43eec004d0be2df7eafc/tumblr_ovrf25nuJ61urz3l2o1_500.gif') no-repeat center center;
    background-size: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.tv-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    text-align: center;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    z-index: 2;
}

.tv-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
     image-rendering: pixelated;
     image-rendering: crisp-edges;
}

.tv-button:hover .tv-overlay {
    opacity: 1;
}

.channel .tv-overlay {
    background-image: url('../images/tv.png');
    background-size: cover;
}

#power-btn .tv-overlay {
    background-image: url('../images/power.png');
}

#volume-up .tv-overlay {
    background-image: url('../images/high-volume.png');
}

#volume-down .tv-overlay {
    background-image: url('../images/volume-down.png');
}

#home-btn .tv-overlay {
    background-image: url('../images/chicken-coop.png');
}

#store-btn .tv-overlay {
    background-image: url('../images/online-store.png');
}

@keyframes tvFlicker {
    0% { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7); }
    100% { box-shadow: 0 10px 30px rgba(50, 50, 50, 0.5); }
}

.help-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.help-menu-backdrop.visible {
    opacity: 1;
    pointer-events: all;
}

.help-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #111;
    border: 10px solid #222;
    border-radius: 15px;
    padding: 20px;
    z-index: 2300;
    width: 90%;
    max-width: 500px;
    text-align: center;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.help-menu.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.close-menu-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #D30000;
    border: 3px solid #500000;
    border-radius: 5px;
    color: #fff;
    font-size: 24px;
    width: 30px;
    height: 30px;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.help-menu-content {
    margin-top: 30px;
}

.help-menu-image {
    width: 100%;
    max-width: 200px;
    border: 3px solid #fff;
    margin-bottom: 20px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

@media (max-width: 768px) {
    #main-content { padding-top: clamp(80px, 20vw, 120px); }
    .logo { top: 10px; max-width: 60vw; }
    .tv-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; width: 90%; padding: 15px; }
    .tv-button { width: 100%; aspect-ratio: 4 / 3; height: auto; }
    .tv-label { font-size: clamp(12px, 2vw, 16px); }
    .cartoon-switch { width: 100px; height: 50px; }
    .switch-lever:before { width: 40px; height: 60px; left: 5px; top: -10px; }
    input:checked + .switch-lever:before { left: 45px; }
    .switch-label { font-size: 14px; margin-bottom: 20px;}
    .passcode-box { width: 200px; font-size: 14px; padding: 10px 8px;}
    .submit-btn { font-size: 12px; padding: 10px 15px; margin-top: 20px; }
    .error-message { font-size: 10px; }
}

@media (max-width: 480px) {
    #main-content { padding-top: clamp(60px, 15vw, 80px); }
    .logo { max-width: 50vw; }
    .tv-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
    .cartoon-switch { width: 80px; height: 40px; }
    .switch-lever:before { width: 30px; height: 50px; top: -10px; }
    input:checked + .switch-lever:before { left: 35px; }
     .switch-label { font-size: 12px; margin-bottom: 15px; }
     .passcode-box { width: 180px; font-size: 12px; padding: 8px 6px;}
     .submit-btn { font-size: 10px; padding: 8px 12px; margin-top: 15px; }
     .error-message { font-size: 9px; }
}
