/* --- Core Layout --- */
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #1c1c1c;
    color: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
#main-content { padding: 20px; }

/* --- UI Elements --- */
h1 { font-size: 2.5em; margin-bottom: 10px; }
p { font-size: 1.2em; color: #aaa; margin-top: 0; min-height: 1.5em; }
#game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 20px auto 0;
    font-size: 1.5em;
    font-weight: bold;
}
#high-score-display { color: #f1c40f; }

/* --- Game Board --- */
#game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: clamp(300px, 80vmin, 500px);
    height: clamp(300px, 80vmin, 500px);
    margin: 20px auto;
    transition: box-shadow 0.3s;
}
.grid-cell {
    background-color: #333;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.grid-cell:hover:not(.path-flash) { transform: scale(1.05); }

/* --- Cell States & Animations --- */
.grid-cell.path-flash { background-color: #3498db; animation: flash 0.5s; cursor: default; }
.grid-cell.player-correct { background-color: #2ecc71; }
.grid-cell.player-wrong { background-color: #e74c3c; animation: shake 0.5s; }

/* NEW: Level complete animation */
.level-complete-flash {
    box-shadow: 0 0 30px 10px #2ecc71;
}

@keyframes flash { 50% { opacity: 0.5; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* --- Game Over Overlay --- */
#game-over-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-size: 2em; animation: fade-in 0.5s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
#game-over-overlay p { font-size: 0.8em; }
#restart-btn { margin-top: 20px; padding: 15px 30px; font-size: 0.8em; border: none; border-radius: 10px; background-color: #3498db; color: white; cursor: pointer; transition: background-color 0.2s; }
#restart-btn:hover { background-color: #2980b9; }
.hidden { display: none !important; }