:root {
    --bg-color: #050a1f;
    --grid-bg: #10162a;
}

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

body {
    margin: 0;
    overflow: hidden;
    background-color: #120024;
    color: #fff;
    font-family: 'Lilita One', cursive;
    cursor: url('cursor.svg') 4 4, auto;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1; /* Canvas goes behind the UI */
}

#ui-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 10; /* UI goes on top */
    pointer-events: none; /* Let clicks pass through to canvas by default */
}

.screen {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; left: 0;
    transition: opacity 0.5s;
}

@keyframes panGrid {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

#main-menu {
    z-index: 200; 
    background-color: rgba(5,10,31, 0.75);
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: panGrid 4s linear infinite;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.logo {
    font-size: 6rem;
    color: #ff00ff;
    text-shadow: 0 0 10px #fff, 0 0 20px #ff00ff, 0px 5px 0px #880088, 0px 5px 20px #ff00ff;
    margin-bottom: 0px;
    letter-spacing: 2px;
    text-align: center;
    line-height: 0.9;
    -webkit-text-stroke: 2px #fff;
}
.subtitle {
    font-size: 2.5rem;
    color: #00ffff;
    text-shadow: 0 0 10px #fff, 0 0 20px #00ffff, 0px 3px 0px #008888, 0px 3px 20px #00ffff;
    margin-bottom: 40px;
    letter-spacing: 1px;
    text-align: center;
    -webkit-text-stroke: 1px #fff;
}

.menu-btn {
    font-size: 2.5rem;
    padding: 15px 50px;
    background: #00ffff;
    color: #fff;
    border: 4px solid #fff;
    border-radius: 30px;
    cursor: pointer;
    text-shadow: 0 0 10px #fff, 0 0 20px #00ffff;
    box-shadow: 0 0 20px #00ffff, inset 0 0 10px #fff, 0 10px 0 #008888;
    transition: all 0.2s;
    pointer-events: auto;
    transform: translateY(0);
}
.menu-btn:hover {
    background: #ff00ff;
    box-shadow: 0 0 20px #ff00ff, inset 0 0 10px #fff, 0 10px 0 #880088;
    text-shadow: 0 0 10px #fff, 0 0 20px #ff00ff;
}
.menu-btn:active {
    transform: translateY(10px);
    box-shadow: 0 0 20px #ff00ff, inset 0 0 10px #fff, 0 0px 0 #880088;
}

#game-container { padding: 20px; justify-content: space-between; }

header {
    display: flex; justify-content: space-between;
    width: 100%; max-width: 600px; padding-top: 20px;
}
.hud-item {
    font-size: 1.5rem; background: rgba(46, 0, 89, 0.8);
    padding: 10px 20px; border: 3px solid #00ffff; border-radius: 20px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5), inset 0 0 10px rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(3px);
    text-shadow: 0 0 10px #00ffff;
}

#mute-btn { border: none; font-size: 2rem; padding: 5px; background: transparent; cursor: pointer; text-shadow: 0 0 10px #ff00ff; }

#tutorial-text {
    text-align: center; color: #fce803; font-size: 1.2rem;
    text-shadow: 0 0 10px #fce803; max-width: 500px;
    background: rgba(0,0,0,0.5); padding: 15px; border-radius: 10px;
}

footer { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; }

