* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: white;
    background: #090d1a;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

button:focus {
    outline: none;
}

.hidden {
    display: none !important;
}


/* ================================
   BACKGROUND
================================ */

body::before {
    content: "";
    position: fixed;

    width: 500px;
    height: 500px;

    top: -200px;
    left: -150px;

    background: #7c3aed;
    filter: blur(150px);
    opacity: 0.22;

    pointer-events: none;
}

body::after {
    content: "";

    position: fixed;

    width: 500px;
    height: 500px;

    right: -200px;
    bottom: -200px;

    background: #06b6d4;
    filter: blur(150px);
    opacity: 0.18;

    pointer-events: none;
}


/* ================================
   SCREENS
================================ */

.screen {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    position: relative;
    z-index: 2;
}


/* ================================
   CARD
================================ */

.card {
    width: 100%;
    max-width: 470px;

    padding: 42px 30px;

    text-align: center;

    background: rgba(255, 255, 255, 0.08);

    border: 1px solid rgba(255, 255, 255, 0.15);

    border-radius: 30px;

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5);

    animation: cardIn 0.5s ease;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ================================
   START SCREEN
================================ */

.logo-circle {
    width: 90px;
    height: 90px;

    margin: auto;
    margin-bottom: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 48px;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #ec4899,
            #8b5cf6,
            #06b6d4
        );

    box-shadow:
        0 15px 40px rgba(139, 92, 246, 0.4);

    animation: floatLogo 3s ease-in-out infinite;
}

@keyframes floatLogo {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.small-label {
    font-size: 11px;
    letter-spacing: 3px;
    color: #94a3b8;
    margin-bottom: 8px;
}

h1 {
    font-size: clamp(38px, 10vw, 55px);
    letter-spacing: 4px;
    line-height: 1;
    margin-bottom: 15px;

    background:
        linear-gradient(
            90deg,
            #f472b6,
            #a78bfa,
            #22d3ee,
            #4ade80
        );

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 span {
    display: block;
}

h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

.subtitle {
    color: #cbd5e1;
    line-height: 1.6;
    max-width: 340px;
    margin: 0 auto 25px;
}


/* ================================
   FEATURES
================================ */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 8px;

    margin-bottom: 28px;
}

.feature {
    padding: 12px 5px;

    border-radius: 15px;

    background: rgba(255, 255, 255, 0.06);

    transition: transform 0.2s ease;
}

.feature:hover {
    transform: translateY(-3px);
}

.feature span {
    font-size: 22px;
    display: block;
    margin-bottom: 5px;
}

.feature p {
    font-size: 11px;
    color: #cbd5e1;
}


/* ================================
   BUTTON
================================ */

.main-button {
    width: 100%;

    border: none;

    padding: 16px 25px;

    border-radius: 16px;

    font-size: 16px;
    font-weight: bold;

    color: white;

    cursor: pointer;

    background:
        linear-gradient(
            100deg,
            #ec4899,
            #8b5cf6,
            #06b6d4
        );

    background-size: 200% 200%;

    box-shadow:
        0 12px 30px rgba(124, 58, 237, 0.35);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;

    animation:
        gradientMove 5s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 16px 35px rgba(124, 58, 237, 0.5);
}

.main-button:active {
    transform: scale(0.97);
}


/* ================================
   SCORE
================================ */

.best-score {
    margin-top: 18px;
    color: #94a3b8;
    font-size: 13px;
}

.best-score strong {
    color: #facc15;
    font-size: 16px;
}


/* ================================
   GAME
================================ */

#gameScreen {
    width: 100%;
    min-height: 100vh;

    position: relative;

    z-index: 3;

    transition:
        transform 0.1s ease;
}


/* ================================
   HEADER
================================ */

.top-bar {
    height: 70px;

    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding:
        0 clamp(12px, 4vw, 35px);

    background:
        rgba(9, 13, 26, 0.75);

    border-bottom:
        1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 20px;
}

.brand span {
    font-size: 26px;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.icon-button {
    width: 42px;
    height: 42px;

    border: none;
    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.08);

    color: white;

    font-size: 18px;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.icon-button:hover {
    background:
        rgba(255, 255, 255, 0.15);

    transform: translateY(-2px);
}

.icon-button:active {
    transform: scale(0.92);
}


/* ================================
   STATS
================================ */

.stats-bar {
    width: 100%;
    max-width: 800px;

    margin: 12px auto 0;

    padding: 0 12px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 8px;
}

.stat-box {
    min-height: 55px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 7px;

    border-radius: 14px;

    background:
        rgba(255, 255, 255, 0.07);

    border:
        1px solid rgba(255, 255, 255, 0.08);

    transition:
        transform 0.15s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 20px;
}

.stat-box div {
    display: flex;
    flex-direction: column;
}

.stat-box small {
    font-size: 8px;
    letter-spacing: 1px;
    color: #94a3b8;
}

.stat-box strong {
    font-size: 17px;
}


/* ================================
   LEVEL
================================ */

.level-section {
    width: 100%;
    max-width: 800px;

    margin: 12px auto;

    padding: 0 12px;
}

.level-info {
    display: flex;
    justify-content: space-between;

    margin-bottom: 5px;

    color: #cbd5e1;

    font-size: 11px;
}

.level-info strong {
    color: white;
    font-size: 13px;
}

#levelMessage {
    color: #94a3b8;

    transition:
        opacity 0.25s ease;
}

