:root {
  --paper: #f6f8fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --volt: #2563eb;
  --volt-deep: #1d4ed8;
  --volt-soft: #eff6ff;
  --ok: #059669;
  --bad: #dc2626;
  --warn: #d97706;
  --sunk: #f1f5f9;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 12% -8%, #e8f0ff 0%, rgba(232,240,255,0) 62%),
    radial-gradient(700px 380px at 88% 0%, #f0f7ff 0%, rgba(240,247,255,0) 60%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}
a { color: var(--volt); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 18px;
  height: 58px; display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 12px rgba(37,99,235,.28);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px; border: 2px solid #fff; border-radius: 3px;
  border-right-color: transparent; border-bottom-color: transparent; transform: rotate(-45deg);
}
.brand small { font-weight: 500; color: var(--ink-faint); font-size: 12px; letter-spacing: 0; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  font-size: 13px; color: var(--ink-soft); padding: 7px 12px; border-radius: 8px;
  border: 1px solid transparent; white-space: nowrap;
}
.nav a:hover { background: var(--volt-soft); color: var(--volt-deep); text-decoration: none; }
.nav a.on { background: var(--volt-soft); color: var(--volt-deep); border-color: #dbeafe; font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 18px 70px; }
.page-head { margin: 0 0 18px; }
.page-head h1 { font-size: 21px; margin: 0 0 5px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--ink-faint); font-size: 13px; }

/* ---------- panels ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 26px -18px rgba(15,23,42,.18);
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }

.label-xs { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); font-weight: 600; }

/* ---------- form ---------- */
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.field { margin-bottom: 12px; }
.field > .label-xs { display: block; margin-bottom: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { min-width: 0; }
.grow { flex: 1 1 180px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: 9px 15px; border: 1px solid var(--volt);
  background: var(--volt); color: #fff; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--volt-deep); border-color: var(--volt-deep); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); border-color: #cbd5e1; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }

.hint { font-size: 12px; color: var(--ink-faint); margin-top: 7px; line-height: 1.6; }
.kbd {
  font-family: var(--mono); font-size: 11.5px; background: var(--sunk); color: var(--volt-deep);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
}
.msg { font-size: 12.5px; margin-top: 10px; padding: 9px 11px; border-radius: 9px; display: none; }
.msg.on { display: block; }
.msg.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.msg.bad { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- gate ---------- */
.gate { max-width: 470px; margin: 40px auto; }
.gate .panel-body { padding: 26px 24px; }
.gate h2 { margin: 0 0 6px; font-size: 17px; }
.gate p.sub { margin: 0 0 18px; color: var(--ink-faint); font-size: 13px; }
.gate input[type=text], .gate input[type=password] { font-family: var(--mono); letter-spacing: .04em; }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, #fff, #f8fbff);
  border: 1px solid var(--line); border-left: 3px solid var(--volt);
  border-radius: 12px; padding: 11px 15px; margin-bottom: 16px;
  font-size: 12.5px; color: var(--ink-soft);
}
.statusbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(5,150,105,.15); }
.statusbar b { color: var(--ink); font-weight: 650; }
.countdown { font-family: var(--mono); font-size: 13px; color: var(--volt-deep); font-weight: 600; letter-spacing: .01em; }
.countdown.low { color: var(--warn); }

/* ---------- editor / console ---------- */
.editor-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.editor-bar select { width: auto; min-width: 108px; }
.editor-bar input[type=text] { width: 160px; font-family: var(--mono); font-size: 12.5px; }
.code-area {
  width: 100%; min-height: 190px; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.65; background: #fbfdff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; color: #0f172a; tab-size: 2;
}
.console {
  margin-top: 12px; background: #0b1220; border-radius: 11px; overflow: hidden;
  border: 1px solid #16233d;
}
.console-head {
  display: flex; align-items: center; gap: 9px; padding: 8px 13px;
  background: #0f1a2e; color: #94a3b8; font-size: 11.5px; font-family: var(--mono);
  border-bottom: 1px solid #16233d;
}
.console-head .led { width: 7px; height: 7px; border-radius: 50%; background: #334155; }
.console-head .led.run { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; animation: pulse 1s infinite; }
.console-head .led.ok { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,.7); }
.console-head .led.bad { background: #f87171; box-shadow: 0 0 8px rgba(248,113,113,.7); }
@keyframes pulse { 50% { opacity: .35; } }
.console pre {
  margin: 0; padding: 13px 15px; color: #d7e2f1; font-family: var(--mono);
  font-size: 12.3px; line-height: 1.62; white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow: auto;
}
.console pre .err { color: #fca5a5; }
.console pre.muted { color: #64748b; }

/* ---------- script rows (sci-fi list) ---------- */
.tabs { display: flex; gap: 6px; padding: 4px; background: var(--sunk); border-radius: 10px; }
.tabs button {
  flex: 1; font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  padding: 7px 10px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--ink-soft); transition: .15s;
}
.tabs button.on { background: #fff; color: var(--volt-deep); border-color: var(--line); box-shadow: 0 1px 2px rgba(15,23,42,.06); }

.slist { display: flex; flex-direction: column; }
.srow {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 14px; border-bottom: 1px solid var(--line-soft);
  overflow: hidden; transition: background .16s;
}
.srow:last-child { border-bottom: 0; }
.srow::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--volt); opacity: .22; border-radius: 2px; transition: .18s;
}
.srow::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(37,99,235,.06) 46%, transparent 72%);
  transform: translateX(-110%); transition: transform .55s ease;
}
.srow:hover { background: #fbfdff; }
.srow:hover::before { opacity: 1; box-shadow: 0 0 10px rgba(37,99,235,.55); }
.srow:hover::after { transform: translateX(110%); }
.srow-main { min-width: 0; flex: 1; }
.srow-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.srow-title b { font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.srow-desc {
  font-size: 12px; color: var(--ink-faint); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.srow-act { display: flex; gap: 7px; flex-shrink: 0; align-items: center; }
.badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; padding: 2px 6px;
  border-radius: 5px; background: var(--volt-soft); color: var(--volt-deep);
  border: 1px solid #dbeafe; white-space: nowrap;
}
.badge.gray { background: var(--sunk); color: var(--ink-soft); border-color: var(--line); }
.badge.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.bad { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.inline-out {
  margin: 0 12px 12px 14px; background: #0b1220; border-radius: 10px; border: 1px solid #16233d;
  padding: 10px 13px; font-family: var(--mono); font-size: 12px; color: #d7e2f1;
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
}
.inline-out .meta { color: #64748b; font-size: 11px; display: block; margin-bottom: 6px; }

.empty { text-align: center; color: var(--ink-faint); font-size: 12.5px; padding: 26px 10px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-weight: 600; color: var(--ink-faint); font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.mono { font-family: var(--mono); font-size: 11.8px; letter-spacing: .02em; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.stat .k { font-size: 11px; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--ink-faint); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-family: inherit; font-size: 12px; cursor: pointer; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); transition: .15s;
}
.chip:hover { border-color: #bfdbfe; color: var(--volt-deep); background: var(--volt-soft); }
.chip.on { background: var(--volt); border-color: var(--volt); color: #fff; font-weight: 600; }

.copy-all { margin-top: 12px; }
.result-box {
  background: #0b1220; border: 1px solid #16233d; border-radius: 11px; padding: 12px 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 7px;
  max-height: 260px; overflow: auto;
}
.result-box .code {
  font-family: var(--mono); font-size: 12px; color: #93c5fd; background: #0f1a2e;
  border: 1px solid #1b2a44; border-radius: 6px; padding: 5px 8px; cursor: pointer;
  text-align: left; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis;
}
.result-box .code:hover { border-color: #38bdf8; color: #e0f2fe; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .brand small { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 18px 12px 60px; }
  .topbar-in { padding: 0 12px; gap: 10px; height: 54px; }
  .nav a { padding: 6px 9px; font-size: 12px; }
  .panel-body { padding: 13px; }
  .gate { margin: 18px auto; }
  .srow { flex-wrap: wrap; }
  .srow-act { width: 100%; justify-content: flex-end; }
  .editor-bar input[type=text] { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .page-head h1 { font-size: 18px; }
}
