:root {
  color-scheme: light;
  --paper: #f4f6f1;
  --paper-deep: #e9eee8;
  --ink: #1f2b2a;
  --muted: #6b7774;
  --line: #d6ded9;
  --panel: #fbfcfa;
  --teal: #2c8c7a;
  --teal-dark: #1d6458;
  --coral: #d76856;
  --amber: #c78938;
  --blue: #587899;
  --shadow: 0 16px 36px rgba(42, 67, 60, 0.08);
  --grid-line: rgba(74, 112, 101, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #19201f;
  --paper-deep: #202a28;
  --ink: #edf3ef;
  --muted: #a5b4ae;
  --line: #35433e;
  --panel: #222c29;
  --teal: #5bb7a1;
  --teal-dark: #9bd5c7;
  --coral: #ec8977;
  --amber: #e0ae61;
  --blue: #91adcb;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  --grid-line: rgba(170, 220, 206, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
}

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

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

.brand strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 8px;
  background: var(--teal);
  transform: rotate(-8deg);
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 4px;
  background: var(--paper);
}

.brand-mark span:nth-child(1) {
  height: 9px;
}

.brand-mark span:nth-child(2) {
  height: 15px;
}

.brand-mark span:nth-child(3) {
  height: 6px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: 7%;
}

.topnav a {
  position: relative;
  padding: 31px 0 27px;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
}

.topnav a::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--teal);
  content: "";
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 160ms ease, transform 160ms ease;
}

.topnav a:hover,
.topnav a.active {
  color: var(--ink);
}

.topnav a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.status-badge,
.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: rotate(18deg);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: clamp(36px, 8vw, 104px);
  align-items: center;
  min-height: 510px;
  padding: 80px 0 72px;
}

.intro-copy {
  display: grid;
  gap: 22px;
}

.kicker {
  margin: 0;
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 660px;
  font-size: clamp(2.6rem, 6.2vw, 5.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0;
}

h1 em {
  color: var(--teal);
  font-style: normal;
}

.intro-text {
  max-width: 550px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.85;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  padding-top: 6px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  font-size: 0.83rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.button-primary {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.button-primary:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.button-secondary {
  background: transparent;
}

.gateway-visual {
  position: relative;
  min-height: 330px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--paper-deep) 72%, transparent), transparent 56%),
    var(--panel);
  box-shadow: var(--shadow);
}

.gateway-visual::before,
.gateway-visual::after {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.gateway-visual::before {
  width: 310px;
  height: 310px;
  right: -154px;
  bottom: -176px;
}

.gateway-visual::after {
  width: 210px;
  height: 210px;
  right: -104px;
  bottom: -126px;
}

.visual-topline,
.visual-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.visual-topline {
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.mono {
  font-family: "Cascadia Code", Consolas, monospace;
  letter-spacing: 0;
}

.route-map {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 68px 1fr 68px 1fr;
  align-items: center;
  min-height: 205px;
}

.route-node {
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 750;
  text-align: center;
}

.route-node small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 500;
}

.node-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--paper);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 1.08rem;
  font-weight: 800;
  box-shadow: 0 0 0 7px var(--panel);
}

.caddy-node .node-icon {
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
  color: var(--paper);
  background: var(--teal);
}

.service-node .node-icon {
  color: var(--coral);
}

.route-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 1px;
  background: var(--line);
}

.route-line::before {
  position: absolute;
  top: 50%;
  right: -1px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--teal);
  border-right: 1px solid var(--teal);
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.route-line span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.72;
}

.route-line span:nth-child(1) {
  animation: travel 2.4s ease-in-out infinite;
}

.route-line span:nth-child(2) {
  animation: travel 2.4s 0.8s ease-in-out infinite;
}

.route-line span:nth-child(3) {
  animation: travel 2.4s 1.6s ease-in-out infinite;
}

@keyframes travel {
  0%,
  100% {
    opacity: 0.15;
    transform: translateX(0);
  }

  50% {
    opacity: 1;
    transform: translateX(15px);
  }
}

.visual-foot {
  justify-content: flex-start;
  gap: 15px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
  font-size: 0.61rem;
}

.visual-foot .mono {
  margin-left: auto;
  color: var(--ink);
  font-size: 0.68rem;
  text-transform: none;
}

.signal {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}

.signal-teal {
  background: var(--teal);
}

.signal-amber {
  background: var(--amber);
}

.section-block {
  padding: 30px 0 68px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-top: 9px;
  font-size: 1.7rem;
  line-height: 1;
}

.section-heading.compact {
  align-items: flex-start;
  margin-bottom: 27px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.77rem;
  cursor: pointer;
}

.text-button:hover {
  color: var(--teal);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  display: grid;
  gap: 19px;
  min-height: 148px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--card-accent);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card::after {
  position: absolute;
  right: -19px;
  bottom: -22px;
  width: 76px;
  height: 76px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 32%, transparent);
  border-radius: 50%;
  content: "";
}

.accent-teal {
  --card-accent: var(--teal);
}

.accent-coral {
  --card-accent: var(--coral);
}

.accent-blue {
  --card-accent: var(--blue);
}

.accent-amber {
  --card-accent: var(--amber);
}

.card-label,
.stat-detail {
  color: var(--muted);
  font-size: 0.72rem;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.card-icon {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, var(--line));
  border-radius: 5px;
  color: var(--card-accent);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
}

.stat-value {
  overflow: hidden;
  color: var(--ink);
  font-size: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-detail {
  align-self: end;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 76px;
}

.info-panel {
  min-height: 320px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-number {
  color: var(--teal);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 11px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.steps li > span {
  color: var(--teal);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.71rem;
  font-weight: 700;
}

.steps strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.83rem;
}

.steps p,
.panel-note {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.65;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--teal-dark);
  background: var(--paper-deep);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
}

.terminal {
  display: grid;
  gap: 12px;
  padding: 19px;
  border-radius: 6px;
  color: #d9e9e2;
  background: #17221f;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.73rem;
  line-height: 1.45;
}

.prompt {
  margin-right: 9px;
  color: #6ed1b6;
}

.panel-note {
  margin-top: 17px;
}

.live-label {
  color: var(--teal);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.67rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 19px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: calc(100% - 48px);
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 42px;
    min-height: 0;
    padding-top: 63px;
  }

  .gateway-visual {
    max-width: 680px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 28px, 560px);
  }

  .topbar {
    min-height: 72px;
  }

  .topnav {
    display: none;
  }

  .status-badge {
    display: none;
  }

  .intro {
    padding: 48px 0 56px;
  }

  h1 {
    font-size: clamp(2.55rem, 14vw, 4.2rem);
  }

  .intro-text {
    font-size: 0.95rem;
  }

  .gateway-visual {
    min-height: 300px;
    padding: 17px;
  }

  .route-map {
    grid-template-columns: 1fr 34px 1fr 34px 1fr;
    min-height: 195px;
  }

  .node-icon {
    width: 47px;
    height: 47px;
  }

  .route-node {
    font-size: 0.72rem;
  }

  .route-node small {
    font-size: 0.57rem;
  }

  .visual-foot {
    flex-wrap: wrap;
    gap: 8px 13px;
  }

  .visual-foot .mono {
    width: 100%;
    margin-left: 0;
  }

  .stats-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .section-heading h2 {
    font-size: 1.45rem;
  }

  .footer {
    gap: 10px;
    line-height: 1.5;
  }
}
