:root {
  --bg: #0e1116; --panel: #161b23; --line: #2a3240; --text: #e6ebf2;
  --muted: #8b96a5; --accent: #756de0; --ok: #3fbf7f; --err: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
header { text-align: center; padding: 28px 16px 8px; }
h1 { margin: 0; font-size: 26px; letter-spacing: 2px; }
.sub { color: var(--muted); margin: 8px 0 0; font-size: 14px; line-height: 1.6; }
.nav-pill { display: inline-block; margin-top: 10px; padding: 6px 14px;
            border: 1px solid var(--line); border-radius: 999px; color: #b4bcff;
            text-decoration: none; font-size: 13px; transition: border-color .15s; }
.nav-pill:hover { border-color: var(--accent); color: var(--text); }
main { flex: 1; display: grid; grid-template-columns: 380px 1fr; gap: 18px;
       padding: 18px; max-width: 1200px; margin: 0 auto; width: 100%; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  header { padding: 20px 14px 6px; }
  h1 { font-size: 23px; }
  .sub { font-size: 13px; }
}
.panel { background: var(--panel); border: 1px solid var(--line);
         border-radius: 14px; padding: 18px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 26px 14px;
        text-align: center; cursor: pointer; transition: border-color .15s; }
.drop.over { border-color: var(--accent); }
.drop p { margin: 0; color: var(--muted); }
.drop small { color: var(--muted); opacity: .7; }
.example-jump { margin: 8px 0 0; text-align: center; }
.example-jump a { color: var(--accent); font-size: 12.5px; text-decoration: none; }
.example-jump a:hover { text-decoration: underline; }
.thumb { max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: 8px; }
label.row { display: flex; justify-content: space-between; color: var(--muted);
            font-size: 13px; margin: 14px 0 6px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.row2 { display: flex; gap: 12px; }
.half { flex: 1; color: var(--muted); font-size: 13px; display: flex;
        flex-direction: column; gap: 6px; }
input[type=number], select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; font-size: 14px;
}
.adv { margin-top: 12px; color: var(--muted); font-size: 13px; }
.adv summary { cursor: pointer; }
.adv input { margin-top: 6px; }
.field-label { display: block; color: var(--muted); font-size: 13px;
               margin: 14px 0 6px; }
.mat-options { display: flex; flex-direction: column; gap: 8px; }
.mat-option { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px;
              background: var(--bg); border: 1px solid var(--line);
              border-radius: 8px; cursor: pointer; }
.mat-option:hover { border-color: var(--accent); }
.mat-option input { width: auto; flex: 0 0 auto; margin: 2px 0 0;
                    accent-color: var(--accent); }
.mat-option span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mat-option b { color: var(--text); font-size: 13px; font-weight: 600; }
.mat-option small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.go { width: 100%; margin-top: 18px; padding: 13px; font-size: 16px; border: none;
      border-radius: 10px; background: var(--accent); color: white; cursor: pointer; }
.go:disabled { opacity: .5; cursor: not-allowed; }
.msg { color: var(--muted); font-size: 13px; min-height: 18px; margin: 10px 0 0; text-align: center; }

/* ── 预览区（v2 参考图风格：上黑蓝→下蓝紫纵向渐变，无地面无阴影）── */
.viewer { position: relative; height: 520px; border-radius: 10px;
          background: linear-gradient(180deg, #090910 0%, #393765 50%, #756de0 100%);
          display: flex; align-items: center; justify-content: center;
          overflow: hidden; }
.viewer-panel { min-width: 0; }
.viewer-panel:fullscreen { display: flex; flex-direction: column; gap: 0;
                           background: #101019; padding: 12px; }
.viewer-panel:fullscreen .viewer { flex: 1 1 auto; min-height: 0; height: auto; border-radius: 0; }
.viewer-panel:fullscreen .actions { flex: 0 0 auto; }
.viewer-panel:fullscreen .examples-wrap { display: none; }
.viewer canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.viewer .placeholder { color: rgba(230, 235, 242, .75); font-size: 14px; }
@media (max-width: 640px) { .viewer { height: 360px; } }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
           gap: 10px; margin-top: 14px; }
.ghost { padding: 10px; background: transparent; color: var(--text);
         border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
         font-size: 14px; white-space: nowrap; }
.ghost:disabled { opacity: .4; cursor: not-allowed; }
.ghost:hover:not(:disabled) { border-color: var(--accent); }
.ghost.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── 示例区 ── */
.examples-wrap { margin-top: 16px; }
.examples-title { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.examples { display: flex; gap: 12px; }
.example-card {
  flex: 1; max-width: 160px; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.example-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.example-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.example-card span { color: var(--muted); font-size: 12px; padding: 7px 10px;
                     text-align: left; }
@media (max-width: 560px) { .examples { flex-wrap: wrap; } .example-card { min-width: 40%; } }

.gate { position: fixed; inset: 0; background: rgba(10, 12, 16, .92);
        display: flex; align-items: center; justify-content: center; z-index: 10; }
.gate-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
            padding: 28px; width: 320px; text-align: center; }
.gate-box h2 { margin: 0 0 14px; font-size: 18px; }
.gate-box input { width: 100%; padding: 10px 12px; border-radius: 8px;
                  border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.gate-box button { width: 100%; margin-top: 12px; padding: 10px; border: none;
                   border-radius: 8px; background: var(--accent); color: white; cursor: pointer; }
.hidden { display: none !important; }
.hint { color: var(--muted); }

/* 最近任务（1020）：刷新后仍可点开已完成/进行中任务 */
.recent { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.recent-head { display: flex; justify-content: space-between; align-items: center;
               color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.link-btn { background: none; border: none; color: var(--accent);
            font-size: 12px; cursor: pointer; padding: 2px 4px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.recent-hint { color: var(--muted); font-size: 11px; text-align: center;
               margin: 6px 0 0; opacity: .8; }
.recent-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto;
               align-items: center; column-gap: 8px; width: 100%;
               background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
               padding: 7px 9px; color: var(--text); font-size: 12px; cursor: pointer;
               text-align: left; }
.recent-item:hover { border-color: var(--accent); }
.recent-item .t { color: var(--muted); font-variant-numeric: tabular-nums;
                   text-align: right; }
.recent-item .st { min-width: 0; overflow: hidden; text-overflow: ellipsis;
                     white-space: nowrap; }
.recent-item .badge { font-size: 11px; padding: 1px 7px; border-radius: 999px;
                      background: #232838; color: var(--muted); }
.recent-item .badge.ok { color: #7fe2a0; }
.recent-item .badge.run { color: #e6d27a; }
.recent-item .badge.err { color: #ff9aa5; }
.recent-list .muted { color: var(--muted); font-size: 12px; margin: 0; }
