
        body {
            font-family: 'Inter', sans-serif;
            background-color: #1a1a2e; /* Dark background */
            color: #e0e0e0; /* Light text for dark theme */
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 1rem;
            overflow-x: hidden; /* Prevent horizontal scrollbar */
        }
        #math-maze-app {
            background-color: #16162a; /* Slightly darker app background */
            border-radius: 1rem;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
            padding: 2rem;
            width: 100%; /* Ensure it takes full width on small screens */
            max-width: 700px; /* Increased max-width for better layout on larger screens */
            text-align: center;
            transition: all 0.3s ease-in-out;
            position: relative; /* For confetti positioning */
            z-index: 10; /* Ensure app is above confetti */
            display: flex;
            flex-direction: column;
            align-items: center;
        }
  
        /* Updated Primary Button Style for blue and loading effect */
        .math-maze-button-primary {
            background-image: linear-gradient(to right, #4F46E5, #6366F1); /* Blue gradient matching the shot */
            @apply text-white font-semibold py-3 px-6 rounded-lg shadow-lg hover:shadow-xl transition duration-300 ease-in-out transform hover:-translate-y-0.5;
            border: none;
            font-size: 1.125rem; /* text-lg */
            display: flex; /* Use flex for content alignment */
            align-items: center;
            justify-content: center;
            gap: 0.5rem; /* Space between spinner and text */
        }
        .math-maze-button-primary:hover {
            background-image: linear-gradient(to right, #4338CA, #4F46E5); /* Darker blue on hover */
        }
        .math-maze-button-primary:disabled {
            opacity: 0.7;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* Spinner Styles */
        .spinner {
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-top: 3px solid #fff;
            border-radius: 50%;
            width: 1.25rem; /* Equivalent to text-lg font size */
            height: 1.25rem;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .math-maze-button-secondary {
            background-color: #3a3a5a; /* Dark gray */
            border: 1px solid #5a5a7a; /* Lighter dark border */
            @apply text-white font-semibold py-2 px-4 rounded-lg shadow-md hover:shadow-lg transition duration-300 ease-in-out;
            font-size: 0.9rem; /* Slightly smaller font */
        }
        .math-maze-info-bar {
            background-color: #26263a;
            padding: 0.75rem;
            border-radius: 0.5rem;
            display: flex;
            justify-content: space-around;
            margin-bottom: 1.5rem;
            font-size: 0.95rem;
            width: 100%;
        }
        #maze-container {
            position: relative;
            border: 2px solid #3a3a5a;
            border-radius: 0.5rem;
            padding: 0.5rem;
            background-color: #1e293b; /* slate-800 */
            margin: 1.5rem auto;
            display: block;
            width: fit-content; /* Ensure container wraps grid */
            max-width: 100%; /* Prevent overflow on small screens */
            box-sizing: border-box; /* Include padding in width calculation */
        }
        #maze-grid {
            display: grid;
            gap: 0px; /* No gap between cells for maze walls */
            /* Ensure grid itself is responsive by letting cells define its size */
        }
        .maze-cell {
            /* Responsive cell size: min(8vw, 36px) means it will be 8% of viewport width, but no larger than 36px */
            width: min(8vw, 36px);
            height: min(8vw, 36px);
            box-sizing: border-box; /* Include padding and border in the element's total width and height */
            background-color: #26263a;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: min(3.5vw, 0.8rem); /* Responsive font size */
            font-weight: 600;
            color: #e0e0e0;
            transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Smooth transition for highlight */
        }
        .maze-cell.wall-top { border-top: 2px solid #4a4a6a; }
        .maze-cell.wall-right { border-right: 2px solid #4a4a6a; }
        .maze-cell.wall-bottom { border-bottom: 2px solid #4a4a6a; }
        .maze-cell.wall-left { border-left: 2px solid #4a4a6a; }

        .maze-cell.start {
            background-color: #4CAF50; /* Green for start */
            color: #fff;
        }
        .maze-cell.goal {
            background-color: #FFC107; /* Amber for goal */
            color: #333;
        }
        .maze-cell.current-player-cell {
            background-color: #2196F3; /* Blue for current cell highlight, acting as player */
            box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5); /* Inner glow */
            color: #fff; /* Ensure text is visible on blue */
            font-weight: bold; /* Make number stand out */
        }

        .collectible {
            position: absolute;
            font-size: min(4vw, 1.2rem); /* Responsive font size for collectibles */
            pointer-events: none; /* Allow clicks to pass through */
            transition: transform 0.3s ease-out, opacity 0.3s ease-out;
        }
        .collectible.collected {
            transform: scale(1.5);
            opacity: 0;
        }

        /* Problem Overlay Styles */
        #problem-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(22, 22, 42, 0.95); /* Slightly darker app background with transparency */
            border-radius: 0.75rem;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 1.5rem;
            box-sizing: border-box;
            z-index: 20; /* Above maze, below messages/confetti */
            opacity: 0;
            pointer-events: none; /* Allow clicks to pass through when hidden */
            transition: opacity 0.3s ease-in-out;
        }

        #problem-overlay.show {
            opacity: 1;
            pointer-events: auto; /* Enable clicks when shown */
        }

        #problem-text-overlay {
            font-size: 1.5rem;
            font-weight: 700;
            color: #e0e0e0;
            margin-bottom: 1rem;
        }
        #answer-options-overlay {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.75rem;
        }
        .answer-button {
            background-color: #008b8b; /* Teal */
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 600;
            transition: background-color 0.2s ease-in-out;
            cursor: pointer;
            border: none;
        }
        .answer-button:hover {
            background-color: #007a7a;
        }

        .math-maze-feedback {
            font-weight: 600;
            margin-top: 1rem;
            padding: 0.75rem;
            border-radius: 0.5rem;
            font-size: 1rem;
            width: 100%;
        }
        .math-maze-feedback.win {
            background-color: #28a745; /* Green */
            color: #ffffff;
        }
        .math-maze-feedback.lose {
            background-color: #dc3545; /* Red */
            color: #ffffff;
        }
        .math-maze-feedback.info {
            background-color: #3a3a5a; /* Dark gray */
            color: #e0e0e0;
        }

        /* Confetti styles */
        .confetti-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            overflow: hidden;
            z-index: 9999; /* Ensure it's on top */
        }
        .confetti {
            position: absolute;
            width: 10px;
            height: 10px;
            background-color: #f00; /* Default color */
            opacity: 0;
            animation: math-maze-confetti-fall 3s forwards;
        }

        @keyframes math-maze-confetti-fall {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 1;
            }
            100% {
                transform: translateY(100vh) rotate(720deg);
                opacity: 0;
            }
        }

        /* New Control Buttons Styling */
        .game-controls-row {
            display: flex;
            flex-wrap: wrap; /* Allow wrapping on smaller screens */
            justify-content: center;
            gap: 0.5rem; /* Space between buttons */
            margin-top: 1.5rem;
            width: 100%;
            max-width: 400px; /* Max width for the row of buttons */
        }

        .control-group {
            display: flex;
            gap: 0.5rem;
            flex-grow: 1; /* Allow groups to grow */
            justify-content: center;
            align-items: center;
        }

        .control-button, .directional-button {
            background-color: #3a3a5a; /* Dark gray */
            color: white;
            padding: 0.75rem 1rem; /* Adjusted padding */
            border-radius: 0.5rem;
            font-weight: 600;
            font-size: 1rem;
            transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
            cursor: pointer;
            border: none;
            flex-shrink: 0; /* Prevent shrinking */
            min-width: 40px; /* Minimum width for smaller buttons */
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .control-button:hover, .directional-button:hover {
            background-color: #5a5a7a; /* Lighter hover */
            transform: translateY(-1px);
        }

        .control-button:active, .directional-button:active {
            transform: translateY(0);
        }

        .directional-button {
            width: 48px; /* Fixed width for directional buttons */
            height: 48px; /* Fixed height for directional buttons */
            padding: 0; /* Remove padding for icon centering */
        }

        .directional-button svg {
            width: 24px; /* Icon size */
            height: 24px; /* Icon size */
            stroke-width: 2.5; /* Thicker stroke for visibility */
        }

        /* Responsive adjustments for maze size */
        @media (max-width: 768px) {
            #math-maze-app {
                padding: 1rem; /* Reduce padding on smaller screens */
                max-width: 95%; /* Allow it to take more width */
            }
            h1 {
                font-size: 1.75rem;
            }
            .math-maze-info-bar {
                flex-direction: column;
                gap: 0.5rem;
                font-size: 0.85rem; /* Smaller font for info bar */
            }
            #problem-text-overlay {
                font-size: 1.2rem;
            }
            .answer-button {
                padding: 0.5rem 1rem;
                font-size: 0.9rem;
            }
            .game-controls-row {
                flex-direction: column; /* Stack buttons vertically on small screens */
                max-width: 200px; /* Constrain width for stacked buttons */
            }
            .control-group {
                flex-direction: column; /* Stack directional buttons */
            }
        }

        /* Modern Select Styles */
        .custom-select-wrapper {
            position: relative;
            width: 100%;
            margin-bottom: 1rem;
        }

        .custom-select-trigger {
            background-color: #3a3a5a;
            border: 1px solid #5a5a7a;
            color: #e0e0e0;
            padding: 0.75rem 1.25rem;
            border-radius: 0.5rem;
            font-weight: 600;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.2s ease-in-out;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }

        .custom-select-trigger:hover {
            background-color: #4a4a6a;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        }

        .custom-select-trigger .arrow {
            margin-left: 0.5rem;
            transition: transform 0.2s ease-in-out;
        }

        .custom-select-trigger.open .arrow {
            transform: rotate(180deg);
        }

        .custom-options {
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            background-color: #26263a;
            border: 1px solid #5a5a7a;
            border-radius: 0.5rem;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            z-index: 30; /* Above other elements */
            max-height: 200px;
            overflow-y: auto;
            opacity: 0;
            pointer-events: none;
            transform: translateY(10px);
            transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
        }

        .custom-options.open {
            opacity: 1;
            pointer-events: auto;
            transform: translateY(0);
        }

        .custom-option {
            padding: 0.75rem 1.25rem;
            cursor: pointer;
            text-align: left;
            transition: background-color 0.15s ease-in-out;
        }

        .custom-option:hover {
            background-color: #3a3a5a;
        }

        .custom-option.selected {
            background-color: #008b8b; /* Teal for selected */
            color: white;
            font-weight: 700;
        }
    