:root {
  --ink: #18181b;
  --ink-secondary: #3f3f46;
  --muted: #71717a;
  --bg: #f4f4f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-subtle: #ededf0;
  --surface-input: #f7f7f9;
  --line: rgba(24, 24, 27, 0.07);
  --line-strong: rgba(24, 24, 27, 0.13);

  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-soft: #f0f0f3;

  --green: #15803d;
  --green-soft: #eaf8ee;
  --green-border: #bbf7d0;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.035), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-pill: 0 2px 8px rgba(0, 0, 0, 0.05);

  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: ui-rounded, "SF Pro Rounded", "PingFang SC", "Hiragino Maru Gothic ProN", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", "PingFang SC", "HarmonyOS Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-rounded, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 14.5px/1.65 var(--font-sans);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: all 0.2s var(--ease-spring);
}

/* 顶部导航：轻玻璃吸顶居中 */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  height: 72px;
  background: rgba(244, 244, 246, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 980px) / 2 + 24px));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-weight: 600;
}

.brand span {
  font: 600 11px/1 var(--font-num);
  letter-spacing: 0.06em;
  color: var(--surface-solid);
  background: var(--accent);
  border-radius: var(--radius-pill);
  padding: 5px 10px;
}

nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(24, 24, 27, 0.05);
  padding: 4px;
  border-radius: var(--radius-pill);
}

nav a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
}

body[data-page="deploy"] nav a[href="/"],
body[data-page="admin"] nav a[aria-current="page"] {
  background: var(--surface-solid);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-pill);
}

nav a:hover {
  color: var(--ink);
}

/* 主内容区：紧凑居中 */
main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: flex;
  flex-direction: column;
}

/* 排版层级 */
h1 {
  font: 600 clamp(22px, 2.6vw, 26px)/1.35 var(--font-sans);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 6px;
}

h2 {
  font: 600 16.5px/1.4 var(--font-sans);
  color: var(--ink);
  margin: 0;
}

h3 {
  font: 600 15px/1.45 var(--font-sans);
  color: var(--ink);
  margin: 0 0 6px;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-subtle);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 8px;
}

/* 顶部提示条 */
#notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  color: var(--ink);
  margin-bottom: 22px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
}

#notice::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

#notice.error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

#notice.error::before {
  background: var(--danger);
}

#notice-message {
  flex: 1;
  line-height: 1.5;
}

#reconnect {
  flex-shrink: 0;
  padding: 6px 14px;
  min-height: 32px;
  font-size: 12.5px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
}

/* 登录门禁卡片：垂直水平居中 */
.gate {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 40px 34px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow-hover);
  text-align: center;
}

.gate h1 {
  font-size: 23px;
  margin-bottom: 8px;
}

.gate p {
  font-size: 13.5px;
  margin-bottom: 0;
}

.gate form {
  margin-top: 28px;
  text-align: left;
}

.gate button {
  width: 100%;
  margin-top: 8px;
}

.route {
  display: flex;
  align-items: center;
  margin-bottom: 26px;
  padding: 8px 14px;
  background: var(--surface-input);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-secondary);
}

.route b {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: var(--accent);
  color: var(--surface-solid);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 13px/1 var(--font-num);
}

.route b:last-child {
  background: var(--surface-subtle);
  color: var(--ink);
}

.route span {
  font: 600 11.5px/1 var(--font-num);
  letter-spacing: 0.08em;
  flex: 1;
  text-align: center;
  color: var(--muted);
}

.route span::before,
.route span::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 16%;
  height: 1.5px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 0 8px;
}

/* 顶部概览卡片 */
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 24px 28px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  gap: 20px;
}

.heading p {
  margin-bottom: 0;
  font-size: 13.5px;
}

.heading > a {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-subtle);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.heading > a:hover {
  background: var(--accent);
  color: var(--surface-solid);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 11px/1.2 var(--font-num);
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px !important;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  font: 600 12.5px/1.2 var(--font-num);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* 部署模式选择器 */
.mode-picker {
  min-width: 0;
  margin: 0 0 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.mode-picker legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.mode-options {
  clear: both;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
}

.mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-input);
  transition: all 0.22s var(--ease-spring);
}

.mode-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mode-copy strong {
  color: var(--ink);
  font: 600 14.5px/1.4 var(--font-num);
}

.mode-copy > span {
  color: var(--muted);
  font-size: 12px;
}

.mode-indicator {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-solid);
  transition: all 0.2s var(--ease-spring);
}

.mode-option:hover .mode-card {
  background: var(--surface-solid);
  border-color: var(--muted);
}

