/* =========================================================
   STICKMAN: THE TYPING FIGHTER
   GAME SCREEN
   ========================================================= */

.game-screen {
    position: relative;

    min-height: 100vh;
    min-height: 100dvh;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 45%,
            #292c30 0%,
            #1b1e21 50%,
            #0d0f11 100%
        );

    color: var(--white);
}


/* =========================================================
   GAME HEADER
   ========================================================= */

.game-header {
    position: absolute;

    top: 30px;
    left: 50%;
    width: min(76vw, 1450px);
    transform: translateX(-50%);

    height: 75px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;

    align-items: center;

    gap: 40px;

    z-index: 10;
}


/* PLAYER / ENEMY INFO */

.game-player-info,
.game-enemy-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-enemy-info {
    align-items: flex-end;
}


/* LABEL */

.game-label {
    font-size: 10px;
    font-weight: 800;

    letter-spacing: 3px;

    color:
        rgba(255, 255, 255, 0.55);
}


/* =========================================================
   HP BAR
   ========================================================= */

.hp-bar {
    position: relative;

    width: 100%;
    max-width: 390px;

    height: 18px;

    padding: 2px;

    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 6px;

    background:
        linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0.58));

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        inset 0 -2px 5px rgba(0,0,0,0.48),
        0 4px 14px rgba(0,0,0,0.20);

    overflow: hidden;
}

.hp-fill {
    width: 100%;
    height: 100%;

    border-radius: 3px;
    position: relative;

    transition:
        width 220ms ease;
}

 .player-hp .hp-fill {
    background: linear-gradient(180deg, #43b9ff 0%, #138ee8 55%, #0875c9 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.35),
        0 0 10px rgba(30, 157, 255, 0.22);
}

.enemy-hp .hp-fill {
    background: linear-gradient(180deg, #ff526d 0%, #ed2948 55%, #c91535 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.30),
        0 0 10px rgba(255, 45, 78, 0.20);
}


/* =========================================================
   CENTER GAME INFO
   ========================================================= */

.game-center-info {
    min-width: 130px;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 6px;
}

.game-difficulty-label {
    font-size: 11px;
    font-weight: 900;

    letter-spacing: 3px;

    color:
        rgba(255, 255, 255, 0.65);
}

.game-timer {
    font-size: 18px;
    font-weight: 800;

    font-variant-numeric: tabular-nums;

    letter-spacing: 2px;

    color: #ffffff;
}


/* =========================================================
   FIGHTING ARENA
   ========================================================= */

.fight-arena {
    position: absolute;

    top: 130px;
    left: 50%;
    transform: translateX(-50%);

    /* Background image ratio: 2048 × 724 = 2.83 : 1 */
    width: min(76vw, 1450px);
    aspect-ratio: 2.83 / 1;

    border:
        1px solid rgba(255, 255, 255, 0.30);

    border-radius: 6px;

    background:
        url("../assets/images/arena-bg.png") center center / cover no-repeat;

    overflow: hidden;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35);

    z-index: 3;
}


/* =========================================================
   ARENA LIGHTING OVERLAY
   ========================================================= */

.fight-arena::before {
    content: "";

    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.06) 0%,
            rgba(0, 0, 0, 0.02) 55%,
            rgba(0, 0, 0, 0.14) 100%
        );

    pointer-events: none;
    z-index: 1;
}


/* =========================================================
   ARENA FLOOR
   The uploaded background already contains the floor.
   ========================================================= */

.arena-floor {
    display: none;
}


/* =========================================================
   FIGHT ANIMATION CANVAS
   ========================================================= */

.fight-arena .stickman-animation-canvas {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    display: block;
    pointer-events: none;
    z-index: 5;
}


/* =========================================================
   STICKMAN BASE
   ========================================================= */

.stickman {
    position: absolute;

    bottom: calc(12% + 3px);

    width: 150px;
    height: 250px;

    z-index: 4;

    transform-origin:
        50% 100%;
}


/* PLAYER POSITION */

.player-stickman {
    left: 15%;
}


/* ENEMY POSITION */

.enemy-stickman {
    right: 15%;
}


/* =========================================================
   STICKMAN HEAD
   ========================================================= */