button {
    background: #00ffff; color: #fff; border: 3px solid #fff;
    padding: 10px 20px; font-family: 'Lilita One', cursive; font-size: 1.2rem;
    cursor: url('cursor-pointer.svg') 16 4, pointer !important;
    border-radius: 20px; transition: all 0.2s;
    text-shadow: 0 0 5px #fff, 0 0 5px #00ffff;
    box-shadow: 0 0 8px #00ffff, inset 0 0 5px #fff, 0 5px 0 #008888;
    transform: translateY(0);
}
button:hover { background: #ff00ff; box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #fff, 0 5px 0 #880088; text-shadow: 0 0 5px #fff, 0 0 5px #ff00ff; }
button:active { transform: translateY(5px); box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #fff, 0 0px 0 #880088; }
button:disabled { opacity: 0.5; filter: grayscale(1); pointer-events: none;}

#hint-btn { background: #ffaa00; box-shadow: 0 0 8px #ffaa00, inset 0 0 5px #fff, 0 5px 0 #aa5500; }
#hint-btn:hover:not(:disabled) { background: #ffdd00; box-shadow: 0 0 10px #ffdd00, inset 0 0 5px #fff, 0 5px 0 #ddaa00; }

.hidden { display: none !important; opacity: 0; pointer-events: none; }

#victory-message {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(46, 0, 89, 0.95); backdrop-filter: blur(10px);
    padding: 40px; border: 4px solid #ff00ff; border-radius: 30px;
    box-shadow: 0 0 50px #ff00ff, inset 0 0 20px #ff00ff; text-align: center; z-index: 100;
}
#victory-message h2 { color: #fff; font-size: 3rem; text-shadow: 0 0 10px #ff00ff, 0 0 20px #ff00ff, -2px -2px 0 #fff; -webkit-text-stroke: 1px #fff; }

#stars { font-size: 3.5rem; color: #222; margin: 15px 0; }
.star { display: inline-block; transition: color 0.5s; }
.star.active {
    color: #fce803; text-shadow: 0 0 20px #fce803, 0 0 40px #fce803;
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes bounceHand { 0% { margin-top: -10px; } 100% { margin-top: -25px; } }
@keyframes clickHandAnim { 0% { transform: translate(-50%, -50%) scale(1); margin-top: -10px; } 50% { transform: translate(-50%, -50%) scale(0.7); margin-top: 5px; } 100% { transform: translate(-50%, -50%) scale(1); margin-top: -10px; } }
.hand-clicking { animation: clickHandAnim 0.4s ease-in-out !important; }
#victory-message p { font-size: 1.2rem; margin-bottom: 20px; }

/* Main Menu Styles */
.level-node-btn {
    width: 60px; height: 60px;
    border-radius: 10px;
    background: rgba(0,255,255,0.1);
    border: 2px solid #0ff;
    color: #fff; font-size: 1.5rem; font-family: 'Lilita One', cursive;
    cursor: pointer; transition: 0.2s;
    box-shadow: 0 0 10px #0ff; text-shadow: 0 0 5px #0ff;
}
.level-node-btn:hover:not(:disabled) {
    background: rgba(0,255,255,0.4); transform: scale(1.1);
}
.level-node-btn:disabled {
    background: rgba(50,50,50,0.5); border-color: #555; color: #777;
    cursor: not-allowed; box-shadow: none; text-shadow: none;
}
.level-node-btn.completed {
    background: rgba(255, 215, 0, 0.2); border-color: #ffd700;
    box-shadow: 0 0 10px #ffd700; text-shadow: 0 0 5px #ffd700;
}
#menu-play-btn:hover { transform: scale(1.05); background: rgba(0,255,255,0.4) !important; }
#menu-levels-btn:hover { transform: scale(1.05); background: rgba(209,0,255,0.4) !important; }
#close-levels-btn:hover { transform: scale(1.05); background: rgba(255,0,85,0.4) !important; }

/* Mobile Portrait Layout Fixes */
@media (max-width: 600px) {
    header {
        gap: 5px;
        padding: 5px;
    }
    .hud-item {
        font-size: 1rem;
        padding: 5px 10px;
        border-width: 2px;
        border-radius: 10px;
    }
    footer {
        padding-bottom: 10px;
        gap: 5px;
    }
    button {
        font-size: 1rem;
        padding: 8px 15px;
    }
}

/* Landscape Layout Fixes (Move UI to sides & Perfect Alignment) */
@media (orientation: landscape) {
    #game-container {
        flex-direction: row;
        padding: 30px;
        align-items: center;
    }
    header {
        flex-direction: column;
        width: auto;
        height: 100%;
        max-width: none;
        justify-content: center;
        align-items: flex-start;
        gap: 15px;
        padding-top: 0;
    }
    header .hud-item {
        min-width: 160px;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    footer {
        flex-direction: column;
        height: 100%;
        justify-content: center;
        align-items: flex-end;
        gap: 15px;
        padding-bottom: 0;
    }
    footer button {
        min-width: 160px;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    main {
        flex: 1;
    }
}

/* --- NEW MAIN MENU STYLES --- */
@keyframes floatMenu {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

@keyframes neonPulse {
    0% { text-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 30px #d100ff; }
    100% { text-shadow: 0 0 20px #0ff, 0 0 40px #0ff, 0 0 80px #d100ff; }
}

.menu-btn {
    font-family: 'Lilita One', cursive;
    color: #fff;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    outline: none;
    pointer-events: auto;
}

.primary-btn {
    padding: 20px;
    font-size: 2.2rem;
    background: rgba(0, 255, 255, 0.2);
    border: 3px solid #0ff;
    text-shadow: 0 0 15px #0ff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 15px rgba(0, 255, 255, 0.2);
}
.primary-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8), inset 0 0 20px rgba(0, 255, 255, 0.5);
    transform: scale(1.05);
}

.secondary-btn {
    padding: 15px;
    font-size: 1.5rem;
    background: rgba(209, 0, 255, 0.15);
    border: 2px solid #d100ff;
    text-shadow: 0 0 10px #d100ff;
    box-shadow: 0 0 15px rgba(209, 0, 255, 0.3), inset 0 0 10px rgba(209, 0, 255, 0.2);
}
.secondary-btn:hover {
    background: rgba(209, 0, 255, 0.3);
    box-shadow: 0 0 25px rgba(209, 0, 255, 0.6), inset 0 0 15px rgba(209, 0, 255, 0.4);
    transform: scale(1.05);
}

.glass-modal {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 15, 40, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid #0ff;
    border-radius: 20px;
    padding: 30px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
    z-index: 300;
}

.glass-modal h2 {
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 0 0 15px #0ff;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.close-btn {
    padding: 10px 40px;
    font-size: 1.5rem;
    font-family: 'Lilita One', cursive;
    border: 2px solid #ff0055;
    background: rgba(255, 0, 85, 0.2);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    text-shadow: 0 0 10px #ff0055;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
    transition: all 0.2s;
}
.close-btn:hover {
    background: rgba(255, 0, 85, 0.4);
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.6);
    transform: scale(1.05);
}
