:root {
    --bg1: #d7d1ef;
    --bg2: #eef3ff;
    --bg3: #ead8f0;
    --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58));
    --card: rgba(255, 255, 255, 0.66);
    --text: #201f29;
    --muted: #8a8796;
    --border: rgba(255, 255, 255, 0.9);
    --soft-border: rgba(220, 218, 234, 0.8);
    --shadow: 0 24px 80px rgba(132, 124, 170, 0.15);
    --primary: #6f49e8;
    --primary-2: #9a50ff;
    --primary-soft: #efe5ff;
    --success: #137333;
    --surface: #f3efff;
    --danger: #c5221f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 25% 12%, #f5f2ff 0 18%, transparent 36%),
        linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 48%, var(--bg3) 100%);
}

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

.hidden {
    display: none !important;
}

.page-shell {
    position: relative;
    min-height: 100vh;
    padding: 28px;
    overflow: hidden;
}

.blur-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    pointer-events: none;
}

.orb-left {
    width: 320px;
    height: 320px;
    background: #fff;
    left: 12px;
    top: 44px;
}

.orb-right {
    width: 360px;
    height: 360px;
    background: #eadcff;
    right: -40px;
    bottom: -10px;
}

.studio-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) 380px;
    gap: 20px;
    align-items: start;
}

.studio-main {
    display: grid;
    gap: 18px;
}

.glass-panel,
.glass-card,
.workflow-card,
.output-item,
.status-box,
.upload-chip {
    background: var(--panel);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
}

.glass-panel {
    border-radius: 34px;
    padding: 26px;
}

.glass-card {
    border-radius: 30px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.64);
    border-color: var(--soft-border);
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: start;
}

.hero-copy h1,
.screen-title,
.glass-card h3,
.output-head h2,
.workflow-library h3,
.empty-state-panel h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

.hero-copy h1 {
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    margin-top: 4px;
    margin-bottom: 10px;
}

.hero-copy p,
.workflow-library p,
.glass-card p,
.output-head p,
.empty-state-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-stats {
    display: grid;
    gap: 12px;
    min-width: 260px;
}

.stat-card {
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.84);
}

.stat-card strong {
    display: block;
    font-size: 1.5rem;
}

.stat-card span,
.pill-badge,
.mini-label,
.field-wrap span,
.muted,
.empty-output,
.status-box {
    color: var(--muted);
}

.workflow-screen {
    display: grid;
    gap: 18px;
}

.generator-shell {
    display: grid;
    gap: 18px;
}

.screen-title {
    font-size: 2rem;
    text-align: center;
}

.steps {
    width: min(560px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: relative;
    gap: 24px;
}

.steps::before {
    content: '';
    position: absolute;
    left: 48px;
    right: 48px;
    top: 14px;
    height: 8px;
    background: #d3c8f7;
    border-radius: 20px;
}

.step {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #a6a2b1;
    font-size: 0.94rem;
}

.step.active {
    color: #24232b;
}

.dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    background: #c9bff0;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
}

.step.active .dot {
    background: linear-gradient(135deg, #3c00f5, #a049ff);
    box-shadow: 0 10px 24px rgba(80, 32, 216, 0.38);
}

.workflow-hero-card,
.library-head,
.card-head-row,
.output-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.mini-label {
    display: inline-flex;
    margin-bottom: 10px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.pill-badge,
.output-badge {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 0.85rem;
    font-weight: 700;
}

.sticky-head {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 2;
    padding-bottom: 8px;
}

.field-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.select-inline {
    min-width: 240px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #dfdced;
    background: rgba(255, 255, 255, 0.72);
}

.field-wrap {
    display: grid;
    gap: 8px;
}

.text-input,
.generator-field input,
.generator-field textarea,
.generator-field select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 26px;
    border: 1px solid #ddd9ed;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus,
.generator-field input:focus,
.generator-field textarea:focus,
.generator-field select:focus {
    border-color: rgba(111, 73, 232, 0.45);
    box-shadow: 0 0 0 4px rgba(111, 73, 232, 0.12);
}

.compact {
    width: 190px;
}

.compact-select {
    appearance: none;
}

.upload-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 18px;
    border-radius: 26px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.76);
}

.upload-chip input {
    display: none;
}

.file-dropzone {
    position: relative;
    display: grid;
    gap: 4px;
    min-height: 84px;
    padding: 18px 18px;
    border-radius: 24px;
    border: 1.4px dashed rgba(111, 73, 232, 0.28);
    background: rgba(255, 255, 255, 0.74);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.file-dropzone-image {
    min-height: 138px;
    place-items: center;
    text-align: center;
    gap: 8px;
}

.file-dropzone:hover {
    transform: translateY(-1px);
    border-color: rgba(111, 73, 232, 0.42);
}

.file-dropzone.is-dragover {
    border-color: rgba(111, 73, 232, 0.8);
    background: rgba(239, 229, 255, 0.82);
    box-shadow: 0 0 0 5px rgba(111, 73, 232, 0.08);
}

.file-dropzone.has-file {
    border-style: solid;
    border-color: rgba(111, 73, 232, 0.38);
}

.file-dropzone input {
    display: none;
}

.dropzone-title {
    font-weight: 700;
    color: var(--text);
}

.dropzone-icon {
    font-size: 2rem;
    line-height: 1;
}

.file-dropzone-image .dropzone-icon {
    font-size: 3.2rem;
}

.dropzone-subtitle {
    font-size: 0.9rem;
    color: var(--muted);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 0;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
    font-weight: 600;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
}

.button.secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    border: 1px solid rgba(111, 73, 232, 0.18);
}

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