.stick-head {
    position: absolute;

    top: 0;
    left: 50%;

    width: 58px;
    height: 58px;

    transform:
        translateX(-50%);

    border-radius: 50%;

    background: #f5f5f5;

    box-shadow:
        0 5px 10px rgba(0,0,0,0.18);
}


/* ENEMY HEAD */

.enemy-stickman .stick-head {
    background: #080909;
}


/* =========================================================
   STICKMAN BODY
   ========================================================= */

.stick-body {
    position: absolute;

    top: 57px;
    left: 50%;

    width: 11px;
    height: 105px;

    transform:
        translateX(-50%);

    border-radius: 10px;

    background: #f5f5f5;
}

.enemy-stickman .stick-body {
    background: #080909;
}


/* =========================================================
   ARMS
   ========================================================= */

.stick-arm {
    position: absolute;

    top: 68px;

    width: 10px;
    height: 90px;

    border-radius: 10px;

    background: #f5f5f5;

    transform-origin:
        50% 0;
}

.enemy-stickman .stick-arm {
    background: #080909;
}


/* PLAYER ARMS */

.player-stickman .stick-arm-left {
    left: 45px;

    transform:
        rotate(35deg);
}

.player-stickman .stick-arm-right {
    right: 45px;

    transform:
        rotate(-48deg);
}


/* ENEMY ARMS */

.enemy-stickman .stick-arm-left {
    left: 45px;

    transform:
        rotate(48deg);
}

.enemy-stickman .stick-arm-right {
    right: 45px;

    transform:
        rotate(-35deg);
}


/* =========================================================
   LEGS
   ========================================================= */

.stick-leg {
    position: absolute;

    top: 150px;

    width: 11px;
    height: 105px;

    border-radius: 10px;

    background: #f5f5f5;

    transform-origin:
        50% 0;
}

.enemy-stickman .stick-leg {
    background: #080909;
}


/* PLAYER LEGS */

.player-stickman .stick-leg-left {
    left: 66px;

    transform:
        rotate(28deg);
}

.player-stickman .stick-leg-right {
    left: 70px;

    transform:
        rotate(-25deg);
}


/* ENEMY LEGS */

.enemy-stickman .stick-leg-left {
    left: 66px;

    transform:
        rotate(25deg);
}

.enemy-stickman .stick-leg-right {
    left: 70px;

    transform:
        rotate(-28deg);
}


/* =========================================================
   TYPING SECTION
   ========================================================= */

.typing-section {
    position: absolute;

    left: 50%;
    right: auto;
    width: min(76vw, 1380px);
    transform: translateX(-50%);

    bottom: 132px;

    z-index: 10;
}


/* =========================================================
   TYPING STATS
   ========================================================= */

.typing-stats {
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 35px;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 2px;

    color:
        rgba(255, 255, 255, 0.48);
}

.typing-stats strong {
    color: #ffffff;
}


/* =========================================================
   TYPING DISPLAY
   ========================================================= */

.typing-display {
    width: 100%;
    min-height: 76px;

    display: block;
    position: relative;
    overflow: hidden;

    padding: 15px 30px;

    border:
        1px solid rgba(255, 255, 255, 0.24);

    border-radius: 5px;

    background:
        rgba(0, 0, 0, 0.35);

    font-size: 22px;
    font-weight: 700;

    letter-spacing: 2px;

    text-align: center;

    color: #ffffff;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.22);
}

.typing-placeholder {
    color:
        rgba(255, 255, 255, 0.35);

    font-size: 14px;
    font-weight: 500;

    letter-spacing: 2px;
}


/* =========================================================
   SENTENCE TYPING TRACK
   Full sentence stays intact; the track shifts left as
   the current character advances.
   ========================================================= */

.typing-track {
    position: absolute;
    left: 0;
    top: 50%;

    width: max-content;
    min-width: 100%;

    white-space: pre;
    text-align: left;

    transform: translate3d(0, -50%, 0);
    will-change: transform;

    transition: transform 90ms ease-out;
}


.typing-track span {
    white-space: pre;
}


/* =========================================================
   HP NUMERIC VALUES
   ========================================================= */

.hp-value {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 3;

    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.5px;
    line-height: 1;

    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.85),
        0 0 5px rgba(0, 0, 0, 0.45);

    pointer-events: none;
}


/* =========================================================
   HIDDEN INPUT
   ========================================================= */

