:root {
    --bg-0: #fff8ec;
    --bg-1: #f2f7ff;
    --card: #ffffff;
    --line: #d7e0ef;
    --text: #17233a;
    --muted: #55627a;
    --accent: #ea580c;
    --accent-2: #0369a1;
    --ok: #15803d;
    --danger: #be123c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-0), var(--bg-1));
    overflow-x: hidden;
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 10% 10%, rgba(234, 88, 12, 0.15), transparent 35%),
        radial-gradient(circle at 85% 20%, rgba(3, 105, 161, 0.14), transparent 33%),
        radial-gradient(circle at 70% 90%, rgba(15, 118, 110, 0.12), transparent 30%);
}

.container {
    width: min(1140px, calc(100vw - 24px));
    max-width: 1140px;
    margin: 26px auto 40px;
    position: relative;
    z-index: 1;
}

.hero {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 16px;
}

.hero-actions,
.docs-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.docs-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid #0f172a;
    background: #0f172a;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.docs-link-btn:hover {
    opacity: .9;
}

.tag {
    display: inline-block;
    margin: 0 0 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 3.8vw, 44px);
    line-height: 1.1;
}

.sub {
    margin: 10px 0 0;
    color: var(--muted);
}

.status {
    min-width: 180px;
    text-align: center;
    padding: 12px 14px;
    background: #111827;
    color: #fff;
    border-radius: 14px;
    font-size: 14px;
}

.docs-container .status {
    min-width: 132px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 14px;
    margin-bottom: 14px;
}

.grid > * {
    min-width: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.docs-card {
    margin-bottom: 14px;
}

.docs-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-top: 8px;
}

.docs-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.docs-steps {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--text);
}

.docs-steps li {
    margin: 6px 0;
}

.docs-code {
    margin: 0;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #c9d6ea;
    background: #0f172a;
    color: #d8e3f8;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.55;
}

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

.api-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

.api-method.get {
    background: #0f766e;
}

.api-method.post {
    background: #1d4ed8;
}

.api-path {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #1e293b;
}

.hint {
    margin: 0 0 14px;
    color: var(--muted);
}

.queue-note {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.form-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.input-row > * {
    min-width: 0;
}

input[type="url"] {
    flex: 1;
    min-width: 220px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s ease;
}

input[type="url"]:focus {
    border-color: var(--accent-2);
}

select {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 10px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    min-width: 136px;
    outline: none;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

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

button.is-loading {
    position: relative;
    padding-right: 36px;
}

button.is-loading::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-top-color: #ffffff;
    border-radius: 50%;
    transform: translateY(-50%);
    animation: btnSpin .7s linear infinite;
}

@keyframes btnSpin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.preview-card {
    min-height: 350px;
    position: relative;
    overflow: hidden;
}

.preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.preview-head a {
    color: var(--accent-2);
    text-decoration: none;
    font-size: 13px;
}

.preview-head a.disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

#previewFrame {
    width: 100%;
    height: 300px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    opacity: 0;
    transform: translateY(6px);
    transition: all .25s ease;
}

#previewFrame.show {
    opacity: 1;
    transform: translateY(0);
}

.preview-empty {
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 34px;
    text-align: center;
    color: var(--muted);
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.list-card {
    overflow: hidden;
}

.queue-live {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #f8fbff;
}

.queue-live-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.queue-live-head h2 {
    margin: 0;
    font-size: 16px;
}

#queueCount {
    font-size: 12px;
    color: var(--muted);
    background: #e2ecfa;
    border-radius: 999px;
    padding: 3px 8px;
}

.queue-body {
    display: grid;
    gap: 8px;
}

.monitor-box {
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid #d9e4f3;
    background: #f8fbff;
    color: #3b4b63;
    font-size: 12px;
    padding: 8px 10px;
    word-break: break-word;
}

.monitor-box.ok {
    border-color: #bde7cc;
    background: #f0fdf4;
    color: #166534;
}

.monitor-box.warn {
    border-color: #f5d0a8;
    background: #fff7ed;
    color: #9a3412;
}

.monitor-box.err {
    border-color: #f5b5c8;
    background: #fff1f2;
    color: #be123c;
}

.queue-item {
    border: 1px solid #d8e4f8;
    border-radius: 12px;
    padding: 11px 12px;
    background: linear-gradient(135deg, #ffffff 20%, #f8fbff 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.queue-item.running {
    border-color: #b9dcff;
    background: linear-gradient(135deg, #fefeff 20%, #eef8ff 100%);
}

.queue-item.pending {
    border-color: #efd9bc;
    background: linear-gradient(135deg, #fffdf9 20%, #fff6ec 100%);
}

.queue-item.queue-focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2), 0 8px 20px rgba(14, 165, 233, 0.22);
    animation: queuePulse 1.1s ease-in-out 2;
}

@keyframes queuePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.015);
    }
    100% {
        transform: scale(1);
    }
}

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

.queue-host {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-all;
}

.queue-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.queue-badge.running {
    background: #e0f2fe;
    color: #075985;
}

.queue-badge.pending {
    background: #ffedd5;
    color: #9a3412;
}

.queue-meta {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.queue-empty {
    text-align: center;
    padding: 8px 4px;
    color: var(--muted);
    border: 1px dashed #d7e3f4;
    border-radius: 10px;
    background: #fbfdff;
}

.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.pager {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager button {
    padding: 7px 12px;
    border-radius: 10px;
    background: #334155;
    font-size: 13px;
}

#pageInfo {
    font-size: 13px;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    table-layout: fixed;
}

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    vertical-align: top;
}

th {
    font-size: 12px;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
}

.empty {
    color: var(--muted);
    text-align: center;
}

.actions {
    display: flex;
    gap: 8px;
}

.actions a,
.actions button {
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    text-decoration: none;
    color: #fff;
}

.actions .preview-btn {
    background: var(--accent-2);
}

.actions .download-btn {
    background: var(--ok);
}

.engine-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

th:nth-child(1),
td:nth-child(1) {
    width: 220px;
}

th:nth-child(6),
td:nth-child(6) {
    width: 120px;
    white-space: nowrap;
}

.source-cell {
    min-width: 0;
}

.task-id {
    display: block;
    max-width: 100%;
    word-break: break-all;
}

.source-url {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-host {
    display: block;
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
}

.source-host-link {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.source-host-link:hover {
    color: #0b5d57;
}

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

.status.success {
    background: var(--ok);
}

@media (max-width: 920px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-actions,
    .docs-hero-actions {
        width: 100%;
        align-items: stretch;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .input-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .input-row input[type="url"] {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .input-row button {
        grid-column: 1 / -1;
    }

    #previewFrame {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .container {
        width: calc(100vw - 16px);
        margin-top: 14px;
    }

    .card {
        padding: 12px;
        border-radius: 12px;
    }

    .status {
        width: 100%;
        min-width: 0;
    }

    .docs-kv {
        grid-template-columns: 1fr;
    }

    .list-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .pager {
        width: 100%;
        justify-content: space-between;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .input-row select,
    .input-row button,
    .input-row input[type="url"] {
        width: 100%;
        min-width: 0;
    }

    .preview-empty {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 14px;
    }

    .queue-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