.button.is-active {
    background: rgba(26, 115, 232, 0.16);
}

.button.danger {
    background: rgba(197, 34, 31, 0.1);
    color: var(--danger);
}

.button.large {
    min-height: 54px;
    padding-inline: 22px;
}

.workflow-card {
    min-width: 0;
    max-width: none;
    padding: 18px;
    border-radius: 28px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
    background: rgba(255, 255, 255, 0.72);
}

.workflow-card:hover,
.workflow-card.active {
    border-color: rgba(111, 73, 232, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(111, 73, 232, 0.12);
}

.workflow-card h3 {
    margin: 0 0 8px;
    font-size: 1.08rem;
}

.workflow-card p {
    color: var(--muted);
    margin-bottom: 10px;
}

.workflow-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.workflow-kind,
.workflow-mini-id {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.workflow-kind {
    background: var(--primary-soft);
    color: var(--primary);
}

.kind-image { background: rgba(75, 196, 125, 0.12); color: #238655; }
.kind-video { background: rgba(107, 73, 232, 0.12); color: #6f49e8; }
.kind-mixed { background: rgba(244, 176, 53, 0.16); color: #996b04; }
.kind-nsfw { background: rgba(197, 34, 31, 0.14); color: #b42318; }
.kind-other { background: rgba(109, 114, 128, 0.14); color: #5b6170; }

.workflow-mini-id {
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.84rem;
    color: var(--muted);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-self: flex-start;
}

.workflow-library {
    display: grid;
    gap: 16px;
}

.library-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.library-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1 1 320px;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-pill {
    height: 46px;
    padding: 0 18px;
    border: 1px solid #e0ddea;
    border-radius: 27px;
    background: rgba(255, 255, 255, 0.68);
    font: inherit;
    color: #585660;
    cursor: pointer;
}

.filter-pill.active {
    background: #eee5ff;
    border-color: #bfaaf3;
    color: #694bd0;
}

.workflow-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
    align-content: start;
}

.workflow-strip > * {
    flex: 1 1 300px;
    min-width: 280px;
}

.empty-library {
    min-height: 120px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.45);
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.field-main-row td {
    border-bottom: 0;
}

.field-detail-row td {
    padding-top: 0;
    padding-bottom: 18px;
}

td input,
td textarea,
td select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
}

td textarea {
    min-height: 84px;
    resize: vertical;
}

.field-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.detail-block {
    display: grid;
    gap: 8px;
}

.detail-block span {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.check-cell {
    text-align: center;
}

.empty-table {
    text-align: center;
    color: var(--muted);
    padding: 28px 16px;
}

.generator-form {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.prompt-sections {
    display: grid;
    gap: 18px;
}

.prompt-section {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.44);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.prompt-section-head h4 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.prompt-section-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.prompt-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.generator-field {
    display: grid;
    gap: 8px;
}

.generator-field.field-wide {
    grid-column: 1 / -1;
}

.generator-field small {
    color: var(--muted);
}

.generator-field label {
    font-weight: 600;
    font-size: 1rem;
}

.generate-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

.status-box {
    padding: 14px 16px;
    border-radius: 18px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.7);
}

.status-box.running {
    background: rgba(111, 73, 232, 0.08);
    color: var(--primary);
}

.status-box.completed {
    background: rgba(19, 115, 51, 0.08);
    color: var(--success);
}

.status-box.failed {
    background: rgba(197, 34, 31, 0.08);
    color: var(--danger);
}

.output-view {
    display: grid;
    gap: 16px;
}

.output-view-large {
    min-height: 620px;
    align-content: start;
}

.output-item {
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.78);
}

.output-item img,
.output-item video {
    width: 100%;
    display: block;
    border-radius: 18px;
    background: #edf2ff;
}

.output-link {
    display: inline-flex;
    margin-top: 10px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.studio-output {
    position: sticky;
    top: 28px;
}

.output-shell {
    min-height: calc(100vh - 56px);
}

.empty-state-panel,
.empty-output {
    text-align: center;
    padding: 42px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 50;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    box-shadow: var(--shadow);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(31, 26, 48, 0.38);
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal-card {
    width: min(640px, 100%);
    padding: 24px;
    border-radius: 30px;
    background: var(--panel);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

.modal-head h3 {
    margin: 0;
}

.modal-form {
    display: grid;
    gap: 14px;
}

.modal-dropzone {
    min-height: 120px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 1200px) {
    .studio-layout {
        grid-template-columns: 1fr;
    }

    .hero-panel {
        display: grid;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .studio-output {
        position: static;
    }

    .output-shell {
        min-height: auto;
    }
}

@media (max-width: 820px) {
    .page-shell {
        padding: 18px;
    }

    .glass-panel,
    .glass-card {
        padding: 18px;
        border-radius: 22px;
    }

    .hero-stats,
    .generator-form,
    .field-detail-grid,
    .prompt-section-grid {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .library-head,
    .card-head-row,
    .workflow-hero-card,
    .output-head {
        flex-direction: column;
    }

    .compact {
        width: 100%;
    }

    .modal-backdrop {
        padding: 14px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }
}