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

:root {
    --bg: #07070d;
    --surface: #0d0d1a;
    --surface2: #141425;
    --border: #1e1e3a;
    --text: #eeeef8;
    --text2: #8888aa;
    --radius: 16px;
    --transition: 0.35s cubic-bezier(0.22, 1, 0.36, 1);

    /* Platform colors */
    --ig1: #f58529;
    --ig2: #dd2a7b;
    --ig3: #8134af;
    --ig-gradient: linear-gradient(135deg, var(--ig1), var(--ig2), var(--ig3));

    --tt-red: #ff004f;
    --tt-cyan: #00f2ea;
    --tt-gradient: linear-gradient(135deg, var(--tt-cyan), var(--tt-red));

    --kwai: #ff6a00;
    --kwai2: #ff8c00;
    --kwai-gradient: linear-gradient(135deg, var(--kwai), var(--kwai2));

    --fb: #1877f2;
    --fb2: #0a5cbf;
    --fb-gradient: linear-gradient(135deg, var(--fb), var(--fb2));
}

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

.bg-grid {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        linear-gradient(rgba(100,100,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100,100,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: -40%; left: -20%;
    width: 140%; height: 80%;
    background: radial-gradient(ellipse at 50% 50%, rgba(120,80,255,0.08), transparent 60%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.5; transform: scale(1) translate(0, 0); }
    100% { opacity: 1; transform: scale(1.1) translate(5%, 2%); }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    padding: 48px 0 28px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(108,92,231,0.3);
}

.pulse {
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(108,92,231,0.3); }
    50% { box-shadow: 0 4px 40px rgba(108,92,231,0.5); }
}

.logo .accent {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text2);
    font-size: 0.95rem;
    margin-top: 8px;
    font-weight: 400;
}

