@font-face {
  font-family: "Noto Sans SC UI";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-sc-ui.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #08111f;
  --bg-deep: #050b15;
  --surface: rgba(15, 29, 48, 0.84);
  --surface-strong: #111f33;
  --line: rgba(163, 184, 214, 0.16);
  --line-strong: rgba(163, 184, 214, 0.28);
  --text: #f2f6fb;
  --muted: #91a2b9;
  --faint: #5d708a;
  --lime: #b7f36b;
  --lime-strong: #9be448;
  --residential: #ff9d4d;
  --warp: #a78bfa;
  --direct: #47d6a2;
  --openwrt: #4cc9f0;
  --danger: #ff6b78;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  font-family: "Noto Sans SC UI", Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg-deep);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 74% 8%, rgba(95, 139, 255, 0.14), transparent 29rem),
    radial-gradient(circle at 8% 30%, rgba(183, 243, 107, 0.08), transparent 24rem),
    linear-gradient(180deg, #091524 0%, var(--bg) 48%, #060d18 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(155, 174, 201, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 174, 201, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 calc(36px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 40px;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: flex;
  width: 42px;
  height: 42px;
  gap: 3px;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 9px;
  border: 1px solid rgba(183, 243, 107, 0.26);
  border-radius: 13px;
  background: rgba(183, 243, 107, 0.08);
}

.brand-mark i {
  display: block;
  width: 5px;
  border-radius: 5px;
  background: var(--lime);
}

.brand-mark i:nth-child(1) { height: 10px; opacity: 0.58; }
.brand-mark i:nth-child(2) { height: 20px; }
.brand-mark i:nth-child(3) { height: 15px; opacity: 0.78; }

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.15em;
}

.brand small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.live-state {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.live-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--direct);
  box-shadow: 0 0 0 5px rgba(71, 214, 162, 0.09);
}

.hero {
  max-width: 760px;
  padding: 46px 0 54px;
}

.eyebrow,
.result-kicker {
  margin: 0 0 16px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 7.4vw, 88px);
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.hero h1 span {
  color: transparent;
  background: linear-gradient(100deg, #ffffff 8%, #9cb0c9 86%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-copy {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.query-panel,
.result-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(18, 34, 55, 0.95), rgba(10, 21, 36, 0.93));
  box-shadow: var(--shadow);
}

.query-panel::after,
.result-panel::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 260px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(183, 243, 107, 0.66));
}

.query-panel {
  padding: 36px;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 19px;
}

.panel-heading > div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.panel-heading p {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}