.typing-input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}


/* =========================================================
   GAME CONTROLS
   ========================================================= */

.game-controls {
    position: absolute;

    left: 50%;
    right: auto;
    width: min(76vw, 1380px);
    transform: translateX(-50%);

    bottom: 74px;

    display: flex;
    justify-content: flex-end;

    gap: 10px;

    z-index: 15;
}

.game-control-button {
    min-width: 85px;
    height: 34px;

    padding: 0 15px;

    border:
        1px solid rgba(255, 255, 255, 0.30);

    border-radius: 4px;

    background:
        rgba(0, 0, 0, 0.20);

    color:
        rgba(255, 255, 255, 0.70);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 2px;

    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}

.game-control-button:hover {
    transform:
        translateY(-2px);

    background:
        rgba(255, 255, 255, 0.08);

    border-color:
        rgba(255, 255, 255, 0.70);

    color:
        #ffffff;
}

.game-control-button:active {
    transform:
        translateY(1px)
        scale(0.98);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .game-header {
        left: 50%;
        right: auto;
        width: 88vw;
        transform: translateX(-50%);

        gap: 20px;
    }

    .fight-arena {
        width: 88vw;
        aspect-ratio: 2.83 / 1;
    }

    .typing-section {
        width: 88vw;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .stickman {
        transform: scale(0.85);
        transform-origin: bottom center;
    }
}


@media (max-width: 650px) {

    .game-header {
        top: 18px;

        left: 50%;
        width: 94vw;
        transform: translateX(-50%);

        height: 65px;

        grid-template-columns:
            1fr auto 1fr;

        gap: 10px;
    }

    .hp-bar {
        height: 12px;
    }

    .game-label {
        font-size: 8px;
    }

    .game-timer {
        font-size: 14px;
    }

    .fight-arena {
        top: 100px;
        width: 94vw;
        aspect-ratio: 2.83 / 1;
    }

    .player-stickman {
        left: 5%;
    }

    .enemy-stickman {
        right: 5%;
    }

    .typing-section {
        bottom: 82px;
        width: 94vw;
    }

    .typing-display {
        min-height: 60px;

        font-size: 16px;
    }

    .typing-stats {
        gap: 12px;

        font-size: 8px;
    }

    .game-controls {
        width: 94vw;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: 32px;
    }
}
/* =========================================================
   TYPING CHARACTER STATES
   ========================================================= */

.typed-correct {
    color: #ffffff;
    opacity: 1;
}

.untyped-character {
    color: rgba(255, 255, 255, 0.32);
}

.current-character {
    position: relative;

    color: rgba(255, 255, 255, 0.32);

    text-shadow: none;
}


/* =========================================================
   CURRENT CHARACTER INDICATOR
   ========================================================= */

.current-character::after {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    bottom: -7px;

    height: 2px;

    background: #ffffff;

    border-radius: 2px;
}


/* =========================================================
   WRONG INPUT FEEDBACK
   ========================================================= */

.typing-display.typing-mistake {
    border-color:
        rgba(255, 90, 70, 0.85);

    box-shadow:
        0 0 20px rgba(255, 70, 50, 0.18);

    animation:
        typing-shake 120ms ease-in-out;
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes typing-shake {

    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-3px);
    }

    100% {
        transform: translateX(0);
    }

}
/* =========================================================
   COMBAT EFFECTS
   ========================================================= */

.effect-layer {
    position: absolute;

    inset: 0;

    z-index: 20;

    pointer-events: none;

    overflow: hidden;
}


/* =========================================================
   IMPACT FLASH
   ========================================================= */

.impact-flash {
    position: absolute;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.55) 25%,
            rgba(255, 255, 255, 0.12) 55%,
            transparent 72%
        );

    pointer-events: none;
}


/* =========================================================
   HIT PARTICLES
   ========================================================= */

.hit-particle {
    position: absolute;

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background:
        #ffffff;

    box-shadow:
        0 0 8px rgba(255, 255, 255, 0.65);

    pointer-events: none;
}
/* =========================================================
   CANVAS ANIMATION MODE
   Hide old DOM stickmen.
   Canvas renderer draws the actual fighters.
   ========================================================= */

#player-stickman,
#enemy-stickman {
    opacity: 0 !important;
    pointer-events: none !important;
}