:root {
    --bg-color: #0a0a0a;
    --primary-color: #ff00ff;
    /* Neon Purple */
    --secondary-color: #00ffff;
    /* Cyber Cyan */
    --accent-color: #39ff14;
    /* Acid Green */
    --text-color: #ffffff;
    --pixel-size: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    image-rendering: pixelated;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stage {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
}

.stage.active {
    display: flex;
    opacity: 1;
}

/* Typography & Effects */
.glitch {
    font-size: 3rem;
    position: relative;
    color: var(--text-color);
    text-shadow: 2px 2px var(--primary-color), -2px -2px var(--secondary-color);
}

.pixel-box {
    border: var(--pixel-size) solid var(--text-color);
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 10px 10px 0px rgba(255, 0, 255, 0.3);
    text-align: center;
}

#system-status {
    margin-top: 1.5rem;
    font-size: 0.8rem;
}

.status-locked {
    color: #ff3131;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.hint-text {
    margin-top: 1rem;
    font-size: 0.6rem;
    color: #888;
}

/* Puzzle Styles */
#pixel-puzzle-board {
    display: grid;
    grid-template-columns: repeat(4, 60px);
    grid-template-rows: repeat(4, 60px);
    gap: 10px;
    background: #1a1a1a;
    padding: 15px;
    border: 4px solid var(--secondary-color);
}

.puzzle-tile {
    width: 60px;
    height: 60px;
    background: #333;
    border: 2px solid #444;
    cursor: none;
    transition: background 0.2s;
}

.puzzle-tile.active {
    background: var(--accent-color);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.puzzle-tile.hint {
    animation: yellowFlash 1s ease-out forwards;
}

@keyframes yellowFlash {
    0% {
        background: #ffff00;
        box-shadow: 0 0 20px #ffff00;
    }

    100% {
        background: #333;
    }
}

/* HUD & Instructions */
.game-ui {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 8px 16px !important;
    font-size: 0.6rem !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--text-color);
    background: transparent;
    font-family: 'Press Start 2P', cursive;
    cursor: none;
    pointer-events: auto;
    z-index: 9999;
}

.home-btn:hover {
    background: var(--primary-color) !important;
    color: var(--bg-color) !important;
    box-shadow: 4px 4px 0 var(--secondary-color) !important;
}

.mute-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    padding: 0 !important;
    font-size: 1.2rem !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: auto;
}

.score-board {
    font-size: 1.2rem;
    color: var(--accent-color);
    margin-bottom: 15px;
    text-shadow: 2px 2px #000;
}

.game-info {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--secondary-color);
    padding: 15px;
    max-width: 500px;
    text-align: center;
    pointer-events: auto;
    box-shadow: 5px 5px 0px rgba(0, 255, 255, 0.2);
}

#game-title {
    color: var(--primary-color);
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-transform: uppercase;
}

#game-controls {
    color: #eee;
    font-size: 0.55rem;
    line-height: 1.6;
    white-space: pre-line;
}

/* Ghost Mascot (Pixel Art Style) */
#ghost-mascot {
    margin: 30px auto;
    width: 56px;
    height: 60px;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.ghost-body {
    width: 100%;
    height: 100%;
    background: #ff0000;
    /* Blocky head top and wavy bottom using polygon */
    clip-path: polygon(15% 0%, 85% 0%,
            100% 15%, 100% 100%,
            85% 100%, 75% 85%, 65% 100%,
            50% 85%, 35% 100%, 25% 85%, 15% 100%,
            0% 100%, 0% 15%);
    position: relative;
}

.ghost-eyes {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 15px;
}

.eye {
    width: 16px;
    height: 20px;
    background: white;
    /* Rectangular eyes */
    position: relative;
}

.pupil {
    width: 8px;
    height: 8px;
    background: #000;
    /* Black pupils as requested */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.05s linear;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.menu-box {
    max-width: 600px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 2rem;
}

.menu-item {
    width: 100%;
}

/* Canvas Overlay */
#cursor-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
}

#pacman-canvas {
    background: #000;
    border: 4px solid var(--secondary-color);
    max-width: 90vw;
    max-height: 70vh;
}

/* Game Over Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.active {
    display: flex;
}

.glitch.small {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.overlay-buttons {
    display: flex;
    gap: 20px;
    margin-top: 2rem;
}

.pixel-btn {
    background: transparent;
    border: 3px solid var(--secondary-color);
    color: var(--text-color);
    padding: 10px 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    cursor: none;
    transition: all 0.2s;
    pointer-events: auto;
}

.pixel-btn:hover {
    background: var(--secondary-color);
    color: var(--bg-color);
    box-shadow: 4px 4px 0 var(--primary-color);
    transform: translate(-2px, -2px);
}