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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: #ff0000;
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
}

header p {
    opacity: 0.9;
    margin-top: 8px;
}

main {
    padding: 30px;
}

.input-section {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group input[type="url"] {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input[type="url"]:focus {
    outline: none;
    border-color: #ff0000;
}

.input-group button {
    padding: 14px 28px;
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.input-group button:hover {
    background: #cc0000;
}

.input-group button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
}

.setting-group select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    border-color: #ff0000;
}

.setting-group .default-badge {
    font-size: 0.75rem;
    color: #ff0000;
    font-weight: 600;
}

.lang-display {
    padding: 10px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    color: #333;
}

.video-section {
    display: none;
}

.video-section.active {
    display: block;
}

.video-info {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.video-thumbnail {
    flex-shrink: 0;
    width: 240px;
    height: 135px;
    border-radius: 8px;
    object-fit: cover;
}

.video-meta h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #333;
}

.video-meta .meta {
    display: flex;
    gap: 16px;
    color: #666;
    font-size: 0.875rem;
}

.video-player {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-player video {
    width: 100%;
    height: 100%;
}

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

.actions button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #ff0000;
    color: white;
}

.btn-primary:hover {
    background: #cc0000;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    display: none;
    background: #fff0f0;
    border: 1px solid #ffcccc;
    color: #cc0000;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.error.active {
    display: block;
}

.downloading {
    display: none;
    text-align: center;
    padding: 40px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.downloading.active {
    display: block;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    margin: 16px auto 0;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #ff0000;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.format-info {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
    }

    .video-info {
        flex-direction: column;
    }

    .video-thumbnail {
        width: 100%;
        height: auto;
    }
}
.quality-badge {
    background: #ff0000;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.quality-badge:empty {
    display: none;
}