        :root {
            --wood: #8b5a2b;
            --wood-dark: #6d4423;
            --stroke: #39ff14;
            --select: #ffff00;
            --bg: #f4d0a4;
            --shadow: rgba(0, 0, 0, 0.3);
        }

        body,
        html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            font-family: 'Arial Rounded MT Bold', sans-serif;
            touch-action: none;

            background-image: url("bg.jpg");
            background-size: cover;
            /* Cover full screen */
            background-repeat: no-repeat;
            /* No repeat */
        }


        /* Preloader */
        #preloader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #8b5a2b 0%, #e8c199 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            transition: opacity 0.5s, visibility 0.5s;
        }

        #preloader.hide {
            opacity: 0;
            visibility: hidden;
        }

        .loader-logo {
            font-size: 64px;
            font-weight: bold;
            margin-bottom: 30px;
            background: linear-gradient(45deg, #39ff14, #00ff88);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: pulse 2s ease-in-out infinite;
            text-shadow: 0 0 20px rgba(57, 255, 20, 0.5);
        }

        .loader-bar-container {
            width: 200px;
            height: 20px;
            background: rgba(255, 255, 255, 0.3);
            border-radius: 10px;
            overflow: hidden;
            border: 3px solid var(--wood);
            box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        .loader-bar {
            width: 0%;
            height: 100%;
            background: linear-gradient(90deg, #39ff14, #00ff88);
            transition: width 0.3s ease;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
        }

        @keyframes pulse {

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

            50% {
                transform: scale(1.05);
            }
        }

        /* Title Animation */
        .game-title {
            position: absolute;
            top: -200px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 48px;
            font-weight: bold;
            z-index: 998;
            background: linear-gradient(45deg, #39ff14, #00ff88);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            animation: slideDown 1s ease-out 0.5s forwards;
        }

        @keyframes slideDown {
            to {
                top: 20px;
            }
        }

        /* Controls */
        #controls-ui {
            position: absolute;
            bottom: 20px;
            width: 100%;
            display: flex;
            justify-content: center;
            gap: 15px;
            z-index: 999;
            pointer-events: auto;
            opacity: 0;
            animation: fadeInUp 0.8s ease-out 1s forwards;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }

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

        button {
            background: white;
            border: 3px solid var(--wood);
            padding: 15px 25px;
            border-radius: 15px;
            cursor: pointer;
            font-weight: bold;
            font-size: 16px;
            box-shadow: 0 5px 0 var(--wood-dark), 0 8px 15px var(--shadow);
            pointer-events: auto;
            transition: all 0.2s ease;
            position: relative;
            overflow: hidden;
        }

        button::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.5);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        button:active::before {
            width: 300px;
            height: 300px;
        }

        button:active {
            transform: translateY(3px);
            box-shadow: 0 2px 0 var(--wood-dark), 0 4px 8px var(--shadow);
        }

        #div-btn {
            background: #ffeb3b;
        }

        #sound-btn {
            background: #4caf50;
            color: white;
            padding: 15px 20px;
        }

        #header-ui {
            position: absolute;
            top: 20px;
            width: 100%;
            display: flex;
            justify-content: space-around;
            align-items: center;
            z-index: 999;
            pointer-events: none;
            opacity: 0;
            animation: fadeIn 0.8s ease-out 1.2s forwards;
        }

        @keyframes fadeIn {
            to {
                opacity: 1;
            }
        }

        .target-box {
            background: white;
            border: 3px solid var(--wood);
            padding: 8px;
            border-radius: 15px;
            pointer-events: auto;
            box-shadow: 0 4px 8px var(--shadow);
            transform: scale(0);
            animation: popIn 0.5s ease-out 1.5s forwards;
        }

        @keyframes popIn {
            0% {
                transform: scale(0);
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        .level-badge {
            background: var(--wood);
            color: white;
            padding: 12px 20px;
            border-radius: 15px;
            font-size: 20px;
            font-weight: bold;
            box-shadow: 0 4px 8px var(--shadow);
            transform: scale(0);
            animation: popIn 0.5s ease-out 1.4s forwards;
        }

        #tutorial,
        #win-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: 1000;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            animation: fadeIn 0.3s ease-out forwards;
        }

        #levels-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: 1000;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding-top: 80px;
            /* Position from top */
            opacity: 0;
            animation: fadeIn 0.3s ease-out forwards;
            overflow-y: auto;
        }

        .modal-body {
            background: white;
            padding: 35px;
            border-radius: 25px;
            border: 6px solid var(--wood);
            text-align: center;
            width: 300px;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
            transform: scale(0.8);
            animation: modalPop 0.5s ease-out 0.2s forwards;
        }

        #levels-modal .modal-body {
            width: 90%;
            max-width: 500px;
            padding: 30px;
            margin-bottom: 100px;
            /* Space at bottom for scrolling */
        }

        @keyframes modalPop {
            0% {
                transform: scale(0.8);
                opacity: 0;
            }

            50% {
                transform: scale(1.05);
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .modal-body h2 {
            color: var(--wood);
            margin-top: 0;
            font-size: 32px;
        }

        .modal-body p {
            font-size: 16px;
            line-height: 1.6;
            color: #555;
        }

        /* Level selection buttons */
        .level-btn {
            background: white;
            border: 3px solid var(--wood);
            border-radius: 12px;
            padding: 20px 15px;
            cursor: pointer;
            font-weight: bold;
            font-size: 18px;
            transition: all 0.3s ease;
            box-shadow: 0 3px 0 var(--wood-dark);
            position: relative;
            min-height: 90px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .level-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 0 var(--wood-dark);
            background: #f5f5f5;
        }

        .level-btn:active {
            transform: translateY(1px);
            box-shadow: 0 2px 0 var(--wood-dark);
        }

        .level-btn.current {
            background: #ffeb3b;
            border-color: #f9a825;
        }

        .level-btn.current:hover {
            background: #ffd54f;
        }

        .level-btn.completed {
            background: #4caf50;
            color: white;
            border-color: #388e3c;
        }

        .level-btn.completed:hover {
            background: #66bb6a;
        }

        .level-btn.completed::after {
            content: '✓';
            position: absolute;
            top: 8px;
            right: 8px;
            font-size: 16px;
            background: white;
            color: #4caf50;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        /* Particle effects */
        .particle {
            position: absolute;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--stroke);
            pointer-events: none;
            z-index: 500;
            animation: particleFly 1s ease-out forwards;
        }

        @keyframes particleFly {
            to {
                transform: translate(var(--tx), var(--ty)) scale(0);
                opacity: 0;
            }
        }

        canvas {
            display: block;
            top: 0;
            left: 0;
            z-index: 1;
            opacity: 0;
            animation: fadeIn 1s ease-out 0.8s forwards;
        }

        /* Win celebration */
        @keyframes celebrate {

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

            25% {
                transform: rotate(-10deg) scale(1.1);
            }

            75% {
                transform: rotate(10deg) scale(1.1);
            }
        }

        .celebrate {
            animation: celebrate 0.5s ease-in-out;
        }

        /* Smooth transitions */
        .smooth-transition {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* Mobile Responsive Styles */
        @media (max-width: 768px) {
            .game-title {
                font-size: 32px;
                top: -150px;
            }

            @keyframes slideDown {
                to {
                    top: 10px;
                }
            }

            #header-ui {
                top: 60px;
                flex-wrap: wrap;
                padding: 0 10px;
                gap: 10px;
            }

            .level-badge {
                font-size: 16px;
                padding: 10px 15px;
            }

            .target-box {
                padding: 5px;
            }

            #target-canvas {
                width: 70px;
                height: 70px;
            }

            #sound-btn {
                padding: 10px 15px;
                font-size: 18px;
            }

            #controls-ui {
                bottom: 20px;
                gap: 8px;
                padding: 0 10px;
                flex-wrap: wrap;
            }

            button {
                padding: 12px 18px;
                font-size: 14px;
                flex: 1;
                min-width: 0;
            }

            #sound-btn {
                flex: 0 0 auto;
                min-width: 50px;
            }

            .modal-body {
                width: 85%;
                padding: 25px;
                margin: 10px;
            }

            .modal-body h2 {
                font-size: 24px;
            }

            .modal-body h1 {
                font-size: 36px !important;
            }

            #levels-modal {
                padding-top: 60px;
            }

            #levels-modal .modal-body {
                width: 92%;
                max-width: 95%;
                padding: 20px;
            }

            .level-btn {
                padding: 15px 10px;
                min-height: 80px;
                font-size: 16px;
            }

            .loader-logo {
                font-size: 48px;
            }
        }

        @media (max-width: 480px) {
            .game-title {
                font-size: 24px;
            }

            #header-ui {
                top: 50px;
            }

            .level-badge {
                font-size: 14px;
                padding: 8px 12px;
            }

            #target-canvas {
                width: 60px;
                height: 60px;
            }

            #controls-ui {
                bottom: 15px;
                gap: 6px;
            }

            button {
                padding: 10px 12px;
                font-size: 12px;
                border-width: 2px;
            }

            .modal-body {
                width: 90%;
                padding: 20px;
            }

            .modal-body h2 {
                font-size: 20px;
            }

            .modal-body p {
                font-size: 14px;
            }

            #levels-modal .modal-body {
                padding: 15px;
            }

            #levels-grid {
                gap: 10px !important;
            }

            .level-btn {
                padding: 12px 8px;
                min-height: 70px;
                font-size: 14px;
            }

            .level-btn.completed::after {
                width: 20px;
                height: 20px;
                font-size: 14px;
                top: 5px;
                right: 5px;
            }

            .loader-logo {
                font-size: 36px;
            }

            .loader-bar-container {
                width: 150px;
            }
        }

        /* Landscape orientation adjustments */
        @media (max-height: 600px) and (orientation: landscape) {
            .game-title {
                font-size: 20px;
                top: -100px;
            }

            @keyframes slideDown {
                to {
                    top: 5px;
                }
            }

            #header-ui {
                top: 35px;
            }

            .level-badge {
                font-size: 12px;
                padding: 6px 10px;
            }

            #target-canvas {
                width: 50px;
                height: 50px;
            }

            #controls-ui {
                bottom: 10px;
                gap: 5px;
            }

            button {
                padding: 8px 12px;
                font-size: 11px;
            }

            #levels-modal {
                padding-top: 40px;
            }

            #levels-modal .modal-body {
                max-height: 85vh;
            }

            .modal-body {
                padding: 15px;
            }

            .modal-body h2 {
                font-size: 18px;
                margin-bottom: 10px;
            }
        }

        #game-canvas {
            border: 2px solid #ddd;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        }