:root {
  color-scheme: light;
  --ink: #15233a;
  --muted: #627086;
  --faint: #8a96a8;
  --line: #dce3ed;
  --line-strong: #c8d2df;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --blue: #2764e7;
  --blue-dark: #174dc5;
  --blue-soft: #eaf1ff;
  --teal: #168d84;
  --teal-soft: #e6f7f4;
  --red: #c83d4e;
  --red-soft: #fff0f2;
  --shadow: 0 24px 70px rgba(28, 51, 84, 0.11), 0 3px 12px rgba(28, 51, 84, 0.05);
  --radius: 22px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f9fd 0, #f4f7fb 44%, #f7f9fc 100%);
  -webkit-font-smoothing: antialiased;
}

button,
a { font: inherit; }

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(39, 100, 231, 0.24);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
}

.page-glow-one {
  top: -230px;
  left: calc(50% - 540px);
  background: radial-gradient(circle, rgba(77, 132, 241, 0.13), rgba(77, 132, 241, 0));
}

.page-glow-two {
  top: 160px;
  right: calc(50% - 650px);
  background: radial-gradient(circle, rgba(28, 171, 158, 0.09), rgba(28, 171, 158, 0));
}

.shell {
  position: relative;
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 0;
}

.hero-banner {
  width: min(520px, 50%);
  margin: 0 auto 16px;
}

.hero-banner img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(1.08);
  mix-blend-mode: multiply;
}

.usage-notes {
  margin-bottom: 18px;
  padding: 20px 24px;
}

.usage-notes ul {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 11px;
  list-style: none;
}

.usage-notes li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.usage-notes li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 2px;
  width: 6px;
  height: 6px;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.usage-notes a {
  color: var(--blue);
  font-weight: 650;
  text-underline-offset: 2px;
}

.usage-notes strong { color: #354961; }

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(211, 220, 232, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step-panel,
.script-panel { padding: 32px 34px; }

.step-head,
.test-intro,
.progress-copy,
.recommendation,
.recommendation-actions,
.download-actions,
.site-footer-inner,
.site-footer-links {
  display: flex;
  align-items: center;
}

.step-head { gap: 0; }

.kicker {
  margin: 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
}

.step-head h2 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.018em;
}

.source-time {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
}

.test-intro {
  gap: 12px;
  margin-top: 24px;
  padding: 17px 18px;
  background: #f8faff;
  border: 1px solid #dce5f1;
  border-radius: 13px;
}

.test-intro p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.button {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 17px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--blue);
  border: 0;
  border-radius: 11px;
  box-shadow: 0 7px 18px rgba(39, 100, 231, 0.16);
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  background: var(--blue-dark);
  box-shadow: 0 9px 22px rgba(39, 100, 231, 0.22);
  transform: translateY(-1px);
}

.button:active:not(:disabled) { transform: translateY(0); }

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button.secondary {
  color: var(--blue);
  background: #fff;
  border: 1px solid #cbd8ee;
  box-shadow: none;
}

.button.secondary:hover:not(:disabled) {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #afc5ec;
  box-shadow: none;
}

.progress-wrap { margin-top: 20px; }

.progress-copy {
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.progress-copy strong { color: var(--blue); }

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e7edf6;
  border-radius: 999px;
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #4f82ef);
  border-radius: inherit;
  transition: width 180ms ease;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}

