/* ==========================================================================
   RETRO FUTBOL PRO - STYLES
   ========================================================================== */

:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 198, 255, 0.4);
    --accent-blue: #00c6ff;
    --accent-purple: #7c3aed;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --text-primary: #ffffff;
    --text-secondary: rgba(232, 244, 255, 0.7);
    --font-outfit: 'Outfit', sans-serif;
    --font-space: 'Space Grotesk', sans-serif;
    --shadow-glow: 0 0 20px rgba(0, 198, 255, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    overflow: hidden;
    touch-action: none;
}

/* Home button */
.home-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.home-link:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.2);
    transform: translateY(-1px);
}

/* Game canvas container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
}

#game-canvas {
    display: block;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}

/* HUD elements */
#hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
    width: auto;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hud-hidden {
    opacity: 0;
    transform: translate(-50%, -20px) !important;
}

.scoreboard-hud {
    background: rgba(11, 15, 25, 0.85);
    border: 1.5px solid var(--border-color);
    padding: 8px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hud-team {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.p-team {
    color: var(--accent-blue);
}

.o-team {
    color: #f43f5e;
}

.flag-icon {
    font-size: 20px;
}

.hud-score-display {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-score {
    font-family: var(--font-space);
    font-weight: 700;
    font-size: 22px;
    min-width: 20px;
    text-align: center;
}

.hud-score-divider {
    margin: 0 6px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

.match-meta-hud {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timer-box {
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-space);
    font-size: 14px;
    color: var(--text-secondary);
}

.half-badge {
    background: var(--accent-blue);
    color: #000;
    font-size: 10px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}

#hud-event-banner {
    background: var(--accent-yellow);
    color: #000;
    font-weight: 900;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: all 0.3s ease;
}

.event-banner-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    width: 0;
    padding: 0 !important;
    overflow: hidden;
}

/* Feedback/Ref overlay card */
#feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s ease;
}

#feedback-card {
    background: rgba(11, 15, 25, 0.9);
    border: 2px solid var(--accent-blue);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 198, 255, 0.5);
    padding: 30px 60px;
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: center;
}

#feedback-text {
    font-family: var(--font-space);
    font-weight: 900;
    font-size: 48px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
}

#card-graphic {
    width: 60px;
    height: 90px;
    margin: 20px auto 0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.card-yellow {
    background: #fbbf24;
    border: 1px solid #d97706;
}

.card-red {
    background: #ef4444;
    border: 1px solid #b91c1c;
}

/* Replay indicator */
#replay-indicator {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 9;
    background: rgba(239, 68, 68, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-space);
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    animation: pulse 1.5s infinite;
    pointer-events: none;
}

.replay-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

/* Screen overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: rgba(6, 9, 17, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    transition: opacity 0.4s ease;
}

.menu-card {
    width: 100%;
    max-width: 580px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.glass::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    padding: 1.5px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.5;
}

/* Title & Glow */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.glow-logo {
    font-size: 40px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 198, 255, 0.4));
    margin-bottom: 12px;
}

.alert-glow {
    background: linear-gradient(135deg, var(--accent-yellow) 0%, var(--accent-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.menu-card h1 {
    font-family: var(--font-space);
    font-weight: 900;
    font-size: 28px;
    letter-spacing: 1px;
    color: #fff;
    text-align: center;
}

.menu-card h1 span {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
}

/* High Score Box */
.high-score-display {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 15px;
    color: var(--text-secondary);
}

.high-score-display i {
    color: var(--accent-yellow);
    font-size: 18px;
}

.high-score-display strong {
    color: #fff;
    font-family: var(--font-space);
    font-size: 18px;
    margin-left: 4px;
}

/* Settings Grid */
.settings-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.settings-group h3 {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.game-select {
    width: 100%;
    background: rgba(11, 15, 25, 0.8);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-select:focus, .game-select:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.15);
}

.selector-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.choice-btn {
    flex: 1;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.choice-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

.choice-btn.active {
    background: rgba(0, 198, 255, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.1);
}

/* Controls Guide */
.controls-guide {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.keys {
    font-family: var(--font-space);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Menu Actions */
.menu-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.play-btn-main {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border: none;
    border-radius: 16px;
    padding: 16px 24px;
    color: #fff;
    font-family: var(--font-space);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
    transition: all 0.3s ease;
}

.play-btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.5), 0 0 15px rgba(0, 198, 255, 0.3);
}

.play-btn-main:active {
    transform: translateY(1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 24px;
    color: #fff;
    font-family: var(--font-space);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.2);
}

/* Mobile virtual joystick and buttons styling */
#mobile-controls {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 10;
    pointer-events: none;
}

#joystick-wrapper {
    pointer-events: auto;
}

#joystick-base {
    width: 110px;
    height: 110px;
    background: rgba(11, 15, 25, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

#joystick-handle {
    width: 46px;
    height: 46px;
    background: var(--accent-blue);
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.4);
    cursor: pointer;
}

#action-buttons {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    pointer-events: auto;
}

