:root {
    --primary-color: #1DA1F2;
    --primary-hover: #0d8bd9;
    --bg-color: #000000;
    --card-bg: #16181c;
    --text-main: #e7e9ea;
    --text-secondary: #71767b;
    --border-color: #2f3336;
    --error-color: #f4212e;
    --success-color: #00ba7c;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.logo svg {
    color: var(--primary-color);
}

.attribution {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
}

.attribution:hover {
    text-decoration: underline;
}

.container {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-section {
    text-align: center;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#urlInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.loader {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.error-message {
    background-color: rgba(244, 33, 46, 0.1);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--error-color);
    text-align: center;
    font-size: 0.9rem;
}

.result-section {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

.video-card h3 {
    margin-bottom: 1rem;
    color: var(--text-main);
}

.video-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1.5rem auto;
    border-radius: 0.5rem;
    overflow: hidden;
    background: black;
}

video {
    width: 100%;
    display: block;
    max-height: 400px;
}

.download-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download {
    background-color: var(--success-color);
    color: black;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.1s;
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.info-section {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.info-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.info-section ul {
    list-style-position: inside;
    color: var(--text-secondary);
    line-height: 1.8;
}

.info-section li strong {
    color: var(--text-main);
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.hidden {
    display: none !important;
}

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

/* Mobile Responsive */
@media (max-width: 600px) {
    .app-header {
        padding: 1rem;
    }
    .logo h1 {
        font-size: 1rem;
    }
    .input-group {
        flex-direction: column;
        padding: 1rem;
    }
    #urlInput {
        text-align: center;
    }
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}