:root {
    --bg: #090a0f;
    --panel: rgba(18, 20, 29, .88);
    --panel-2: #151823;
    --border: rgba(255,255,255,.09);
    --text: #f4f5fa;
    --muted: #979cad;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    --shadow: 0 24px 80px rgba(0,0,0,.32);
}

* { box-sizing: border-box; }
.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.nav-link {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 750;
    background: rgba(255,255,255,.025);
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
    border-color: rgba(139,92,246,.45);
    background: rgba(139,92,246,.12);
}

.nav-logout { margin-left: auto; color: #fda4af; }


body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 0%, rgba(139,92,246,.22), transparent 34%),
        radial-gradient(circle at 90% 12%, rgba(34,211,238,.12), transparent 28%),
        var(--bg);
}

button, input, textarea, select { font: inherit; }

button { cursor: pointer; }

code {
    padding: .12rem .35rem;
    border-radius: .35rem;
    background: rgba(255,255,255,.08);
}

.app-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 50px;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-2);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.35rem, 7vw, 5.6rem);
    line-height: .92;
    letter-spacing: -.06em;
}

h1 span {
    background: linear-gradient(90deg, #a78bfa, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-copy {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

.status-pill {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,.04);
    color: var(--muted);
    font-size: .82rem;
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 16px currentColor;
}

.status-pill.ok .dot { background: var(--success); }
.status-pill.error .dot { background: var(--danger); }

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(340px, .8fr);
    gap: 22px;
    align-items: start;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.controls { padding: 26px; }

.queue-panel {
    position: sticky;
    top: 18px;
    padding: 22px;
    max-height: calc(100vh - 36px);
    overflow: auto;
}

.gallery-panel {
    margin-top: 22px;
    padding: 24px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-heading > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.02rem;
}

.step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #ddd6fe;
    background: rgba(139,92,246,.16);
    font-size: .72rem;
    font-weight: 800;
}

.spacing-top { margin-top: 30px; }

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 5px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.025);
}

.segmented input { display: none; }

.segmented span {
    display: block;
    padding: 11px;
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
    font-size: .88rem;
    font-weight: 700;
    transition: .2s ease;
}

.segmented input:checked + span {
    color: var(--text);
    background: rgba(139,92,246,.2);
}

.upload-zone {
    min-height: 158px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 22px;
    border: 1px dashed rgba(167,139,250,.45);
    border-radius: 16px;
    background: rgba(139,92,246,.045);
    text-align: center;
    transition: .2s ease;
}

.upload-zone:hover,
.upload-zone.dragging {
    border-color: var(--accent-2);
    background: rgba(34,211,238,.06);
}

.upload-zone input { display: none; }
.upload-zone small, .field small { color: var(--muted); }

.upload-icon {
    font-size: 1.8rem;
    color: #c4b5fd;
}

.preview-wrap {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 13px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.025);
}

.preview-wrap img {
    width: 90px;
    height: 112px;
    border-radius: 10px;
    object-fit: cover;
}

.preview-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.preview-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-meta span {
    color: var(--muted);
    font-size: .83rem;
}

.or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: #71778a;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.or::before, .or::after {
    content: "";
    height: 1px;
    background: var(--border);
    flex: 1;
}

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

.field > span {
    font-size: .85rem;
    font-weight: 700;
}

input[type="text"], input[type="url"], textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: rgba(255,255,255,.035);
    color: var(--text);
    padding: 12px 13px;
    transition: .2s ease;
}

textarea { resize: vertical; min-height: 112px; }

select option { background: #151823; }

input:focus, textarea:focus, select:focus {
    border-color: rgba(139,92,246,.8);
    box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0;
}

.info-box {
    margin-top: 12px;
    padding: 12px 13px;
    border: 1px solid rgba(34,211,238,.14);
    border-radius: 12px;
    background: rgba(34,211,238,.055);
    color: #b9c2d2;
    font-size: .82rem;
    line-height: 1.5;
}

.styles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 9px;
}

.style-card input { display: none; }

.style-card span {
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255,255,255,.02);
    transition: .18s ease;
}

.style-card strong { font-size: .82rem; }
.style-card small { color: var(--muted); font-size: .7rem; }

.style-card input:checked + span {
    border-color: rgba(139,92,246,.72);
    background: rgba(139,92,246,.13);
    box-shadow: inset 0 0 0 1px rgba(139,92,246,.14);
}

.primary-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 22px;
    padding: 15px 18px;
    border: 0;
    border-radius: 14px;
    color: white;
    background: linear-gradient(90deg, #7c3aed, #0891b2);
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(124,58,237,.2);
}

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

.button-note {
    margin: 9px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: .74rem;
}

.link-btn {
    padding: 5px 7px;
    border: 0;
    color: #c4b5fd;
    background: transparent;
    font-size: .77rem;
}

.link-btn.danger { color: #fda4af; }

.mini-actions { display: flex; gap: 5px; }

.queue-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.queue-summary div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.queue-summary strong { font-size: 1rem; }
.queue-summary span { color: var(--muted); font-size: .65rem; }

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.queue-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.025);
}

.queue-row {
    display: flex;
    justify-content: space-between;
    gap: 9px;
    align-items: center;
}

.queue-title {
    min-width: 0;
    font-size: .82rem;
    font-weight: 750;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.badge {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255,255,255,.055);
    font-size: .65rem;
}

.badge.running { color: #fde68a; background: rgba(251,191,36,.1); }
.badge.done { color: #a7f3d0; background: rgba(52,211,153,.1); }
.badge.error { color: #fecdd3; background: rgba(251,113,133,.1); }

.progress {
    height: 6px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
}

.progress > span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #22d3ee);
    transition: width .35s ease;
}

.queue-sub {
    margin-top: 7px;
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.35;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.video-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel-2);
}

.video-card video {
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 500px;
    background: #000;
    object-fit: cover;
}

.video-card-body { padding: 12px; }

.video-card h3 {
    margin: 0 0 5px;
    font-size: .9rem;
}

.video-card p {
    margin: 0;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.4;
}

.video-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.video-actions a {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    text-align: center;
    font-size: .72rem;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 28px 14px;
    color: var(--muted);
    text-align: center;
}

.empty-state span { font-size: 1.65rem; }
.empty-state p { margin: 7px 0 0; font-size: .82rem; }

.toast-stack {
    position: fixed;
    z-index: 30;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100% - 36px));
}

.toast {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #171a24;
    box-shadow: 0 14px 40px rgba(0,0,0,.35);
    font-size: .82rem;
    animation: slideIn .18s ease;
}

.toast.error { border-color: rgba(251,113,133,.35); }
.toast.success { border-color: rgba(52,211,153,.35); }

.hidden { display: none !important; }

footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 4px 0;
    color: #686d7e;
    font-size: .72rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .queue-panel { position: static; max-height: none; }
}

@media (max-width: 700px) {
    .app-shell { width: min(100% - 18px, 1440px); padding-top: 18px; }
    .hero { flex-direction: column; }
    .controls, .queue-panel, .gallery-panel { padding: 17px; border-radius: 17px; }
    .styles-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .gallery { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    footer { flex-direction: column; }
}
