body {
    font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #87CEEB; /* Sky blue */
    color: #333;
    user-select: none; /* Prevent text selection */
}

h1 {
    color: #FFDF00; /* Yellow title */
    text-shadow: 2px 2px #000;
    margin-bottom: 20px;
}

/* Character Selection Styles */
.character-select-container {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    margin-bottom: 30px;
}

.character-select-container h2 {
    color: #333;
    margin-bottom: 15px;
}

.character-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.char-option {
    width: 80px;
    height: 80px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 10px;
    transition: all 0.2s ease;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* For tooltip */
    overflow: hidden; /* Prevent SVG overflow */
}

.char-option svg {
    width: 70%;
    height: 70%;
    display: block;
}

.char-option:hover {
    transform: scale(1.1);
    border-color: #FFDF00;
}

.char-option.selected {
    border-color: #228B22;
    background-color: #c8e6c9;
}

/* Tooltip for character names on hover */
.char-option::after {
    content: attr(data-name);
    position: absolute;
    bottom: -25px; /* Start hidden below */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    transition: bottom 0.2s ease, opacity 0.2s ease;
    pointer-events: none; /* Don't interfere with clicks */
}

.char-option:hover::after {
    bottom: 5px; /* Move into view */
    opacity: 1;
}

#selection-prompt {
    font-weight: bold;
    color: #555;
}

/* Game Area Styles */
.game-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end; /* Align items at the bottom */
    width: 90%;
    max-width: 800px; /* Increased max width */
    background-color: #90EE90; /* Light green ground */
    padding: 20px;
    border-radius: 15px;
    border: 5px solid #228B22; /* Forest green border */
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    position: relative; /* Needed for absolute positioning of VS */
}

.hidden {
    display: none !important; /* Use important to override default flex */
}

.vs {
    font-size: 3em;
    font-weight: bold;
    color: #FF4500; /* OrangeRed */
    text-shadow: 2px 2px #000;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -100%); /* Adjust positioning */
}

.character-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.character-container h2 {
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 1px 1px #000;
}

.character {
    width: 100px;
    height: 100px;
    cursor: pointer; /* Keep cursor for basic attack */
    transition: transform 0.1s ease-in-out, opacity 0.3s ease;
    margin-bottom: 10px; /* Space between character and health bar */
}

.character.player1:hover:not(.no-hover) { 
    transform: scale(1.05); 
} 

.character.player2:hover:not(.no-hover) { 
    transform: scale(1.05); 
} 

.character:active:not(.no-hover) { 
    transform: scale(0.98); 
}

.character svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Hit animation */
.character.hit {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px) rotate(-3deg); }
    50% { transform: translateX(8px) rotate(3deg); }
    75% { transform: translateX(-5px) rotate(-2deg); }
}

.health-bar-container {
    width: 120px;
    height: 20px;
    background-color: #eee;
    border: 2px solid #555;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px; /* Increased space below health bar */
}

.health-bar {
    width: 100%;
    height: 100%;
    background-color: #32CD32; /* LimeGreen */
    transition: width 0.5s ease-in-out, background-color 0.3s ease;
}

/* Abilities Container Styles */
.abilities-container {
    display: flex;
    flex-direction: column; /* Stack abilities vertically */
    align-items: center;
    gap: 8px; /* Space between ability rows */
    margin-top: 5px; /* Space above abilities */
}

.ability {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px; /* Give abilities some base width */
}

/* Ability Button Styles */
.ability-button {
    padding: 5px 8px; /* Slightly smaller padding */
    font-size: 0.8em; /* Slightly smaller font */
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #4682B4; /* SteelBlue */
    background-color: #ADD8E6; /* LightBlue */
    color: #2a526e;
    border-radius: 5px;
    transition: background-color 0.2s, transform 0.1s;
    min-width: 90px; /* Ensure consistent width */
    white-space: nowrap; /* Prevent button text wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if text too long */
}

.ability-button:hover:not(:disabled) {
    background-color: #B0E0E6; /* PowderBlue */
}

.ability-button:active:not(:disabled) {
    transform: scale(0.95);
}

.ability-button:disabled {
    cursor: not-allowed;
    background-color: #cccccc;
    border-color: #999999;
    color: #666666;
    opacity: 0.7;
}

.cooldown-timer {
    font-size: 0.75em; /* Slightly smaller */
    color: #555;
    min-height: 1em; /* Reserve space */
    margin-top: 2px; /* Space above cooldown text */
}

#status {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 10px;
    text-align: center;
    min-height: 1.5em; /* Ensure space even when empty */
    max-width: 80%; /* Prevent status becoming too wide */
}

/* Replay Button */
#replay-button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #FFDF00; /* Yellow border */
    background-color: #FF4500; /* OrangeRed */
    color: #fff;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
    text-shadow: 1px 1px #000;
}

#replay-button:hover {
    background-color: #ff6347; /* Tomato */
}

#replay-button:active {
    transform: scale(0.97);
}

#replay-button.hidden {
    display: none;
}