.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-space);
    font-weight: 800;
    backdrop-filter: blur(4px);
    transition: all 0.1s ease;
}

#btn-pass {
    background: rgba(16, 185, 129, 0.45);
    border-color: var(--accent-green);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

#btn-pass:active {
    background: rgba(16, 185, 129, 0.85);
    transform: scale(0.92);
}

#btn-shoot {
    background: rgba(239, 68, 68, 0.45);
    border-color: var(--accent-red);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
    width: 76px;
    height: 76px;
}

#btn-shoot:active {
    background: rgba(239, 68, 68, 0.85);
    transform: scale(0.92);
}

.btn-lbl {
    font-size: 14px;
    letter-spacing: 0.5px;
}

.btn-sub-lbl {
    font-size: 9px;
    opacity: 0.5;
    font-weight: 400;
    margin-top: 2px;
}

/* Game over screen additions */
.final-score-recap {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-space);
    font-weight: 900;
    font-size: 48px;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.recap-divider {
    color: rgba(255, 255, 255, 0.3);
}

#recap-p-flag, #recap-o-flag {
    font-size: 36px;
}

.stats-summary {
    width: 100%;
    margin-bottom: 24px;
}

.stats-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
}

.stat-cell {
    font-family: var(--font-outfit);
}

.stat-cell.label {
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-cell.val-left {
    color: var(--accent-blue);
    font-weight: 800;
    min-width: 40px;
}

.stat-cell.val-right {
    color: #f43f5e;
    font-weight: 800;
    min-width: 40px;
    text-align: right;
}

.score-calculation {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.summary-val.highlight {
    font-family: var(--font-space);
    font-size: 24px;
    font-weight: 900;
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(0, 198, 255, 0.3);
}

.new-record-box {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid var(--accent-yellow) !important;
    color: var(--accent-yellow) !important;
    animation: flashGlow 2.5s infinite;
}

.new-record-box span {
    font-weight: 800 !important;
    color: var(--accent-yellow) !important;
}

.animated-star {
    animation: spin 3s linear infinite;
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.flex-actions-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.flex-actions-row button {
    flex: 1;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 0.85; }
    50% { opacity: 0.4; }
    100% { opacity: 0.85; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flashGlow {
    0% { box-shadow: 0 0 5px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.5); }
    100% { box-shadow: 0 0 5px rgba(245, 158, 11, 0.2); }
}

.hidden {
    display: none !important;
}

/* Utility layout adjustments for small height screens */
@media (max-height: 520px) {
    .menu-card {
        padding: 20px 30px;
        max-width: 520px;
        border-radius: 20px;
    }
    .menu-card h1 {
        font-size: 22px;
    }
    .subtitle {
        margin-bottom: 12px;
    }
    .high-score-display {
        padding: 6px 16px;
        margin-bottom: 12px;
        font-size: 13px;
    }
    .settings-grid {
        gap: 10px;
        margin-bottom: 12px;
    }
    .controls-guide {
        padding: 10px 16px;
        margin-bottom: 12px;
    }
    .menu-actions {
        gap: 8px;
    }
    .play-btn-main, .secondary-btn {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 12px;
    }
    .final-score-recap {
        font-size: 32px;
        padding: 5px 20px;
        margin-bottom: 12px;
    }
    #recap-p-flag, #recap-o-flag {
        font-size: 24px;
    }
    .stats-row {
        padding: 6px 12px;
        font-size: 12px;
    }
    .score-calculation {
        margin-bottom: 12px;
    }
}
