@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap');

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

body {
    background: #0a0a0a;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-family: 'Creepster', cursive;
    cursor: default;
    user-select: none;
}

/* Click-to-start overlay (needed for audio autoplay policy) */
.click-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* .click-overlay uses the global .hidden class */

.click-prompt {
    font-family: 'Creepster', cursive;
    font-size: 2.5rem;
    color: #888;
    animation: pulse-prompt 2s ease-in-out infinite;
    letter-spacing: 0.15em;
}

@keyframes pulse-prompt {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* TV static overlay */
.static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* Film grain canvas */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    opacity: 0.06;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Main menu layout */
.main-menu {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 10;
}

/* Left panel - Title & Buttons */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 6vw;
    position: relative;
}

.title {
    display: flex;
    flex-direction: column;
    margin-bottom: 3rem;
    line-height: 1;
}

.title-line {
    display: block;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        0 0 10px rgba(255, 0, 0, 0.3),
        0 0 40px rgba(255, 0, 0, 0.1),
        0 0 80px rgba(255, 0, 0, 0.05);
    letter-spacing: 0.08em;
}

.title-five {
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: #e0e0e0;
}

.title-at {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #888;
    margin: 0.3rem 0;
    letter-spacing: 0.2em;
}

.title-name {
    font-size: clamp(2.5rem, 6.5vw, 6rem);
    color: #d42020;
    text-shadow:
        0 0 10px rgba(255, 0, 0, 0.5),
        0 0 40px rgba(255, 0, 0, 0.3),
        0 0 80px rgba(255, 0, 0, 0.15),
        2px 2px 0 #1a0000;
    animation: title-flicker 4s ease-in-out infinite;
}

@keyframes title-flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.7; }
    94% { opacity: 1; }
    96% { opacity: 0.85; }
    97% { opacity: 1; }
}

/* Menu buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 280px;
}

.menu-btn {
    font-family: 'Creepster', cursive;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #999;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: 0.5rem 1rem;
    letter-spacing: 0.12em;
    position: relative;
    transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.15s ease;
    text-transform: uppercase;
}

.menu-btn::before {
    content: '>';
    position: absolute;
    left: -1rem;
    opacity: 0;
    color: #d42020;
    transition: opacity 0.2s ease, left 0.2s ease;
}

.menu-btn:hover {
    color: #fff;
    text-shadow:
        0 0 8px rgba(255, 0, 0, 0.4),
        0 0 25px rgba(255, 0, 0, 0.15);
    transform: translateX(5px);
}

.menu-btn:hover::before {
    opacity: 1;
    left: -0.5rem;
}

.menu-btn:active {
    color: #d42020;
    transform: translateX(5px) scale(0.98);
}

/* Version info */
.version-info {
    position: absolute;
    bottom: 2rem;
    left: 6vw;
    font-family: monospace;
    font-size: 0.75rem;
    color: #333;
    letter-spacing: 0.1em;
}

/* Right panel - Character image */
.right-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.character-frame {
    position: relative;
    width: 75%;
    max-width: 500px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

.character-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) contrast(1.2) saturate(0.3);
    animation: img-breathe 6s ease-in-out infinite;
    transition: filter 0.3s ease;
}

@keyframes img-breathe {
    0%, 100% { filter: brightness(0.7) contrast(1.2) saturate(0.3); }
    50% { filter: brightness(0.6) contrast(1.3) saturate(0.25); }
}

/* Reddish glow around the image */
.character-glow {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(
        ellipse at center,
        rgba(180, 0, 0, 0.08) 0%,
        transparent 70%
    );
    pointer-events: none;
    animation: glow-pulse 5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* CRT scan line effect over image */
.scan-line {
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
    animation: scan 8s linear infinite;
}

@keyframes scan {
    0% { top: -10%; }
    100% { top: 110%; }
}

/* Vignette over the whole page */
.main-menu::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
    pointer-events: none;
    z-index: 15;
}

/* ===== GAME SCREEN ===== */
.game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: #080808;
}

/* .game-screen uses the global .hidden class */

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.game-static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    transition: opacity 0.1s ease;
}

/* Night transition overlay */
.night-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.night-transition.active {
    opacity: 1;
    pointer-events: all;
}

.night-transition .night-text {
    font-family: 'Creepster', cursive;
    font-size: 3rem;
    color: #fff;
    letter-spacing: 0.2em;
    opacity: 0;
    animation: fade-in-text 1.5s ease forwards;
    animation-delay: 0.5s;
}

.night-transition .night-subtext {
    font-family: monospace;
    font-size: 1rem;
    color: #666;
    margin-top: 1rem;
    opacity: 0;
    animation: fade-in-text 1.5s ease forwards;
    animation-delay: 1.2s;
}

@keyframes fade-in-text {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
