:root {
    --bg: #09090b;
    --card: #0c0c0f;
    --border: #1f1f23;
    --text: #fafafa;
    --text-muted: #71717a;
    --accent: #a855f7;
    --accent-dim: rgba(168, 85, 247, 0.15);
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
}

.noise {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.grid-bg {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(168, 85, 247, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(168, 85, 247, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 20px 50px -12px rgba(0, 0, 0, 0.5);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--accent-dim);
    border-radius: 10px;
    color: var(--accent);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.format-toggle {
    display: flex;
    gap: 0.5rem;
}

.input-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea.error {
    border-color: var(--error);
    animation: shake 0.3s;
}

@keyframes shake {
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
}

.format-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.format-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.format-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.add-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -8px var(--accent);
}

.add-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.status-msg {
    min-height: 1.2em;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.status-msg.error {
    color: var(--error);
}

.status-msg.success {
    color: var(--success);
}

.queue-section {
    display: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.download-all-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.download-all-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

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

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.queue-item.loading {
    opacity: 0.7;
}

.queue-thumb {
    width: 64px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--border);
}

.queue-info {
    flex: 1;
    min-width: 0;
}

.queue-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-channel {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.queue-status.success {
    color: var(--success);
}

.queue-status.error {
    color: var(--error);
}

.queue-actions {
    display: flex;
    gap: 0.375rem;
}

.queue-download-btn,
.queue-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.queue-download-btn:hover:not(:disabled) {
    border-color: var(--success);
    color: var(--success);
}

.queue-remove-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

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

.features {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.feature svg {
    opacity: 0.7;
}

footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

@media (max-width: 480px) {
    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .features {
        gap: 1rem;
    }

    .queue-thumb {
        width: 48px;
        height: 27px;
    }
}
