/* Simply Neon Labyrinth Styles */

:root {
    --bg-color: #0c0e11;
    --neon-blue: #00ffff;
    --neon-pink: #ff00ff;
    --neon-green: #39ff14;
    --neon-yellow: #ffff00;
    --neon-red: #ff3131;
    --text-color: #ececec;
    --grid-color: rgba(255, 255, 255, 0.05);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
}

header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border-bottom: 2px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    z-index: 100;
}

.score-board {
    display: flex;
    gap: 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    color: var(--neon-pink);
    font-size: 0.6rem;
    margin-bottom: 2px;
    text-shadow: 0 0 5px var(--neon-pink);
}

#score,
#level,
#high-score {
    color: var(--neon-blue);
    text-shadow: 0 0 5px var(--neon-blue);
}

.icon-btn {
    background: none;
    border: 1px solid var(--neon-blue);
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    box-shadow: 0 0 5px var(--neon-blue);
    margin-left: 5px;
}

.icon-btn:hover {
    background: var(--neon-blue);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--neon-blue);
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    border: 4px solid var(--neon-pink);
    box-shadow:
        0 0 10px var(--neon-pink),
        inset 0 0 10px var(--neon-pink);
    background: rgba(0, 0, 0, 0.8);
    image-rendering: pixelated;
    max-width: 95vw;
    max-height: 80vh;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 14, 17, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 50;
    backdrop-filter: blur(5px);
}

.screen.active {
    display: flex;
}

.neon-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    color: var(--neon-pink);
    text-shadow:
        0 0 5px var(--neon-pink),
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink),
        0 0 40px var(--neon-pink);
    margin-bottom: 20px;
    animation: flicker 1.5s infinite alternate;
}

.neon-text-red {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--neon-red);
    text-shadow: 0 0 10px var(--neon-red);
    margin-bottom: 20px;
}

.neon-text-green {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    margin-bottom: 20px;
}

/* Game Logo Image */
.game-logo-img {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 0 15px var(--neon-blue));
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px var(--neon-blue));
    }

    100% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px var(--neon-pink));
    }
}

.pixel-scene span {
    display: inline-block;
    filter: drop-shadow(0 0 10px var(--neon-pink));
}

/* Make them chase */
.pixel-scene span:nth-child(1) {
    /* Ghost/Virus */
    animation: bounce 1s infinite alternate;
    filter: drop-shadow(0 0 10px var(--neon-red));
}

.pixel-scene span:nth-child(2) {
    /* Candy */
    animation: spin 3s linear infinite;
    filter: drop-shadow(0 0 10px var(--neon-yellow));
}

.pixel-scene span:nth-child(3) {
    /* Runner */
    animation: run 0.5s infinite alternate;
    transform: scaleX(-1);
    /* Face left towards candy */
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

@keyframes run {
    from {
        transform: scaleX(-1) translateX(0);
    }

    to {
        transform: scaleX(-1) translateX(5px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.header-left img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    transition: all 0.2s;
}

.home-btn:hover img {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--neon-pink));
}

.mode-selector {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.mode-btn {
    background: transparent;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 10px 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

.mode-btn.active {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
    opacity: 1;
    transform: scale(1.1);
}

.mode-btn:hover {
    opacity: 1;
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.neon-btn {
    font-family: 'Press Start 2P', cursive;
    background: transparent;
    color: var(--neon-blue);
    border: 2px solid var(--neon-blue);
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    margin: 10px;
    text-shadow: 0 0 5px var(--neon-blue);
    box-shadow: 0 0 5px var(--neon-blue), inset 0 0 5px var(--neon-blue);
    transition: all 0.2s;
    text-transform: uppercase;
}

.neon-btn:hover {
    background: var(--neon-blue);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--neon-blue), inset 0 0 10px var(--neon-blue);
}

.neon-btn.secondary {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
    box-shadow: 0 0 5px var(--neon-pink), inset 0 0 5px var(--neon-pink);
}

.neon-btn.secondary:hover {
    background: var(--neon-pink);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--neon-pink), inset 0 0 10px var(--neon-pink);
}

.blink {
    animation: blink 1s infinite;
    color: var(--neon-yellow);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    margin-top: 20px;
}

@keyframes flicker {

    0%,
    18%,
    22%,
    25%,
    53%,
    57%,
    100% {
        text-shadow:
            0 0 4px #fff,
            0 0 11px #fff,
            0 0 19px #fff,
            0 0 40px var(--neon-pink),
            0 0 80px var(--neon-pink),
            0 0 90px var(--neon-pink),
            0 0 100px var(--neon-pink),
            0 0 150px var(--neon-pink);
    }

    20%,
    24%,
    55% {
        text-shadow: none;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    width: 100%;
    justify-content: center;
    z-index: 40;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.d-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.d-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--neon-blue);
    border-radius: 10px;
    color: var(--neon-blue);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.d-btn:active {
    background: var(--neon-blue);
    color: var(--bg-color);
}

.d-center {
    width: 60px;
    height: 60px;
}

@media (max-width: 768px) {
    #mobile-controls {
        display: none !important;
    }

    header {
        padding: 5px 10px;
        flex-flow: row wrap;
        /* Allow wrap */
        justify-content: space-between;
        /* Space out logo and buttons */
        align-items: center;
        gap: 5px;
    }

    .score-board {
        order: 1;
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
        padding-bottom: 5px;
        border-bottom: 1px solid rgba(0, 255, 255, 0.2);
        font-size: 0.6rem;
        gap: 10px;
    }

    .header-left {
        order: 2;
        width: auto;
    }

    .header-left img {
        height: 30px;
        /* Smaller logo */
    }

    .header-right {
        order: 3;
        width: auto;
        display: flex;
        flex-direction: row;
        gap: 15px;
        /* Nice gap between buttons */
        justify-content: flex-end;
    }

    .neon-text {
        font-size: 1.5rem;
    }

    canvas {
        max-height: 65vh;
        /* Increase height since controls are gone */
        margin-top: -40px;
        /* Move up */
    }

    #mobile-controls {
        display: none !important;
        /* Hide D-pad */
    }
}