:root {
    --bg: #0b1020;
    --panel: rgba(255, 255, 255, .06);
    --panel2: rgba(255, 255, 255, .08);
    --text: rgba(255, 255, 255, .92);
    --muted: rgba(255, 255, 255, .65);
    --border: rgba(255, 255, 255, .12);
    --accent: #7c5cff;
    --accent2: #35d0ff;
    --danger: #ff4d6d;
    --ok: #36d399;
    --shadow: 0 10px 35px rgba(0, 0, 0, .35);
    --radius: 18px;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    color: var(--text);
    background: radial-gradient(900px 500px at 20% 10%, rgba(124, 92, 255, .35), transparent 60%), radial-gradient(700px 450px at 80% 20%, rgba(53, 208, 255, .25), transparent 60%), radial-gradient(900px 650px at 50% 120%, rgba(54, 211, 153, .12), transparent 55%), var(--bg);
    min-height: 100vh;
}

header {
    padding: 26px 20px 8px;
    max-width: 1200px;
    margin: 0 auto;
}

.title-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: .2px;
}

.subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.35;
    max-width: 980px;
}

.pill {
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

.scenario-bar {
    max-width: 1200px;
    margin: 12px auto 0;
    padding: 0 20px;
}

.scenario-bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.scenario-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.scenario-label {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.scenario-input {
    width: 200px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .22);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.scenario-input:focus {
    border-color: rgba(53, 208, 255, .65);
    box-shadow: 0 0 0 3px rgba(53, 208, 255, .14);
}

.scenario-select {
    min-width: 220px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .22);
    color: var(--text);
    outline: none;
    font-size: 13px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.6)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.scenario-select:focus {
    border-color: rgba(53, 208, 255, .65);
    box-shadow: 0 0 0 3px rgba(53, 208, 255, .14);
}

.scenario-select option {
    background: #1a1a2e;
    color: var(--text);
}

.scenario-link {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(54, 211, 153, .45);
    background: rgba(54, 211, 153, .10);
    color: var(--ok);
    font-weight: 700;
    font-size: 12.5px;
    text-decoration: none;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    transition: all .15s ease;
    white-space: nowrap;
}

.scenario-link:hover {
    border-color: rgba(54, 211, 153, .75);
    background: rgba(54, 211, 153, .20);
    color: #fff;
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 26px;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
}

@media (max-width: 980px) {
    .wrap {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card:first-child {
    position: sticky;
    top: 16px;
    align-self: flex-start;
    z-index: 10;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
}

.card-header .h {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .3px;
}

.card-header .small {
    color: var(--muted);
    font-size: 12px;
}

.card-body {
    padding: 14px;
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    padding: 10px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: grab;
    user-select: none;
    transition: transform .08s ease, border-color .15s ease, background .15s ease;
}

.action-item:hover {
    border-color: rgba(124, 92, 255, .45);
    background: rgba(124, 92, 255, .10);
}

.action-item:active {
    cursor: grabbing;
    transform: scale(.995);
}

.action-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .10);
    flex: 0 0 auto;
}

.action-name {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-meta {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
}

.dropzone {
    border: 1px dashed rgba(255, 255, 255, .22);
    border-radius: var(--radius);
    padding: 14px;
    min-height: 240px;
    background: rgba(255, 255, 255, .03);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dropzone.dragover {
    border-color: rgba(53, 208, 255, .75);
    background: rgba(53, 208, 255, .08);
}

.hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    padding: 10px 0 0;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, .04);
    overflow: hidden;
}

.step.dragging {
    opacity: .55;
}

.step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .03);
}

.step-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.grab {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .03);
    cursor: grab;
    user-select: none;
}

.grab:active {
    cursor: grabbing;
}

.step-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.step-title b {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-title span {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn {
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    transition: transform .08s ease, border-color .15s ease, background .15s ease;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.btn:hover {
    border-color: rgba(124, 92, 255, .55);
    background: rgba(124, 92, 255, .14);
}

.btn:active {
    transform: scale(.99);
}

.btn.primary {
    border-color: rgba(124, 92, 255, .75);
    background: linear-gradient(180deg, rgba(124, 92, 255, .32), rgba(124, 92, 255, .18));
}

.btn.primary:hover {
    border-color: rgba(53, 208, 255, .65);
    background: linear-gradient(180deg, rgba(53, 208, 255, .28), rgba(124, 92, 255, .18));
}

.btn.danger:hover {
    border-color: rgba(255, 77, 109, .65);
    background: rgba(255, 77, 109, .16);
}

.step-body {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 980px) {
    .step-body {
        grid-template-columns: 1fr;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 11.5px;
    color: var(--muted);
}

input[type="text"] {
    width: 100%;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .22);
    color: var(--text);
    outline: none;
}

input[type="text"]:focus {
    border-color: rgba(53, 208, 255, .65);
    box-shadow: 0 0 0 3px rgba(53, 208, 255, .14);
}

.field-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.field-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.api-toggle {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    transition: all .15s ease;
    padding: 0;
}

.api-toggle:hover {
    border-color: rgba(53, 208, 255, .45);
    background: rgba(53, 208, 255, .08);
}

.api-toggle.active {
    border-color: rgba(53, 208, 255, .75);
    background: rgba(53, 208, 255, .18);
    color: var(--text);
    box-shadow: 0 0 8px rgba(53, 208, 255, .25);
}

input[type="text"].api-input {
    border-color: rgba(53, 208, 255, .45);
    background: rgba(53, 208, 255, .06);
}

.footer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
}

.left-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.codebox {
    margin-top: 10px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .14);
    overflow: hidden;
}

.codebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.codebar .muted {
    font-size: 12px;
    color: var(--muted);
}

pre {
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, .28);
    overflow: auto;
    max-height: 340px;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .90);
    white-space: pre;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .6);
    border: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .92);
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .85);
    font-size: 12px;
}