.progress-background {
    height: 5px;
    width: 100%;

    border-radius: 10px;

    overflow: hidden;

    background:
        rgba(255, 255, 255, 0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;

    border-radius: 10px;

    background:
        linear-gradient(
            90deg,
            #ec4899,
            #8b5cf6,
            #22d3ee
        );

    transition:
        width 0.25s ease;
}


/* ================================
   TARGET
================================ */

.target-section {
    text-align: center;

    margin: 8px auto 10px;
}

.target-label {
    color: #64748b;

    font-size: 9px;

    letter-spacing: 2px;

    margin-bottom: 5px;
}

.target-display {
    display: inline-flex;

    align-items: center;

    gap: 9px;

    padding: 7px 16px;

    border-radius: 30px;

    background:
        rgba(255, 255, 255, 0.08);

    border:
        1px solid rgba(255, 255, 255, 0.1);

    transition:
        transform 0.2s ease;
}

.target-display.pop {
    animation:
        targetPop 0.25s ease;
}

@keyframes targetPop {
    50% {
        transform: scale(1.08);
    }
}

#targetColor {
    width: 28px;
    height: 28px;

    border-radius: 50%;

    border: 3px solid white;

    box-shadow:
        0 0 20px currentColor;

    transition:
        background-color 0.25s ease,
        box-shadow 0.25s ease;
}

.target-display div:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#targetName {
    font-size: 14px;
    letter-spacing: 1px;
}

.target-display small {
    font-size: 8px;
    color: #94a3b8;
}


/* ================================
   GAME AREA
================================ */

#gameArea {
    position: relative;

    width:
        min(800px, calc(100% - 24px));

    height:
        min(62vh, 620px);

    min-height: 400px;

    margin: 0 auto;

    overflow: hidden;

    border-radius: 24px;

    border:
        1px solid rgba(255, 255, 255, 0.16);

    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(124, 58, 237, 0.18),
            transparent 25%
        ),

        radial-gradient(
            circle at 80% 75%,
            rgba(6, 182, 212, 0.13),
            transparent 25%
        ),

        linear-gradient(
            180deg,
            #111a38,
            #080c18
        );

    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.5),
        0 20px 50px rgba(0, 0, 0, 0.35);

    touch-action: none;

    /*
       Helps browser understand
       that this area is animated.
    */
    contain: layout paint;
}


/* ================================
   BACKGROUND STARS
================================ */

.background-star {
    position: absolute;

    color:
        rgba(255, 255, 255, 0.25);

    user-select: none;

    pointer-events: none;

    animation:
        starFloat 4s ease-in-out infinite;
}

.star-1 {
    left: 10%;
    top: 15%;
    font-size: 20px;
}

.star-2 {
    right: 15%;
    top: 30%;
    font-size: 25px;
    animation-delay: 1s;
}

.star-3 {
    left: 25%;
    bottom: 25%;
    font-size: 15px;
    animation-delay: 2s;
}

.star-4 {
    right: 30%;
    bottom: 15%;
    font-size: 30px;
    animation-delay: 0.5s;
}

@keyframes starFloat {
    0%,
    100% {
        transform:
            translateY(0)
            scale(1);
    }

    50% {
        transform:
            translateY(-12px)
            scale(1.15);
    }
}


/* ================================
   PLAYER
================================ */

#player {
    position: absolute;

    left: 50%;
    bottom: 15px;

    width: 60px;
    height: 60px;

    transform:
        translate3d(-50%, 0, 0);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 43px;

    z-index: 10;

    user-select: none;

    pointer-events: none;

    /*
       Browser optimization.
    */
    will-change: left, transform;
}

.player-glow {
    position: absolute;

    width: 45px;
    height: 45px;

    border-radius: 50%;

    background: #22d3ee;

    filter: blur(18px);

    opacity: 0.5;

    z-index: -1;
}

#player span {
    filter:
        drop-shadow(
            0 0 10px rgba(255, 255, 255, 0.7)
        );

    animation:
        playerFloat 1.2s ease-in-out infinite;
}

@keyframes playerFloat {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}


/* ================================
   FALLING OBJECT
================================ */

.object {
    position: absolute;

    width: 38px;
    height: 38px;

    border-radius: 50%;

    border:
        3px solid rgba(255, 255, 255, 0.85);

    box-shadow:
        0 0 18px currentColor,
        inset 0 0 8px rgba(255, 255, 255, 0.4);

    z-index: 5;

    pointer-events: none;

    /*
       Very important for smooth
       animation.
    */
    will-change: transform;

    transform:
        translate3d(0, 0, 0);
}


