/* style.css */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #07070d;
    color: #fff;
    font-family: "Trebuchet MS", Arial, sans-serif;
    overflow-x: hidden;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 18px;
    image-rendering: pixelated;
    background:
        radial-gradient(circle at top, rgba(108, 35, 168, 0.32), transparent 38%),
        linear-gradient(180deg, rgba(17, 17, 34, 0.62) 0%, rgba(7, 7, 13, 0.82) 58%, rgba(2, 2, 5, 0.94) 100%),
        url("backgrounds/fight-bg.png") center center / cover fixed no-repeat,
        #07070d;
}

.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.035),
        rgba(255, 255, 255, 0.035) 1px,
        transparent 1px,
        transparent 4px
    );
    mix-blend-mode: screen;
}

.fight-cabinet {
    width: min(1120px, 100%);
    min-height: 680px;
    border: 5px solid #1f1f38;
    border-radius: 18px;
    background: rgba(16, 16, 28, 0.92);
    box-shadow:
        0 0 0 5px #050508,
        0 0 45px rgba(255, 38, 191, 0.25),
        inset 0 0 70px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    position: relative;
}

.fight-hud {
    display: grid;
    grid-template-columns: 1fr 130px 1fr;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(180deg, #24243d, #10101c);
    border-bottom: 4px solid #050508;
}

.fighter-name {
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 6px;
}

.fighter-right .fighter-name {
    text-align: right;
}

.health-frame {
    height: 30px;
    padding: 4px;
    background: #050508;
    border: 3px solid #fff0a0;
    box-shadow: inset 0 0 0 3px #6b3f00;
}

.health-fill {
    width: 100%;
    height: 100%;
    transition: width 0.18s steps(4, end);
}

.health-p1 {
    background: linear-gradient(90deg, #19e45f, #e7ff43);
}

.health-p2 {
    margin-left: auto;
    background: linear-gradient(90deg, #ff3131, #ffb331);
}

.round-box {
    text-align: center;
    background: #07070d;
    border: 3px solid #fff0a0;
    border-radius: 10px;
    padding: 7px 4px;
    box-shadow: inset 0 0 18px rgba(255, 220, 60, 0.2);
}

.round-label {
    font-size: 13px;
    color: #ffdd55;
}

.round-number {
    font-size: 32px;
    line-height: 1;
    text-shadow: 3px 3px 0 #000;
}

.arena {
    min-height: 480px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(13, 13, 34, 0.12), rgba(7, 7, 13, 0.42)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 4px, transparent 4px 48px),
        rgba(8, 8, 14, 0.48);
}

.arena::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.035) 1px,
            transparent 1px,
            transparent 5px
        ),
        radial-gradient(circle at center, transparent 35%, rgba(0, 0, 0, 0.38) 100%);
}

.pixel-floor {
    display: none;
}

.portrait-zone {
    position: relative;
    z-index: 2;
    width: min(540px, calc(100% - 320px));
    text-align: center;
}

.image-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #050508;
    border: 5px solid #fff0a0;
    box-shadow:
        0 0 0 5px #3c2200,
        0 18px 0 rgba(0, 0, 0, 0.3),
        0 0 38px rgba(255, 50, 190, 0.28);
    overflow: hidden;
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: pixelated;
}

.empty-art {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffdd55;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 4px 4px 0 #000;
    background: repeating-linear-gradient(45deg, #151529 0 20px, #10101c 20px 40px);
}

.image-frame img[src]:not([src=""]) + .empty-art {
    display: none;
}

.event-name {
    margin-top: 18px;
    font-size: clamp(28px, 6vw, 54px);
    font-weight: 900;
    color: #ffdd55;
    letter-spacing: 2px;
    text-shadow: 4px 4px 0 #000, 0 0 18px rgba(255, 221, 85, 0.35);
    text-transform: uppercase;
}

.status-text {
    min-height: 24px;
    margin-top: 8px;
    font-size: 18px;
    color: #b8d8ff;
    text-shadow: 2px 2px 0 #000;
}

.score-panel {
    position: absolute;
    z-index: 7;
    left: 20px;
    top: 20px;
    width: 175px;
    padding: 12px;
    background: #050508;
    border: 4px solid #34c7ff;
    box-shadow:
        0 0 0 4px #061b5c,
        0 0 22px rgba(52, 199, 255, 0.45),
        inset 0 0 18px rgba(52, 199, 255, 0.18);
    text-align: center;
}

.score-title,
.highscore-title,
.name-entry-title {
    color: #ffdd55;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 3px 3px 0 #000;
}

.score-value {
    margin-top: 6px;
    color: #fff;
    font-size: 34px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 4px 4px 0 #000, 0 0 14px rgba(255, 255, 255, 0.25);
}

.score-small {
    margin-top: 8px;
    color: #b8d8ff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 #000;
}

.highscore-panel {
    position: absolute;
    z-index: 7;
    right: 20px;
    top: 165px;
    width: 230px;
    min-height: 255px;
    padding: 12px;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 6px),
        #050508;
    border: 4px solid #ffdd55;
    box-shadow:
        0 0 0 4px #3c2200,
        0 0 25px rgba(255, 221, 85, 0.35),
        inset 0 0 22px rgba(255, 221, 85, 0.14);
}

