:root {
  color-scheme: light;
  --page: #f5f7fb;
  --card: #ffffff;
  --card-soft: #f9fafc;
  --text: #172033;
  --muted: #657085;
  --line: #e5e9f1;
  --primary: #2764ff;
  --primary-dark: #174bd0;
  --green: #0e9f6e;
  --green-soft: #e9f9f2;
  --amber: #c87805;
  --amber-soft: #fff7e6;
  --red: #dc3d43;
  --red-soft: #fff0f0;
  --violet: #7557d9;
  --violet-soft: #f2efff;
  --shadow: 0 14px 45px rgba(32, 47, 78, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% -5%, rgba(39, 100, 255, 0.09), transparent 28rem),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #3773ff, #174bd0);
  color: white;
  box-shadow: 0 10px 24px rgba(39, 100, 255, 0.24);
}

.brand-mark svg { width: 26px; height: 26px; }

h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.035em; }

.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; place-self: center }

.api-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 13px;
}

.api-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa3b3; }
.api-state.ok .api-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.api-state.bad .api-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.panel {
  border: 1px solid rgba(225, 230, 239, 0.9);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-panel { padding: 26px; }

.field-label {
  display: block;
  margin-bottom: 9px;
  color: #445069;
  font-size: 13px;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 122px 108px 108px 138px;
  gap: 10px;
  align-items: end;
}

@media (min-width: 961px) {
  .search-row.no-port { grid-template-columns: minmax(240px, 1fr) 122px 108px 138px; }
}

.field { min-width: 0; }

input, select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--card-soft);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input { padding: 0 14px; }
select { padding: 0 34px 0 12px; cursor: pointer; }
input::placeholder { color: #a0a8b6; }
input:focus, select:focus {
  border-color: rgba(39, 100, 255, 0.65);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(39, 100, 255, 0.09);
}

.primary-button {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(39, 100, 255, 0.2);
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }
.primary-button:disabled { cursor: not-allowed; opacity: .68; transform: none; }

.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  align-items: center;
}

.samples-label { color: var(--muted); font-size: 13px; margin-right: 2px; }

