/* ════════════════════════════════════════
   SHADOW STRIKE - Estilos góticos
   ════════════════════════════════════════ */

:root {
    --strike-bg:       #0a0a12;
    --strike-card:     #12121e;
    --strike-card2:    #1a1a2e;
    --strike-accent:   #cc4444;
    --strike-accent2:  #8844aa;
    --strike-text:     #eef3ff;
    --strike-muted:    #667788;
    --strike-blood:    #8a1a1a;
    --strike-gold:     #c9a84c;
    --radius:          16px;
    --shadow:          0 8px 32px rgba(0,0,0,0.6);
}

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

body {
    font-family: 'Outfit', 'Segoe UI', sans-serif;
    background: var(--strike-bg);
    color: var(--strike-text);
    overflow: hidden;
    user-select: none;
}

/* ── Screens ── */
.screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.screen.hidden { display: none !important; }

/* ── Overlay (pause/gameover) ── */
.overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(5, 5, 15, 0.92);
    display: flex; align-items: center; justify-content: center;
}

/* ════════════════════════════════════════
   START SCREEN
   ════════════════════════════════════════ */
#startScreen {
    background: radial-gradient(ellipse at 50% 0%, #1a0a2a 0%, #0a0a12 70%);
    overflow-y: auto;
    padding: 20px;
}

.start-panel {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 10px 0;
}

.game-logo {
    text-align: center;
    padding: 10px 0 0;
}

.logo-img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 0 20px rgba(136, 68, 170, 0.3));
}

/* ── Section cards ── */
.section-card {
    background: var(--strike-card);
    border-radius: var(--radius);
    padding: 18px 22px;
    border: 1px solid rgba(136, 68, 170, 0.12);
    box-shadow: var(--shadow);
}

.section-card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--strike-gold);
    margin-bottom: 14px;
}

/* ── Difficulty buttons ── */
.diff-row {
    display: flex;
    gap: 10px;
}

.diff-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--strike-card2);
    color: var(--strike-text);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.diff-btn:hover { border-color: var(--strike-muted); }
.diff-btn.selected.easy   { border-color: #2ecc71; background: rgba(46,204,113,0.12); color: #2ecc71; }
.diff-btn.selected.normal { border-color: #f39c12; background: rgba(243,156,18,0.12); color: #f39c12; }
.diff-btn.selected.hard   { border-color: #e74c3c; background: rgba(231,76,60,0.12);  color: #e74c3c; }

/* ── Player name & start ── */
.name-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.name-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--strike-card2);
    border: 2px solid rgba(136, 68, 170, 0.15);
    border-radius: 10px;
    color: var(--strike-text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.name-input:focus { outline: none; border-color: var(--strike-accent2); }
.name-input::placeholder { color: var(--strike-muted); }

.btn-start {
    background: linear-gradient(135deg, #cc4444, #882244);
    color: #fff;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 900;
    padding: 13px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(136, 34, 68, 0.35);
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(136, 34, 68, 0.5); }
.btn-start:active { transform: translateY(0); }

/* ════════════════════════════════════════
   GAME SCREEN
   ════════════════════════════════════════ */
#gameScreen {
    position: fixed; inset: 0;
    background: #000;
    display: flex;
    padding: 0;
}

#canvasContainer {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
}

#canvasContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ── HUD ── */
#hud {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 10;
}

/* Player health & armor */
#playerHud {
    position: absolute;
    bottom: 30px; left: 16px;
    background: rgba(5, 5, 15, 0.8);
    border-radius: 14px;
    padding: 10px 14px;
    min-width: 180px;
    border: 1px solid rgba(136, 68, 170, 0.12);
    backdrop-filter: blur(8px);
}

.hud-name {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--strike-muted);
    margin-bottom: 3px;
}

.health-bar-wrap {
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 3px;
}

.health-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #cc4444, #882244);
    transition: width 0.15s ease;
}

.hud-hp-text { font-size: 0.75rem; color: var(--strike-muted); }

/* Ammo HUD */
#ammoHud {
    position: absolute;
    bottom: 30px; right: 16px;
    background: rgba(5, 5, 15, 0.8);
    border-radius: 14px;
    padding: 12px 18px;
    border: 1px solid rgba(136, 68, 170, 0.12);
    backdrop-filter: blur(8px);
    text-align: center;
    min-width: 80px;
}

#ammoDisplay {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ammo-icon { font-size: 1.4rem; }

.ammo-count {
    font-size: 2rem;
    font-weight: 900;
    color: var(--strike-gold);
    line-height: 1;
}

.ammo-max {
    font-size: 1rem;
    color: var(--strike-muted);
    align-self: flex-end;
    padding-bottom: 3px;
}

#reloadText {
    font-size: 0.75rem;
    color: var(--strike-gold);
    font-weight: 700;
    letter-spacing: 1px;
    animation: pulse-reload 0.6s ease infinite;
}

@keyframes pulse-reload {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Reload progress bar */
#reloadBar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}
#reloadBarFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c9a84c, #ffdd88);
    border-radius: 3px;
    transition: width 0.05s linear;
}

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 100;
    color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,0.3);
    pointer-events: none;
    z-index: 11;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

/* Score, kills, time */
#scoreHud {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(5, 5, 15, 0.75);
    border-radius: 14px;
    padding: 10px 14px;
    border: 1px solid rgba(136, 68, 170, 0.1);
    backdrop-filter: blur(8px);
    text-align: right;
    min-width: 120px;
}

.score-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.score-label { font-size: 0.75rem; color: var(--strike-muted); text-transform: uppercase; letter-spacing: 1px; }
.score-val { font-size: 1.1rem; font-weight: 900; color: var(--strike-gold); }

