/* ============================================
   CTF ARENA - Cyberpunk Neon Theme
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 35, 0.9);

    --accent-red: #ff3366;
    --accent-red-glow: rgba(255, 51, 102, 0.5);
    --accent-blue: #00ccff;
    --accent-blue-glow: rgba(0, 204, 255, 0.5);
    --accent-purple: #9933ff;
    --accent-gold: #ffcc00;

    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-red), var(--accent-purple));
    --gradient-secondary: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));

    /* Shadows */
    --shadow-glow: 0 0 30px rgba(153, 51, 255, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Fonts */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* ============================================
   SCREENS
   ============================================ */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
}

.screen.active {
    display: flex;
}

/* ============================================
   MENU SCREEN
   ============================================ */

.menu-container {
    text-align: center;
    z-index: 10;
    padding: 2rem;
}

.logo-container {
    margin-bottom: 3rem;
}

.game-logo {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 50px var(--accent-red-glow);
    letter-spacing: 0.1em;
    animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    from {
        filter: drop-shadow(0 0 20px var(--accent-red-glow));
    }

    to {
        filter: drop-shadow(0 0 40px var(--accent-purple));
    }
}

.game-subtitle {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 2.5rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 20px var(--accent-red-glow);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px var(--accent-red-glow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 20px var(--accent-blue-glow);
}

.btn-icon {
    font-size: 1.5rem;
}

/* Instructions */
.instructions {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.instructions h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.instruction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.key {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent-blue);
    border: 1px solid rgba(0, 204, 255, 0.3);
}

.instruction-item span:last-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.win-info {
    color: var(--accent-gold);
    font-size: 1rem;
    font-weight: 700;
}

/* Connection Status */
.connection-status {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 30, 30, 0.9);
    border: 2px solid #333;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hud-right .score-container {
    align-items: flex-end;
}

.player-kills {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.ping-display {
    font-size: 0.8rem;
    color: var(--accent-gold);
    margin-top: 0.25rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: pulse 1.5s infinite;
}

.status-dot.connected {
    background: #00ff88;
    animation: none;
}

.status-dot.disconnected {
    background: var(--accent-red);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Version Tag */
.version-tag {
    position: absolute;
    bottom: 0.5rem;
    right: 1rem;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.grid-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(153, 51, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(153, 51, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px);
    }
}

/* ============================================
   MATCHMAKING SCREEN
   ============================================ */

.matchmaking-container {
    text-align: center;
}

.searching-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--accent-purple);
    border-radius: 50%;
    animation: pulseRing 2s ease-out infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.search-icon {
    font-size: 3rem;
    z-index: 10;
    animation: searchBounce 1s ease-in-out infinite;
}

@keyframes searchBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.matchmaking-title {
    font-family: var(--font-display);
    font-size: 2rem;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.matchmaking-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.queue-info {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   GAME SCREEN
   ============================================ */

#game-screen {
    background: #0d0d15;
}

#game-canvas {
    display: block;
    border: 3px solid rgba(153, 51, 255, 0.5);
    border-radius: 8px;
    box-shadow: var(--shadow-glow);
}

/* HUD */
.game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 100;
}

.hud-left,
.hud-right,
.hud-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hud-center {
    flex-direction: column;
    gap: 0.25rem;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 2px solid;
}

.red-team {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px var(--accent-red-glow);
}

.blue-team {
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px var(--accent-blue-glow);
}

.team-icon {
    font-size: 1.5rem;
}

.player-score {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
}

.timer {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.5);
}

.match-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* Health Bar */
.health-bar-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
}

.health-bar {
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3366, #ff6699);
    border-radius: 8px;
    transition: width 0.3s ease;
}

.health-text {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

/* Flag Indicator */
.flag-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 204, 0, 0.9), rgba(255, 153, 0, 0.9));
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: #000;
    animation: flagPulse 0.5s ease-in-out infinite alternate;
    z-index: 100;
}

@keyframes flagPulse {
    from {
        transform: translateX(-50%) scale(1);
    }

    to {
        transform: translateX(-50%) scale(1.05);
    }
}

/* Ultimate Bar */
.ultimate-bar-container {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 100;
    transition: all 0.3s ease;
}

.ultimate-bar-container.ready {
    animation: ultReadyPulse 0.5s ease-in-out infinite alternate;
}

@keyframes ultReadyPulse {
    from {
        filter: drop-shadow(0 0 5px var(--accent-gold));
    }

    to {
        filter: drop-shadow(0 0 20px var(--accent-gold));
    }
}

.ultimate-bar {
    width: 150px;
    height: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    border: 2px solid rgba(153, 51, 255, 0.5);
    overflow: hidden;
}

.ultimate-bar-container.ready .ultimate-bar {
    border-color: var(--accent-gold);
}

.ultimate-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #9933ff, #6600cc);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.ultimate-text {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.ultimate-bar-container.ready .ultimate-text {
    color: var(--accent-gold);
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */

.gameover-container {
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.result-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.result-title.win {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-title.lose {
    color: var(--accent-red);
}

.result-title.tie {
    color: var(--text-secondary);
}

.result-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.final-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.score-box {
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px solid;
    text-align: center;
}

.score-box.red {
    border-color: var(--accent-red);
}

.score-box.blue {
    border-color: var(--accent-blue);
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.score-value {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
}

.vs {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .game-logo {
        font-size: 2.5rem;
    }

    .instruction-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-hud {
        padding: 0.5rem 1rem;
    }

    .player-info {
        padding: 0.3rem 0.8rem;
    }

    .player-score {
        font-size: 1.5rem;
    }

    .timer {
        font-size: 1.5rem;
    }
}

/* Weapon Selection Overlay */
.weapon-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 21, 0.95);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.weapon-overlay.active {
    display: flex;
}

.weapon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 800px;
    padding: 2rem;
}

.weapon-card {
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.9), rgba(20, 20, 30, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.weapon-card:hover {
    transform: translateY(-5px);
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.weapon-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.weapon-card h3 {
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.weapon-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.weapon-stat {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.weapon-stat div {
    height: 100%;
    border-radius: 2px;
}