        @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;900&display=swap');

        :root {
            --bg-teal: #1f302e;
            --bg-teal-light: #70c4b8;
            --board-purple: #745464;
            --dark-purple: #4a3442;
            --tile-beige: #fcf1e5;
            --rock-blue: #7684b5;
            --ball-red: #f05a66;
            --basket-green: #8bc34a;
            --ui-yellow: #f8e5a3;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            font-family: 'Nunito', system-ui, sans-serif;
        }

        body {
            background-color: var(--bg-teal);
            /* Generating the 4-point star pattern background */
            background-image: radial-gradient(var(--bg-teal-light) 15%, transparent 16%), radial-gradient(var(--bg-teal-light) 15%, transparent 16%);
            background-size: 60px 60px;
            background-position: 0 0, 30px 30px;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            overflow: hidden;
        }

        #game-container {
            position: relative;
            width: 340px;
            height: 560px;
            overflow: hidden;
        }

        /* Screens & Modals */
        .screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: opacity 0.3s ease;
            z-index: 50;
            background-color: rgba(0, 0, 0, 0.6);
            border-radius: 20px;
        }

        .hidden {
            opacity: 0;
            pointer-events: none;
            z-index: -1;
        }

        .modal {
            background: var(--tile-beige);
            width: 85%;
            padding: 25px;
            border-radius: 20px;
            text-align: center;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
            border: 4px solid white;
        }

        .modal h2 {
            color: var(--board-purple);
            margin-bottom: 10px;
            font-weight: 900;
            font-size: 28px;
        }

        .btn {
            padding: 12px 20px;
            background: var(--ball-red);
            color: white;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-size: 18px;
            margin-top: 15px;
            font-weight: 900;
            width: 100%;
            box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
            transition: transform 0.1s;
        }

        .btn:active {
            transform: translateY(4px);
            box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        }

        .btn-alt {
            background: var(--rock-blue);
        }

        #preloader {
            background: var(--bg-teal);
            z-index: 100;
        }

        .loader-bar {
            width: 200px;
            height: 20px;
            background: rgba(0, 0, 0, 0.1);
            border-radius: 10px;
            margin-top: 20px;
            overflow: hidden;
            border: 2px solid white;
        }

        .loader-fill {
            width: 0%;
            height: 100%;
            background: var(--ui-yellow);
            transition: width 0.1s linear;
        }

        /* Top Controls UI */
        .top-ui-container {
            position: absolute;
            top: 20px;
            width: 100%;
            display: flex;
            justify-content: center;
            gap: 15px;
            z-index: 10;
        }

        .circle-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: var(--ui-yellow);
            border: 2px solid #e3cc86;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            color: #6d4b5a;
            box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
            transition: transform 0.1s;
            font-weight: 900;
        }

        .circle-btn:active {
            transform: translateY(4px);
            box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        }

        /* Main Game Board Layout */
        #game-board-area {
            position: absolute;
            top: 90px;
            left: 50%;
            transform: translateX(-50%);
            width: 320px;
            height: 450px;
            background: var(--board-purple);
            border-radius: 25px;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding-top: 20px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            z-index: 5;
            /* 3D Border */
            border: 4px solid rgba(255, 255, 255, 0.15);

            /* 3D Shadows */
            box-shadow:
                /* Main shadow */
                0 18px 30px rgba(0, 0, 0, .35),

                /* Bottom depth */
                0 8px 0 rgba(65, 40, 120, .9),

                /* Inner top highlight */
                inset 0 4px 0 rgba(255, 255, 255, .35),

                /* Inner left highlight */
                inset 3px 0 0 rgba(255, 255, 255, .12),

                /* Inner bottom shadow */
                inset 0 -8px 12px rgba(0, 0, 0, .25),

                /* Outer glow */
                0 0 15px rgba(255, 255, 255, .08);
        }

        .score-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 85%;
            margin-bottom: 25px;
            color: white;
        }

        .stars-ui {
            color: var(--ui-yellow);
            font-size: 20px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            letter-spacing: 2px;
        }

        .level-badge {
            background: var(--dark-purple);
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            line-height: 1.1;
            box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
        }

        .level-badge span:first-child {
            font-size: 10px;
            opacity: 0.8;
            text-transform: uppercase;
        }

        .level-badge span:last-child {
            font-size: 24px;
            font-weight: 900;
        }

        .moves-badge {
            background: rgba(0, 0, 0, 0.2);
            padding: 5px 15px;
            border-radius: 20px;
            text-align: center;
            line-height: 1.1;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .moves-badge span:first-child {
            font-size: 10px;
            opacity: 0.8;
        }

        .moves-badge span:last-child {
            font-size: 16px;
            font-weight: 900;
            display: block;
        }

        /* Grid */
        #grid-wrapper {
            background: white;
            padding: 5px;
            border-radius: 12px;
            box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15);
        }

        #grid {
            position: relative;
            width: 240px;
            height: 320px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(4, 1fr);
            gap: 2px;
            background: #ebdcc9;
        }

        .cell {
            background: var(--tile-beige);
            width: 100%;
            height: 100%;
            border: 1px solid rgba(0, 0, 0, 0.03);
        }

        /* Entities */
        .entity {
            position: absolute;
            width: calc(100% / 3 - 2px);
            height: calc(100% / 4 - 2px);
            transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
            pointer-events: none;
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2;
        }

        /* Stylized Rock */
        .entity.rock {
            background: var(--rock-blue);
            border-radius: 4px;
            box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.15), inset 3px 3px 0 rgba(255, 255, 255, 0.1);
            z-index: 1;
        }

        .entity.rock::before {
            content: '';
            position: absolute;
            width: 8px;
            height: 8px;
            background: rgba(0, 0, 0, 0.1);
            border-radius: 50%;
            top: 10px;
            left: 10px;
            box-shadow: 20px 15px 0 rgba(0, 0, 0, 0.1), 5px 30px 0 rgba(0, 0, 0, 0.05), 35px 5px 0 rgba(0, 0, 0, 0.1);
        }

        /* Stylized Ball */
        .entity.ball::after {
            content: '';
            width: 65%;
            height: 65%;
            background: radial-gradient(circle at 30% 30%, #ff8a93 0%, var(--ball-red) 40%, #c43c46 100%);
            border-radius: 50%;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
        }

        /* Stylized Basket (Top Entry Enforced) */
        .entity.basket::after {
            content: '';
            width: 75%;
            height: 60%;
            border: 3px solid var(--basket-green);
            border-top: none;
            border-radius: 5px 5px 25px 25px;
            background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(132, 201, 95, 0.2) 5px, rgba(132, 201, 95, 0.2) 10px);
            box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.1);
        }

        .entity.basket::before {
            content: '';
            position: absolute;
            top: 15%;
            width: 85%;
            height: 12px;
            background: var(--basket-green);
            border-radius: 10px;
            z-index: 3;
            box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
        }

        /* Canvas Overlay */
        #confetti-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 60;
        }