/* ================================
   CATCH EFFECT
================================ */

.catch {
    animation:
        catchAnimation 0.35s ease-out forwards;
}

@keyframes catchAnimation {
    0% {
        transform:
            scale(1);
        opacity: 1;
    }

    50% {
        transform:
            scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform:
            scale(2.3);
        opacity: 0;
    }
}


/* ================================
   WRONG EFFECT
================================ */

.miss {
    animation:
        missAnimation 0.3s ease;
}

@keyframes missAnimation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.7);
    }

    100% {
        transform: scale(1);
    }
}


/* ================================
   PARTICLES
================================ */

.particle {
    position: absolute;

    width: 7px;
    height: 7px;

    border-radius: 50%;

    pointer-events: none;

    z-index: 20;

    will-change: transform, opacity;

    animation:
        particleAnimation 0.65s ease-out forwards;
}

@keyframes particleAnimation {
    0% {
        opacity: 1;

        transform:
            translate3d(0, 0, 0)
            scale(1);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(
                var(--x),
                var(--y),
                0
            )
            scale(0);
    }
}


/* ================================
   SCORE POPUP
================================ */

.score-popup {
    position: absolute;

    font-weight: bold;

    font-size: 20px;

    color: #facc15;

    pointer-events: none;

    z-index: 30;

    will-change: transform, opacity;

    animation:
        scorePopup 0.7s ease-out forwards;
}

@keyframes scorePopup {
    0% {
        opacity: 1;

        transform:
            translate3d(0, 0, 0)
            scale(1);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(0, -45px, 0)
            scale(1.2);
    }
}


/* ================================
   CONTROLS
================================ */

.controls {
    text-align: center;

    padding: 9px 12px;

    color: #94a3b8;

    font-size: 12px;
}

.controls span {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;

    margin: 0 3px;

    border-radius: 6px;

    background:
        rgba(255, 255, 255, 0.1);

    color: white;

    font-weight: bold;
}

.controls small {
    display: block;

    margin-top: 3px;

    font-size: 9px;

    color: #64748b;
}


/* ================================
   OVERLAY
================================ */

.overlay {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(3, 7, 18, 0.78);

    backdrop-filter: blur(10px);
}


/* ================================
   PAUSE
================================ */

.pause-icon {
    font-size: 60px;

    margin-bottom: 15px;
}


/* ================================
   GAME OVER
================================ */

.result-icon {
    font-size: 65px;

    margin-bottom: 10px;
}

.final-score-label {
    font-size: 10px;

    letter-spacing: 2px;

    color: #94a3b8;

    margin-top: 20px;
}

#finalScore {
    font-size: 75px;

    line-height: 1;

    font-weight: bold;

    margin:
        8px 0 22px;

    background:
        linear-gradient(
            90deg,
            #f472b6,
            #a78bfa,
            #22d3ee
        );

    -webkit-background-clip: text;

    -webkit-text-fill-color: transparent;
}

.results-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    margin-bottom: 20px;
}

.results-grid > div {
    padding: 12px 5px;

    border-radius: 13px;

    background:
        rgba(255, 255, 255, 0.06);
}

.results-grid small {
    display: block;

    font-size: 8px;

    color: #94a3b8;

    margin-bottom: 5px;
}

.results-grid strong {
    font-size: 19px;
}

.record {
    color: #facc15;

    font-size: 13px;

    margin-bottom: 18px;
}


/* ================================
   RESPONSIVE
================================ */

@media (max-width: 600px) {

    .top-bar {
        height: 60px;
    }

    .brand {
        font-size: 16px;
    }

    .brand span {
        font-size: 22px;
    }

    .icon-button {
        width: 38px;
        height: 38px;

        font-size: 16px;
    }

    .stats-bar {
        gap: 5px;
        margin-top: 8px;
    }

    .stat-box {
        min-height: 48px;

        gap: 3px;

        border-radius: 11px;
    }

    .stat-icon {
        font-size: 15px;
    }

    .stat-box small {
        font-size: 7px;
    }

    .stat-box strong {
        font-size: 14px;
    }

    .level-section {
        margin: 8px auto;
    }

    #gameArea {
        width:
            calc(100% - 16px);

        height:
            calc(100vh - 220px);

        min-height: 380px;

        border-radius: 20px;
    }

    .target-section {
        margin-top: 5px;
    }

    .controls {
        font-size: 10px;
    }

    .card {
        padding:
            32px 20px;

        border-radius: 24px;
    }

    .feature-grid {
        gap: 5px;
    }

    .feature {
        padding:
            10px 3px;
    }

    .feature span {
        font-size: 19px;
    }

    .feature p {
        font-size: 9px;
    }
}


@media (max-height: 700px) {

    #gameArea {
        height: 52vh;
        min-height: 330px;
    }

    .target-section {
        margin-bottom: 5px;
    }

    .controls small {
        display: none;
    }
}


/* ================================
   ACCESSIBILITY
================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            0.01ms !important;
    }
}