/* ═══════════════════════════════════════════════════════════════════════════
   PENALES '98 — PS1 Edition — Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ── Reset ────────────────────────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: linear-gradient(180deg, #0a1628 0%, #0d1f12 40%, #0a1a0a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Press Start 2P', monospace;
    padding: 0;
}

/* ── CRT wrapper — fills all available space ──────────────────────────────── */
.crt-wrap {
    position: relative;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: flicker 6s infinite;
}

#c {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

/* ── CRT overlay effects ──────────────────────────────────────────────────── */
.crt-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

/* Scanlines */
.crt-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.12) 2px,
            rgba(0, 0, 0, 0.12) 4px);
}

/* Vignette */
.crt-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            transparent 60%,
            rgba(0, 0, 0, 0.5) 100%);
}

/* Screen flicker */
@keyframes flicker {

    0%,
    100% {
        opacity: 1
    }

    92% {
        opacity: 1
    }

    93% {
        opacity: 0.93
    }

    94% {
        opacity: 1
    }

    96% {
        opacity: 0.96
    }

    97% {
        opacity: 1
    }
}

/* RGB fringe */
.rgb-fringe {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9;
    mix-blend-mode: screen;
    background:
        linear-gradient(90deg, rgba(255, 0, 0, 0.025) 0%, transparent 3%),
        linear-gradient(270deg, rgba(0, 0, 255, 0.025) 0%, transparent 3%);
}

/* ── HUD below screen ─────────────────────────────────────────────────────── */
.hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px 0;
    color: #0f0;
    font-size: clamp(6px, 1.2vw, 10px);
    letter-spacing: 1px;
    gap: 4px;
    flex-shrink: 0;
}

.hud-box {
    background: rgba(0, 10, 0, 0.8);
    border: 1px solid #0f0;
    padding: 4px 10px;
    text-align: center;
    flex: 1;
    image-rendering: pixelated;
}

.hud-label {
    color: #060;
    font-size: 0.7em;
    margin-bottom: 2px;
}

.hud-val {
    color: #0f0;
}

.hud-val.red {
    color: #f00;
}

.hud-val.yel {
    color: #ff0;
}

.balls-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.bi {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #222;
    border: 1px solid #0f0;
    transition: all .2s;
}

.bi.gol {
    background: #0f0;
    box-shadow: 0 0 4px #0f0;
}

.bi.fallo {
    background: #f00;
    box-shadow: 0 0 4px #f00;
}

.bi.act {
    background: #ff0;
    box-shadow: 0 0 4px #ff0;
    animation: blink .4s infinite alternate;
}

@keyframes blink {
    to {
        opacity: .3
    }
}

/* ── Pixel button ──────────────────────────────────────────────────────────── */
.btn-shoot {
    width: 100%;
    padding: clamp(8px, 1.5vh, 14px);
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(8px, 1.8vw, 14px);
    background: rgba(0, 0, 0, 0.9);
    color: #ff0;
    border: 2px solid #ff0;
    cursor: pointer;
    letter-spacing: 2px;
    image-rendering: pixelated;
    transition: all .1s;
    box-shadow: 3px 3px 0 #aa0, inset 0 0 0 transparent;
    flex-shrink: 0;
}

.btn-shoot:hover:not(:disabled) {
    background: #ff0;
    color: #000;
    box-shadow: 2px 2px 0 #aa0;
    transform: translate(1px, 1px);
}

.btn-shoot:disabled {
    color: #444;
    border-color: #444;
    box-shadow: 3px 3px 0 #222;
    cursor: not-allowed;
}

/* ── Power bar ─────────────────────────────────────────────────────────────── */
.power-bar-wrap {
    width: 100%;
    height: 14px;
    background: rgba(0, 10, 0, 0.8);
    border: 1px solid #0f0;
    margin-top: 2px;
    position: relative;
    overflow: hidden;
    display: none;
    /* shown during power phase */
    flex-shrink: 0;
}

.power-bar-wrap.visible {
    display: block;
}

.power-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.05s linear;
}

/* Power bar gradient zones */
.power-bar-fill.low {
    background: #0f0;
}

.power-bar-fill.mid {
    background: #ff0;
}

.power-bar-fill.high {
    background: #f80;
}

.power-bar-fill.max {
    background: #f00;
}

.power-bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #060;
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    letter-spacing: 1px;
    pointer-events: none;
}

/* ── Mobile responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .hud {
        font-size: clamp(4px, 2.5vw, 8px);
        padding: 2px 4px 0;
    }

    .btn-shoot {
        font-size: clamp(7px, 3vw, 12px);
    }
}