.mode-option input:focus-visible + .mode-card {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.mode-option input:checked + .mode-card {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.mode-option input:checked + .mode-card .mode-indicator {
  border-color: var(--accent);
  background: var(--accent);
}

.mode-option input:checked + .mode-card .mode-indicator::after {
  content: "";
  width: 8px;
  height: 4.5px;
  margin-top: -2px;
  border: solid var(--surface-solid);
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}

.mode-picker p {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* 中转机 / 落地机 双列对称卡片 */
.endpoints {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: stretch;
}

.endpoint {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.22s var(--ease-spring), border-color 0.22s var(--ease-spring);
}

.endpoint:hover,
.endpoint:focus-within {
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.endpoint-title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.endpoint-title > div {
  flex: 1;
  min-width: 0;
}

.endpoint-title p {
  font: 500 12px/1.4 var(--font-sans);
  margin: 2px 0 0;
  color: var(--muted);
}

.letter {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--surface-solid);
  background: var(--accent);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font: 600 16px/1 var(--font-num);
}

.letter.exit {
  color: var(--ink);
  background: var(--surface-subtle);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1.2 var(--font-sans);
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.role-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.role-badge.exit::before {
  background: var(--green);
}

/* 中间 WG 连接桥 */
.bridge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bridge::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 1.5px;
  background: var(--line-strong);
}

.bridge span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 8px 11px;
  color: var(--ink);
  font: 600 11px/1.1 var(--font-num);
  box-shadow: var(--shadow-pill);
}

.bridge span::after {
  content: "→";
  font-size: 11px;
  line-height: 1;
  margin-top: 3px;
  color: var(--muted);
}

/* 表单与圆润输入框 */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: 14px;
}

.endpoint > label:last-child,
.panel > label:last-of-type {
  margin-bottom: 0;
}

input,
textarea {
  display: block;
  width: 100%;
  font: 500 14px/1.5 var(--font-num);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  background: var(--surface-input);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 6px;
  min-height: 44px;
  transition: all 0.2s var(--ease-spring);
}

input::placeholder,
textarea::placeholder {
  color: #a1a1aa;
  font-weight: 400;
}

input:hover,
textarea:hover {
  background: var(--surface-solid);
  border-color: var(--line-strong);
}

input:focus,
textarea:focus {
  background: var(--surface-solid);
  border-color: var(--accent);
  outline: 3px solid rgba(24, 24, 27, 0.08);
  outline-offset: 0;
}

.endpoint .two {
  padding: 14px 0;
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.endpoint .two label {
  margin-bottom: 0;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 表单底部 sudo 提示文字居中 */
#deploy-form > p.muted {
  text-align: center;
  margin: 14px 0 0;
  font-size: 12.5px;
}

/* 全圆润胶囊按钮 */
button,
#download-link,
.result-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 13.5px/1.4 var(--font-sans);
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  cursor: pointer;
  min-height: 44px;
  box-shadow: var(--shadow-pill);
  transition: all 0.2s var(--ease-spring);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

button:hover,
#download-link:hover,
.result-actions a:hover {
  border-color: var(--accent);
  background: var(--surface-input);
  transform: translateY(-1px);
}

button:active,
#download-link:active,
.result-actions a:active {
  transform: scale(0.98);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface-solid);
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.18);
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--surface-solid);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.plain {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6px 16px;
  color: var(--muted);
  min-height: 32px;
  font-size: 13.5px;
  font-weight: 500;
}

.plain:hover {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-pill);
  transform: none;
}

/* 高级设置折叠卡片 */
.advanced {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-card);
}

summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  padding: 2px 0;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "展开 ▾";
  font: 500 12px/1 var(--font-sans);
  color: var(--muted);
  margin-left: 8px;
}

.advanced[open] summary::after {
  content: "收起 ▴";
  color: var(--ink);
}

summary span {
  margin-left: auto;
  color: var(--ink-secondary);
  font: 600 12px/1.3 var(--font-num);
  background: var(--surface-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.advanced .two {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.advanced .two label {
  margin-bottom: 0;
}

/* 底部操作栏 */
.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 16px 0 24px;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.actions p {
  margin: 0 auto 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* 任务列表与日志 */
.tasks {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-title span {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

#job-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

#job-list > .muted {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  background: var(--surface-input);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
}

.job-row {
  position: relative;
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 15px 18px 15px 38px;
  background: var(--surface-solid);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.job-row::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--surface-subtle);
}

.job-row strong {
  font: 600 14px/1.4 var(--font-num);
  color: var(--ink);
}

.job-row span {
  font: 500 12px/1.3 var(--font-sans);
  color: var(--muted);
}

.job-row strong,
.job-row span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.job-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-input);
  transform: none;
}

.job-row.selected {
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

/* 状态圆点语义色 */
.job-row[data-status="running"]::before { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.job-row[data-status="succeeded"]::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.job-row[data-status="failed"]::before,
.job-row[data-status="interrupted"]::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

#job-detail {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

#job-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin: 0;
}

#job-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

#job-status[data-status="running"] { color: var(--blue); background: var(--blue-soft); }
#job-status[data-status="succeeded"] { color: var(--green); background: var(--green-soft); }
#job-status[data-status="failed"],
#job-status[data-status="interrupted"] { color: var(--danger); background: var(--danger-bg); }

#job-id {
  font: 600 12px/1 var(--font-num);
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

#job-id::before {
  content: "ID · ";
  color: var(--muted);
}

#job-log {
  background: var(--surface-input);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 0;
  max-height: 320px;
  min-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 500 12.5px/1.8 var(--font-mono);
}

/* 导入链接与二维码结果卡 */
#result {
  margin-top: 18px;
  padding: 24px;
  background: var(--surface-solid);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-card);
}

