:root {
    --primary-color: #0a0a20;
    --secondary-color: #191970;
    --accent-color: #8a2be2;
    --glow-color: #4169e1;
    --text-color: #e0e0ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none"/><path d="M0,50 L50,0 L100,50 L50,100 Z" fill="rgba(138, 43, 226, 0.05)"/></svg>');
    z-index: -1;
    opacity: 0.1;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(10, 10, 32, 0.7);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
    padding: 40px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}

.container.tall {
    min-height: 600px;
}

.upload-section {
    text-align: center;
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--glow-color);
    background: linear-gradient(90deg, #4169e1, #8a2be2, #4169e1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: colorFlow 10s linear infinite;
    background-size: 200% auto;
}

@keyframes colorFlow {
    0% {background-position: 0% center;}
    100% {background-position: 200% center;}
}

p {
    margin-bottom: 30px;
    font-size: 1.1rem;
}

#counter {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-weight: bold;
    text-shadow: 0 0 5px var(--glow-color);
}

.upload-area {
    border: 2px dashed var(--accent-color);
    border-radius: 10px;
    padding: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    position: relative;
    background: rgba(25, 25, 112, 0.2);
}

.upload-area:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
    border-color: var(--glow-color);
}

.upload-area i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.upload-area.active {
    border-color: var(--glow-color);
    background: rgba(65, 105, 225, 0.1);
}

button {
    background: linear-gradient(45deg, var(--accent-color), var(--glow-color));
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.6);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.animation-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 32, 0.9);
    z-index: 10;
    overflow: hidden;
}

.portal {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.portal-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: conic-gradient(
        var(--glow-color),
        var(--accent-color),
        var(--glow-color)
    );
    animation: spin 2s linear infinite, pulse 1s ease-in-out infinite;
    border-radius: 50%;
    z-index: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.inner-portal {
    position: absolute;
    width: 200px;
    height: 200px;
    background: conic-gradient(
        transparent,
        rgba(138, 43, 226, 0.5),
        transparent
    );
    animation: spinReverse 1.5s linear infinite;
    border-radius: 50%;
    z-index: 1;
}

@keyframes spinReverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

.your-image-container, .received-image-container {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
}

.your-image-container {
    left: -200px;
    animation: moveToCenter 1.5s forwards, moveToRight 1.5s 3s forwards;
}

.received-image-container {
    right: -200px;
    animation: moveToCenter 1.5s 4.5s forwards;
}

.your-image-container img, .received-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@keyframes moveToCenter {
    to { transform: translateX(0); }
}

@keyframes moveToRight {
    to { transform: translateX(400px); }
}

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: var(--glow-color);
    border-radius: 50%;
    opacity: 0;
    animation: particleEffect 2s ease-in-out infinite;
}

@keyframes particleEffect {
    0% { transform: translate(0, 0); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translate(var(--x), var(--y)); opacity: 0; }
}

.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.2; }
    50% { transform: translate(-50%, -50%) scale(2); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.2; }
}

.animation-text {
    position: absolute;
    bottom: 50px;
    color: var(--text-color);
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--glow-color);
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.result-container {
    text-align: center;
}

.result-image-container {
    width: 300px;
    height: 300px;
    margin: 30px auto;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 30px var(--glow-color);
}

.result-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mystical-text {
    font-style: italic;
    color: var(--accent-color);
    margin-bottom: 30px;
}

#newTradeButton {
    margin-top: 20px;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .result-image-container {
        width: 250px;
        height: 250px;
    }
}