/* Spree announcement */
#spreeOverlay {
    position: absolute;
    top: 35%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 30;
    animation: spree-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

#spreeOverlay.hidden { display: none; }

.spree-text {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    color: var(--strike-accent);
    text-shadow: 0 0 30px rgba(204,68,68,0.7), 0 3px 10px rgba(0,0,0,0.6);
    letter-spacing: 4px;
}

.spree-kills {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--strike-gold);
    margin-top: 4px;
}

@keyframes spree-pop {
    from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Damage vignette */
#damageVignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(139, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 9;
    opacity: 0;
    transition: opacity 0.1s;
}

#damageVignette.hidden { display: none; }

/* Low HP vignette */
#lowHpVignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(139, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 8;
    animation: lowhp-pulse 1.5s ease infinite;
}

#lowHpVignette.hidden { display: none; }

@keyframes lowhp-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Pause btn */
#pauseBtn {
    position: absolute;
    top: auto; bottom: 80px; right: 16px;
    width: 38px; height: 38px;
    background: rgba(5, 5, 15, 0.75);
    border: 1px solid rgba(136, 68, 170, 0.15);
    border-radius: 10px;
    cursor: pointer;
    pointer-events: all;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    z-index: 20;
    color: var(--strike-text);
    transition: background 0.15s;
}

#pauseBtn:hover { background: rgba(255,255,255,0.1); }

/* ════════════════════════════════════════
   MOBILE CONTROLS
   ════════════════════════════════════════ */
#mobileControls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 15;
}

@media (pointer: coarse) {
    #mobileControls { display: block; }
    #pauseBtn { pointer-events: all; }
}

#joystickLeft {
    position: absolute;
    bottom: 40px; left: 40px;
    width: 110px; height: 110px;
    background: rgba(136, 68, 170, 0.06);
    border-radius: 50%;
    border: 2px solid rgba(136, 68, 170, 0.15);
    pointer-events: all;
    touch-action: none;
}

#joystickKnobLeft {
    position: absolute;
    width: 46px; height: 46px;
    background: rgba(136, 68, 170, 0.25);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(136, 68, 170, 0.4);
    pointer-events: none;
}

#fireBtn {
    position: absolute;
    bottom: 60px; right: 50px;
    width: 80px; height: 80px;
    background: radial-gradient(circle, #cc4444, #661122);
    border-radius: 50%;
    pointer-events: all;
    touch-action: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    border: 3px solid rgba(204, 68, 68, 0.4);
    box-shadow: 0 4px 20px rgba(204, 68, 68, 0.4);
    transition: transform 0.1s;
}
#fireBtn:active { transform: scale(0.9); }

/* ════════════════════════════════════════
   PAUSE SCREEN
   ════════════════════════════════════════ */
#pauseScreen { pointer-events: all; }

.pause-panel {
    background: var(--strike-card);
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
    width: 320px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(136, 68, 170, 0.1);
}

.pause-panel h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 28px;
    color: var(--strike-accent);
    text-shadow: 0 0 20px rgba(204,68,68,0.3);
}

.pause-panel .btn-menu {
    display: block;
    width: 100%;
    padding: 13px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-resume {
    background: linear-gradient(135deg, #cc4444, #882244);
    color: #fff;
}
.btn-resume:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(204,68,68,0.3); }

.btn-restart {
    background: var(--strike-card2);
    color: var(--strike-text);
    border: 1px solid rgba(136, 68, 170, 0.1) !important;
}
.btn-restart:hover { background: rgba(255,255,255,0.07); }

.btn-quit {
    background: rgba(136, 68, 170, 0.1);
    color: var(--strike-accent2);
    border: 1px solid rgba(136, 68, 170, 0.15) !important;
}
.btn-quit:hover { background: rgba(136, 68, 170, 0.2); }

/* ════════════════════════════════════════
   GAME OVER SCREEN
   ════════════════════════════════════════ */
#gameOverScreen {
    background: radial-gradient(ellipse at 50% 0%, #1a0a2a 0%, #0a0a12 80%);
    overflow-y: auto;
    padding: 20px;
}

.gameover-panel {
    background: var(--strike-card);
    border-radius: 20px;
    padding: 36px 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(136, 68, 170, 0.08);
    text-align: center;
}

.result-banner {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.result-banner.win  {
    color: var(--strike-gold);
    text-shadow: 0 0 30px rgba(201, 168, 76, 0.5);
}
.result-banner.lose {
    color: var(--strike-accent);
    text-shadow: 0 0 30px rgba(204, 68, 68, 0.5);
}

.result-subtitle { font-size: 1rem; color: var(--strike-muted); margin-bottom: 24px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--strike-card2);
    border-radius: 12px;
    padding: 14px 10px;
}

.stat-box .stat-val { font-size: 1.8rem; font-weight: 900; color: var(--strike-gold); }
.stat-box .stat-lbl { font-size: 0.8rem; color: var(--strike-muted); text-transform: uppercase; letter-spacing: 1px; }

.btn-row { display: flex; gap: 12px; }

.btn-play-again {
    flex: 1;
    padding: 13px;
    background: linear-gradient(135deg, #cc4444, #882244);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 900;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-play-again:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(204,68,68,0.35); }

.btn-menu-back {
    padding: 13px 20px;
    background: var(--strike-card2);
    color: var(--strike-text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid rgba(136, 68, 170, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-menu-back:hover { background: rgba(255,255,255,0.07); }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 520px) {
    .stat-grid { grid-template-columns: repeat(3,1fr); }
    .btn-row { flex-direction: column; }
    .start-panel { gap: 16px; }
}

@media (max-width: 380px) {
    .section-card { padding: 14px 16px; }
    .gameover-panel { padding: 24px 20px; }
}
