@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800;900&family=Orbitron:wght@500;700;900&display=swap');

:root {
    --bg-deep: #1a0533;
    --purple-mid: #3f0b9e;
    --purple-bright: #6c1bd4;
    --neon-cyan: #00e5ff;
    --neon-pink: #ff4081;
    --gold: #ffd740;
    --white-soft: #f0e6ff;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #c9b8e8;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --radius-full: 999px;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-deep);
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
}

/* Animated background orbs */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    animation: floatOrb 8s ease-in-out infinite;
}

.bg-orb.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
    top: -15%;
    left: -10%;
    animation-delay: 0s;
}

.bg-orb.orb-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
    bottom: -12%;
    right: -8%;
    animation-delay: -4s;
}

.bg-orb.orb-3 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, #ec4899 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -6s;
    animation-duration: 10s;
}

@keyframes floatOrb {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(40px, -30px) scale(1.08);
    }

    50% {
        transform: translate(-20px, 25px) scale(0.94);
    }

    75% {
        transform: translate(-35px, -15px) scale(1.05);
    }
}

#game-container {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    margin: auto;
    margin-top: 1%;
}

canvas {
    background-color: transparent;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(255, 255, 255, 0.08),
        0 0 80px rgba(108, 27, 212, 0.3);
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2;
}

/* Overlay base */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(15, 2, 35, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: white;
    z-index: 20;
    text-align: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    border-radius: var(--radius-xl);
}

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

/* Preloader */
#preloader {
    background: radial-gradient(ellipse at center, #2d0a5e 0%, #0f0223 100%);
    z-index: 30;
    gap: 30px;
}

#preloader .logo-icon {
    font-size: 5rem;
    animation: pulseLogo 1.6s ease-in-out infinite;
}

@keyframes pulseLogo {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.6));
    }

    50% {
        transform: scale(1.12);
        filter: drop-shadow(0 0 45px rgba(0, 229, 255, 0.9));
    }
}

#preloader h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.2rem;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #fff 0%, #c084fc 40%, #00e5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin: 0;
}

.loader-bar-container {
    width: 320px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

#loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6c1bd4, #00e5ff, #ff4081);
    background-size: 200% 100%;
    border-radius: var(--radius-full);
    transition: width 0.08s linear;
    animation: shimmerBar 1.5s linear infinite;
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
}

@keyframes shimmerBar {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Menu card */
.menu-card {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 50px 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 30px 70px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    max-width: 500px;
    width: 90%;
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-card .icon-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c1bd4 0%, #00e5ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 15px 40px rgba(108, 27, 212, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.menu-card h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.8rem;
    margin: 0;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #c084fc 50%, #00e5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    text-transform: uppercase;
}

.menu-card p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.5;
    font-weight: 500;
}

.menu-card .level-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    margin-bottom: 4px;
}

/* Buttons */
.btn {
    padding: 16px 44px;
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #fff;
    background: linear-gradient(135deg, #6c1bd4 0%, #8b3cf5 50%, #00b8d4 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 10px 35px rgba(108, 27, 212, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.15);
    transition: all var(--transition-smooth);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    animation: bgShift 4s ease infinite;

    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.35),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2),
        0 4px 0 #4a138d,
        0 8px 18px rgba(0, 0, 0, 0.35),
        0 14px 35px rgba(108, 27, 212, 0.45);
}

@keyframes bgShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.btn:hover {
    transform: translateY(-3px);

    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.4),
        inset 0 -2px 3px rgba(0, 0, 0, 0.15),
        0 6px 0 #4a138d,
        0 12px 24px rgba(0, 0, 0, 0.4),
        0 18px 45px rgba(108, 27, 212, 0.55);
}

.btn:active {
    transform: translateY(4px);

    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.25),
        0 2px 0 #4a138d,
        0 4px 10px rgba(0, 0, 0, 0.25);
}

.btn.secondary {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: none;
    color: #fff;
    animation: none;
    background-size: auto;
}

.btn.secondary:hover {
    border-color: #fff;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

/* HUD */
#hud {
    position: absolute;
    top: 24px;
    left: 28px;
    right: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    z-index: 10;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
}

#hud>div {
    pointer-events: auto;
}

.hud-item {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);

    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.35),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2),
        0 4px 0 #140e1c,
        0 8px 18px rgba(0, 0, 0, 0.35),
        0 14px 35px rgba(37, 22, 56, 0.45);


}

#level-display {
    background: linear-gradient(135deg, rgba(108, 27, 212, 0.7) 0%, rgba(0, 229, 255, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    padding: 10px 24px;
    letter-spacing: 2px;
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.35),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2),
        0 4px 0 #4a138d,
        0 8px 18px rgba(0, 0, 0, 0.35),
        0 14px 35px rgba(108, 27, 212, 0.45);
}

input[type="color"] {
    -webkit-appearance: none;
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

input[type="color"]:hover {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 600px) {
    .menu-card {
        padding: 30px 22px;
        gap: 12px;
        border-radius: var(--radius-lg);
    }

    .menu-card h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .menu-card .icon-circle {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .btn {
        padding: 13px 32px;
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .hud-item {
        font-size: 0.75rem;
        padding: 7px 12px;
        letter-spacing: 1px;
    }

    #level-display {
        font-size: 0.85rem;
        padding: 7px 16px;
    }

    input[type="color"] {
        width: 26px;
        height: 26px;
    }

    #preloader h1 {
        font-size: 2.2rem;
    }

    .loader-bar-container {
        width: 240px;
        height: 6px;
    }
}