:root {
    --bg: #0b0f17;
    --surface: #141b27;
    --surface-2: #1c2536;
    --border: #26314a;
    --text: #e7ecf5;
    --muted: #8b98b0;
    --accent: #5b8cff;
    --accent-hover: #6f9bff;
    --danger: #ff6b6b;
    --success: #4ade80;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 50% -200px, #17203300, #0b0f17), var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.shell {
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 20px 64px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0 0 20px;
    color: var(--muted);
}

.platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.platforms li {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    transition: color .15s, border-color .15s, background .15s;
}

.platforms li.active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(91, 140, 255, .12);
}

.url-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.url-form input {
    flex: 1 1 320px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
}

.url-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, .18);
}

button {
    cursor: pointer;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 20px;
    transition: background .15s, border-color .15s, opacity .15s;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

button.primary {
    background: var(--accent);
    color: #0b0f17;
}

button.primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

button.ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

button.ghost:hover:not(:disabled) {
    border-color: var(--accent);
}

.error {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 107, 107, .4);
    background: rgba(255, 107, 107, .1);
    color: #ffc9c9;
}

.card {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.preview {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
}

.thumb-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-2);
}

.thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chip {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(91, 140, 255, .15);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.title {
    margin: 0 0 6px;
    font-size: 19px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.muted {
    margin: 2px 0;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.save-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 13px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.field select {
    min-width: 200px;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 15px;
    padding-bottom: 12px;
}

.jobs {
    margin-top: 40px;
}

.section-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.job-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.job-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.job-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.status.queued,
.status.downloading,
.status.cancelling,
.status.saving {
    color: var(--accent);
}

.status.completed,
.status.saved {
    color: var(--success);
}

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

.bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #8ab4ff);
    transition: width .25s ease;
}

.job-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.job-foot a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.job-foot a:hover {
    text-decoration: underline;
}

.job-foot button {
    padding: 6px 12px;
    font-size: 13px;
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.job-foot button:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

.job-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.job-error {
    margin: 8px 0 0;
    color: #ffc9c9;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.footer {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 640px) {
    .preview {
        grid-template-columns: 1fr;
    }

    .actions {
        align-items: stretch;
    }

    .field select {
        width: 100%;
    }
}
