:root {
            /* Light Theme */
            --background-gradient: linear-gradient(135deg, #74ebd5, #acb6e5);
            --container-bg: linear-gradient(145deg, #ffffff, #f0f4f8);
            --text-color: #2c3e50;
            --secondary-text-color: #34495e;
            --cell-bg: #f7f9fc;
            --cell-border: #e0e6ed;
            --cell-found-bg: #e74c3c;
            --cell-found-text: #000;
            --word-list-item-bg: #fff;
            --word-list-found-bg: #a9dfbf;
            --button-gradient: linear-gradient(90deg, #1abc9c, #16a085);
            --button-hover-gradient: linear-gradient(90deg, #16a085, #1abc9c);
            --hint-button-gradient: linear-gradient(90deg, #f39c12, #e67e22);
            --hint-button-hover-gradient: linear-gradient(90deg, #e67e22, #f39c12);
            --timer-bg: linear-gradient(90deg, #e74c3c, #c0392b);
            --timer-text: #fff;
            --modal-overlay: rgba(0, 0, 0, 0.5);
            --modal-bg: linear-gradient(145deg, #ffffff, #f0f4f8);
            --score-bg: #ecf0f1;
            --score-text: #2c3e50;
        }

        [data-theme="dark"] {
            /* Dark Theme */
            --background-gradient: linear-gradient(135deg, #2c3e50, #4a5568);
            --container-bg: linear-gradient(145deg, #2d3748, #4a5568);
            --text-color: #e2e8f0;
            --secondary-text-color: #a0aec0;
            --cell-bg: #4a5568;
            --cell-border: #718096;
            --cell-found-bg: #e74c3c;
            --cell-found-text: #000;
            --word-list-item-bg: #2d3748;
            --word-list-found-bg: #68d391;
            --button-gradient: linear-gradient(90deg, #38b2ac, #319795);
            --button-hover-gradient: linear-gradient(90deg, #319795, #38b2ac);
            --hint-button-gradient: linear-gradient(90deg, #dd6b20, #c05621);
            --hint-button-hover-gradient: linear-gradient(90deg, #c05621, #dd6b20);
            --timer-bg: linear-gradient(90deg, #c53030, #9b2c2c);
            --timer-text: #fff;
            --modal-overlay: rgba(0, 0, 0, 0.7);
            --modal-bg: linear-gradient(145deg, #2d3748, #4a5568);
            --score-bg: #4a5568;
            --score-text: #e2e8f0;
        }

        body {
            font-family: 'Poppins', sans-serif;
            background: var(--background-gradient);
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            overflow: auto;
        }
#bonusMalus{
	color:gray;
	font-size:0.7em;
	text-decoration: underline;}
        .game-container {
            background: var(--container-bg);
            padding: 2rem;
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            text-align: center;
            width: 90%;
            max-width: 700px;
            animation: fadeIn 0.5s ease-in-out;
            position: relative;
        }
#btRetour{
	position: absolute;
	left:10px;
	top:10px;
}
 { touch-action: manipulation; }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        h1 {
            color: var(--text-color);
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 1rem;
        }

        h2 {
            color: var(--secondary-text-color);
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 0.75rem;
        }

        .start-screen {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .start-screen button {
            padding: 0.75rem 1.5rem;
            font-size: 1rem;
            font-weight: 600;
            color: #fff;
            background: var(--button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
            margin: 0.5rem;
        }

        .start-screen button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        .category-selection {
            margin-bottom: 1.5rem;
            display: none;
        }

        .category-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 0.5rem;
            justify-items: center;
            margin-bottom: 1rem;
        }

        .category-grid button {
            padding: 0.75rem 1.5rem;
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            background: var(--button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
            width: 100%;
            max-width: 150px;
            text-align: center;
        }

        .category-grid button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        .all-category {
            display: flex;
            justify-content: center;
        }

        .all-category button {
            padding: 0.75rem 1.5rem;
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            background: var(--button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
            width: 100%;
            max-width: 150px;
        }

        .all-category button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        .level-selection {
            margin-bottom: 1.5rem;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.5rem;
            display: none;
        }

        .level-selection button {
            padding: 0.75rem 1.5rem;
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            background: var(--button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
        }

        .level-selection button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        .timer {
            position: absolute;
            top: 1rem;
            left: 1rem;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--timer-text);
            background: var(--timer-bg);
            padding: 0.3rem 0.6rem;
            border-radius: 20px;
            display: none;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        }

         .score {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%); /* Horizontally center */
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--score-text);
    background: var(--score-bg);
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    display: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

        .grid {
            display: inline-block;
            background: var(--word-list-item-bg);
            padding: 0.5rem;
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            margin-bottom: 1rem;
            display: none;
        }

        .row {
            display: flex;
        }

        .cell {
            width: 2.5rem;
            height: 2.5rem;
            background: var(--cell-bg);
            border: 1px solid var(--cell-border);
            border-radius: 8px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 600;
            color: var(--text-color);
            font-size: 1.5rem;
            text-transform: lowercase;
            user-select: none;
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .cell:hover {
            background: #e6f0fa;
        }

        .cell.selected {
            background: #81ecec;
        }

        .cell.found {
            background: var(--cell-found-bg);
            color: var(--cell-found-text);
            text-decoration: line-through;
            cursor: not-allowed;
        }

        .word-list {
            margin-top: 1rem;
            display: none;
        }

        .word-list h3 {
            color: var(--secondary-text-color);
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 0.75rem;
        }

        .word-list ul {
            list-style: none;
            padding: 0;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.5rem;
        }

        .word-list li {
            background: var(--word-list-item-bg);
            padding: 0.5rem 0.75rem;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
            color: var(--text-color);
            font-weight: 600;
            font-size: 1.1rem;
            transition: transform 0.2s ease, background 0.3s ease;
        }

        .word-list li.found {
            text-decoration: line-through;
            background: var(--word-list-found-bg);
            transform: scale(1.02);
        }

        .hint-button {
            margin: 1rem auto;
            padding: 0.6rem 1.2rem;
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            background: var(--hint-button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
            display: none;
        }

        .hint-button:hover {
            transform: scale(1.05);
            background: var(--hint-button-hover-gradient);
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--modal-overlay);
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .modal-content {
            background: var(--modal-bg);
            padding: 1.5rem;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            text-align: center;
            animation: fadeIn 0.3s ease-in-out;
            width: 90%;
            max-width: 400px;
        }

        .modal-content h2 {
            color: var(--text-color);
            font-size: 1.5rem;
            margin-bottom: 0.75rem;
        }

        .modal-content p {
            color: var(--text-color);
            font-size: 1rem;
            margin-bottom: 1rem;
        }

        .modal-content button {
            padding: 0.6rem 1.2rem;
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            background: var(--button-gradient);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: transform 0.2s ease, background 0.3s ease;
            margin: 0.3rem;
        }

        .modal-content button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        /* Theme and Sound Toggle Buttons */
        .theme-toggle, .sound-toggle {
            position: absolute;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .theme-toggle {
            top: 1rem;
            right: 1rem;
        }

        .sound-toggle {
            top: 1rem;
            right: 4rem; /* Increased distance from theme toggle */
        }

        .theme-toggle button, .sound-toggle button {
            width: 2rem;
            height: 2rem;
            background: var(--button-gradient);
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 1rem;
            color: #000; /* Black color for outline icons */
            transition: transform 0.2s ease, background 0.3s ease;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        }

        .theme-toggle button:hover, .sound-toggle button:hover {
            transform: scale(1.05);
            background: var(--button-hover-gradient);
        }

        /* Ensure icons are black outlines */
        .theme-toggle button, .sound-toggle button {
            -webkit-text-fill-color: transparent;
            -webkit-text-stroke-width: 1px;
            -webkit-text-stroke-color: #000;
            text-fill-color: transparent;
            text-stroke-width: 1px;
            text-stroke-color: #000;
        }

        @media (max-width: 600px) {
            .game-container {
                padding: 1rem;
            }

            h1 {
                font-size: 1.5rem;
            }

            h2 {
                font-size: 1rem;
            }

            .timer, .score {
                font-size: 0.7rem;
                padding: 0.2rem 0.5rem;
            }

            .cell {
                width: 2rem;
                height: 2rem;
                font-size: 0.8rem;
            }

            .word-list h3 {
                font-size: 0.9rem;
            }

            .word-list li {
                font-size: 0.8rem;
                padding: 0.4rem 0.6rem;
            }

            .hint-button {
                padding: 0.5rem 1rem;
                font-size: 0.8rem;
            }

            .modal-content {
                padding: 1rem;
            }

            .modal-content h2 {
                font-size: 1.2rem;
            }

            .modal-content p {
                font-size: 0.9rem;
            }

            .modal-content button {
                padding: 0.5rem 1rem;
                font-size: 0.8rem;
            }

            .theme-toggle, .sound-toggle {
                top: 0.5rem;
            }

            .sound-toggle {
                right: 3.5rem; /* Adjusted for increased distance on mobile */
            }

            .theme-toggle button, .sound-toggle button {
                width: 1.8rem;
                height: 1.8rem;
                font-size: 0.9rem;
            }
        }