body {
    margin: 0;
    background-color: #0d0d0d; /* Bardzo ciemne tło */
    color: #c5c5c5; /* Jasnoszary tekst */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    width: 800px;
    height: 800px;
    border: 3px solid #c0392b; /* Ciemnoczerwona ramka */
    box-shadow: 0 0 25px rgba(192, 57, 43, 0.5); /* Poświata ramki */
}

#gameCanvas {
    display: block;
    background-color: #1a1a1a; /* Ciemne tło canvas, jeśli obrazek nie pokrywa */
}

#uiContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 0, 0, 0.92); /* Ciemne, lekko czerwonawe tło */
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: auto;
    padding: 20px;
    box-sizing: border-box;
}

.screen.active {
    display: flex;
}

h1, h2 {
    color: #e74c3c; /* Jasnoczerwony */
    margin-bottom: 25px;
    text-shadow: 0 0 10px #c0392b;
}
h1 {
    font-size: 3em;
}
h2 {
    font-size: 2.2em;
}

button {
    background-color: #330000; /* Ciemnoczerwony */
    color: #e0e0e0;
    border: 2px solid #7f0000; /* Ciemniejszy czerwony */
    padding: 12px 25px;
    margin: 12px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    background-color: #550000;
    border-color: #c0392b;
    box-shadow: 0 0 15px rgba(192, 57, 43, 0.7);
}
button:active {
    transform: scale(0.96);
    background-color: #7f0000;
}

/* Character Select */
.character-options {
    display: flex;
    justify-content: space-around;
    width: 90%;
    margin-bottom: 30px;
}
.character-option {
    border: 3px solid #552222;
    padding: 25px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, transform 0.2s;
    background-color: #2a1f1f;
    border-radius: 8px;
    width: 40%;
}
.character-option:hover {
    background-color: #c0392b;
    border-color: #e74c3c;
    transform: translateY(-5px);
}
.character-option img {
    width: 100px;
    height: 150px;
    object-fit: contain;
    margin-bottom: 10px;
    border-bottom: 2px solid #552222;
    padding-bottom: 10px;
}
.character-option p {
    font-size: 1.2em;
    color: #f0a090;
    margin-bottom: 5px;
}
.character-option span {
    font-size: 0.9em;
    color: #aaa;
}


/* In-Game UI (Overlay) */
.screen-overlay { /* Dla HUD w grze */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Pozwól na klikanie przez to na canvas */
    display: none; /* Będzie aktywowane przez JS */
}
.screen-overlay.active {
    display: block;
}


#playerStats {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(20, 0, 0, 0.8);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #550000;
    color: #e0e0e0;
    font-size: 1em;
    width: 280px;
}
.stat-item {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}
.stat-item .label {
    min-width: 90px; /* Aby wyrównać paski */
    margin-right: 8px;
    color: #ff8c69; /* Jasny pomarańczowo-czerwony */
}

#hpBarContainer, #xpBarContainer, #bossHpBarOuter div {
    height: 18px;
    background-color: #400000; /* Ciemnoczerwone tło paska */
    border: 1px solid #7f0000;
    border-radius: 3px;
    overflow: hidden;
    flex-grow: 1; /* Aby pasek wypełnił dostępną przestrzeń */
}
#hpBarContainer { width: 150px; } /* Stała szerokość dla HP */
#xpBarContainer { width: 150px; } /* Stała szerokość dla XP */


#hpValueText {
    margin-left: 8px;
    font-size: 0.9em;
}


#hpBar {
    width: 100%;
    height: 100%;
    background-color: #2ecc71; /* Zielony */
    background-image: linear-gradient(45deg, rgba(255,255,255,.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.1) 75%, transparent 75%, transparent);
    background-size: 30px 30px;
    transition: width 0.3s ease-in-out;
    border-radius: 2px;
}

#xpBar {
    width: 0%;
    height: 100%;
    background-color: #3498db; /* Niebieski */
    background-image: linear-gradient(45deg, rgba(255,255,255,.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.1) 75%, transparent 75%, transparent);
    background-size: 30px 30px;
    transition: width 0.3s ease-in-out;
    border-radius: 2px;
}

#bossHpBarContainer {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(20, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #7f0000;
    color: #e0e0e0;
    text-align: center;
    display: none; /* Pokaż przez JS */
    width: 400px; /* Szerokość kontenera paska bossa */
}
#bossHpBarContainer .label {
    color: #ff8c69;
    margin-right: 10px;
}
#bossHpBarOuter { /* Zewnętrzny kontener dla paska, aby lepiej kontrolować szerokość */
    width: 100%; /* Pasek wypełni kontener */
    height: 22px;
    background-color: #400000;
    border: 1px solid #7f0000;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}
#bossHpBar {
    width: 100%;
    height: 100%;
    background-color: #e74c3c; /* Czerwony dla bossa */
    background-image: linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
    background-size: 40px 40px;
    transition: width 0.2s ease-out;
    border-radius: 2px;
}


/* Perk Screen */
#perkScreen h2 {
    margin-bottom: 35px;
}
.perk-option {
    display: block;
    width: 300px;
    margin-bottom: 18px;
    padding: 15px;
    font-size: 1.05em;
}

/* High Scores */
#highScoresList {
    list-style-type: decimal;
    padding-left: 30px;
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    width: 75%;
    background-color: rgba(42, 31, 31, 0.7); /* Ciemniejsze tło listy */
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #552222;
}
#highScoresList li {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #f0c0b0; /* Jaśniejszy, ciepły kolor dla wpisów */
    border-bottom: 1px dashed #552222;
    padding-bottom: 5px;
}
#highScoresList li:last-child {
    border-bottom: none;
}