/* ===== Help Simon beat the Machine ===== */
/* Simon, his thread and the bugs reuse the portfolio game's styles (game.css) */

.battle {
    background: var(--cream);
}

/* ----- Scoreboard ----- */
.battle-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 0.9rem 1.25rem;
    border-radius: 1rem;
    background: var(--sage);
    color: var(--off-white);
}

.battle-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.battle-score {
    min-width: 2ch;               /* stops the board jumping when 9 becomes 10 */
    font-family: var(--font-heading);
    font-size: 1.75rem;
    line-height: 1;
    color: var(--butter);
}

.battle-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9rem;
}

.battle-timer {
    font-weight: 600;
}

/* The last 5 seconds turn a warm red */
.battle-timer.is-ending {
    color: #F2A99A;
}

/* On small phones, stack each player's name above their score */
@media (max-width: 480px) {
    .battle-player {
        flex-direction: column;
        gap: 0.2rem;
        font-size: 0.85rem;
    }
}

/* ----- Play area ----- */
.battle-area {
    position: relative;
    height: 24rem;
    margin-top: 1rem;
    border-radius: 1.25rem;
    background: var(--bubble);
    overflow: hidden;
    text-align: left;
    touch-action: manipulation;   /* quicker taps on phones (no double-tap zoom) */
}

/* ----- The Machine's claw ----- */
.battle-claw {
    position: absolute;
    top: -44px;                   /* hiding above the play area */
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
    pointer-events: none;
}

.claw-cable {
    width: 3px;
    height: 0;                    /* battle.js lowers the claw by growing this */
    background: #8A9199;
}

.claw-body {
    fill: #8A9199;
    stroke: #5E656C;
    stroke-width: 1.5;
}

/* Its eye glows red, menacingly... */
.claw-eye {
    fill: #E0533D;
    animation: claw-glow 1s ease-in-out infinite alternate;
}

@keyframes claw-glow {
    from { opacity: 0.5; }
    to   { opacity: 1; }
}

.claw-arm {
    fill: none;
    stroke: #5E656C;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Snap! */
.battle-claw.is-grabbing .claw-head {
    animation: claw-snap 0.25s ease;
}

@keyframes claw-snap {
    50% { transform: scaleX(0.75); }
}

/* ----- Start, round and result screen ----- */
.battle-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(70, 79, 70, 0.88);   /* see-through sage */
    color: var(--off-white);
    text-align: center;
}

.battle-overlay[hidden] {
    display: none;
}

.battle-title {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    line-height: 1.2;
}

.battle-start {
    cursor: pointer;
    font: inherit;
}

/* Hide the button between rounds */
.battle-start[hidden] {
    display: none;
}