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

:root {
    --primary: #E1306C;
    --primary-dark: #C13584;
    --secondary: #5B51D8;
    --accent: #F77737;
    --bg-dark: #0a0a0f;
    --bg-card: rgba(20, 20, 30, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #b0b0c0;
    --success: #10b981;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(225, 48, 108, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(91, 81, 216, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(247, 119, 55, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

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

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

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

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

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    filter: drop-shadow(0 0 20px rgba(225, 48, 108, 0.5));
}

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

.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: fadeInUp 0.8s ease 0.2s both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

.card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(225, 48, 108, 0.1);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.format-selector {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.format-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.format-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.format-btn svg {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
}

.format-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.format-btn:hover svg {
    transform: scale(1.1);
}

.format-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(225, 48, 108, 0.3);
}

.download-btn {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 8px 24px rgba(225, 48, 108, 0.3);
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(225, 48, 108, 0.4);
}

.download-btn:active:not(:disabled) {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    width: 24px;
    height: 24px;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.message {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.message.info {
    background: rgba(91, 81, 216, 0.1);
    border: 1px solid rgba(91, 81, 216, 0.3);
    color: var(--secondary);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease both;
}

.feature-card:nth-child(1) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.4s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.5s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(225, 48, 108, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 12px rgba(225, 48, 108, 0.3));
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin: 0.5rem 0;
}

.disclaimer {
    font-size: 0.85rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .card {
        padding: 2rem 1.5rem;
    }

    .format-options {
        grid-template-columns: 1fr;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

/* --- Direct Download Fallback UI --- */
.direct-download-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.direct-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.direct-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.direct-link {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary-dark));
    border-radius: 50px;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.direct-link:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(91, 81, 216, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.direct-link::before {
    content: '↓';
    font-weight: bold;
}

.preview-container {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}

.preview-content {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.preview-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.preview-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.preview-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.preview-badge {
    padding: 0.25rem 0.75rem;
    background: rgba(225, 48, 108, 0.15);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}