/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-dark: #0a0a0f;
    --primary-light: #1a1a2e;
    --accent-save: #00ff88;
    --accent-destroy: #ff0066;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --glow-save: rgba(0, 255, 136, 0.5);
    --glow-destroy: rgba(255, 0, 102, 0.5);
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Particle Background */
#particles {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    from {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    to {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 2;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px;
    background: rgba(26, 26, 46, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-save), var(--accent-destroy));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    align-items: center;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
}

.faction-ratio {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.faction-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
}

.savior-bar {
    background: linear-gradient(90deg, var(--accent-save), #00cc70);
    height: 100%;
    transition: width 0.5s ease;
}

.destroyer-bar {
    background: linear-gradient(90deg, var(--accent-destroy), #cc0050);
    height: 100%;
    transition: width 0.5s ease;
}

.faction-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}

.savior-label {
    color: var(--accent-save);
}

.destroyer-label {
    color: var(--accent-destroy);
}

/* Clock Display */
.clock-container {
    position: relative;
    margin: 60px auto;
    max-width: 800px;
}

.clock-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 200px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    filter: blur(40px);
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.clock-wrapper {
    text-align: center;
    position: relative;
}

.clock-label {
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    animation: fadeIn 1s ease;
}

.clock {
    font-family: 'Orbitron', monospace;
    font-size: clamp(60px, 15vw, 120px);
    font-weight: 900;
    letter-spacing: 5px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    animation: fadeIn 1s ease 0.2s both;
}

.clock-segment {
    display: inline-block;
    min-width: 1.2ch;
    transition: all 0.3s ease;
}

.clock-segment.tick {
    animation: tick 0.3s ease;
}

@keyframes tick {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.clock-separator {
    display: inline-block;
    animation: blink 1s infinite;
    margin: 0 10px;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.clock-status {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    animation: fadeIn 1s ease 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Action Buttons */
.action-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 60px 0;
    flex-wrap: wrap;
}

.action-btn {
    position: relative;
    width: 200px;
    height: 80px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.action-btn:not(:disabled):hover {
    transform: translateY(-5px) scale(1.05);
}

.save-btn:not(:disabled):hover {
    box-shadow: 0 20px 40px var(--glow-save);
    border-color: var(--accent-save);
}

.destroy-btn:not(:disabled):hover {
    box-shadow: 0 20px 40px var(--glow-destroy);
    border-color: var(--accent-destroy);
}

.btn-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-btn:not(:disabled):hover .btn-glow {
    background: radial-gradient(ellipse at center, var(--glow-save) 0%, transparent 70%);
    opacity: 1;
}

.destroy-btn:not(:disabled):hover .btn-glow {
    background: radial-gradient(ellipse at center, var(--glow-destroy) 0%, transparent 70%);
    opacity: 1;
}

.btn-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    z-index: 2;
}

.btn-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.btn-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.btn-value {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
}

.save-btn .btn-text, .save-btn .btn-value {
    color: var(--accent-save);
}

.destroy-btn .btn-text, .destroy-btn .btn-value {
    color: var(--accent-destroy);
}

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.7);
    transition: height 0.3s linear;
    pointer-events: none;
}

/* Cooldown Display */
.cooldown-display {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    height: 20px;
}

/* Live Feed */
.live-feed {
    background: rgba(26, 26, 46, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    margin-bottom: 40px;
    max-height: 200px;
    overflow: hidden;
}

.feed-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.feed-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.feed-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent-save);
    border-radius: 50%;
    animation: feedPulse 2s infinite;
}

@keyframes feedPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.feed-content {
    max-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
}

.feed-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 13px;
    animation: slideIn 0.5s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.feed-item.save {
    border-left: 3px solid var(--accent-save);
}

.feed-item.destroy {
    border-left: 3px solid var(--accent-destroy);
}

.feed-country {
    font-weight: 600;
}

.feed-action {
    color: var(--text-secondary);
}

.feed-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Leaderboard */
.leaderboard {
    background: rgba(26, 26, 46, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
}

.leaderboard-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.leaderboard-tab {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 1px;
}

.leaderboard-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.leaderboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.leaderboard-section h3 {
    font-size: 14px;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.leaderboard-rank {
    width: 30px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
}

.leaderboard-rank.gold {
    color: #ffd700;
}

.leaderboard-rank.silver {
    color: #c0c0c0;
}

.leaderboard-rank.bronze {
    color: #cd7f32;
}

.leaderboard-name {
    flex: 1;
    margin-left: 10px;
}

.leaderboard-score {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeInModal 0.5s ease;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    text-align: center;
    padding: 40px;
    max-width: 600px;
}

.endgame-animation {
    position: relative;
    height: 200px;
    margin-bottom: 30px;
}

.explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    animation: explode 2s ease infinite;
}

@keyframes explode {
    0% {
        width: 100px;
        height: 100px;
        background: radial-gradient(circle, var(--accent-destroy) 0%, transparent 70%);
        opacity: 1;
    }
    100% {
        width: 400px;
        height: 400px;
        background: radial-gradient(circle, transparent 0%, transparent 70%);
        opacity: 0;
    }
}

.endgame-title {
    font-family: 'Orbitron', monospace;
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-save), var(--accent-destroy));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    animation: glitch 2s infinite;
}

@keyframes glitch {
    0%, 100% {
        text-shadow: 2px 2px 0 var(--accent-save), -2px -2px 0 var(--accent-destroy);
    }
    25% {
        text-shadow: -2px 2px 0 var(--accent-destroy), 2px -2px 0 var(--accent-save);
    }
    50% {
        text-shadow: 2px -2px 0 var(--accent-save), -2px 2px 0 var(--accent-destroy);
    }
    75% {
        text-shadow: -2px -2px 0 var(--accent-destroy), 2px 2px 0 var(--accent-save);
    }
}

.endgame-winner {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

.endgame-stats {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.restart-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--accent-save), var(--accent-destroy));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
    }
    
    .stats {
        flex-direction: column;
        width: 100%;
    }
    
    .faction-bar {
        width: 100%;
    }
    
    .clock {
        font-size: clamp(40px, 12vw, 80px);
    }
    
    .action-container {
        gap: 20px;
    }
    
    .action-btn {
        width: 160px;
        height: 70px;
    }
    
    .leaderboard-content {
        grid-template-columns: 1fr;
    }
    
    .endgame-title {
        font-size: 32px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}