body {
    background-color: #0b031b;
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    color: white;
}

/* ================== Main Menu ================== */
#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
}

.sandbox-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.sandbox-team {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    text-align: center;
}

.sandbox-team ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    min-height: 120px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

.sandbox-team li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.remove-btn {
    background-color: #e74c3c;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: bold;
}

.char-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
}

.add-btn {
    width: 100%;
    padding: 10px;
    background-color: #2ecc71;
    color: #0b031b;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.add-btn:hover { background-color: #27ae60; }

.start-btn {
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    background-color: #9b59b6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.5);
    transition: transform 0.2s, background-color 0.2s;
}

.start-btn:hover {
    background-color: #8e44ad;
    transform: scale(1.05);
}

.trials-btn {
    background-color: #e67e22;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.5);
}

.trials-btn:hover {
    background-color: #d35400;
}

/* ================== Battle UI ================== */
#fight-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 40px;
    padding: 20px;
    min-height: 300px;
    overflow-x: auto;
}

.team-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex: 1;
    max-width: 400px;
}

#player-container, #enemy-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: center;
}

.team-sp-wrapper {
    width: 100%;
    padding: 0 10px;
}

.team-sp-label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.team-sp-container {
    height: 22px;
}

.entity {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    width: 100px;
    transition: transform 0.2s, border-color 0.2s, opacity 0.3s;
}

.entity.dead {
    opacity: 0.3;
    filter: grayscale(100%);
}

.entity img {
    object-fit: contain;
}

.entity.targetable {
    border-color: #e74c3c;
    cursor: pointer;
    animation: pulseTarget 0.8s infinite alternate;
}

.entity.targetable:hover {
    transform: scale(1.08);
    border-color: #ff6b6b;
}

@keyframes pulseTarget {
    0% { box-shadow: 0 0 4px #e74c3c; }
    100% { box-shadow: 0 0 16px #e74c3c; }
}

.health-bar-container {
    position: relative;
    width: 100%;
    height: 18px;
    background-color: #333;
    border: 1px solid #fff;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.health-bar {
    width: 100%;
    height: 100%;
    background-color: #2ecc71;
    transition: width 0.3s ease;
}

.health-bar.boss-bar {
    background-color: #8e44ad !important;
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
}

/* ================= Indicators ================= */
.boost-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #f1c40f;
    color: #000;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.8);
    display: none;
    z-index: 5;
}

.boost-badge.active { display: block; }

.def-badge {
    position: absolute;
    top: -10px;
    right: 35px; 
    background: #3498db;
    color: #fff;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.8);
    display: none;
    z-index: 5;
}

.def-badge.active { display: block; }

.ls-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #e74c3c;
    color: #fff;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.8);
    display: none;
    z-index: 5;
}

.ls-badge.active { display: block; }

/* ================= Floating Popups ================= */
.boost-popup {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f1c40f;
    font-size: 22px;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 0 0 5px #000, 0 0 10px #f39c12;
    animation: floatUpBoost 0.9s forwards ease-out;
    z-index: 10;
}

@keyframes floatUpBoost {
    0% { opacity: 0; transform: translate(-50%, 10px) scale(0.6); }
    30% { opacity: 1; transform: translate(-50%, -15px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -45px) scale(1); }
}

.heal-heart-popup {
    position: absolute;
    top: 25%;
    left: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 4px #000;
    pointer-events: none;
    z-index: 20;
    animation: healFloatFade 1.1s forwards ease-out;
}

.heal-heart-popup::before {
    content: '❤️';
    font-size: 38px;
    position: absolute;
    z-index: -1;
    filter: drop-shadow(0 0 8px rgba(46, 204, 113, 0.6));
}

@keyframes healFloatFade {
    0% { opacity: 0; transform: translate(-50%, 15px) scale(0.6); }
    30% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(0.85); }
}

.damage-star-popup {
    position: absolute;
    top: 25%;
    left: 50%;
    width: 52px;
    height: 52px;
    background: radial-gradient(circle, #ff4d4d 0%, #b31212 100%);
    clip-path: polygon(
        50% 0%, 61% 35%, 85% 15%, 75% 42%, 
        100% 50%, 75% 58%, 85% 85%, 61% 65%, 
        50% 100%, 39% 65%, 15% 85%, 25% 58%, 
        0% 50%, 25% 42%, 15% 15%, 39% 35%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 15px;
    text-shadow: 1px 1px 3px #000;
    pointer-events: none;
    z-index: 20;
    animation: damageFallFade 0.9s forwards ease-in;
}

@keyframes damageFallFade {
    0% { opacity: 1; transform: translate(-50%, -20px) scale(1.1); }
    30% { opacity: 1; transform: translate(-50%, -5px) scale(1.25); }
    100% { opacity: 0; transform: translate(-50%, 45px) scale(0.75); }
}

.defense-star-popup {
    position: absolute;
    top: 25%;
    left: 50%;
    width: 52px;
    height: 52px;
    background: radial-gradient(circle, #3498db 0%, #1a5276 100%);
    clip-path: polygon(
        50% 0%, 61% 35%, 85% 15%, 75% 42%, 
        100% 50%, 75% 58%, 85% 85%, 61% 65%, 
        50% 100%, 39% 65%, 15% 85%, 25% 58%, 
        0% 50%, 25% 42%, 15% 15%, 39% 35%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 3px #000;
    pointer-events: none;
    z-index: 20;
    animation: defenseFloatFade 0.9s forwards ease-out;
}

@keyframes defenseFloatFade {
    0% { opacity: 0; transform: translate(-50%, 15px) scale(0.6); }
    30% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(0.85); }
}

/* Battle Log & Menu */
#battle-log {
    text-align: center;
    height: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 15px 0;
}

#action-menu {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.move-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    background-color: #333;
    color: white;
    border: 2px solid #2ecc71;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.move-btn:hover {
    background-color: #2ecc71;
    color: #0b031b;
}

.move-btn.cancel-btn { border-color: #e74c3c; }
.move-btn.cancel-btn:hover { background-color: #e74c3c; color: white; }
.move-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Add this anywhere in your style.css file */
.burn-badge {
    position: absolute;
    top: -10px;
    right: 15px; 
    background: #d35400;
    color: #fff;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(211, 84, 0, 0.8);
    display: none;
    z-index: 5;
}

.burn-badge.active { display: block; }

/* ================= Animations ================= */
@keyframes tackle-right {
    0% { transform: translateX(0); }
    50% { transform: translateX(80px); }
    100% { transform: translateX(0); }
}

@keyframes tackle-left {
    0% { transform: translateX(0); }
    50% { transform: translateX(-80px); }
    100% { transform: translateX(0); }
}

@keyframes boost-glow {
    0% { filter: drop-shadow(0 0 0px gold); transform: scale(1); }
    50% { filter: drop-shadow(0 0 15px gold); transform: scale(1.1); }
    100% { filter: drop-shadow(0 0 0px gold); transform: scale(1); }
}

/* Dizzy Effect Animation */
.entity.dizzy img {
    animation: dizzy-wobble 0.8s infinite alternate ease-in-out;
    filter: blur(1px) hue-rotate(30deg);
}

@keyframes dizzy-wobble {
    0% { transform: rotate(-15deg) translateX(-5px); }
    100% { transform: rotate(15deg) translateX(5px); }
}

.anim-attack-right { animation: tackle-right 0.4s ease-in-out; }
.anim-attack-left { animation: tackle-left 0.4s ease-in-out; }
.anim-boost { animation: boost-glow 0.8s ease-in-out; }