@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;700&display=swap');

:root {
    --primary: #7B2FE3;
    --secondary: #FF36D9;
    --accent: #36FFE5;
    --background: #000000;
    --surface: rgba(0, 0, 0, 0.3);
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --neon-red: #FF2F8E;
    --neon-cyan: #18e6e6;
    --neon-purple: #7b2fe3;
    --neon-pink: #e31e79;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: clamp(6rem, 12vw, 12rem);
    --border-radius: 15px;

    --glow-purple: 0 0 20px rgba(123, 47, 227, 0.5), 0 0 40px rgba(123, 47, 227, 0.3);
    --glow-pink: 0 0 20px rgba(227, 30, 121, 0.5), 0 0 40px rgba(227, 30, 121, 0.3);
    --glow-cyan: 0 0 20px rgba(24, 230, 230, 0.5), 0 0 40px rgba(24, 230, 230, 0.3);
    --glow-text-shadow: 
        2px 2px 0 var(--neon-cyan),
        -2px -2px 0 var(--neon-cyan);
    --stripe-bg: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #0a0a0a;
    color: var(--text);
    font-family: 'Orbitron', sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: var(--background);
    z-index: -2;
}

.bg-animation::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(227, 30, 121, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(24, 230, 230, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(123, 47, 227, 0.1) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(227, 30, 121, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(24, 230, 230, 0.15) 0%, transparent 40%);
    opacity: 0.7;
    animation: pulseBackground 8s ease infinite;
}

@keyframes pulseBackground {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes subtlePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

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

@keyframes vsFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes glowPulse {
    0%, 100% {
        text-shadow: 0 0 10px var(--neon-cyan);
    }
    50% {
        text-shadow: 0 0 20px var(--neon-cyan);
    }
}

/* Home Link */
.home-link {
    position: fixed;
    top: var(--spacing-md);
    left: var(--spacing-md);
    color: var(--text);
    text-decoration: none;
    font-size: 1.2rem;
    z-index: 100;
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
    border: 2px solid var(--neon-purple);
    border-radius: 8px;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px var(--neon-purple);
    backdrop-filter: blur(5px);
    box-shadow: var(--glow-purple);
}

.home-link:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--glow-cyan);
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    border-color: var(--neon-cyan);
}

/* Battle Header */
.battle-header {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-md);
    position: relative;
}

.battle-header h1,
.winner-content h3 {
    font-family: 'Impact', sans-serif;
    font-size: clamp(2rem, 15vw, 5rem);
    color: #FF4DD6;
    text-shadow: 
        clamp(1px, 0.6vw, 3px) clamp(1px, 0.6vw, 3px) 0 #00FFF7,
        clamp(-1px, -0.6vw, -3px) clamp(-1px, -0.6vw, -3px) 0 #00FFF7;
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 1rem;
    width: 100%;
    max-width: 90vw;
    word-wrap: break-word;
    text-transform: uppercase;
}

.battle-header h1 {
    font-family: 'Impact', sans-serif;
    font-size: clamp(2rem, 6vw, 4rem);
    position: relative;
    color: #FF4DD6;
    margin: 0 auto var(--spacing-sm);
    padding: 0;
    text-transform: uppercase;
    max-width: 90vw;
    word-wrap: break-word;
}

.winner-content h3 {
    margin: var(--spacing-sm) 0;
    font-size: clamp(1.5rem, 10vw, 3rem);
}

.battle-header h1::before {
    content: attr(data-text);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    color: var(--neon-cyan);
    opacity: 0.7;
    filter: blur(4px);
    z-index: -1;
}

.battle-header h1::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--stripe-bg);
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* Füge den Glitch-Effekt als Overlay hinzu */
.battle-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 3;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    max-width: 600px;
    height: 4px;
    background: var(--surface);
    border-radius: 2px;
    margin: var(--spacing-xs) auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

/* Battle Arena */
.battle-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    min-height: calc(100vh - 200px);
}

.battle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.image-slot {
    flex: 1;
    max-width: 500px;
    aspect-ratio: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(123, 47, 227, 0.2);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--glow-purple);
}

.image-slot:hover {
    transform: scale(1.02);
    box-shadow: var(--glow-pink);
}

.image-content {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.image-slot:hover .image-content {
    transform: scale(1.05);
}

.image-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.8);
    color: var(--text);
    text-align: center;
    font-size: 1.1rem;
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--neon-purple);
}

.vs-indicator {
    font-size: 2rem;
    font-weight: bold;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
    animation: glowPulse 2s infinite;
}

.champion {
    border-color: var(--neon-pink);
    box-shadow: var(--glow-pink);
}

/* Winner Overlay */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(123, 47, 227, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto; /* Ermöglicht Scrollen */
    padding: var(--spacing-md);
}

.winner-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.winner-content {
    text-align: center;
    padding: var(--spacing-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(123, 47, 227, 0.2);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    margin: auto; /* Zentriert den Content vertikal */
}

.winner-image {
    width: 300px;
    height: 300px;
    margin: 0 auto var(--spacing-md);
    border-radius: 15px;
    border: 3px solid var(--neon-pink);
    overflow: hidden;
    box-shadow: var(--glow-pink);
    background: rgba(0, 0, 0, 0.2);
}

.winner-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Füge den Glitch-Effekt als Overlay hinzu */
.winner-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 3;
}

.winner-content p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.button-container {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.button {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.play-again {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
    color: var(--text);
    box-shadow: var(--glow-purple);
    border: 2px solid transparent;
}

.play-again:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--glow-cyan);
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    border-color: var(--neon-cyan);
}

.home {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    border: 2px solid var(--neon-purple);
    box-shadow: var(--glow-purple);
}

.home:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--glow-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .home-link {
        top: var(--spacing-sm);
        left: var(--spacing-sm);
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .battle-header {
        padding: var(--spacing-sm);
        margin-top: 4rem;  /* Increased margin-top */
    }
    
    .battle-header h1 {
        font-size: clamp(1.2rem, 4vw, 2rem);
        margin-bottom: var(--spacing-xs);
    }

    .progress-bar {
        max-width: 90%;
    }

    .progress-text {
        font-size: 0.8rem;
    }

    .battle-arena {
        min-height: calc(100vh - 100px);
        padding: var(--spacing-sm);
    }

    .battle-container {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .image-slot {
        width: 50vw;  /* Reduced from 85vw */
        height: 50vw;  /* Reduced from 85vw */
        max-width: 50vw;  /* Reduced from 85vw */
        max-height: 50vw;  /* Reduced from 85vw */
    }

    .image-slot .image-content {
        width: 100%;
        height: 100%;
    }

    .image-slot img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .image-label {
        font-size: 0.9rem;
        padding: var(--spacing-xs);
    }

    .vs-indicator {
        font-size: 1rem;
        margin: var(--spacing-xs) 0;
    }

    .winner-overlay {
        padding: var(--spacing-sm);
    }

    .winner-content {
        padding: var(--spacing-md);
        width: 95%;
    }

    .winner-content h3 {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }

    .winner-image {
        width: 200px;
        height: 200px;
    }

    .button-container {
        gap: var(--spacing-sm);
    }

    .button {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
        min-width: 100px;
    }

    * {
        touch-action: manipulation;
    }
}