:root {
    --bg: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #222222;
    --border: #333333;
    --text: #e0e0e0;
    --text-dim: #888888;
    --accent: #ff3b3b;
    --accent-hover: #ff5555;
    --accent-glow: rgba(255, 59, 59, 0.25);
    --success: #4caf50;
    --error: #ff5252;
    --radius: 12px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 680px;
}

header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
}

.subtitle {
    color: var(--text-dim);
    margin-top: 6px;
    font-size: 14px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.search-box button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.search-box button:hover {
    background: var(--accent-hover);
}

.search-box button:active {
    transform: scale(0.97);
}

.search-box button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-box {
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--error);
    font-size: 14px;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    gap: 0;
}

.preview-left {
    position: relative;
    width: 240px;
    min-width: 240px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    flex-shrink: 0;
}

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

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.preview-right {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.preview-right h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uploader {
    color: var(--text-dim);
    font-size: 13px;
}

.format-section {
    margin-top: auto;
}

.format-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.tab-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-input);
    color: var(--text);
    border-color: var(--text-dim);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.format-section select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.audio-hint {
    color: var(--text-dim);
    font-size: 13px;
    padding: 8px 0;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.download-btn:hover {
    background: var(--accent-hover);
}

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

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

.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-fill.done {
    background: var(--success);
}

.progress-details {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 40px;
}

footer strong {
    color: var(--text);
}

.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .preview-card {
        flex-direction: column;
    }

    .preview-left {
        width: 100%;
        min-width: 100%;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        justify-content: center;
    }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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