/* ========================================
   BATTLE - Scene, Sprites, HUD, Dialog, Menus
   ======================================== */

/* --- BATTLE SCENE --- */
.scene {
    height: 200px;
    position: relative;
    background: linear-gradient(to bottom, #f8f8f8 0%, #e0e0e0 100%);
    transform-origin: center center;
}

.sprite {
    position: absolute;
    image-rendering: pixelated;
    z-index: 5;
    transition: opacity 0.2s, transform 0.4s, filter 0.4s;
}

#enemy-sprite {
    width: 112px;
    height: 112px;
    top: 5px;
    right: 20px;
}

#player-sprite {
    width: 224px;
    height: 224px;
    bottom: -40px;
    left: -30px;
    transform-origin: bottom center;
}

/* --- HUD SYSTEM --- */
.hud {
    position: absolute;
    background: white;
    border: 2px solid var(--ui-border);
    border-radius: 2px;
    padding: 4px;
    width: 135px;
    z-index: 10;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#enemy-hud {
    top: 10px;
    left: 10px;
    transform: translateX(-250px);
}

#player-hud {
    bottom: 25px;
    right: 10px;
    transform: translateX(250px);
}

#enemy-hud.hud-active,
#player-hud.hud-active {
    transform: translateX(0);
}

.name {
    font-size: 10px;
    margin-bottom: 4px;
    text-transform: uppercase;
    display: block;
    white-space: normal;
    line-height: 14px;
    overflow: visible;
}

.level {
    font-size: 10px;
    float: right;
}

.hp-box {
    display: flex;
    align-items: center;
    font-size: 8px;
    font-weight: bold;
}

.hp-bar-bg {
    width: 90px;
    height: 6px;
    background: #f0f0f0;
    border: 1px solid #000;
    border-radius: 2px;
    position: relative;
}

.hp-fill {
    height: 100%;
    background-color: var(--hp-green);
    width: 100%;
    transition: width 0.5s ease;
    border-right: 1px solid black;
}

#player-hp-text {
    font-size: 10px;
    text-align: right;
    margin-top: 4px;
    letter-spacing: 1px;
}

.exp-box {
    display: flex;
    align-items: center;
    margin-top: 2px;
    justify-content: flex-end;
}

.exp-bar-bg {
    width: 80px;
    height: 2px;
    background: #ccc;
    border: 1px solid #444;
    border-radius: 2px;
    margin-left: 4px;
}

.exp-fill {
    height: 100%;
    width: 0%;
    background: var(--xp-blue);
    transition: width 0.5s ease;
}

.aggro-icon {
    font-size: 10px;
    margin-left: 4px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #fff;
    flex-shrink: 0;
    display: inline-block;
}

.aggro-1 {
    color: #d8b030;
}

.aggro-2 {
    color: #c86028;
}

.aggro-3 {
    color: #c83828;
    animation: pulseAggro 0.5s infinite;
}

@keyframes pulseAggro {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

#streak-box {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    border: 2px solid #202020;
    padding: 4px 6px;
    font-size: 8px;
    z-index: 50;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
    color: black;
}

/* --- PARTICLES --- */
.smoke-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 0px solid #000;
    border-radius: 50%;
    pointer-events: none;
    z-index: 25;
    opacity: 1;
    box-shadow: inset -0px -0px 0 #ccc;
    animation: smokePop 0.4s ease-out forwards;
}

@keyframes smokePop {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(1.5);
        opacity: 0;
    }
}

/* --- DIALOG BOX --- */
#dialog-box {
    height: 88px;
    background-color: #282828;
    color: white;
    border-top: 4px solid #a0a0a0;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 20;
}

#text-content {
    width: 60%;
    font-size: 11px;
    line-height: 18px;
    text-transform: uppercase;
    white-space: pre-wrap;
}

#text-content.full-width {
    width: 100%;
}

/* Menu Variant for Dialog Box */
#dialog-box.menu-style {
    background: white;
    color: black;
    border-top: 4px solid #222;
}

#dialog-box.menu-style #text-content {
    color: black;
}

#dialog-box.menu-style #advance-arrow {
    border-top-color: black;
}

/* --- ACTION MENU --- */
#action-menu {
    width: 45%;
    background: white;
    color: black;
    border-left: 4px solid #a0a0a0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 5px;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    box-sizing: border-box;
    cursor: pointer;
    z-index: 20;
}

.menu-item {
    font-size: 10px;
    display: flex;
    align-items: center;
    padding-left: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.menu-item::before {
    content: "▸";
    opacity: 0;
    margin-right: 2px;
}

.menu-item.centered {
    justify-content: center;
    padding-left: 0;
}

/* --- MOVE MENU --- */
#move-menu {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    position: absolute;
    background: white;
    z-index: 25;
    display: flex;
}

#move-info {
    width: 35%;
    background: #282828;
    color: white;
    padding: 8px;
    font-size: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    border-right: 2px solid #a0a0a0;
    box-sizing: border-box;
}

#move-grid {
    width: 65%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 1fr;
    gap: 2px;
    padding: 4px;
    box-sizing: border-box;
}

.move-btn {
    background: #fff;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    cursor: pointer;
    text-transform: uppercase;
    text-align: center;
    padding: 2px;
    color: #000;
}

.move-btn.cancel {
    grid-column: span 2;
    border-color: #a0a0a0;
    background: #f0f0f0;
    color: #444;
    font-weight: bold;
}

/* --- SUBSTITUTE --- */
.sub-back {
    transform: scaleX(-1);
}

/* --- POKÉBALL ANIMATIONS --- */
.pokeball-anim {
    position: absolute;
    bottom: 40px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 35% 35%, white 10%, red 11%, red 50%, black 51%, black 60%, white 61%);
    border-radius: 50%;
    border: 1px solid black;
    z-index: 50;
}

.pokeball-anim.great {
    background: radial-gradient(circle at 35% 35%, white 10%, #3b82c4 11%, #3b82c4 50%, black 51%, black 60%, white 61%);
}

.pokeball-anim.ultra {
    background: radial-gradient(circle at 35% 35%, white 10%, #333 11%, #333 50%, gold 51%, gold 60%, white 61%);
}

.pokeball-anim.master {
    background: radial-gradient(circle at 35% 35%, white 10%, #7e30cc 11%, #7e30cc 50%, pink 51%, pink 60%, white 61%);
}

.pokeball-caught {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 35% 35%, white 10%, #555 11%, #555 50%, black 51%, black 60%, white 61%);
    border-radius: 50%;
    border: 1px solid black;
    z-index: 40;
    filter: grayscale(1);
}

/* --- TRANSFORMED SPRITE --- */
.transformed-sprite {
    filter: grayscale(0.4) brightness(0.9) contrast(1.1) sepia(0.2) hue-rotate(240deg) !important;
}

/* --- SHINY SPARKLE --- */
.shiny-star {
    position: absolute;
    width: 10px;
    height: 10px;
    background: transparent;
    pointer-events: none;
    z-index: 20;
}

.shiny-star::before {
    content: "✦";
    color: gold;
    font-size: 16px;
    position: absolute;
}

/* --- BOSS VISUALS --- */

.boss-name-tag {
    color: #ff4444;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}

.lucky-name-tag {
    color: #4facfe;
    /* Blue */
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}