.search-box-wrapper {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}
.search-box {
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.5rem;
    transition: 0.3s;
    box-shadow: var(--shadow);
}
.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(254, 44, 85, 0.2);
}
.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-main);
    font-size: 1.1rem;
    outline: none;
    min-width: 0;
}
.btn-downloader {
    border-radius: 50px;
    padding: 0 2.5rem;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}
.btn-downloader:hover {
    opacity: 0.9;
    transform: scale(1.02);
}
#error-msg {
    color: #ff4d4d;
    text-align: center;
    margin-top: 1rem;
    display: none;
    font-size: 0.9rem;
}
#loader {
    display: none;
    text-align: center;
    padding: 2rem;
}
.spinner {
    width: 60px;
    height: 30px;
    margin: 0 auto 1.5rem;
    position: relative;
    border: none !important;
    animation: none !important;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.spinner::before {
    background: #20D5EC;
    left: 4px;
    animation: tiktok-move-1 0.8s infinite ease-in-out;
}

.spinner::after {
    background: #FE2C55;
    left: 4px;
    animation: tiktok-move-2 0.8s infinite ease-in-out;
}

@keyframes tiktok-move-1 {
    0%, 100% { transform: translateX(0) scale(1); z-index: 2; }
    50% { transform: translateX(24px) scale(0.85); z-index: 1; }
}

@keyframes tiktok-move-2 {
    0%, 100% { transform: translateX(24px) scale(1); z-index: 2; }
    50% { transform: translateX(0) scale(0.85); z-index: 1; }
}

#result {
    display: none;
    grid-template-columns: 350px 1fr;
    gap: 2.5rem;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}
.result-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 9/16;
    background: #000;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}
.result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.author-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.author-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.author-info img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}
#author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}
#author-id {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}
.result-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#vid-title {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-item {
    background: rgba(255,255,255,0.03);
    padding: 1.2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--glass-border);
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    letter-spacing: 0.5px;
}
.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}
.download-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


@media (max-width: 992px) {
    #result {
        grid-template-columns: 300px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .tool-card {
        padding: 1.5rem;
    }
    .search-box {
        flex-direction: column;
        border-radius: 15px;
        padding: 0.5rem;
    }
    .btn-downloader {
        width: 100%;
        padding: 1rem;
        border-radius: 10px;
        justify-content: center;
    }
    #result {
        display: none; /* Controlled by JS, but will be flex when active on mobile */
        grid-template-columns: 1fr;
        flex-direction: column;
        gap: 2rem;
    }
    #result[style*="display: grid"],
    #result[style*="display: flex"] {
        display: flex !important;
    }
    .result-preview {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        min-height: 400px; /* Fallback for aspect-ratio */
    }
    #vid-title {
        text-align: center;
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }
    .stats-grid {
        gap: 0.75rem;
    }
    .stat-item {
        padding: 1rem;
    }
}
