:root {
    --bg-color: #050510;
    --panel-color: rgba(20, 20, 40, 0.8);
    --neon-blue: #00f2ff;
    --neon-pink: #ff00ff;
    --neon-yellow: #ffff00;
    --neon-red: #ff3e3e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --border-radius: 16px;
    --transition-speed: 0.4s;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 600px;
    max-height: 900px;
    background: radial-gradient(circle at center, #101030 0%, #050510 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-speed), transform var(--transition-speed);
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 3rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 20px rgba(255, 255, 0, 0.6);
    margin-bottom: 3rem;
    text-align: center;
}

h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    color: var(--neon-blue);
    margin-bottom: 2rem;
}

/* UI Elements */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.arcade-btn {
    background: var(--panel-color);
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 1.2rem;
    border-radius: var(--border-radius);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.arcade-btn:hover {
    background: var(--neon-blue);
    color: var(--bg-color);
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.5);
    transform: scale(1.05);
}

.arcade-btn.secondary {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.arcade-btn.secondary:hover {
    background: var(--neon-pink);
    color: var(--bg-color);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.5);
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* HUD */
#hud {
    position: absolute;
    top: 2rem;
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-item .label {
    font-size: 0.6rem;
    font-family: 'Press Start 2P', cursive;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

#score-val {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--neon-yellow);
}

/* Canvas Area */
#canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding-top: 6rem;
}

#game-canvas {
    max-width: 100%;
    max-height: calc(100vh - 12rem);
    background: var(--bg-color);
    box-shadow: 0 0 40px rgba(0, 21, 255, 0.1);
    border-radius: 8px;
}

/* Instructions */
.instructions-content {
    background: var(--panel-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
}

.control-item {
    text-align: center;
    margin-bottom: 1.5rem;
}

.key {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 26px;
    border: 2px solid var(--text-secondary);
    border-radius: 4px;
    margin: 0 4px;
    font-weight: bold;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.entity-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.pacman-preview { background: var(--neon-yellow); box-shadow: 0 0 10px var(--neon-yellow); }
.ghost-preview { background: var(--neon-red); box-shadow: 0 0 10px var(--neon-red); }

/* Glitch Effect */
.glitch-text {
    position: relative;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px rgba(255, 255, 0, 0.5); }
    to { text-shadow: 0 0 25px rgba(255, 255, 0, 0.9), 0 0 50px rgba(255, 255, 0, 0.4); }
}

#lives-container {
    display: flex;
    gap: 4px;
}

.life-icon {
    width: 12px;
    height: 12px;
    background: var(--neon-yellow);
    border-radius: 50%;
    clip-path: polygon(100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 50%);
    transform: rotate(45deg);
}

@media (max-width: 480px) {
    h1 { font-size: 2rem; }
    .arcade-btn { padding: 1rem; font-size: 0.7rem; }
}