.highscore-list {
    margin: 12px 0 0;
    padding-left: 25px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.55;
    text-shadow: 2px 2px 0 #000;
}

.highscore-list li {
    padding: 2px 0;
    border-bottom: 1px dashed rgba(255, 221, 85, 0.22);
}

.highscore-list span {
    color: #34c7ff;
}

.name-entry {
    position: absolute;
    z-index: 14;
    left: 50%;
    top: 50%;
    width: min(360px, calc(100% - 32px));
    transform: translate(-50%, -50%);
    padding: 18px;
    text-align: center;
    background: #050508;
    border: 5px solid #ff3131;
    box-shadow:
        0 0 0 5px #350000,
        0 0 35px rgba(255, 49, 49, 0.65),
        inset 0 0 24px rgba(255, 49, 49, 0.18);
}

.name-entry-score {
    margin-top: 10px;
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 3px 3px 0 #000;
}

.name-input {
    width: 100%;
    margin-top: 14px;
    padding: 13px 12px;
    color: #ffdd55;
    background: #10101c;
    border: 4px solid #fff0a0;
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    outline: none;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.65);
}

.save-score-button {
    width: 100%;
    margin-top: 14px;
    background: linear-gradient(180deg, #19e45f, #087e32);
    box-shadow: 0 7px 0 #03431a, 0 0 18px rgba(25, 228, 95, 0.25);
}

.prompt-box {
    position: absolute;
    z-index: 8;
    right: 34px;
    top: 18px;
    transform: none;
    width: 205px;
    min-width: 0;
    padding: 9px 14px;
    text-align: center;
    background: #050508;
    border: 5px solid #ff3131;
    box-shadow: 0 0 25px rgba(255, 49, 49, 0.7), inset 0 0 18px rgba(255, 49, 49, 0.3);
    animation: promptPop 0.18s steps(2, end) infinite alternate;
    transition: left 0.42s steps(5, end), top 0.42s steps(5, end);
}

.prompt-box.is-floating {
    box-shadow:
        0 0 30px rgba(255, 49, 49, 0.85),
        0 0 8px rgba(255, 221, 85, 0.8),
        inset 0 0 18px rgba(255, 49, 49, 0.3);
    animation: promptPop 0.14s steps(2, end) infinite alternate;
}

.prompt-small {
    color: #ffdd55;
    font-size: 13px;
    letter-spacing: 2px;
}

.prompt-key {
    font-size: 40px;
    line-height: 0.95;
    font-weight: 900;
    text-shadow: 4px 4px 0 #000;
}

.hidden {
    display: none;
}

.controls-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px;
    background: #090910;
    border-top: 4px solid #050508;
}

.arcade-button {
    cursor: pointer;
    border: 0;
    border-radius: 12px;
    padding: 14px 24px;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 3px 3px 0 #000;
    box-shadow: 0 7px 0 #350000, 0 0 18px rgba(255, 49, 49, 0.25);
    transform: translateY(0);
}

.arcade-button:active,
.arcade-button.pressed {
    transform: translateY(5px);
    box-shadow: 0 2px 0 #350000, 0 0 18px rgba(255, 49, 49, 0.25);
}

.start-button {
    background: linear-gradient(180deg, #34c7ff, #1452d9);
    box-shadow: 0 7px 0 #061b5c, 0 0 18px rgba(52, 199, 255, 0.25);
}

.action-button {
    min-width: 150px;
    background: linear-gradient(180deg, #ff5b5b, #c40000);
}

.action-button:disabled {
    opacity: 0.65;
}


.keyboard-help {
    color: #b8d8ff;
    font-size: 15px;
}

.flash-hit {
    animation: flashHit 0.16s steps(2, end) 2;
}

.shake {
    animation: shake 0.18s linear 1;
}

@keyframes promptPop {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

@keyframes flashHit {
    from { filter: brightness(2) contrast(1.5); }
    to { filter: brightness(1) contrast(1); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@media (max-width: 720px) {
    body {
        padding: 8px;
        align-items: flex-start;
    }

    .fight-cabinet {
        min-height: 100vh;
        border-radius: 10px;
    }

    .fight-hud {
        grid-template-columns: 1fr 78px 1fr;
        gap: 8px;
        padding: 10px;
    }

    .fighter-name {
        font-size: 13px;
    }

    .health-frame {
        height: 22px;
        border-width: 2px;
    }

    .round-number {
        font-size: 24px;
    }

    .arena {
        min-height: 430px;
    }

    .event-name {
        margin-top: 14px;
    }

    .portrait-zone {
        width: min(540px, calc(100% - 28px));
    }

    .score-panel {
        left: 10px;
        top: 10px;
        width: 125px;
        padding: 8px;
    }

    .score-title,
    .highscore-title,
    .name-entry-title {
        font-size: 12px;
    }

    .score-value {
        font-size: 24px;
    }

    .score-small {
        font-size: 11px;
    }

    .highscore-panel {
        display: none;
    }

    .prompt-box {
        top: 12px;
        right: 12px;
        width: 120px;
        min-width: 0;
        padding: 7px 10px;
    }

    .prompt-key {
        font-size: 42px;
    }

    .prompt-small {
        font-size: 12px;
    }

    .controls-panel {
        padding: 14px 10px;
    }

    .arcade-button {
        width: 140px;
        padding: 15px 10px;
    }

}