.step-number {
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

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

.node-option {
  position: relative;
  display: flex;
  min-height: 100px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  background: rgba(8, 18, 31, 0.55);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.node-option:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.node-option:focus-visible {
  box-shadow: 0 0 0 3px rgba(183, 243, 107, 0.22);
}

.node-option.is-active {
  border-color: rgba(183, 243, 107, 0.44);
  background: linear-gradient(135deg, rgba(183, 243, 107, 0.11), rgba(8, 18, 31, 0.72));
}

.node-number {
  min-width: 77px;
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.08em;
}

.node-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.node-copy strong {
  font-size: 14px;
}

.node-copy small {
  color: var(--muted);
  font-size: 11px;
}

.radio-indicator {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.node-option.is-active .radio-indicator {
  border: 5px solid var(--lime);
  background: var(--bg);
}

.input-heading {
  margin-top: 34px;
}

.url-field {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 15px;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: rgba(4, 12, 23, 0.76);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.url-field:focus-within {
  border-color: rgba(183, 243, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(183, 243, 107, 0.08);
}

.url-field.has-error {
  border-color: rgba(255, 107, 120, 0.62);
}

.protocol-hint {
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.url-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.url-field input::placeholder {
  color: #52657e;
}

.submit-button {
  display: inline-flex;
  min-height: 50px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  color: #10190e;
  background: var(--lime);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.submit-button:hover {
  background: var(--lime-strong);
  transform: translateY(-1px);
}

.submit-button:focus-visible {
  outline: 3px solid rgba(183, 243, 107, 0.24);
  outline-offset: 3px;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

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

.input-meta {
  display: flex;
  min-height: 25px;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 4px 0;
}

.input-meta p {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.input-meta .input-error {
  color: var(--danger);
  text-align: right;
}

.examples {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.examples > span {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11px;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.example-list button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  outline: 0;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 10px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.example-list button:hover,
.example-list button:focus-visible {
  border-color: rgba(183, 243, 107, 0.34);
  color: var(--text);
  background: rgba(183, 243, 107, 0.07);
}

.result-panel {
  margin-top: 22px;
  padding: 36px;
}

.result-panel[hidden] {
  display: none;
}

.result-panel.is-entering {
  animation: result-enter 320ms cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

@keyframes result-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.result-kicker {
  margin-bottom: 7px;
}

.result-topline h2 {
  margin: 0;
  font-size: 22px;
}

.result-node {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
  font-weight: 700;
}

.route-verdict {
  --route-color: var(--warp);
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 30px;
  padding: 26px;
  border: 1px solid color-mix(in srgb, var(--route-color) 36%, transparent);
  border-radius: 21px;
  background: color-mix(in srgb, var(--route-color) 8%, rgba(5, 13, 24, 0.72));
}

.route-verdict[data-route="residential"] { --route-color: var(--residential); }
.route-verdict[data-route="warp"] { --route-color: var(--warp); }
.route-verdict[data-route="direct"] { --route-color: var(--direct); }
.route-verdict[data-route="openwrt"] { --route-color: var(--openwrt); }

.route-symbol {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--route-color) 42%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--route-color) 12%, transparent);
}

.route-symbol span {
  position: relative;
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--route-color);
}

.route-symbol span::before,
.route-symbol span::after {
  position: absolute;
  right: 0;
  width: 10px;
  height: 2px;
  border-radius: 2px;
  content: "";
  background: var(--route-color);
  transform-origin: right center;
}

.route-symbol span::before { transform: rotate(42deg); }
.route-symbol span::after { transform: rotate(-42deg); }

.verdict-copy {
  min-width: 0;
}

.verdict-copy p,
.verdict-copy strong,
.verdict-copy span {
  display: block;
}

.verdict-copy p {
  margin: 0 0 2px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.verdict-copy strong {
  color: var(--route-color);
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -0.045em;
}

.verdict-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 26px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.result-details > div {
  min-width: 0;
  padding: 17px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-details dt {
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 10px;
}

.result-details dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: #dbe5f1;
  font-family: "Noto Sans SC UI", ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
}

.priority-block {
  margin-top: 30px;
}

.priority-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.priority-heading h3 {
  margin: 0;
  font-size: 13px;
}

.priority-heading span {
  color: var(--faint);
  font-size: 10px;
}

.priority-chain {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.priority-chain li {
  --item-color: var(--muted);
  position: relative;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(4, 11, 20, 0.42);
}

.priority-chain li[data-kind="residential"] { --item-color: var(--residential); }
.priority-chain li[data-kind="warp"] { --item-color: var(--warp); }
.priority-chain li[data-kind="direct"] { --item-color: var(--direct); }
.priority-chain li[data-kind="openwrt"] { --item-color: var(--openwrt); }

.priority-chain li.is-match {
  border-color: color-mix(in srgb, var(--item-color) 45%, transparent);
  color: var(--text);
  background: color-mix(in srgb, var(--item-color) 9%, rgba(4, 11, 20, 0.56));
}

.priority-chain li.is-match::before {
  position: absolute;
  top: 0;
  right: 13px;
  width: 23px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  content: "";
  background: var(--item-color);
}

.priority-chain strong,
.priority-chain small {
  display: block;
}

.priority-chain strong {
  color: inherit;
  font-size: 11px;
}

.priority-chain small {
  margin-top: 6px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.45;
}

.result-footnote {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.shield-icon {
  position: relative;
  width: 14px;
  height: 16px;
  flex: 0 0 auto;
  border: 1px solid var(--direct);
  border-radius: 7px 7px 8px 8px;
}

.shield-icon::after {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  content: "";
  background: var(--direct);
}

.result-footnote p {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
}

.result-footnote span:last-child {
  color: var(--muted);
}

.legend {
  padding: 62px 0 34px;
}

.legend h2 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.legend article {
  --legend-color: var(--muted);
  display: flex;
  min-width: 0;
  gap: 11px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 24, 40, 0.48);
}

.legend article[data-kind="residential"] { --legend-color: var(--residential); }
.legend article[data-kind="warp"] { --legend-color: var(--warp); }
.legend article[data-kind="direct"] { --legend-color: var(--direct); }
.legend article[data-kind="openwrt"] { --legend-color: var(--openwrt); }

.legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--legend-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--legend-color) 10%, transparent);
}

.legend strong,
.legend small {
  display: block;
}

.legend strong {
  font-size: 11px;
}

.legend small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #465971;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 28px, 620px);
    padding-top: calc(18px + env(safe-area-inset-top));
  }

  .topbar {
    padding-bottom: 18px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .live-state span:last-child {
    display: none;
  }

  .hero {
    padding: 34px 2px 38px;
  }

  .hero h1 {
    font-size: clamp(43px, 14.2vw, 64px);
  }

  .hero-copy {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.75;
  }

  .query-panel,
  .result-panel {
    border-radius: 22px;
  }

  .query-panel,
  .result-panel {
    padding: 21px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .panel-heading p {
    padding-left: 29px;
    text-align: left;
  }

  .node-switch {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .node-option {
    min-height: 79px;
    padding: 15px 17px;
  }

  .node-number {
    min-width: 69px;
    font-size: 30px;
  }

  .input-heading {
    margin-top: 28px;
  }

  .url-field {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
  }

  .url-field input {
    font-size: 16px;
  }

  .submit-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .input-meta {
    display: block;
    min-height: 37px;
    padding-left: 2px;
  }

  .input-meta .input-error {
    margin-top: 4px;
    text-align: left;
  }

  .examples {
    display: block;
  }

  .example-list {
    margin-top: 9px;
  }

  .route-verdict {
    gap: 16px;
    padding: 20px 17px;
  }

  .route-symbol {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .verdict-copy strong {
    font-size: 32px;
  }

  .result-details {
    grid-template-columns: 1fr;
  }

  .priority-chain {
    grid-template-columns: 1fr 1fr;
  }

  .legend {
    padding-top: 44px;
  }

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

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

@media (max-width: 380px) {
  .page-shell {
    width: calc(100% - 22px);
  }

  .hero h1 {
    font-size: 43px;
  }

  .query-panel,
  .result-panel {
    padding: 18px;
  }

  .result-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .route-symbol {
    display: none;
  }

  .priority-chain,
  .legend-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
