body {
    font-family: Arial, sans-serif;
    background-color: #f0f8ff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

#app-container {
    width: 95%;
    max-width: 900px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 25px;
    border: 2px solid #b0e0e6;
}

/* ----- Ekran wyboru poziomu ----- */
#difficulty-selection {
    text-align: center;
}

#difficulty-selection h2 {
    color: #0056b3;
    margin-bottom: 25px;
}

.difficulty-btn {
    background-color: #007bff;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    margin: 10px;
}

.difficulty-btn:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

#btn-trudny {
    background-color: #dc3545;
}

#btn-trudny:hover {
    background-color: #c82333;
}

/* ----- Główna gra (początkowo ukryta) ----- */
#game-wrapper {
    display: none; 
}

h1, h2 {
    text-align: center;
    color: #0056b3; 
}

#instruction-text-desktop,
#instruction-text-mobile {
    text-align: center;
    color: #333;
    margin-top: 20px;
    font-weight: normal;
}

#instruction-text-mobile {
    display: none;
}


#score-board {
    display: flex;
    justify-content: space-around;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}

#score-correct { color: #28a745; }
#score-errors { color: #dc3545; }

/* Układ gry na poziomy */
#game-area {
    display: flex;
    flex-direction: row; 
    justify-content: space-between; 
    gap: 20px;
    margin-top: 20px;
}

/* Kafelki po lewej stronie */
#source-tiles {
    width: 48%; 
    min-height: 400px; 
    background: #e6f7ff; 
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap; 
    justify-content: center; 
    align-content: flex-start; 
    gap: 10px;
    box-sizing: border-box; 
}

/* Sloty po prawej stronie */
#target-slots {
    width: 48%; 
    min-height: 400px; 
    background: #f9f9f9;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    counter-reset: slot-counter; 
    box-sizing: border-box;
}

/* Pojedynczy kafelek */
.tile {
    background-color: #007bff;
    color: white;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer; /* ZMIANA: z 'grab' na 'pointer' */
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, opacity 0.2s, transform 0.2s; /* ZMIANA: dodano transform */
    flex-grow: 1; 
    min-width: 150px; 
}

.tile:hover {
    background-color: #0056b3;
}

.tile.dragging {
    opacity: 0.5;
    cursor: grabbing; /* Ten styl nadpisze 'pointer' podczas przeciągania */
}

/* NOWY STYL: dla zaznaczonego kafelka */
.tile.selected {
    background-color: #20c997; /* Turkusowy */
    transform: scale(1.05); /* Lekkie powiększenie */
    border: 2px solid #0056b3;
}


/* Pojedyncze miejsce docelowe */
.slot {
    background-color: #ffffff;
    border: 2px dashed #aaa;
    border-radius: 5px;
    min-height: 50px; 
    padding: 10px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    flex-grow: 1;
    cursor: pointer; /* ZMIANA: Dodano kursor */
}

.slot::before {
    counter-increment: slot-counter;
    content: counter(slot-counter) ". ";
    font-weight: bold;
    font-size: 1.1em;
    color: #555;
    margin-right: 10px;
    min-width: 20px; 
}

.slot.drag-over {
    background-color: #d4edda; 
    border-color: #28a745;
}

#controls {
    text-align: center;
    margin-top: 25px;
}

#check-button {
    background-color: #28a745;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#check-button:hover { background-color: #218838; }
#check-button:disabled { background-color: #ccc; cursor: not-allowed; }

#message {
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
    font-weight: bold;
    height: 20px; 
}

.success { color: #28a745; }
.error { color: #dc3545; }
.finished { color: #0056b3; }

/* Przycisk "Wróć" */
.back-button {
    display: block;
    width: 150px;
    margin: 25px auto 10px auto; 
    padding: 12px 20px;
    background-color: #6c757d; 
    color: white;
    text-decoration: none;
    text-align: center;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.back-button:hover {
    background-color: #5a6268;
}


/* ------------------------------------------- */
/* SEKCJA: Responsywność na telefony           */
/* ------------------------------------------- */

@media (max-width: 700px) {
    body {
        padding: 10px;
    }

    #app-container {
        padding: 15px;
    }

    #game-area {
        flex-direction: column; 
    }

    #source-tiles,
    #target-slots {
        width: 100%;
        min-height: 250px;
    }
    
    #instruction-text-desktop {
        display: none;
    }
    
    #instruction-text-mobile {
        display: block;
    }
}