/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #0a0a0f;
    color: #eee;
    font-family: 'Outfit', system-ui, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

/* ===== MENU ===== */
#menu-inicial {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.menu-bg-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,68,0.12) 0%, transparent 70%);
    animation: pulse-glow 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.card {
    background: linear-gradient(160deg, #141420 0%, #1c1c30 100%);
    padding: 44px 40px 36px;
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.06),
        inset 0 1px 0 rgba(255,255,255,0.05);
    text-align: center;
    min-width: 360px;
    max-width: 420px;
    position: relative;
    z-index: 2;
}

.logo-container { margin-bottom: 28px; }

.logo-badge {
    font-size: 48px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 12px rgba(0,255,68,0.4));
}

.card h1 {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    line-height: 1;
}

.card h1 .accent {
    color: #00ff44;
    text-shadow: 0 0 20px rgba(0,255,68,0.4);
}

.subtitle {
    font-size: 12px;
    letter-spacing: 6px;
    color: #666;
    margin-top: 4px;
    font-weight: 600;
}

.setup-group {
    margin-bottom: 16px;
    text-align: left;
}

.setup-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 6px;
}

.setup-group input,
.setup-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #333;
    border-radius: 12px;
    background: #0f0f1a;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

.setup-group input:focus,
.setup-group select:focus {
    border-color: #00ff44;
    box-shadow: 0 0 0 3px rgba(0,255,68,0.15);
}

.setup-group select option {
    background: #1a1a2e;
}

/* Team selector */
.team-selector {
    display: flex;
    gap: 10px;
}

.team-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #333;
    border-radius: 12px;
    background: #0f0f1a;
    color: #aaa;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.team-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.red-circle { background: #ff3e3e; box-shadow: 0 0 8px rgba(255,62,62,0.5); }
.blue-circle { background: #3e8bff; box-shadow: 0 0 8px rgba(62,139,255,0.5); }

.team-btn.active.team-red {
    border-color: #ff3e3e;
    background: rgba(255,62,62,0.1);
    color: #ff6b6b;
}
.team-btn.active.team-blue {
    border-color: #3e8bff;
    background: rgba(62,139,255,0.1);
    color: #6ba3ff;
}

.team-btn:hover { transform: translateY(-1px); }

.peer-id-display {
    padding: 12px 16px;
    background: #0f0f1a;
    border: 1px solid #333;
    border-radius: 12px;
    font-family: monospace;
    font-size: 13px;
    color: #00ff44;
    word-break: break-all;
}

/* Main button */
.btn-main {
    width: 100%;
    background: linear-gradient(135deg, #00ff44 0%, #00cc37 100%);
    color: #0a0a0f;
    border: none;
    padding: 16px 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,255,68,0.3);
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,255,68,0.45);
}

.btn-main:active { transform: translateY(0); }

.btn-icon { font-size: 20px; }

/* ===== GAME CONTAINER ===== */
#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #0a0a0f;
}

/* Header */
.header-game {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 6px 24px;
    background: rgba(10,10,20,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 30px;
}

.team-info-left,
.team-info-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.team-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #aaa;
}

.score-box {
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
    min-width: 50px;
    text-align: center;
}

.red-score { color: #ff3e3e; text-shadow: 0 0 15px rgba(255,62,62,0.5); }
.blue-score { color: #3e8bff; text-shadow: 0 0 15px rgba(62,139,255,0.5); }

.timer-container { text-align: center; }

.timer-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: #555;
    font-weight: 600;
}

.timer {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* Canvas */
canvas#cancha {
    background: #1a5c1a;
    border: 3px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    box-shadow:
        inset 0 0 80px rgba(0,0,0,0.4),
        0 0 40px rgba(0,0,0,0.5);
    margin-top: 2px;
}

/* Footer */
.footer-game {
    display: flex;
    gap: 20px;
    padding: 4px 10px;
    color: #555;
    font-size: 12px;
}

.control-hint {
    display: flex;
    align-items: center;
    gap: 4px;
}

kbd {
    display: inline-block;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: 'Outfit', monospace;
    color: #ccc;
    margin: 0 2px;
}

/* ===== GOAL OVERLAY ===== */
.goal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: none;
}

.goal-overlay.active {
    display: flex;
}

.goal-text {
    font-size: clamp(60px, 12vw, 140px);
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 30px rgba(255,215,0,0.8),
        0 0 60px rgba(255,215,0,0.4),
        0 4px 0 #b8860b;
    animation: goal-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 101;
}

@keyframes goal-pop {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

#confetti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===== END GAME OVERLAY ===== */
.end-overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
}

.end-overlay.active {
    display: flex;
}

.end-card {
    background: linear-gradient(160deg, #141420, #1c1c30);
    padding: 40px 48px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.06);
    text-align: center;
    animation: goal-pop 0.4s ease-out forwards;
}

.end-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    margin-bottom: 24px;
}

.end-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.end-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.end-team-name {
    font-size: 12px;
    letter-spacing: 2px;
    color: #888;
    font-weight: 600;
}

.end-team-score {
    font-size: 56px;
    font-weight: 900;
    line-height: 1;
}

.red-text { color: #ff3e3e; text-shadow: 0 0 20px rgba(255,62,62,0.4); }
.blue-text { color: #3e8bff; text-shadow: 0 0 20px rgba(62,139,255,0.4); }

.end-vs {
    font-size: 28px;
    color: #555;
    font-weight: 200;
}

.end-winner {
    font-size: 18px;
    font-weight: 700;
    margin: 12px 0 24px;
    color: #00ff44;
    text-shadow: 0 0 10px rgba(0,255,68,0.3);
}

.end-card .btn-main {
    pointer-events: all;
}
