body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
    margin: 0;
    overflow: hidden;
}

h1 {
    margin-bottom: 10px;
}

#game-area {
    width: 500px;
    height: 500px;
    border: 2px solid #000;
    position: relative;
    background-color: #f0f0f0;
    overflow: hidden; 
    transition: background-image 0.5s ease, background-color 0.5s ease;
}

/* --- Fondos --- */
.bg-grid {
    background-image: 
        linear-gradient(to right, #ccc 1px, transparent 1px),
        linear-gradient(to bottom, #ccc 1px, transparent 1px);
    background-size: 25px 25px;
    background-color: #f0f0f0;
}
.bg-dark {
    background-image: none;
    background-color: #1a1a1a;
}
.bg-space {
    background-image: url('espace.jpg');
    background-size: cover;
    background-color: #000;

}
#controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 500px;
    margin-bottom: 10px;
    min-height: 2.5em; 
}

#score-board {
    font-size: 1.2em;
    display: flex;
    gap: 20px;
    font-weight: bold;
}

#level-display-container {
    color: #b30000;
}

.character {
    width: 50px;
    height: 50px;
    position: absolute;
    transition: transform 0.05s linear;
    will-change: transform;
}

#player {
    background-color: #33c1ff;
    border-radius: 50%;
    box-shadow: 0 0 10px #33c1ff, 0 0 15px #33c1ff;
    z-index: 10;
    transition: transform 0.05s linear, box-shadow 0.1s ease;
}

.player-dashing {
    box-shadow: 0 0 25px #fff, 0 0 40px #33c1ff !important;
    transform: scale(1.1); 
}

#enemy {
    background-image: url('sat.png'); 
    background-size: cover;
    background-color: #d90429;
    border-radius: 10px;
    z-index: 5;
    box-shadow: 0 0 10px #d90429;
}

.enemy-minion {
    background-color: #b30000;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    z-index: 4;
    box-shadow: 0 0 8px #b30000;
}

#point-item {
    width: 30px;
    height: 30px;
    background-color: #ffd700;
    border: 2px solid #b8860b;
    border-radius: 50%;
    position: absolute;
    z-index: 8;
    box-shadow: 0 0 10px #ffd700, 0 0 15px #ffd700;
}

.pop {
    animation: pop 0.2s ease-out forwards;
}

.particle {
    position: absolute;
    background-color: #ffd700;
    border-radius: 50%;
    z-index: 20;
    pointer-events: none;
    transition: transform 1s cubic-bezier(0.17, 0.84, 0.44, 1), 
                opacity 1s cubic-bezier(0.3, 0.8, 0.5, 1);
}
.player-trail {
    background-color: #33c1ff;
    opacity: 0.8;
    z-index: 9;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}


.hidden {
    display: none !important;
}

#start-screen,
#game-over-screen, 
#settings-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

#settings-screen {
     z-index: 101;
}

.overlay-box {
    background-color: white;
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 400px;
}

#start-box p {
    font-size: 1em;
    line-height: 1.5;
    text-align: left;
    margin: 10px 0;
}
#start-box p strong {
    color: #d90429;
}

/* High Scores */
#high-score-list {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
#high-score-list h3 {
    margin: 0 0 10px 0;
}
#high-score-list ol {
    list-style-type: none;
    padding: 0;
    margin: 0;
    text-align: left;
    font-family: monospace;
    font-size: 1.1em;
}
#high-score-list li {
    padding: 4px 0;
    border-bottom: 1px dashed #ccc;
}
#high-score-list li:last-child {
    border-bottom: none;
}
#high-score-list li::before {
    content: "• ";
    color: #ffd700;
    font-weight: bold;
}


.start-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
    align-items: stretch;
}

#game-over-box p {
    margin: 10px 0;
    font-size: 1.1em;
}

#start-button,
#restart-button {
    font-size: 1.1em;
    padding: 12px 25px;
    cursor: pointer;
    background-color: #33c1ff;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    transition: background-color 0.2s;
}
#start-button:hover,
#restart-button:hover {
    background-color: #009ce0;
}

.button-secondary {
    font-size: 1em;
    padding: 10px 20px;
    cursor: pointer;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    color: #333;
    font-weight: bold;
    transition: background-color 0.2s;
}
.button-secondary:hover {
    background-color: #e0e0e0;
}

/* Settings */
#settings-box {
    text-align: left;
}
#settings-box h2 {
    text-align: center;
    margin-top: 0;
}
.setting-item {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
}
.setting-item label {
    font-weight: bold;
    grid-column: 1 / 3;
}
.setting-item input[type="range"] {
    width: 100%;
    grid-column: 1 / 2;
    cursor: pointer;
}
.setting-item span {
    font-family: monospace;
    font-size: 1.1em;
    min-width: 30px;
    text-align: right;
}
.setting-item select {
    width: 100%;
    font-size: 1em;
    padding: 5px;
    grid-column: 1 / 3;
    cursor: pointer;
}

.setting-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}
#save-settings-button, #close-settings-button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: opacity 0.2s;
}
#save-settings-button {
    background-color: #28a745;
    color: white;
}
#close-settings-button {
    background-color: #dc3545;
    color: white;
}
#save-settings-button:hover, #close-settings-button:hover {
    opacity: 0.8;
}

/* --- Overlays de Efectos --- */
#countdown-overlay, #level-up-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10em;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    -webkit-text-stroke: 2px black;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.countdown-active {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1.1) !important;
}

#level-up-display {
    font-size: 5em;
    color: #ffd700;
    -webkit-text-stroke: 2px #d90429;
    animation: levelUpAnim 1s ease-out forwards;
}


/* --- Animaciones (Keyframes) --- */
@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
    animation: shake 0.5s;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

@keyframes levelUpAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}