.sample-button, .text-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #4d5870;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.sample-button { padding: 7px 11px; font-size: 12px; }
.sample-button:hover, .text-button:hover { border-color: #b8c8f5; color: var(--primary); background: #f7f9ff; }

.sample-button span { color: #8b94a6; margin-left: 5px; }

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

.advanced summary {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.advanced-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.help { margin: 7px 0 0; color: #8a94a7; font-size: 12px; line-height: 1.5; }

.feedback {
  display: none;
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 1.55;
}

.feedback.show { display: flex; align-items: center; gap: 12px; }
.feedback.progress { color: #30486c; background: #f2f6ff; border: 1px solid #dce7ff; }
.feedback.error { color: #9b2731; background: var(--red-soft); border: 1px solid #ffd6d8; }

.spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid rgba(39, 100, 255, .2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.summary-panel {
  display: none;
  margin-top: 20px;
  padding: 22px 24px;
}

.summary-panel.show { display: block; }

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.summary-title { margin: 0; font-size: 17px; }

.text-button { padding: 7px 12px; font-size: 12px; }

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

.summary-item {
  min-width: 0;
  padding: 14px 15px;
  border-radius: 13px;
  background: var(--card-soft);
  border: 1px solid #edf0f5;
}

.summary-item dt { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.summary-item dd { margin: 0; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.summary-item small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; line-height: 1.4; }

.result-section { display: none; margin-top: 20px; }
.result-section.show { display: block; }

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

.section-head h2 { margin: 0; font-size: 17px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }

.carrier-list { display: grid; gap: 14px; }

.carrier-card { overflow: hidden; }

.carrier-main {
  display: grid;
  grid-template-columns: 210px minmax(230px, .8fr) minmax(280px, 1.3fr);
  gap: 20px;
  align-items: center;
  padding: 21px 23px;
}

.carrier-name { display: flex; align-items: center; gap: 12px; }

.carrier-icon {
  width: 46px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: transparent;
}

.carrier-icon img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.carrier-icon.unicom img { width: 40px; height: 40px; }

.carrier-title { margin: 0; font-size: 15px; }
.probe-location { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.route-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.route-name strong { font-size: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.premium { color: mediumpurple; background: var(--violet-soft); }
.badge.optimized { color: #087b56; background: var(--green-soft); }
.badge.standard { color: #966009; background: var(--amber-soft); }
.badge.unknown { color: #6f7888; background: #eef1f5; }
.badge.failed { color: #ac2d35; background: var(--red-soft); }

.route-detail { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.asn-path { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.asn-pill { padding: 4px 7px; border-radius: 7px; background: #f0f3f8; color: #536077; font-size: 11px; font-variant-numeric: tabular-nums; }
.asn-arrow { color: #b0b7c4; font-size: 10px; }
.empty { color: #929bad; font-size: 13px; }

.hop-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 23px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
  color: #59647a;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.hop-toggle:hover { background: #f7f9fc; }
.chevron { transition: transform .18s ease; }
.hop-toggle.open .chevron { transform: rotate(180deg); }

.hop-detail { display: none; border-top: 1px solid var(--line); overflow-x: auto; }
.hop-detail.show { display: block; }

.hop-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 12px; }
.hop-table th, .hop-table td { padding: 11px 12px; border-bottom: 1px solid #edf0f5; text-align: right; white-space: nowrap; }
.hop-table th { background: #f8fafc; color: #788296; font-weight: 700; }
.hop-table th:nth-child(2), .hop-table td:nth-child(2) { text-align: left; }
.hop-table td { color: #4d5870; font-variant-numeric: tabular-nums; }
.hop-table tr:last-child td { border-bottom: 0; }
.hop-table tbody tr.premium-hop {
  background: #f1eaff;
}
.hop-table tbody tr.premium-hop td {
  color: #513a83;
  background: #f1eaff;
  border-bottom-color: #ded1fb;
}
.hop-table tbody tr.premium-hop td:first-child {
  color: #693fc4;
  font-weight: 850;
}
.hop-table tbody tr.premium-hop .hop-host strong { color: #4f2f91; }
.hop-number { color: #9aa3b2; }
.hop-host strong { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; color: #344158; font-weight: 650; }
.hop-host small { display: block; margin-top: 3px; color: #9099aa; }
.loss-high { color: var(--red) !important; font-weight: 750; }
.loss-mid { color: var(--amber) !important; font-weight: 750; }

.notice {
  margin: 14px 2px 0;
  color: #788296;
  font-size: 12px;
  line-height: 1.6;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  color: #8a93a4;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .search-row { grid-template-columns: minmax(220px, 1fr) 110px 100px 130px; }
  .port-field { grid-column: 2; grid-row: 2; }
  .primary-button { grid-column: 4; }
  .carrier-main { grid-template-columns: 180px minmax(200px, .8fr) 1fr; gap: 14px; }
}

@media (max-width: 740px) {
  .shell { width: min(100% - 22px, 1120px); padding: 24px 0 28px; }
  .topbar { margin-bottom: 18px; align-items: center; }
  .api-state span:last-child { display: none; }
  .api-state { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .search-panel { padding: 18px; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .target-field { grid-column: 1 / -1; }
  .protocol-field, .packets-field, .port-field { grid-column: auto; grid-row: auto; }
  .primary-button { grid-column: 1 / -1; }
  .advanced-grid { grid-template-columns: 1fr; }
  .summary-panel { padding: 18px; }
  .summary-grid { grid-template-columns: 1fr; }
  .carrier-main { grid-template-columns: 1fr; padding: 18px; gap: 15px; }
  .asn-path { padding-top: 2px; }
  .hop-toggle { padding: 12px 18px; }
  footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 420px) {
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
  .subtitle { max-width: 250px; }
  .samples-label { width: 100%; }
  .section-head { align-items: flex-end; }
}

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

/* Serendipity-style network tool theme */
body {
  background: linear-gradient(165deg, #c9def4 0%, #e4edf8 45%, #f3efe4 100%) fixed;
  color: #23272e;
}

.shell {
  width: min(1020px, calc(100% - 32px));
  padding: 36px 0 28px;
}

.topbar {
  position: relative;
  display: block;
  margin-bottom: 22px;
  text-align: center;
}

.brand { display: block; }
.brand-mark { display: none; }
h1 { font-size: clamp(27px, 4vw, 32px); letter-spacing: -.02em; }
.subtitle { margin-top: 9px; color: #4f5866; font-size: 14px; }

.api-state {
  position: absolute;
  top: 5px;
  right: 0;
  border-color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .66);
  box-shadow: 0 4px 14px rgba(30, 45, 65, .08);
  backdrop-filter: blur(10px);
}

.panel {
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 16px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 1px 2px rgba(23, 32, 45, .05), 0 10px 30px -8px rgba(23, 32, 45, .16);
  backdrop-filter: blur(12px);
}

.api-panel,
.search-panel,
.summary-panel,
.empty-panel { margin-top: 16px; }

.api-panel { padding: 0 16px 16px; overflow: hidden; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 70px;
  margin: 0;
  color: #2d333c;
  font-size: 17px;
  font-weight: 750;
}

.panel-heading svg { width: 22px; height: 22px; }
.api-panel .panel-heading svg { color: #e3a51c; }
.search-panel .panel-heading svg { color: #24b7a6; }
.summary-panel .panel-heading svg { color: #5966d7; }

.api-table-wrap {
  overflow: hidden;
  border: 1px solid #d9dee6;
  border-radius: 12px;
  background: rgba(255, 255, 255, .56);
}

.api-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.api-table th, .api-table td { padding: 12px 14px; border-bottom: 1px solid #e3e6eb; text-align: left; }
.api-table tr:last-child td { border-bottom: 0; }
.api-table th { color: #657080; background: rgba(247, 249, 252, .62); font-weight: 700; }
.api-method { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.api-method.post { color: #087d6d; background: #dcf7f1; }
.api-method.get { color: #0877b8; background: #ddf1ff; }
.api-path { color: #0a89d8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.api-copy {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  margin-left: 6px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #6c7684;
  cursor: pointer;
  vertical-align: middle;
}
.api-copy:hover { color: #087cdb; background: #e9f4fd; }
.api-copy svg { width: 15px; height: 15px; }
.api-params code { padding: 3px 6px; border-radius: 6px; color: #c3567d; background: #f9edf2; font-size: 11px; }

.search-panel { padding: 0 16px 18px; }
.search-row {
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(100px, .55fr));
  gap: 12px;
}
.search-row.no-port {
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(110px, .65fr));
  gap: 12px;
}
.primary-button {
  grid-column: 1 / -1;
  height: 49px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1596f3 0%, #087cdb 100%);
  box-shadow: 0 7px 16px rgba(8, 124, 219, .23);
  font-size: 15px;
}
.primary-button:hover { background: linear-gradient(180deg, #0c8be6 0%, #066fc5 100%); }

input, select {
  height: 48px;
  border-color: #dce1e8;
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
  box-shadow: inset 0 1px 2px rgba(35, 45, 60, .03);
}
.field-label { color: #5e6877; font-weight: 650; }
.samples { margin-top: 14px; justify-content: center; }
.sample-button { background: rgba(255, 255, 255, .66); }
.advanced { margin-top: 15px; }
.feedback { margin-bottom: 0; }

.empty-panel {
  display: grid;
  min-height: 154px;
  place-items: center;
  padding: 28px 18px;
  text-align: center;
}
.empty-panel.hidden { display: none; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 10px; color: #8e969f; }
.empty-panel strong { display: block; color: #515a66; font-size: 15px; }
.empty-panel p { margin: 7px 0 0; color: #878f9a; font-size: 13px; }

.summary-panel { padding: 0 16px 18px; }
.summary-head { position: relative; justify-content: center; min-height: 68px; margin-bottom: 0; }
.summary-title { font-size: 17px; }
.summary-head .text-button { position: absolute; right: 0; }
.summary-item { background: rgba(248, 250, 252, .7); border-color: #e5e8ed; }

.result-section { margin-top: 18px; }
.section-head {
  justify-content: center;
  position: relative;
  min-height: 54px;
  margin-bottom: 10px;
}
.section-head h2 { font-size: 18px; }
.section-head p { position: absolute; right: 4px; }
.carrier-list { gap: 16px; }
.carrier-main { padding: 22px 24px; }
.carrier-card { background: rgba(255, 255, 255, .86); }
.hop-toggle { background: rgba(249, 251, 253, .82); }
.hop-table th { background: rgba(247, 249, 252, .9); }

footer {
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 15px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 8px 24px -10px rgba(23, 32, 45, .18);
  color: #707985;
  text-align: center;
}

@media (max-width: 740px) {
  .shell { width: min(100% - 22px, 1020px); padding: 24px 0 22px; }
  .topbar { padding: 0 34px; }
  .api-state { top: 2px; right: 0; }
  .api-table-wrap { overflow-x: auto; }
  .api-table { min-width: 650px; }
  .search-row,
  .search-row.no-port { grid-template-columns: 1fr 1fr; }
  .target-field { grid-column: 1 / -1; }
  .port-field { grid-column: 1 / -1; }
  .primary-button { grid-column: 1 / -1; }
  .panel-heading { min-height: 62px; }
  .summary-head { min-height: 62px; }
  .summary-head .text-button { right: 0; }
}

@media (max-width: 430px) {
  .topbar { padding: 0 32px; }
  h1 { font-size: 25px; }
  .subtitle { font-size: 12px; }
  .api-panel, .search-panel, .summary-panel { padding-left: 12px; padding-right: 12px; }
  .api-table th, .api-table td { padding: 11px 12px; }
  .sample-button { width: 100%; }
  .summary-head .text-button { position: static; margin-left: 12px; }
}

/* Reference-page visual system */
:root {
  color-scheme: light dark;
  --page: #eef3fa;
  --card: rgba(255, 255, 255, .82);
  --card-soft: rgba(255, 255, 255, .65);
  --text: #23272e;
  --muted: #68717d;
  --line: rgba(23, 32, 45, .10);
  --primary: #0486ff;
  --primary-dark: #0470d6;
  --primary-soft: rgba(4, 134, 255, .12);
  --green: #1f9d5b;
  --green-soft: rgba(31, 157, 91, .13);
  --amber: #c87805;
  --amber-soft: rgba(200, 120, 5, .12);
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, .12);
  --violet: #7557d9;
  --violet-soft: rgba(117, 87, 217, .13);
  --card-border: rgba(255, 255, 255, .55);
  --field-bg: rgba(255, 255, 255, .65);
  --hover: rgba(23, 32, 45, .04);
  --shadow: 0 1px 2px rgba(23, 32, 45, .05), 0 10px 30px -8px rgba(23, 32, 45, .16);
  --bg-veil: linear-gradient(160deg, rgba(255,255,255,.42), rgba(255,255,255,.30) 55%, rgba(255,255,255,.42));
  --bg-fallback: linear-gradient(165deg, #c9def4 0%, #e4edf8 45%, #f3efe4 100%);
  --premium-row: #f1eaff;
  --premium-text: #513a83;
  --premium-line: #ded1fb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #17191d;
    --card: rgba(30, 33, 40, .82);
    --card-soft: rgba(18, 20, 25, .55);
    --text: #e8eaef;
    --muted: #9aa3b0;
    --line: rgba(255, 255, 255, .12);
    --primary: #4da8ff;
    --primary-dark: #2f8fe9;
    --primary-soft: rgba(77, 168, 255, .16);
    --green: #3ecf74;
    --green-soft: rgba(62, 207, 116, .14);
    --amber: #f1b34a;
    --amber-soft: rgba(241, 179, 74, .14);
    --red: #ff6369;
    --red-soft: rgba(255, 99, 105, .14);
    --violet: #b69cff;
    --violet-soft: rgba(182, 156, 255, .15);
    --card-border: rgba(255, 255, 255, .08);
    --field-bg: rgba(18, 20, 25, .55);
    --hover: rgba(255, 255, 255, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -8px rgba(0, 0, 0, .55);
    --bg-veil: linear-gradient(160deg, rgba(16,18,22,.62), rgba(16,18,22,.50) 55%, rgba(16,18,22,.62));
    --bg-fallback: linear-gradient(165deg, #1b2330 0%, #191d26 50%, #20222b 100%);
    --premium-row: rgba(117, 87, 217, .20);
    --premium-text: #d7cbff;
    --premium-line: rgba(182, 156, 255, .24);
  }
}

html, body { min-height: 100%; }

body {
  min-height: 100dvh;
  color: var(--text);
  font: 400 16px/1.6 "MiSans", "小米兰亭", Roboto, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-fallback) fixed;
}

.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 1s ease, transform 1.6s ease;
}
.bg img.on { opacity: .60; transform: scale(1); }
.bg::after { content: ""; position: absolute; inset: 0; background: var(--bg-veil); }

.shell { width: min(1020px, calc(100% - 32px)); padding: 20px 0 28px; }

.topbar { margin-bottom: 0; padding: 14px 0 22px; }
.topbar h1 {
  font-size: clamp(1.45rem, 1.1rem + 1.8vw, 1.9rem);
  font-weight: 700;
  letter-spacing: .01em;
  text-shadow: 0 1px 12px rgba(255, 255, 255, .35);
}
.subtitle { margin: 4px 0 0; color: var(--text); font-size: .9rem; }

.api-state {
  top: 17px;
  border-color: var(--card-border);
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.panel {
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .panel {
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    backdrop-filter: blur(14px) saturate(1.15);
  }
}

.panel-heading { min-height: 68px; color: var(--text); font-size: 1.02rem; font-weight: 700; }
.field-label, .advanced summary, .help, .empty-panel p, .probe-location,
.route-detail, .section-head p, .summary-item dt, .summary-item small, .notice { color: var(--muted); }

.api-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
}
.api-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.api-table th, .api-table td {
  padding: 12px 14px;
  border: 0;
  text-align: left;
  vertical-align: middle;
}
.api-table thead th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.api-table tbody tr + tr td { border-top: 1px solid var(--line); }
.api-table tbody tr:hover { background: var(--hover); }
.api-col-index { width: 2.2em; color: var(--muted); }
.api-method {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  line-height: 1.6;
}
.api-url-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.api-path {
  color: var(--primary);
  font: inherit;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.api-copy {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin: 0;
  color: var(--muted);
}
.api-copy:hover { color: var(--primary); background: var(--primary-soft); }
.api-params code {
  display: inline-block;
  margin: 1px 0;
  padding: 1px 8px;
  border-radius: 6px;
  color: #c7386e;
  background: rgba(199, 56, 110, .09);
  font: .84rem/1.6 "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}
.api-params > span { margin: 0 3px; color: var(--muted); }

input, select {
  border-color: var(--line);
  background: var(--field-bg);
  color: var(--text);
}
input::placeholder { color: var(--muted); opacity: .72; }
input:focus, select:focus {
  border-color: var(--primary);
  background: var(--field-bg);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.primary-button {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 14px -4px rgba(4, 134, 255, .55);
}
.primary-button:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  filter: brightness(1.06);
}

.sample-button, .text-button { border-color: var(--line); background: var(--field-bg); color: var(--muted); }
.sample-button:hover, .text-button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.sample-button span { color: var(--muted); opacity: .8; }
.advanced { border-top-color: var(--line); }
.feedback.progress { color: var(--text); background: var(--primary-soft); border-color: rgba(4, 134, 255, .24); }
.feedback.error { color: var(--red); background: var(--red-soft); border-color: rgba(229, 72, 77, .3); }

.empty-panel strong { color: var(--text); }
.empty-icon { color: var(--muted); }
.summary-item { background: var(--hover); border-color: var(--line); }
.summary-title, .section-head h2, .carrier-title, .route-name strong { color: var(--text); }
.carrier-card { background: var(--card); }
.asn-pill { background: var(--hover); color: var(--muted); }
.asn-arrow, .empty { color: var(--muted); }
.hop-toggle { border-top-color: var(--line); background: var(--hover); color: var(--muted); }
.hop-toggle:hover { background: var(--primary-soft); }
.hop-detail { border-top-color: var(--line); }
.hop-table th, .hop-table td { border-bottom-color: var(--line); }
.hop-table th { background: var(--hover); color: var(--muted); }
.hop-table td { color: var(--muted); background: transparent; }
.hop-host strong { color: var(--text); }
.hop-host small, .hop-number { color: var(--muted); }

/* One continuous highlight across the row; cells stay transparent to avoid pale seams. */
.hop-table tbody tr.premium-hop { background: var(--premium-row); }
.hop-table tbody tr.premium-hop td {
  color: var(--premium-text);
  background: transparent;
  border-bottom-color: var(--premium-line);
}
.hop-table tbody tr.premium-hop td:first-child { color: var(--violet); font-weight: 850; }
.hop-table tbody tr.premium-hop .hop-host strong { color: var(--premium-text); }

.footer-card {
  display: block;
  margin-top: 18px;
  padding: 14px 16px;
  text-align: center;
  color: var(--muted);
}
.footer-card a { color: var(--primary); font-size: .95rem; font-weight: 600; text-decoration: none; }
.footer-card a:hover { opacity: .78; text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-color-scheme: dark) {
  .topbar h1 { text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
  .api-method.post { color: #67dfca; background: rgba(20, 184, 166, .14); }
  .api-method.get { color: #77bcff; background: rgba(77, 168, 255, .14); }
  .api-params code { color: #ff8ab5; background: rgba(255, 138, 181, .12); }
  .badge.unknown { color: var(--muted); background: var(--hover); }
}

@media (max-width: 740px) {
  .shell { width: min(100% - 22px, 1020px); padding: 20px 0 22px; }
  .topbar { padding: 10px 34px 18px; }
  .api-state { top: 9px; display: none; }
  .footer-card { padding: 14px 12px; }
}

@media (max-width: 640px) {
  .api-table-wrap { overflow: hidden; }
  .api-table { min-width: 0; }
  .api-table thead { display: none; }
  .api-table, .api-table tbody, .api-table tr, .api-table td { display: block; width: 100%; }
  .api-table tbody tr { padding: 6px 0; }
  .api-table tbody tr + tr { border-top: 1px solid var(--line); }
  .api-table tbody tr + tr td { border-top: 0; }
  .api-table td { padding: 7px 14px; }
  .api-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .04em;
  }
  .api-table td.api-col-index { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bg img { transition: none; transform: none; }
}