.platform-strip {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.plat-tag {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.8;
    transition: var(--transition);
}

.plat-tag:hover { opacity: 1; transform: translateY(-1px); }

.tag-instagram { background: linear-gradient(135deg, #f58529, #dd2a7b); color: #fff; }
.tag-tiktok { background: linear-gradient(135deg, #00f2ea, #ff004f); color: #000; }
.tag-kwai { background: linear-gradient(135deg, #ff6a00, #ff8c00); color: #fff; }
.tag-facebook { background: linear-gradient(135deg, #1877f2, #0a5cbf); color: #fff; }

/* Card principal */
.card-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 8px 60px rgba(0,0,0,0.4);
    animation: slideUp 0.6s ease-out;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.tab:hover {
    border-color: rgba(255,255,255,0.2);
    color: var(--text);
}

.tab.active {
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(108,92,231,0.2);
}

.tab.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    padding: 1px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Platform-specific active tab */
.tab[data-platform="instagram"].active::before { background: var(--ig-gradient); }
.tab[data-platform="tiktok"].active::before { background: var(--tt-gradient); }
.tab[data-platform="kwai"].active::before { background: var(--kwai-gradient); }
.tab[data-platform="facebook"].active::before { background: var(--fb-gradient); }

.tab[data-platform="instagram"].active { box-shadow: 0 4px 20px rgba(221,42,123,0.2); }
.tab[data-platform="tiktok"].active { box-shadow: 0 4px 20px rgba(255,0,79,0.2); }
.tab[data-platform="kwai"].active { box-shadow: 0 4px 20px rgba(255,106,0,0.2); }
.tab[data-platform="facebook"].active { box-shadow: 0 4px 20px rgba(24,119,242,0.2); }

/* Input group */
.input-group {
    display: flex;
    gap: 12px;
    position: relative;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-glow {
    position: absolute;
    top: -2px; left: -2px;
    right: -2px; bottom: -2px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe, #6c5ce7);
    background-size: 200% 200%;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: gradientShift 3s ease infinite;
    z-index: 0;
}

.input-wrapper:focus-within .input-glow { opacity: 0.6; }

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text2);
    pointer-events: none;
    z-index: 2;
    transition: var(--transition);
}

.input-wrapper:focus-within .input-icon { color: #a29bfe; }

input[type="url"] {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

input[type="url"]:focus {
    border-color: transparent;
    background: #1a1a30;
    box-shadow: 0 0 30px rgba(108,92,231,0.1);
}

input[type="url"]::placeholder {
    color: var(--text2);
    opacity: 0.5;
}

/* Button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    transition: var(--transition);
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-primary:hover .btn-bg {
    background: linear-gradient(135deg, #7c6cf7, #b2abfe);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Platform-specific button colors via data attribute */
body[data-platform="instagram"] .btn-bg { background: var(--ig-gradient); }
body[data-platform="tiktok"] .btn-bg { background: var(--tt-gradient); }
body[data-platform="tiktok"] .btn-content { color: #000; }
body[data-platform="kwai"] .btn-bg { background: var(--kwai-gradient); }
body[data-platform="facebook"] .btn-bg { background: var(--fb-gradient); }

/* Status bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.78rem;
    color: var(--text2);
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00b894;
    animation: dotPulse 2s ease-in-out infinite;
}

.status-dot.offline { background: #ff6b6b; }

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Result area */
#resultArea { margin-top: 24px; }

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    animation: slideUp 0.5s ease-out;
}

.result-info {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.result-thumb {
    width: 120px;
    height: 68px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface2);
    flex-shrink: 0;
}

.result-details { flex: 1; min-width: 0; }
.result-details h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-details p { font-size: 0.82rem; color: var(--text2); }

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #00b894, #00a381);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,184,148,0.3);
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-copy:hover {
    border-color: rgba(255,255,255,0.2);
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

.error-card {
    background: var(--surface);
    border: 1px solid rgba(255,107,107,0.3);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    animation: shakeIn 0.5s ease-out;
}

@keyframes shakeIn {
    0% { transform: translateX(-10px); opacity: 0; }
    25% { transform: translateX(10px); }
    50% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); opacity: 1; }
}

.error-card svg { color: #ff6b6b; margin-bottom: 12px; }
.error-card h3 { font-size: 1rem; margin-bottom: 4px; color: #ff6b6b; }
.error-card p { font-size: 0.85rem; color: var(--text2); }

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    animation: slideUp 0.4s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: #6c5ce7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading p { color: var(--text2); font-size: 0.9rem; }

.loading .progress-bar {
    width: 240px;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 12px auto 0;
    overflow: hidden;
}

.loading .progress-fill {
    height: 100%;
    border-radius: 4px;
    width: 0%;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
    animation: progressAnim 2s ease-in-out infinite;
}

@keyframes progressAnim {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; }
    100% { width: 0%; margin-left: 100%; }
}

/* Info section */
.info-section {
    margin-top: 48px;
    text-align: center;
}

.info-section h2, .features-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 28px;
    position: relative;
    display: inline-block;
}

.info-section h2::after, .features-section h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
}

.steps {
    display: grid;
    grid-template-columns: auto auto auto auto auto;
    align-items: center;
    gap: 16px;
}

.step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.step:hover {
    border-color: rgba(108,92,231,0.3);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.step h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.step p { font-size: 0.82rem; color: var(--text2); line-height: 1.5; }

.step-arrow {
    color: #6c5ce7;
    opacity: 0.3;
    display: flex;
    align-items: center;
}

/* Features */
.features-section {
    margin-top: 48px;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    opacity: 0;
    transition: var(--transition);
}

.feature-card:hover::before { opacity: 1; }
.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.card-instagram::before { background: var(--ig-gradient); }
.card-instagram:hover { border-color: rgba(221,42,123,0.3); }
.card-instagram .feature-icon { color: #dd2a7b; }

.card-tiktok::before { background: var(--tt-gradient); }
.card-tiktok:hover { border-color: rgba(255,0,79,0.3); }
.card-tiktok .feature-icon { color: #ff004f; }

.card-kwai::before { background: var(--kwai-gradient); }
.card-kwai:hover { border-color: rgba(255,106,0,0.3); }
.card-kwai .feature-icon { color: #ff6a00; }

.card-facebook::before { background: var(--fb-gradient); }
.card-facebook:hover { border-color: rgba(24,119,242,0.3); }
.card-facebook .feature-icon { color: #1877f2; }

.feature-icon { margin-bottom: 12px; }
.feature-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.feature-card p { font-size: 0.8rem; color: var(--text2); }

/* Footer */
footer {
    text-align: center;
    padding: 32px 0 48px;
    color: var(--text2);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}
footer .disclaimer { opacity: 0.6; margin-top: 4px; font-size: 0.75rem; }

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(20px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: #ff6b6b; color: #ff6b6b; }
.toast.success { border-color: #00b894; color: #00b894; }

/* Responsive */
@media (max-width: 700px) {
    .input-group { flex-direction: column; }
    .btn-primary { justify-content: center; }
    .steps { grid-template-columns: 1fr; }
    .step-arrow { transform: rotate(90deg); justify-content: center; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .result-info { flex-direction: column; }
    .result-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
}

@media (max-width: 500px) {
    header { padding: 32px 0 20px; }
    .card-main { padding: 20px; }
    .tabs { gap: 6px; }
    .tab { padding: 8px 12px; font-size: 0.75rem; }
    .features-grid { grid-template-columns: 1fr; }
}