#result h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  margin-bottom: 4px;
}

#result h3::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

#result p {
  font-size: 12.5px;
  margin-bottom: 12px;
}

#link {
  font: 500 12.5px/1.6 var(--font-mono);
  min-height: 84px;
  resize: vertical;
}

.result-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

#qr,
.saved-node img {
  display: block;
  width: 176px;
  height: 176px;
  padding: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pill);
}

#qr {
  justify-self: end;
}

/* 私密后台面板 */
.panel {
  padding: 26px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.saved-nodes {
  margin-bottom: 20px;
}

.saved-nodes .section-title button {
  margin-top: 0;
  min-height: 36px;
  padding: 6px 16px;
  font-size: 12.5px;
}

.saved-node {
  margin-top: 16px;
  padding: 20px 22px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.saved-node h3,
.saved-node p {
  overflow-wrap: anywhere;
}

.saved-node p {
  border-bottom: none;
  padding-bottom: 0;
  margin: 0 0 12px;
}

.saved-node textarea,
#import-nodes-json {
  width: 100%;
  min-height: 88px;
  font: 500 12.5px/1.6 var(--font-mono);
  overflow-wrap: anywhere;
}

.saved-node .result-actions {
  margin: 14px 0 0;
}

.saved-node .result-actions button,
.saved-node .result-actions a {
  margin-top: 0;
  min-height: 38px;
  padding: 8px 16px;
  font-size: 12.5px;
}

.saved-node img {
  margin: 16px auto 0;
}

/* 备注输入框与按钮底部严格对齐 */
.node-note {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.node-note label {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.node-note button {
  margin-top: 0;
  flex-shrink: 0;
  min-height: 44px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.admin-grid .panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-grid .panel h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

#admin-form.panel h2::before {
  background: var(--green);
}

.admin-grid .panel p {
  font-size: 13px;
  margin: 6px 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-grid .panel button,
#import-nodes-form button {
  margin-top: 18px;
  align-self: flex-start;
}

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

/* 后台底部状态胶囊居中 */
#admin-stats {
  margin: 24px auto 0;
  padding: 10px 20px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font: 600 12.5px/1.5 var(--font-num);
  color: var(--ink-secondary);
  box-shadow: var(--shadow-pill);
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
}

#admin-stats::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

#admin-stats:empty {
  display: none;
}

/* 页脚 */
footer {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: center;
}

[hidden] {
  display: none !important;
}

/* 移动端响应式 */
@media (max-width: 760px) {
  header {
    height: 62px;
    padding: 0 16px;
  }

  main {
    padding: 16px 16px 48px;
  }

  .heading {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 12px;
  }

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

  .bridge {
    height: 44px;
  }

  .bridge::before {
    left: 50%;
    right: auto;
    top: 4px;
    bottom: 4px;
    width: 1.5px;
    height: auto;
    transform: translateX(-50%);
  }

  .bridge span {
    flex-direction: row;
    gap: 6px;
    padding: 6px 14px;
  }

  .bridge span::after {
    content: "↓";
    margin-top: 0;
  }

  .endpoint,
  .tasks,
  .panel {
    padding: 20px 18px;
  }

  input,
  textarea {
    font-size: 16px;
    min-height: 46px;
  }

  #import-nodes-json {
    font-size: 16px;
  }

  .advanced .two,
  .admin-grid,
  #result {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-wrap: wrap;
    padding: 18px;
  }

  .actions p {
    width: 100%;
    margin-bottom: 6px;
  }

  .actions button {
    flex: 1;
  }

  .section-title {
    flex-wrap: wrap;
    gap: 8px;
  }

  #qr {
    justify-self: center;
  }

  .node-note {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-grid .panel button {
    width: 100%;
  }

  .gate {
    padding: 32px 22px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0 12px;
    gap: 10px;
  }

  .brand {
    flex-shrink: 0;
    gap: 6px;
    font-size: 16px;
    white-space: nowrap;
  }

  .brand span {
    font-size: 10px;
    padding: 4px 7px;
  }

  nav {
    gap: 2px;
    padding: 3px;
  }

  nav a,
  nav .plain {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .mode-options,
  .two {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
