:root {
  --page: #f6f8fa;
  --surface: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e0e7;
  --green: #16803a;
  --green-soft: #e9f7ee;
  --red: #c9362b;
  --red-soft: #fdece9;
  --blue: #2367a8;
  --blue-soft: #eaf2fa;
  --waiting: #98a2b3;
  --shadow: 0 10px 30px rgba(24, 33, 47, 0.07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; color: var(--ink); background: var(--page); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(35, 103, 168, 0.28); outline-offset: 2px; }

.topbar { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--ink); font: 750 11px/1 "Cascadia Mono", Consolas, monospace; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 14px; }
.brand small { color: var(--muted); font-size: 11px; }
.service-state { min-width: 80px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; color: var(--muted); font-size: 11px; }
.service-state span { width: 8px; height: 8px; border-radius: 50%; background: #d7a11c; }
.service-state.ready span { background: var(--green); }
.service-state.error span { background: var(--red); }

main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 52px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 36px; }
.kicker { margin: 0 0 7px; color: var(--blue); font: 700 10px/1.2 "Cascadia Mono", Consolas, monospace; }
h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 680; }
.heading > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; text-align: right; }

.route-strip { margin: 32px 0 24px; padding: 17px 22px; display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.route-strip div { display: flex; align-items: center; gap: 10px; }
.route-strip div span { min-width: 42px; height: 32px; display: grid; place-items: center; border-radius: 5px; color: #fff; background: var(--blue); font: 750 10px "Cascadia Mono", Consolas, monospace; }
.route-strip div:nth-of-type(2) span { background: #9d4e3d; }
.route-strip div:nth-of-type(3) span { background: var(--green); }
.route-strip strong { font-size: 12px; white-space: nowrap; }
.route-strip i { height: 1px; margin: 0 20px; background: var(--line); position: relative; }
.route-strip i::after { content: ""; position: absolute; right: 0; top: -3px; width: 6px; height: 6px; border-top: 1px solid var(--waiting); border-right: 1px solid var(--waiting); transform: rotate(45deg); }

.workspace { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr); gap: 24px; align-items: start; }
.input-panel, .progress-panel { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.panel-title { min-height: 40px; margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-title h2 { margin: 0; font-size: 18px; font-weight: 680; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #fff; font-size: 22px; cursor: pointer; }

.field { margin-bottom: 18px; }
.label-row { min-height: 24px; display: flex; align-items: start; justify-content: space-between; gap: 12px; }
label { color: var(--ink); font-size: 12px; font-weight: 650; }
label span { margin-left: 5px; color: var(--blue); font: 750 10px "Cascadia Mono", Consolas, monospace; }
.text-button { min-height: 24px; padding: 0 2px; border: 0; color: var(--blue); background: transparent; font-size: 11px; cursor: pointer; }
textarea { width: 100%; min-height: 108px; resize: vertical; padding: 12px; border: 1px solid #cbd4dd; border-radius: 6px; color: var(--ink); background: #fbfcfd; font: 12px/1.55 "Cascadia Mono", Consolas, monospace; }
textarea::placeholder { color: #a4adb9; }
.proxy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.proxy-grid textarea { min-height: 126px; }
.form-error { min-height: 20px; margin: -3px 0 8px; color: var(--red); font-size: 12px; line-height: 1.5; }
.primary-button, .secondary-button, .primary-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 6px; font-size: 13px; font-weight: 680; cursor: pointer; }
.primary-button { width: 100%; border: 1px solid var(--green); color: #fff; background: var(--green); }
.primary-button:disabled { cursor: wait; opacity: .68; }
.run-icon { font-size: 10px; }

.status-tag { min-width: 72px; min-height: 28px; display: grid; place-items: center; padding: 0 9px; border-radius: 5px; color: var(--muted); background: #eef1f4; font: 700 10px "Cascadia Mono", Consolas, monospace; }
.status-tag.running { color: #1d5e90; background: var(--blue-soft); }
.status-tag.succeeded { color: var(--green); background: var(--green-soft); }
.status-tag.failed { color: var(--red); background: var(--red-soft); }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { min-height: 66px; display: grid; grid-template-columns: 34px 1fr auto; gap: 13px; align-items: center; position: relative; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 48px; bottom: -18px; width: 2px; background: var(--line); }
.step-mark { width: 34px; height: 34px; display: grid; place-items: center; z-index: 1; border: 2px solid var(--line); border-radius: 50%; color: var(--waiting); background: #fff; font: 700 11px "Cascadia Mono", Consolas, monospace; }
.steps li div { display: grid; gap: 4px; }
.steps strong { font-size: 13px; }
.steps small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.steps time { color: var(--waiting); font: 10px "Cascadia Mono", Consolas, monospace; }
.steps li.running .step-mark { border-color: var(--green); color: transparent; position: relative; }
.steps li.running .step-mark::after { content: ""; width: 10px; height: 10px; border: 2px solid var(--green); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.steps li.succeeded .step-mark { border-color: var(--green); color: #fff; background: var(--green); }
.steps li.succeeded .step-mark::before { content: "✓"; font-size: 15px; }
.steps li.succeeded .step-mark { font-size: 0; }
.steps li.succeeded:not(:last-child)::after { background: var(--green); }
.steps li.failed .step-mark { border-color: var(--red); color: #fff; background: var(--red); font-size: 0; }
.steps li.failed .step-mark::before { content: "!"; font-size: 15px; }
.steps li.failed small { color: var(--red); }
.steps li.warning .step-mark { border-color: #d39a22; color: #7a5812; background: #fff4d8; font-size: 0; }
.steps li.warning .step-mark::before { content: "!"; font-size: 15px; }
.steps li.warning small { color: #8a6417; }

.result-box { margin-top: 24px; padding: 18px; border: 1px solid #a9d9b8; border-left: 4px solid var(--green); border-radius: 7px; background: var(--green-soft); }
.result-box[hidden] { display: none; }
.result-box > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-box span { color: var(--green); font-size: 11px; }
.result-box strong { color: var(--green); font-size: 13px; }
#resultLink { margin: 12px 0 15px; display: block; color: var(--ink); font: 11px/1.55 "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.secondary-button { border: 1px solid #a9c4b2; color: var(--green); background: #fff; }
.primary-link { color: #fff; background: var(--green); text-decoration: none; }

footer { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 28px; border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  main { width: min(680px, calc(100% - 32px)); padding-top: 34px; }
  .workspace { grid-template-columns: 1fr; }
  .heading { align-items: start; }
  .heading > p { text-align: left; }
}
@media (max-width: 580px) {
  .topbar { padding: 0 17px; }
  main { width: calc(100% - 24px); }
  .heading { display: grid; gap: 13px; }
  h1 { font-size: 29px; }
  .route-strip { padding: 15px; grid-template-columns: 1fr; gap: 11px; }
  .route-strip i { width: 1px; height: 14px; margin: 0 0 0 20px; }
  .route-strip i::after { right: -3px; top: 7px; transform: rotate(135deg); }
  .proxy-grid { grid-template-columns: 1fr; gap: 0; }
  .input-panel, .progress-panel { padding: 19px; }
  .steps li { grid-template-columns: 34px 1fr; }
  .steps time { display: none; }
  footer { padding: 13px 20px; flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
