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

:root {
    --primary: #fe2c55;
    --primary-dark: #d91242;
    --secondary: #00d4ff;
    --bg: #0a0a0f;
    --bg-card: #16161d;
    --text: #ffffff;
    --text-secondary: #b4b4c8;
    --border: rgba(255, 255, 255, 0.1);
    --success: #00ff88;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(254, 44, 85, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Card */
.main-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.8s ease;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    color: var(--text);
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(254, 44, 85, 0.1);
}

textarea::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    padding: 1.2rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(254, 44, 85, 0.4);
}

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

.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary .btn-loading {
    display: none;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .btn-loading {
    display: inline;
}

/* Result Section */
.result-section {
    animation: fadeInUp 0.5s ease;
}

.video-info {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cover-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 9/16;
}

.cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    backdrop-filter: blur(10px);
}

.info-text h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.author {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.stats {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Download Buttons */
.download-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-download {
    padding: 1rem;
    background: linear-gradient(135deg, var(--secondary), #0099cc);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.4);
}

.btn-download.secondary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.btn-download.secondary:hover {
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

/* Error Message */
.error-message {
    background: rgba(254, 44, 85, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1rem;
    color: var(--primary);
    animation: shake 0.5s ease;
}

/* History Section */
.history-section {
    margin-top: 3rem;
}

.history-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.history-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 9/16;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.history-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(254, 44, 85, 0.3);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .main-card {
        padding: 1.5rem;
    }
    
    .video-info {
        grid-template-columns: 1fr;
    }
    
    .cover-wrap {
        max-width: 200px;
        margin: 0 auto;
    }
    
    .download-btns {
        grid-template-columns: 1fr;
    }
    
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
