:root {
  --bg: #0b0f14;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --accent: #60a5fa;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-family: var(--sans);
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(11, 15, 20, 0.6);
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
}
.topnavInner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topnavRight {
  display: flex;
  align-items: center;
  gap: 12px;
}
.langToggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(17, 24, 39, 0.55);
}
.langBtn {
  width: auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.langBtn:hover {
  color: var(--text);
}
.langBtn.active {
  background: rgba(96, 165, 250, 0.95);
  color: #061018;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}
.langBtn:focus {
  outline: 2px solid rgba(96,165,250,0.55);
  outline-offset: 2px;
}
.nav {
  display: flex;
  gap: 14px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
}
.nav a:hover {
  color: var(--text);
  background: rgba(17, 24, 39, 0.55);
}

.hero {
  position: relative;
  padding: 54px 0 28px;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(96,165,250,0.22), transparent 55%),
    radial-gradient(900px 500px at 90% 20%, rgba(52,211,153,0.16), transparent 55%),
    radial-gradient(700px 500px at 50% 90%, rgba(251,191,36,0.14), transparent 55%);
}
.heroInner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
.heroTitle {
  margin: 10px 0 8px;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.6px;
}
.heroSubtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.heroSubtitle code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid rgba(31,41,55,0.8);
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  color: #c7d2fe;
}
.heroCtas {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.primary {
  background: linear-gradient(180deg, rgba(96,165,250,1), rgba(59,130,246,0.95));
  border: 1px solid rgba(96,165,250,0.65);
  color: #061018;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}
.ghost {
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(31,41,55,0.9);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 650;
  font-size: 13px;
  background: rgba(0,0,0,0.18);
}
.ghost:hover {
  background: rgba(17,24,39,0.55);
}
.heroMeta {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  font-size: 12px;
  color: #d1d5db;
  border: 1px solid rgba(31,41,55,0.85);
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  padding: 6px 10px;
}
.heroCard {
  border: 1px solid rgba(31,41,55,0.9);
  border-radius: 14px;
  background: rgba(17,24,39,0.55);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.heroCardTitle {
  padding: 12px 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(31,41,55,0.8);
  background: rgba(0,0,0,0.18);
}
.heroCardBody {
  padding: 12px;
  display: grid;
  gap: 10px;
}
.mini {
  border: 1px solid rgba(31,41,55,0.75);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.20);
}
.miniK { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.miniV { color: var(--text); font-size: 13px; }
.heroCardFooter {
  padding: 12px;
  border-top: 1px solid rgba(31,41,55,0.8);
  background: rgba(0,0,0,0.14);
}
.heroFade {
  height: 36px;
  background: linear-gradient(180deg, rgba(11,15,20,0.0), rgba(11,15,20,1));
  margin-top: 18px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.pageFooter {
  margin-top: 22px;
  padding: 8px 0 26px;
  display: flex;
  justify-content: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brandLogo {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

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

.donateNote {
  width: 100%;
  max-width: 920px;
  margin: 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(96,165,250,0.28);
  background: rgba(96,165,250,0.08);
  color: #d1d5db;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sectionHeader {
  display: grid;
  gap: 6px;
  margin: 6px 0 14px;
}
.sectionTitle {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.callout {
  border: 1px solid rgba(96,165,250,0.35);
  background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(0,0,0,0.10));
  border-radius: 14px;
  padding: 12px 12px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
  margin: 10px 0 14px;
  display: grid;
  gap: 6px;
}
.calloutTitle {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: rgba(147,197,253,0.95);
  font-size: 12px;
  text-transform: uppercase;
}
.calloutBody {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.45;
}
.calloutBody b {
  color: #e5e7eb;
}

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

.panel {
  background: linear-gradient(180deg, rgba(17,24,39,0.9), rgba(17,24,39,0.65));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-height: 200px;
  box-shadow: 0 12px 26px rgba(0,0,0,0.22);
  /* 关键：防止 grid 子项被长内容撑破布局 */
  min-width: 0;
}

h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #d1d5db;
  letter-spacing: 0.3px;
}

.form {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-bottom: 12px;
}

.span2 { grid-column: span 2; }

.label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, button {
  width: 100%;
  box-sizing: border-box;
}

input, select {
  background: rgba(11, 15, 20, 0.6);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 10px;
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.15);
}

.actions {
  display: flex;
  gap: 10px;
}

button {
  background: var(--accent);
  border: 1px solid rgba(96,165,250,0.6);
  color: #0b0f14;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.checkbox input { width: auto; }

.status {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 8px;
}

.statusRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.k {
  display: inline-block;
  width: 44px;
  color: var(--muted);
  font-size: 12px;
}
.v {
  font-family: var(--mono);
  font-size: 12px;
}
.error {
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--text);
  background: rgba(0,0,0,0.25);
}
.badge.ok { border-color: rgba(52, 211, 153, 0.4); }
.badge.warn { border-color: rgba(251, 191, 36, 0.45); }
.badge.err { border-color: rgba(248, 113, 113, 0.45); }
.badge.run { border-color: rgba(96, 165, 250, 0.45); }
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.historyActions {
  display: flex;
  gap: 10px;
  margin: 8px 0 10px;
}

button.small {
  padding: 8px 10px;
  font-weight: 600;
  font-size: 12px;
}

.history {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,0.20);
  overflow: hidden;
  margin-bottom: 10px;
}

.progressBox {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(31,41,55,0.9);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.18);
  margin-bottom: 12px;
}
.progressRow {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  gap: 10px;
  align-items: center;
}
.progressLabel {
  color: #d1d5db;
  font-size: 12px;
}
.progressBar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(31,41,55,0.9);
  background: rgba(0,0,0,0.20);
  overflow: hidden;
}
.progressFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(96,165,250,0.9), rgba(52,211,153,0.85));
  transition: width 320ms ease;
}
.progressFill.failed {
  background: linear-gradient(90deg, rgba(248,113,113,0.95), rgba(251,191,36,0.65));
}
.progressFill.running {
  filter: saturate(1.15);
}
.progressPct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.details {
  border: 1px solid rgba(31,41,55,0.9);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.14);
}
.details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
  margin-bottom: 8px;
}

.historyEmpty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.historyItem {
  display: grid;
  /* 关键：允许左侧内容收缩，避免把右侧按钮挤出可视区 */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.historyItem:first-child { border-top: none; }

.historyMain {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.historyLine1 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
}
.historyMeta {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.historyBtns {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.historyBtns button {
  width: auto;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}
.historyBtns button.secondary {
  font-weight: 600;
}

.log {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
}

.markdown {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  max-height: 720px;
  overflow: auto;
  /* 防止长链接/长 token 把容器撑开 */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown pre, .markdown code {
  font-family: var(--mono);
}

.markdown pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  overflow: auto;
  /* 代码块横向滚动，不撑破外层 */
  max-width: 100%;
  white-space: pre;
}

.markdown a { color: #93c5fd; }
.markdown h3 { margin-top: 18px; }
.markdown img { max-width: 100%; height: auto; }
.markdown table { display: block; max-width: 100%; overflow-x: auto; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .heroInner { grid-template-columns: 1fr; }
  .heroTitle { font-size: 34px; }
}

