body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100%;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
}

body.modal-open {
    overflow: hidden;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    width: 100%;
    margin-top: 20px;
}

h1 {
    color: #0056b3;
    margin-bottom: 25px;
    font-size: 2.2em;
}

.rules-box {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #ffeccf;
    border-left: 6px solid #ff9800;
    border-radius: 8px;
    text-align: left;
}
.rules-box h2 {
    color: #ff9800;
    margin-top: 0;
}
.rules-box p {
    font-size: 1em;
    line-height: 1.5;
}

.alphabet-code-section {
    margin-bottom: 35px;
    padding: 20px;
    background-color: #e6f2ff;
    border-left: 6px solid #007bff;
    border-radius: 8px;
    text-align: left;
}

.alphabet-code-section h2 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.6em;
}

.alphabet-code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); /* Flexibele kolommen */
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.code-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #a8d5ff;
    border-radius: 5px;
    background-color: #d1e7ff;
    padding: 5px 0;
}

.code-number {
    font-size: 0.9em;
    font-weight: bold;
    color: #0056b3;
    margin-bottom: 3px;
}

.code-input {
    width: 35px;
    height: 35px;
    text-align: center;
    font-size: 1.5em;
    text-transform: uppercase;
    border: 1px solid #99ccff;
    border-radius: 4px;
    background-color: #f0f8ff;
}

.code-input:focus {
    outline: 2px solid #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.hint-text {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
}


.aanwijzingen {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    margin-top: 30px;
    text-align: left;
}

.aanwijzingen .horizontaal,
.aanwijzingen .verticaal {
    flex: 1;
    background-color: #eaf7ed;
    padding: 25px;
    border-radius: 10px;
    border-left: 6px solid #28a745;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.aanwijzingen h2 {
    color: #28a745;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.6em;
}

.aanwijzingen p {
    margin-bottom: 8px;
    line-height: 1.4;
    font-size: 1.1em;
}

/* --- Algemene Modal Stijlen (zorgt voor centrering) --- */
.modal-overlay {
    display: flex; /* Essentieel voor centrering */
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(96 108 102 / 77%);
    z-index: 1000;
}

.modal-content {
    position: relative; /* Nodig voor de z-index en achtergrond */
    z-index: 2; /* Ligt boven de animatie */
    background: #fff; /* Witte achtergrond voor de content */
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* --- Stijlen voor de Geanimeerde Achtergrond --- */
.animation-bg {
    position: absolute; /* Vult de .modal-overlay op */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1; /* Ligt achter de .modal-content */
}

.char {
    position: absolute;
    bottom: -50px;
    color: rgba(255, 255, 255, 0.15); /* Subtiel wit */
    font-size: 20px;
    font-weight: bold;
    user-select: none;
    animation-name: swirl;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes swirl {
    0% {
        transform: translateY(-105vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotate(360deg);
        opacity: 0;
    }
}

.modal-content h2 {
    margin-top: 0;
    color: #28a745;
}

#completion-time {
    font-size: 1.1em;
    color: #333;
    margin: 20px 0;
}

#play-again-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#play-again-btn:hover {
    background-color: #0056b3;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* NIEUW: Stijlen voor Highscores */
.highscore-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}
.highscore-list {
    list-style-type: decimal;
    padding-left: 20px;
    margin: 0 auto;
    width: 20%;
}
.highscore-list li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}
.highscore-list li:last-child {
    border-bottom: none;
}
.highscore-name {
    font-family: monospace;
    font-weight: bold;
}
.highscore-time {
    font-family: monospace;
    color: #007bff;
}

/* Stijlen voor het score formulier */
#score-form {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
#player-name {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#save-score-btn {
    padding: 8px 15px;
    border: none;
    background-color: #28a745;
    color: white;
    border-radius: 4px;
    cursor: pointer;
}
#save-score-btn:hover {
    background-color: #218838;
}

/* Stijl voor de knop rechtsboven */
.top-right-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    
    /* Nieuw uiterlijk */
    background-color: #ffffff; /* Witte achtergrond */
    color: #007bff; /* Blauwe tekst */
    border: 2px solid #007bff; /* Blauwe rand */
    font-weight: bold;

    padding: 10px 15px;
    border-radius: 8px; /* Iets ronder, past beter bij de container */
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    
    /* Vloeiende overgang */
    transition: all 0.3s ease;
}

.top-right-btn:hover {
    /* Effect bij hover */
    background-color: #007bff; /* Wordt blauw */
    color: #ffffff; /* Tekst wordt wit */
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transform: translateY(-2px); /* Kleine 'lift' animatie */
}

.top-right-btn span {
    margin-right: 8px;
    vertical-align: middle;
} 

/* Stijlen voor de knoppen in de bevestigings-modal */
.modal-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}
.modal-buttons button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}
.modal-buttons button:hover {
    opacity: 0.8;
}
.btn-confirm {
    background-color: #dc3545; /* Rood */
    color: white;
}
.btn-cancel {
    background-color: #6c757d; /* Grijs */
    color: white;
}

/* Class om elementen te verbergen */
.hidden {
    display: none !important;
}

/* Stijlen voor de instellingen-modal */
.settings-form {
    margin: 25px 0;
    text-align: left;
}
.setting-item {
    margin-bottom: 20px;
}
.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}
.setting-item select,
.setting-item input[type="range"] {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
.setting-item input[type="range"] {
    padding: 0; /* Range sliders hebben geen padding nodig */
}

/* --- Stijlen voor de custom dropdown --- */
.select-wrapper {
    position: relative; /* Nodig om het pijltje te positioneren */
}

/* Verberg het standaard pijltje en pas de basisstijl aan */
.setting-item select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    background-color: #fff; /* Witte achtergrond */
    padding: 12px 40px 12px 15px; /* Extra ruimte rechts voor het pijltje */
    font-size: 16px;
    color: #333;
    cursor: pointer;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* Creëer ons eigen pijltje met een pseudo-element */
.select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid #555; /* Dit vormt de pijl */
    
    pointer-events: none; /* Zorgt dat je door de pijl heen kunt klikken */
    transition: all 0.2s ease;
}

/* Optioneel: Laat het pijltje iets draaien als de dropdown open is (werkt in sommige browsers) */
.select-wrapper select:focus + ::after {
    transform: translateY(-50%) rotate(180deg);
}

/* --- Stijlen voor de Roterende Laad-animatie (Correctie) --- */
.loading-content {
    text-align: center;
    color: white;
}
.loading-content h2 {
    margin-bottom: 60px;
    font-size: 24px;
    color: white;
}


/* --- De Animatie-onderdelen --- */
#loader-case {
    display: flex;
    gap: 8px;
}

/* De keyframes hoeven niet aangepast te worden */
@keyframes stamp-in {
    from {
        transform: scale(1.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Stijlen voor Mobiele Apparaten --- */
        @media (max-width: 768px) {
            body {
                overflow-x: hidden;
            }
            
            .container {
                display: block; 
                margin: 0;
                border-radius: 0;
                box-shadow: none;
            }
        
            .puzzle-grid-container {
                overflow-x: auto;
                justify-content: left;
                -webkit-overflow-scrolling: touch;
                background-color: #f8f9fa;
                border: 1px solid #dee2e6;
                border-radius: 8px;
                box-shadow: inset -10px 0 8px -8px rgba(0,0,0,0.1);
            }
        
            .puzzle-grid {
                min-width: 700px; 
            }
        
            .puzzle-input {
                font-size: 1.2em;
            }
        
            .cell-number {
                font-size: 10px;
            }
            
            .modal-content {
                width: 80%;
            }

        }