:root {
  --ink: #1c1917;
  --muted: #78716c;
  --faint: #a8a29e;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(68, 54, 39, 0.08);
  --teal: #0f766e;
  --good: #15803d;
  --slow: #b45309;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 50% -80px, rgba(15, 118, 110, 0.14), transparent 70%),
    linear-gradient(180deg, #f7f3ec 0%, #e7eef0 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.gate {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: calc(32px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
}

.gate-brand {
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.gate h1 {
  margin: 8px 0 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.gate-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.probe,
.lines,
.empty-nodes,
.retry {
  margin-top: 28px;
}

.probe[hidden],
.lines[hidden],
.empty-nodes[hidden],
.retry[hidden] {
  display: none !important;
}

.probe {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 22px 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 18px 40px rgba(68, 54, 39, 0.08);
  text-align: center;
}

.probe-ring {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f4efe6;
}

.probe-ring i {
  width: 34px;
  height: 34px;
  border: 2.5px solid #e6dfd4;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.probe-title {
  margin: 18px 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.probe-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.probe-track {
  width: min(180px, 70%);
  height: 4px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe8de;
}

.probe-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.25s ease;
}

.lines {
  margin-top: 22px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.line {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 16px 16px 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(68, 54, 39, 0.06);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.line.best {
  background: linear-gradient(180deg, #fffdf8 0%, #fff 100%);
  box-shadow: 0 14px 30px rgba(180, 120, 40, 0.12);
}

.line.best::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #e08a1e;
}

.line:disabled {
  cursor: default;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.55);
}

.line:not(:disabled):active {
  transform: scale(0.985);
}

.line-mark {
  width: 10px;
  height: 10px;
  justify-self: center;
  border-radius: 50%;
  background: #d6d3d1;
}

.line-mark.good {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.12);
}

.line-mark.ok {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.line-mark.slow {
  background: var(--slow);
  box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.12);
}

.line-main {
  min-width: 0;
}

.line-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.line-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-tag {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff1dc;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.line-host {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.line-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: #e7e5e4;
}

.bars i:nth-child(1) {
  height: 4px;
}

.bars i:nth-child(2) {
  height: 7px;
}

.bars i:nth-child(3) {
  height: 10px;
}

.bars i:nth-child(4) {
  height: 13px;
}

.bars.good i {
  background: var(--good);
}

.bars.ok i:nth-child(-n + 3) {
  background: var(--teal);
}

.bars.slow i:nth-child(-n + 2) {
  background: var(--slow);
}

.bars.bad i:nth-child(1) {
  background: var(--faint);
}

.line-ms {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.line-ms.good {
  color: var(--good);
}

.line-ms.ok {
  color: var(--teal);
}

.line-ms.slow {
  color: var(--slow);
}

.line-ms.bad {
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}

.line-go {
  color: var(--faint);
  font-size: 12px;
  line-height: 1;
}

.line:not(:disabled) .line-go {
  color: var(--teal);
}

.empty-nodes {
  padding: 28px 18px;
  border-radius: 20px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.retry {
  display: block;
  margin-right: auto;
  margin-left: auto;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.retry:active {
  color: var(--ink);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (hover: hover) {
  .line:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(68, 54, 39, 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .probe-ring i {
    animation: none;
    border-color: #e6dfd4;
    border-right-color: var(--teal);
  }

  .probe-track span,
  .line,
  .line:not(:disabled):hover,
  .line:not(:disabled):active {
    transition: none;
    transform: none;
  }
}
