        /* Import OpenDyslexic font for dyslexia-friendly text */
        @import url('https://fonts.googleapis.com/css2?family=OpenDyslexic&display=swap');

        /* 2. Root palette (earth-and-rust tones) */
        :root {
            --wall-color: #2c2a28;     /* weathered metal walls */
            --path-color: #827060;     /* dusty earth paths */
            --highlight:  #c47f00;     /* glowing amber highlights */
            --text-color: #f2e8cf;     /* warm off-white text */
        }

        /* Global resets */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* 3. Body background with layered metal grunge */
        body {
            background: 
                radial-gradient(circle at 50% 20%, rgba(255,200,50,0.1), transparent 60%),
                linear-gradient(135deg, #0d0f14 20%, #1a1c26 80%);
            color: var(--text-color);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            overflow: hidden;
            position: relative;
            filter: contrast(1.1) brightness(0.9);
        }

        /* Background maze pattern with cracked concrete */
        .bg-maze {
            background:
                repeating-linear-gradient(0deg, rgba(70,255,170,0.05) 0, rgba(70,255,170,0.05) 1px, transparent 1px, transparent 50px),
                repeating-linear-gradient(90deg, rgba(70,255,170,0.05) 0, rgba(70,255,170,0.05) 1px, transparent 1px, transparent 50px);
            opacity: 0.12;
        }

        /* Game container styling */
        .game-container {
            position: relative;
            margin: 20px auto;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
            border-radius: 5px;
            overflow: hidden;
        }

        /* Maze grid */
        .maze {
            display: grid;
            background-color: var(--wall-color);
            position: relative;
            border: 2px solid #3a2e28;
        }

        /* Cells */
        .cell {
            width: 30px;
            height: 30px;
            border: 1px solid rgba(130,112,96,0.3);
            position: relative;
        }
        .wall {
            /* lighter metallic panels with a touch of amber tint */
            background:
                linear-gradient(145deg,
                rgba(60, 60, 65, 1) 0%,
                rgba(80, 75, 70, 1) 50%,
                rgba(60, 60, 65, 1) 100%
                );
            box-shadow:
                inset 0 0 3px rgba(196,127,0,0.2),  /* warmer inner glow */
                inset 0 0 10px rgba(0,0,0,0.5);      /* softer depth shadow */
            border: 1px solid rgba(196,127,0,0.2); /* subtle amber seam */
        }

        .path {
            background:
                linear-gradient(to right,
                var(--path-color) 0%,
                var(--path-color) 40%,
                #555 40%, #555 42%,
                var(--path-color) 42%, var(--path-color) 82%,
                #555 82%, #555 84%,
                var(--path-color) 84%, var(--path-color) 100%
                );
            box-shadow: inset 0 0 3px rgba(0,0,0,0.5);
        }

        /* Player & mission icons */
        .player {
            font-size: 22px;
            position: absolute;
            z-index: 10;
            transform: translate(-50%, -50%) scale(1);
            transition: transform 0.2s ease;
            filter: drop-shadow(0 0 5px rgba(196,127,0,0.8))
                    drop-shadow(0 0 10px rgba(196,127,0,0.6));
            animation: player-shine 2s infinite ease-in-out;
        }

        /* Grow slightly on move for extra “pop” */
        .player.moved {
            transform: translate(-50%, -50%) scale(1.1);
        }

        /* Keyframes for a gentle shine pulse, reduced intensity */
        @keyframes player-shine {
            0% {
                filter: drop-shadow(0 0 2px rgba(196,127,0,0.6))
                    drop-shadow(0 0 4px rgba(196,127,0,0.4));
            }
            50% {
                filter: drop-shadow(0 0 5px rgba(255,204,0,0.9))
                    drop-shadow(0 0 10px rgba(255,204,0,0.7));
            }
            100% {
                filter: drop-shadow(0 0 2px rgba(196,127,0,0.6))
                    drop-shadow(0 0 4px rgba(196,127,0,0.4));
            }
        }

        .mission {
            font-size: 22px;
            position: absolute;
            z-index: 5;
            transform: translate(-50%, -50%);
            animation: pulse 2s infinite;
            filter: drop-shadow(0 0 5px rgba(255, 255, 100, 0.8));
        }

                /* Exit door styling */
        .exit {
            background: linear-gradient(45deg, var(--highlight), #3a2e28);
            position: absolute;
            z-index: 4;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            color: var(--text-color);
            box-shadow: inset 0 0 10px rgb(38, 226, 142);
        }
        .exit.locked::before {
            content: "🚪";
            font-size: 16px;
        }
        .exit.unlocked {
            background: linear-gradient(45deg, #5a493f, #3a2e28);
            animation: glow 1.5s infinite alternate;
        }
        .exit.unlocked::before {
            content: "🚁";
            font-size: 16px;
        }

        /* Enhanced Message boxes with better sizing */
        .message-box {
            position: absolute;
            top: 120px; 
            left: 50%;
            transform: translateX(-50%);
            background: rgba(28, 26, 24, 0.95);
            backdrop-filter: blur(5px);
            padding: 20px 30px;
            border-radius: 8px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
            z-index: 100;
            text-align: center;
            border: 1px solid var(--highlight);
            min-width: 1000px;
            max-width: 50vw;
            max-height: 500vh;
            overflow-y: auto;
            display: none;
        }
        .message-box h3 {
            margin-bottom: 15px;
            color: var(--highlight);
            font-size: 20px;
            font-family: 'Rubik Mono One', sans-serif;
        }
        .message-box p {
            margin-bottom: 15px;
            line-height: 1.6;
            font-size: 16px;
            font-family: 'OpenDyslexic', sans-serif;
        }

        /* Drag and Drop Styles */
        .task-container {
            margin: 20px 0;
            text-align: left;
        }
        
        .task-title {
            color: var(--highlight);
            font-size: 18px;
            margin-bottom: 15px;
            text-align: center;
            font-weight: bold;
        }

        .sentence-bank {
            background: rgba(130, 112, 96, 0.2);
            border: 2px dashed var(--path-color);
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 20px;
            min-height: 120px;
        }

        .sentence-bank-title {
            color: var(--text-color);
            font-size: 14px;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .sentence-area {
            background: rgba(44, 42, 40, 0.3);
            border: 2px solid var(--wall-color);
            border-radius: 8px;
            padding: 15px;
            min-height: 150px;
            margin-bottom: 20px;
        }

        .sentence-area-title {
            color: var(--text-color);
            font-size: 14px;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .draggable-sentence {
            background: linear-gradient(to right, var(--highlight), #d49000);
            color: #1a1c26;
            padding: 8px 12px;
            margin: 5px;
            border-radius: 6px;
            cursor: move;
            display: inline-block;
            font-size: 14px;
            font-weight: bold;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
            user-select: none;
            max-width: calc(100% - 10px);
            word-wrap: break-word;
        }

        .draggable-sentence:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(196, 127, 0, 0.5);
        }

        .draggable-sentence.dragging {
            opacity: 0.5;
            transform: rotate(5deg);
        }

        .drop-slot {
            background: rgba(130, 112, 96, 0.1);
            border: 2px dashed var(--path-color);
            border-radius: 6px;
            padding: 12px;
            margin: 8px 0;
            min-height: 45px;
            display: flex;
            align-items: center;
            transition: all 0.3s ease;
            position: relative;
        }

        .drop-slot::before {
            content: attr(data-number);
            position: absolute;
            left: -30px;
            color: var(--highlight);
            font-weight: bold;
            font-size: 16px;
        }

        .drop-slot.drag-over {
            background: rgba(196, 127, 0, 0.2);
            border-color: var(--highlight);
            border-style: solid;
        }

        .drop-slot.filled {
            background: rgba(130, 112, 96, 0.3);
            border-color: var(--text-color);
        }

        .drop-slot .draggable-sentence {
            margin: 0;
            width: 100%;
            cursor: move;
        }

        /* Buttons: beaten metal look */
        .btn {
            background: linear-gradient(to bottom right, #3a2e28, #5a493f);
            color: var(--text-color);
            border: 1px solid var(--path-color);
            padding: 10px 25px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s ease;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
            margin: 5px;
            font-size: 14px;
        }
        .btn:hover {
            background: linear-gradient(to bottom right, #5a493f, #3a2e28);
            transform: translateY(-2px);
            box-shadow: 0 0 10px rgba(196,127,0,0.7);
        }
        .btn:active {
            transform: translateY(1px);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none !important;
        }

        .btn:disabled:hover {
            transform: none;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
        }

        /* Fill-in-the-blank specific styles */
        .fill-blank-container {
            margin: 20px 0;
            text-align: left;
        }

        .sentence-with-blanks {
            background: rgba(130, 112, 96, 0.1);
            border: 2px solid var(--path-color);
            border-radius: 8px;
            padding: 20px;
            margin: 15px 0;
            line-height: 2;
            font-size: 16px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 5px;
        }

        .blank-slot {
            display: inline-block;
            min-width: 80px;
            min-height: 35px;
            background: rgba(196, 127, 0, 0.2);
            border: 2px dashed var(--highlight);
            border-radius: 6px;
            margin: 0 3px;
            vertical-align: middle;
            transition: all 0.3s ease;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .blank-slot.drag-over {
            background: rgba(196, 127, 0, 0.4);
            border-style: solid;
        }

        .blank-slot.filled {
            background: rgba(130, 112, 96, 0.3);
            border-color: var(--text-color);
            border-style: solid;
        }

        .word-bank {
            background: rgba(130, 112, 96, 0.2);
            border: 2px dashed var(--path-color);
            border-radius: 8px;
            padding: 15px;
            margin: 15px 0;
        }

        .word-bank-title {
            color: var(--text-color);
            font-size: 14px;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .draggable-word {
            background: linear-gradient(to right, var(--highlight), #d49000);
            color: #1a1c26;
            padding: 8px 15px;
            margin: 5px;
            border-radius: 6px;
            cursor: move;
            display: inline-block;
            font-size: 14px;
            font-weight: bold;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            transition: all 0.3s ease;
            user-select: none;
        }

        .draggable-word:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(196, 127, 0, 0.5);
        }

        .draggable-word.dragging {
            opacity: 0.5;
            transform: rotate(5deg);
        }

        .feedback-message {
            margin: 10px 0;
            padding: 10px;
            border-radius: 6px;
            font-weight: bold;
            text-align: center;
        }

        .feedback-correct {
            background: rgba(76, 175, 80, 0.2);
            color: #4CAF50;
            border: 1px solid #4CAF50;
        }

        .feedback-incorrect {
            background: rgba(244, 67, 54, 0.2);
            color: #F44336;
            border: 1px solid #F44336;
        }

        /* Hide original next button initially */
        .original-next-btn {
            display: none;
        }

        /* Status bar & controls panel */
        .status-bar {
            position: absolute;
            top: 15px; 
            right: 10px;
            background: rgba(28, 26, 24, 0.8);
            padding: 8px 15px;
            border-radius: 5px;
            font-size: 16px; /* Increased for readability */
            z-index: 50;
            border: 1px solid var(--highlight);
            font-family: 'OpenDyslexic', sans-serif; /* Dyslexia-friendly font */
            text-shadow: none; /* Removed for clarity */
        }
        .mission-status {
            display: flex;
            gap: 10px;
        }
        .mission-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .mission-indicator {
            width: 12px; 
            height: 12px;
            border-radius: 50%;
            background-color: #555;
        }
        .mission-indicator.completed {
            background-color: #4CAF50;
        }

        .controls-info {
            position: absolute;
            bottom: 10px; 
            left: 10px;
            background: rgba(28, 26, 24, 0.8);
            padding: 8px 15px;
            border-radius: 5px;
            font-size: 16px; /* Increased for readability */
            z-index: 50;
            border: 1px solid var(--highlight);
            font-family: 'OpenDyslexic', sans-serif; /* Dyslexia-friendly font */
            text-shadow: none; /* Removed for clarity */
        }

        /* Title styling */
        .title {
            font-size: 38px;
            position: absolute;
            top: 50px;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            text-transform: uppercase;
            letter-spacing: 6px;
            color: #b17575; /* amber highlight */
            font-family: 'Rubik Mono One', sans-serif; /* Retain original style */
            text-shadow:
                0 0 5px #c47f00,
                0 0 10px #c47f00,
                0 0 20px #ffb84d,
                0 0 30px #ffb84d,
                0 0 40px #ffb84d,
                0 0 55px #ffb84d,
                0 0 75px #ffb84d;
            animation: flicker 3s infinite alternate;
            letter-spacing: 6px;
            font-weight: 900;
            user-select: none;
        }
        @keyframes flicker {
            0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
                opacity: 1;
                text-shadow:
                    0 0 5px #c47f00,
                    0 0 10px #c47f00,
                    0 0 20px #ffb84d,
                    0 0 30px #ffb84d,
                    0 0 40px #ffb84d,
                    0 0 55px #ffb84d,
                    0 0 75px #ffb84d;
            }
            20%, 22%, 24%, 55% {
                opacity: 0.8;
                text-shadow:
                    0 0 3px #c47f00,
                    0 0 7px #c47f00,
                    0 0 15px #ffb84d,
                    0 0 20px #ffb84d,
                    0 0 25px #ffb84d,
                    0 0 35px #ffb84d,
                    0 0 45px #ffb84d;
            }
        }

        /* 4. Apply stencil font and text effects */
        body,
        .title,
        .status-bar,
        .controls-info,
        .message-box h3 {
            font-family: 'Rubik Mono One', sans-serif;
            letter-spacing: 1px;
            text-shadow: 0 0 4px rgba(0,0,0,0.6);
        }

        /* Override font and remove text shadow for dyslexia-friendly elements */
        .status-bar,
        .controls-info,
        .message-box p {
            font-family: 'OpenDyslexic', sans-serif;
            text-shadow: none;
        }

        /* Touch controls visibility */
        @media (max-width: 768px) {
            .touch-controls-container {
                display: flex;
            }
        }

        /* Touch controls styling */
        .touch-controls-container {
            display: none;
            justify-content: center;
            width: 100%;
            margin: 20px 0;
        }

        .touch-controls {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(3, 1fr);
            width: 160px;
            height: 160px;
            gap: 10px;
        }

        .touch-controls button {
            background: rgba(28, 26, 24, 0.8);
            border: 1px solid var(--highlight);
            border-radius: 50%;
            color: var(--text-color);
            font-size: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
        }

        .touch-controls button:active {
            background: rgba(196, 127, 0, 0.3);
        }

        .touch-controls .up { grid-column: 2; grid-row: 1; }
        .touch-controls .left { grid-column: 1; grid-row: 2; }
        .touch-controls .right { grid-column: 3; grid-row: 2; }
        .touch-controls .down { grid-column: 2; grid-row: 3; }

        /* Responsive adjustments */
        @media (max-width: 1200px) {
            .message-box {
                min-width: 90%;
                max-width: 85vw;
                top: 80px;
            }
            
            .title {
                font-size: 32px;
                top: 30px;
            }
        }

        @media (max-width: 1024px) {
            :root {
                --wall-color: #2a2826;
                --path-color: #76685a;
            }
            
            .cell {
                width: 25px;
                height: 25px;
            }
            
            .status-bar,
            .controls-info {
                font-size: 14px;
                padding: 6px 12px;
            }
        }

        @media (max-width: 768px) {
            .game-container {
                transform: scale(0.9);
                margin: 10px auto;
            }
            
            .title {
                font-size: 28px;
                letter-spacing: 3px;
                top: 20px;
            }
            
            .message-box {
                padding: 15px 20px;
                top: 60px;
                min-width: 95%;
            }
            
            .task-title,
            .sentence-bank-title,
            .sentence-area-title,
            .word-bank-title {
                font-size: 16px;
            }
            
            .draggable-sentence,
            .draggable-word {
                padding: 6px 10px;
                font-size: 13px;
            }
            
            .status-bar {
                top: 10px;
                right: 5px;
            }
            
            .controls-info {
                bottom: 5px;
                left: 5px;
                font-size: 13px;
            }
        }

        @media (max-width: 480px) {
            .game-container {
                transform: scale(0.8);
            }
            
            .title {
                font-size: 22px;
                top: 15px;
            }
            
            .cell {
                width: 20px;
                height: 20px;
            }
            
            .player,
            .mission {
                font-size: 18px;
            }
            
            .message-box {
                padding: 12px 15px;
                top: 50px;
                border-radius: 6px;
            }
            
            .message-box h3 {
                font-size: 18px;
            }
            
            .message-box p {
                font-size: 14px;
            }
            
            .btn {
                padding: 8px 15px;
                font-size: 12px;
            }
            
            .sentence-bank,
            .sentence-area,
            .word-bank {
                padding: 10px;
            }
            
            .drop-slot {
                padding: 8px;
            }
            
            .blank-slot {
                min-width: 60px;
                min-height: 30px;
            }
        }

        /* Mobile landscape optimization */
        @media (max-height: 480px) and (orientation: landscape) {
            .game-container {
                transform: scale(0.7) translateY(-10%);
            }
            
            .title {
                top: 10px;
                font-size: 24px;
            }
            
            .message-box {
                top: 40px;
                max-height: 70vh;
                overflow-y: auto;
            }
            
            .status-bar {
                top: 5px;
            }
            
            .controls-info {
                bottom: 2px;
            }
        }