:root {
            --bg: #ffffff;
            --surface: #fcfcfc;
            --border: #e5e5e5;
            --primary: #000000;
            --secondary: #777777;
            --accent: #f0f0f0;
            --path: #e0e0e0;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Montserrat', sans-serif;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            outline: none;
        }

        body {
            background-color: var(--bg);
            color: var(--primary);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            overflow-x: hidden;
        }

        header {
            height: 60px;
            background: transparent;
            backdrop-filter: 10px 0 blur(40px) #00000080;
            color: #000;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 5%;
            width: 100%;
            position: fixed;
            top: 0;
            z-index: 100;
        }

        header h1 {
            font-size: 1rem;
            letter-spacing: 3px;
            text-transform: uppercase;
            font-weight: 600;
        }

        header i {
            cursor: pointer;
            font-size: 1.2rem;
        }

        main {
            margin-top: 80px;
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 15px;
            width: 100%;
        }

        .panel {
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 20px;
            border-radius: 4px;
            width: 100%;
            max-width: 1000px;
            margin-bottom: 20px;
        }

        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: flex-end;
            justify-content: center;
        }

        .input-box {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .input-box label {
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--secondary);
            text-transform: uppercase;
        }

        input {
            padding: 8px;
            border: 1px solid var(--border);
            border-radius: 2px;
            outline: none;
            width: 80px;
        }

        .btn-group {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 15px;
            justify-content: center;
        }

        button {
            padding: 10px 15px;
            border-radius: 2px;
            border: 1px solid var(--primary);
            cursor: pointer;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            transition: 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .btn-outline { background: transparent; color: var(--primary); }
        .btn-fill { background: var(--primary); color: white; }
        button:hover { background: var(--accent); color: var(--primary); }
        button.active { background: var(--primary); color: white; }

        #status-msg {
            margin-bottom: 15px;
            font-size: 0.8rem;
            font-weight: 600;
            letter-spacing: 0.5px;
            color: var(--secondary);
            text-align: center;
        }

        .scroll-container {
            width: 100%;
            max-width: 1000px;
            height: 100%;
            overflow: auto;
            border:none;
            background: transparent;
            position: relative;
            border-radius: 4px;
        }

        #grid {
            display: grid;
            padding: 10px;
            width: max-content;
            margin: 0 auto;
        }

        .cell {
            width: 30px;
            height: 30px;
            background: white;
            border: 0.1px solid #b2a9a9;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.8rem;
        }

        .cell:hover { background: var(--accent); }
        .cell.wall { background: var(--primary); border-color: var(--primary); }
        .cell.start { color: #000; font-weight: bold; }
        .cell.end { color: #000; font-weight: bold; }
        .cell.path { background: var(--path); border: none; }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: 0.3s;
        }

        .modal-overlay.show { opacity: 1; visibility: visible; }

        .modal {
            background: white;
            padding: 40px;
            max-width: 80%;
            text-align: center;
            border-radius: 6px;
        }

        .modal h2 { font-size: 1.2rem; margin-bottom: 15px; }
        .modal p { font-size: 0.9rem; line-height: 1.6; color: var(--secondary); margin-bottom: 25px; }

        footer {
            padding: 40px 20px;
            text-align: center;
            border-top: 1px solid var(--border);
            background: var(--surface);
            margin-top: auto;
        }

        footer p {
            font-size: 0.8rem;
            color: var(--secondary);
            margin-bottom: 10px;
            letter-spacing: 1px;
        }

        footer a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
        }

        footer a:hover {
            text-decoration: underline;
        }

        @media (max-width: 600px) {
            .scroll-container { height: 50vh; }
            button { padding: 8px 12px; font-size: 0.65rem; }
        }