:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --border: #e5e9f0;
    --border-strong: #d4dae3;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-on-primary: #ffffff;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.08);
    --shadow-primary: 0 8px 24px rgba(37, 99, 235, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.background-gradient {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(ellipse 60% 50% at 100% 50%, rgba(59, 130, 246, 0.10), transparent 60%),
        radial-gradient(ellipse 60% 50% at 0% 80%, rgba(96, 165, 250, 0.10), transparent 60%),
        linear-gradient(180deg, #f4f7fc 0%, #eef2f9 100%);
    pointer-events: none;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 64px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 8px 0 4px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    margin-bottom: 20px;
    box-shadow: var(--shadow-primary);
    transition: transform var(--transition);
}

.logo:hover {
    transform: translateY(-2px) scale(1.03);
}

.logo svg {
    width: 38px;
    height: 38px;
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 12px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Field */
.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field[hidden] {
    display: none;
}

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.field-label,
label[for="url"] {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}

.paste-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.paste-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-200);
}

.paste-btn:active {
    transform: scale(0.97);
}

textarea,
select {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 14px;
}

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

textarea:hover,
select:hover {
    border-color: var(--border-strong);
}

textarea:focus,
select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Segmented control */
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    position: relative;
}

.segmented-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 10px 14px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    z-index: 1;
}

.segmented-btn:hover:not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.5);
}

.segmented-btn.active {
    background: var(--surface);
    color: var(--primary-700);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.segmented-btn svg {
    flex-shrink: 0;
}

/* Options grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Select wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    padding-right: 40px;
    cursor: pointer;
    background: var(--surface);
}

.select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    transition: var(--transition);
}

.select-wrapper:hover .select-chevron {
    color: var(--text-secondary);
}

/* Download button */
.download-btn {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: var(--shadow-primary);
    position: relative;
    overflow: hidden;
    letter-spacing: -0.005em;
    margin-top: 8px;
}

.download-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.download-btn:hover:not(:disabled)::before {
    opacity: 1;
}

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

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

.btn-content,
.btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-loader {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.download-btn.loading .btn-content {
    opacity: 0;
}

.download-btn.loading .btn-loader {
    opacity: 1;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Status */
.status {
    min-height: 0;
    border-radius: var(--radius-md);
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    overflow: hidden;
}

.status.show {
    padding: 12px 16px;
}

.status.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status.info {
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
}

.status a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 8px;
}

.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: left;
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-50);
    color: var(--primary-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.005em;
}

.feature p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 16px 0 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 40px 16px 32px;
        gap: 24px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .subtitle {
        font-size: 15.5px;
    }

    .card {
        padding: 22px;
        gap: 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

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

    .logo {
        width: 60px;
        height: 60px;
    }

    .logo svg {
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
