:root {
    --bg:       #080a12;
    --panel:    rgba(18, 22, 38, 0.74);
    --panel-2:  rgba(10, 14, 26, 0.92);
    --line:     rgba(140, 160, 210, 0.16);
    --line-2:   rgba(140, 160, 210, 0.32);
    --text:     #e2e8fb;
    --muted:    #8794bb;
    --faint:    #5a6688;
    --accent:   #d8405e;
    --accent-2: #7a5cff;
    --gold:     #e9c46a;
    --ok:       #6ee7b7;
    --radius:   16px;
    --shadow:   0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    position: relative;
    padding: 28px clamp(14px, 4vw, 56px) 60px;
    overflow-x: hidden;
}

.bg-glow {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(680px 460px at 8% -8%, rgba(216, 64, 94, 0.22), transparent 62%),
        radial-gradient(620px 440px at 98% 4%, rgba(122, 92, 255, 0.22), transparent 60%),
        radial-gradient(700px 500px at 50% 120%, rgba(233, 196, 106, 0.08), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- 头部 ---------- */
.site-header {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px; flex-wrap: wrap; margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: 15px;
    font-weight: 800; font-size: 17px; letter-spacing: 1px;
    color: #12060c;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    box-shadow: 0 10px 30px rgba(216, 64, 94, 0.32);
}
.brand h1 { margin: 0; font-size: clamp(18px, 2.4vw, 25px); letter-spacing: .5px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; letter-spacing: .5px; }

.sys-status {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    font-size: 12.5px; color: var(--muted);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot-wait { background: var(--gold); animation: pulse 1.4s infinite; }
.dot-ok   { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot-bad  { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- 布局 ---------- */
.layout {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas:
        "console results"
        "archive results";
    gap: 22px; align-items: start;
}
.console { grid-area: console; }
.results { grid-area: results; min-height: 440px; }
.archive { grid-area: archive; }
@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; grid-template-areas: "console" "results" "archive"; }
}

/* ---------- 面板 ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}
.panel-title {
    margin: 0 0 16px; font-size: 14px; font-weight: 700;
    letter-spacing: 2px; color: var(--accent); text-transform: uppercase;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head .panel-title { margin: 0; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: .4px;
}
.hint { color: var(--faint); font-size: 11px; }

select, input[type="text"], input[type="number"] {
    width: 100%; padding: 11px 12px;
    font-size: 14px; color: var(--text);
    background: rgba(8, 11, 22, 0.85);
    border: 1px solid var(--line-2);
    border-radius: 10px; outline: none;
    font-family: inherit;
    transition: border-color .18s, box-shadow .18s;
}
select:focus, input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216, 64, 94, 0.16);
}
select option { background: #0b1020; color: var(--text); }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg {
    padding: 9px 0; font-size: 13px; font-family: inherit;
    color: var(--muted); background: rgba(8, 11, 22, 0.85);
    border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer;
    transition: all .16s;
}
.seg:hover { color: var(--text); border-color: var(--accent); }
.seg.is-active {
    color: #12060c; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-color: transparent;
}

.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper input { text-align: center; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step {
    width: 44px; border: 1px solid var(--line-2);
    background: rgba(8, 11, 22, 0.85); color: var(--text);
    border-radius: 10px; font-size: 17px; cursor: pointer;
    transition: background .18s, border-color .18s;
}
.step:hover { background: rgba(216, 64, 94, 0.14); border-color: var(--accent); }

/* ---------- 按钮 ---------- */
.btn {
    font-family: inherit; font-size: 14px; border-radius: 11px;
    border: 1px solid transparent; cursor: pointer; padding: 11px 16px;
    color: var(--text);
    transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary {
    font-weight: 700; color: #14060a;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    box-shadow: 0 10px 26px rgba(216, 64, 94, 0.26);
}
.btn-primary:hover { box-shadow: 0 14px 32px rgba(233, 196, 106, 0.36); }
.btn-primary[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn-glyph { font-size: 15px; }

.console-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.mini-stat { text-align: center; }
.mini-stat span { display: block; font-size: 22px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.mini-stat em { font-style: normal; font-size: 11.5px; color: var(--faint); }

/* ---------- 候选 ID ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 92px; padding: 13px 16px 11px;
    border: 1px solid var(--line-2);
    border-radius: 13px;
    background: linear-gradient(160deg, rgba(24, 28, 48, 0.95), rgba(10, 13, 26, 0.95));
    cursor: pointer;
    animation: chipIn .3s ease both;
    transition: border-color .18s, transform .18s, box-shadow .18s;
}
.chip:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.chip[data-len="2"] { border-left: 3px solid var(--gold); }
.chip[data-len="3"] { border-left: 3px solid var(--accent); }
.chip[data-len="4"] { border-left: 3px solid var(--accent-2); }

@keyframes chipIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chip-name { font-size: 20px; font-weight: 800; letter-spacing: 3px; line-height: 1.15; }
.chip-meta { font-size: 10.5px; color: var(--faint); letter-spacing: .3px; }
.chip-fav {
    position: absolute; top: 5px; right: 7px;
    font-size: 12px; color: var(--faint);
    opacity: 0; transition: opacity .15s, color .15s;
}
.chip:hover .chip-fav { opacity: 1; }
.chip.is-fav .chip-fav { opacity: 1; color: var(--gold); }

/* ---------- 提示词 ---------- */
.prompt-box { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.prompt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.prompt-head h3 { margin: 0; font-size: 13px; letter-spacing: 1px; color: var(--gold); }
.prompt-note { margin: 0 0 10px; font-size: 11.5px; color: var(--faint); }
#promptText {
    width: 100%; min-height: 210px; resize: vertical;
    padding: 13px 14px;
    font-family: "SFMono-Regular", Consolas, "PingFang SC", monospace;
    font-size: 12.5px; line-height: 1.7;
    color: #cbd5f0;
    background: rgba(6, 9, 18, 0.9);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    outline: none;
}
#promptText:focus { border-color: var(--gold); }

/* ---------- 收藏 ---------- */
.archive-note { margin: -6px 0 14px; font-size: 11.5px; color: var(--faint); }
.archive-list { display: grid; gap: 8px; max-height: 460px; overflow-y: auto; }
.archive-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 11px; background: rgba(8, 11, 22, 0.6);
}
.archive-item .a-name { flex: 1; font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.archive-item .a-meta { font-size: 11px; color: var(--faint); }
.archive-item .a-del {
    border: 1px solid var(--line-2); background: transparent; color: var(--muted);
    border-radius: 8px; padding: 5px 9px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.archive-item .a-del:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 空状态 / 页脚 / 提示 ---------- */
.empty { text-align: center; padding: 54px 20px; color: var(--faint); }
.empty.small { padding: 22px 10px; }
.empty-glyph { font-size: 40px; color: var(--line-2); margin-bottom: 10px; }
.empty p { margin: 0 0 6px; font-size: 15px; color: var(--muted); }
.empty span { font-size: 12.5px; }

.site-footer {
    position: relative; z-index: 1; margin-top: 34px; text-align: center;
    font-size: 12px; color: var(--faint); letter-spacing: .5px;
}
.toast {
    position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 24px);
    background: var(--panel-2); border: 1px solid var(--gold); color: var(--text);
    padding: 12px 22px; border-radius: 12px; font-size: 13.5px;
    box-shadow: var(--shadow); opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--accent); }