.candidate-card,
.loading-card {
  min-width: 0;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.loading-card {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
}

.candidate-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.candidate-card:hover {
  border-color: #b9cae4;
  box-shadow: 0 8px 22px rgba(28, 51, 84, 0.07);
  transform: translateY(-1px);
}

.candidate-card.selected {
  background: #f7faff;
  border-color: rgba(39, 100, 231, 0.7);
  box-shadow: inset 0 0 0 1px rgba(39, 100, 231, 0.09);
}

.candidate-card.recommended::after {
  content: "推荐";
  position: absolute;
  top: 32px;
  right: 9px;
  padding: 3px 6px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 750;
  background: var(--blue-soft);
  border-radius: 999px;
}

.candidate-rank {
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.candidate-ip {
  display: block;
  margin-top: 0;
  overflow: hidden;
  color: #243550;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
}

.candidate-state {
  display: block;
  grid-column: 1 / -1;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.candidate-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column: 1 / -1;
  gap: 6px;
  margin-top: 8px;
}

.candidate-card.recommended .candidate-state { padding-right: 44px; }

.candidate-metrics span {
  padding: 6px 7px;
  color: var(--faint);
  font-size: 9px;
  background: #fff;
  border: 1px solid #e8edf4;
  border-radius: 8px;
}

.candidate-metrics strong {
  display: block;
  margin-top: 2px;
  color: #354961;
  font-size: 12px;
}

.candidate-card.failed .candidate-state { color: var(--red); }

.recommendation {
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 23px 28px;
  background: rgba(255, 255, 255, 0.97);
  border-color: #bfd0ee;
}

.recommendation h2 {
  margin: 5px 0 6px;
  font-size: 22px;
  letter-spacing: -0.018em;
}

.recommendation h2 span {
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.recommendation p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.recommendation-actions { gap: 10px; }

.script-panel { margin-top: 18px; }

code { font-family: "SFMono-Regular", Consolas, monospace; }

.selected-strip {
  display: flex;
  margin-top: 22px;
  padding: 13px 15px;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  background: #f3f7ff;
  border: 1px solid #dbe6f8;
  border-radius: 11px;
}

.selected-strip strong {
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.code-card {
  margin-top: 16px;
  overflow: hidden;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.code-toolbar {
  display: flex;
  min-height: 48px;
  padding: 0 14px;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  background: #f1f5fb;
  border-bottom: 1px solid var(--line);
}

.code-toolbar > strong {
  color: var(--blue);
  font-size: 10px;
  letter-spacing: 0.08em;
}

#scriptHash {
  overflow: hidden;
  color: #728198;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

pre {
  min-height: 340px;
  max-height: 520px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #2c405d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre;
  background: transparent;
}

.download-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.site-footer {
  width: min(1040px, calc(100% - 40px));
  margin: 48px auto 28px;
  color: #596a80;
  border-top: 1px solid rgba(39, 100, 231, 0.58);
}

.site-footer-inner {
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 0 0;
}

.site-footer-copyright {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.site-footer-separator { margin: 0 0.38em; }

.site-footer-links { gap: 4px; }

.site-footer-link {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: #596a80;
  border-radius: 10px;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.site-footer-link:hover {
  color: var(--blue);
  background: rgba(39, 100, 231, 0.08);
  transform: rotate(6deg);
}

.site-footer-link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  padding: 12px 15px;
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  background: #243550;
  border: 1px solid #344a69;
  border-radius: 11px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(18px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .candidate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .recommendation {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 520px);
    padding-top: 10px;
  }

  .hero-banner {
    margin-bottom: 10px;
  }

  .step-panel,
  .script-panel {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .source-time { display: none; }

  .step-head {
    gap: 0;
    align-items: flex-start;
  }

  .step-head h2 { font-size: 19px; }

  .test-intro {
    align-items: stretch;
    flex-direction: column;
  }

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

  .recommendation {
    padding: 20px 18px;
    border-radius: 18px;
  }

  .recommendation-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .recommendation-actions .button { width: 100%; }

  .selected-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-toolbar {
    padding: 10px 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  #scriptHash { width: 100%; }

  pre {
    min-height: 300px;
    padding: 14px;
    font-size: 10px;
  }

  .download-actions .button { width: 100%; }

  .site-footer {
    width: min(100% - 20px, 520px);
    margin-top: 34px;
  }

  .site-footer-inner {
    gap: 8px;
    flex-direction: column;
  }

  .site-footer-copyright { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
