* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 30px;
}

h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.battle-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.character-info {
    flex: 1;
}

.character-info h2 {
    margin-bottom: 10px;
}

.character-portrait {
    width: 100%;
    max-width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #667eea;
    margin-bottom: 10px;
}

.hp-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
    position: relative;
}

.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
}

.hp-bar::after {
    content: attr(data-hp);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

form {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

button[name="attack"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    flex: 1;
}

button[name="attack"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

button[name="attack2"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    flex: 1;
}

button[name="attack2"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

button[name="attack3"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    flex: 1;
}

button[name="attack3"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}
button[name="attack4"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    flex: 1;
}
button[name="attack4"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

button[name="reset"] {
    background: #999;
    color: white;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.move-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.cooldown {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.combat-log {
    background: #1a1a1a;
    color: #0f0;
    padding: 15px;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    border: 2px solid #0f0;
    box-shadow: inset 0 0 10px rgba(0,255,0,0.1);
    display: flex;
    flex-direction: column-reverse;
}

.combat-log p {
    margin-bottom: 5px;
}

/* make older log entries faint and keep the newest entry bright */
.combat-log p {
    color: rgba(15, 255, 15, 0.89);
    transition: color 0.2s ease, opacity 0.2s ease;
}
.combat-log p.log-newest {
    color: #0f0;
    font-weight: 700;
    opacity: 1;
}
.combat-log p.log-old {
    opacity: 0.5;
}

.combat-log p:last-child {
    margin-bottom: 0;
}

.end-screen {
    text-align: center;
    padding: 50px;
}

.end-screen h2 {
    color: #333;
    margin-bottom: 20px;
}

.end-screen p {
    font-size: 18px;
    margin: 20px 0;
    color: #555;
}

.end-screen button {
    background: #667eea;
    color: white;
    padding: 15px 30px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

.end-screen button:hover {
    background: #5568d3;
}