:root {
  --bg: #0b1220;
  --bg-elev: #121c2e;
  --ink: #e8eef8;
  --muted: #9aabc4;
  --accent: #3dd6c6;
  --accent-2: #f0a35e;
  --line: rgba(232, 238, 248, 0.12);
  --edge: rgba(61, 214, 198, 0.55);
  --node: #1a2740;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Noto Sans SC", system-ui, sans-serif;
}

body[data-lang="zh"] {
  --font-display: "Noto Sans SC", "Manrope", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "Manrope", system-ui, sans-serif;
}

.lang-bar {
  position: absolute;
  top: 0.85rem;
  right: clamp(0.85rem, 3vw, 1.5rem);
  z-index: 5;
  margin: 0;
  padding: 0;
}

.lang-switch {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.25rem;
  background: rgba(11, 18, 32, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 0.78rem/1 var(--font-body);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.lang-switch button:hover {
  color: var(--ink);
}

.lang-switch button.is-active {
  background: rgba(61, 214, 198, 0.18);
  color: var(--accent);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 214, 198, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(240, 163, 94, 0.1), transparent 50%),
    var(--bg);
  line-height: 1.55;
}

code {
  font-size: 0.92em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.hero {
  position: relative;
  min-height: min(92vh, 720px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  z-index: -2;
}

.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 18, 32, 0.25) 0%, rgba(11, 18, 32, 0.55) 45%, rgba(11, 18, 32, 0.96) 100%),
    linear-gradient(90deg, rgba(11, 18, 32, 0.55), transparent 55%);
}

.hero__inner {
  width: min(920px, 100%);
  padding: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 3.2vw, 2.05rem);
  margin: 0 0 0.9rem;
  max-width: 16ch;
  line-height: 1.18;
}

.lede {
  margin: 0 0 1.5rem;
  max-width: 34rem;
  color: #dce5f2;
  font-size: clamp(1.05rem, 2.2vw, 1.15rem);
  line-height: 1.6;
}

.idea p,
.get ol li {
  line-height: 1.65;
  font-size: 1.02rem;
}

.get ol {
  padding-left: 1.25rem;
}

.get ol li {
  margin-bottom: 0.85rem;
}

.get .fine {
  margin-top: 1.25rem;
  max-width: 40rem;
  line-height: 1.6;
}

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: var(--accent);
  color: #06221f;
}
.btn--primary:hover { background: #5ee4d6; }
.btn--ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(11, 18, 32, 0.35);
}
.btn--ghost:hover { border-color: rgba(61, 214, 198, 0.45); }

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 2rem) 4rem;
}

section { margin-bottom: 3.25rem; }

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.65rem;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.idea p, .get p, .get ol { color: var(--muted); }
.idea p, .get ol { max-width: 48rem; }

.bullets {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.bullets li {
  padding-left: 1.1rem;
  position: relative;
  color: var(--ink);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent-2);
}

.graph-head { margin-bottom: 1rem; }
.graph-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }
.stat {
  margin: 0.65rem 0 0;
  font-weight: 600;
  color: var(--accent);
}

.graph-wrap {
  position: relative;
  background:
    radial-gradient(600px 280px at 50% 40%, rgba(61, 214, 198, 0.07), transparent 70%),
    var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  min-height: 280px;
}

.graph-toolbar {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem;
  background: rgba(11, 18, 32, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.gbtn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(26, 39, 64, 0.9);
  color: var(--ink);
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  font: 600 1.05rem/1 var(--font-body);
  cursor: pointer;
  padding: 0;
}

.gbtn:hover {
  border-color: rgba(61, 214, 198, 0.45);
  color: var(--accent);
}

.gbtn--text {
  width: auto;
  padding: 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.zoom-label {
  min-width: 2.6rem;
  text-align: center;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.toolbar-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--line);
  margin: 0 0.15rem;
}

#graph {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

#graph.is-panning {
  cursor: grabbing;
}

#graph .edge {
  fill: none;
  stroke-linecap: round;
}

#graph .edge--peer {
  stroke: rgba(61, 214, 198, 0.45);
  stroke-width: 1.6;
  stroke-dasharray: 6 5;
}

#graph .edge--return {
  stroke: rgba(61, 214, 198, 0.8);
  stroke-width: 2.4;
  stroke-dasharray: none;
}

#graph .edge--ext {
  stroke: rgba(240, 163, 94, 0.75);
  stroke-width: 1.7;
  stroke-dasharray: 5 4;
}

#graph .node .halo {
  fill: rgba(61, 214, 198, 0.12);
}

#graph .node--ext .halo {
  fill: rgba(240, 163, 94, 0.1);
}

#graph .node .ring {
  fill: none;
  stroke: rgba(61, 214, 198, 0.35);
  stroke-width: 1;
}

#graph .node--ext .ring {
  stroke: rgba(240, 163, 94, 0.4);
  stroke-dasharray: 3 2;
}

#graph .node .core {
  fill: #1a2740;
  stroke: #3dd6c6;
  stroke-width: 2.2;
}

#graph .node--ext .core {
  fill: rgba(26, 39, 64, 0.35);
  stroke: #f0a35e;
  stroke-width: 1.7;
  stroke-dasharray: 3 2;
}

#graph .node--peer .core {
  animation: node-pulse 3.2s ease-in-out infinite;
}

#graph .node.is-selected .ring {
  stroke: #e8eef8;
  stroke-width: 1.6;
  stroke-dasharray: none;
}

#graph .node.is-dragging .halo {
  fill: rgba(61, 214, 198, 0.22);
}

#graph .node.is-collapsed .core {
  stroke: #f0a35e;
}

#graph .node .badge circle {
  fill: #0b1220;
  stroke: #3dd6c6;
  stroke-width: 1.4;
}

#graph .node.is-collapsed .badge circle {
  stroke: #f0a35e;
  fill: rgba(240, 163, 94, 0.2);
}

#graph .node .badge text {
  fill: #e8eef8;
  font-size: 9px;
  font-family: var(--font-body);
  font-weight: 700;
  pointer-events: none;
}

#graph .node .label {
  fill: #e8eef8;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(11, 18, 32, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

#graph .node--ext .label {
  fill: #f0c49a;
  font-size: 11px;
  font-weight: 500;
}

#graph .node .desc,
#graph .node .sub {
  fill: #9aabc4;
  font-size: 11px;
  font-family: var(--font-body);
}

#graph .node .desc {
  font-size: 10px;
}

@keyframes node-pulse {
  0%, 100% { stroke-width: 2.2; }
  50% { stroke-width: 2.8; }
}

.graph-detail {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.85rem 0 0;
  padding: 0.75rem 1rem;
  background: rgba(18, 28, 46, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
}

.graph-detail[hidden] {
  display: none !important;
}

.graph-detail .icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.graph-detail .meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 2rem;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

/* Author display:grid must not override the hidden attribute */
.graph-empty[hidden] {
  display: none !important;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.graph-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.graph-legend .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--node);
  flex-shrink: 0;
}

.graph-legend .dot--ext {
  border-color: var(--accent-2);
  border-style: dashed;
  background: var(--accent-2);
}

.graph-legend .legend-note {
  color: var(--muted);
  opacity: 0.85;
}

.server-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.server-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: rgba(18, 28, 46, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
}

.server-list .name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.server-list .name .icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  image-rendering: pixelated;
  flex-shrink: 0;
  background: #0b1220;
}
.server-list .addr { color: var(--muted); font-size: 0.88rem; }
.server-list .ping { color: var(--accent); font-variant-numeric: tabular-nums; }

.get .build-lead { margin-bottom: 1.5rem; }

.steps {
  display: grid;
  gap: 1.75rem;
  max-width: 44rem;
}

.step h3,
.extra h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 0.65rem;
  color: var(--ink);
}

.step-body {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.step-body p {
  margin: 0 0 0.75rem;
}

.step-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.step-body a:hover {
  color: #5ee4d6;
}

pre.path-tree {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  background: rgba(18, 28, 46, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #d5deec;
  font: 0.88rem/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre;
  overflow-x: auto;
}

.extra {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: 44rem;
}

.fine {
  font-size: 0.92rem;
  margin-top: 1.5rem;
  max-width: 44rem;
  color: var(--muted);
  line-height: 1.6;
}

/* —— Build portals —— */
.build-lead,
.build-p {
  color: var(--muted);
  max-width: 44rem;
  line-height: 1.65;
  font-size: 1.02rem;
}

.build-h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 2rem 0 0.65rem;
  color: var(--ink);
}

.schematics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.25rem 0 1.5rem;
}

.schematic {
  margin: 0;
}

.schematic figcaption {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.55rem;
  color: var(--ink);
}

.sch {
  display: grid;
  gap: 3px;
  width: fit-content;
  padding: 0.85rem;
  background:
    linear-gradient(160deg, rgba(26, 39, 64, 0.9), rgba(11, 18, 32, 0.95)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 8px,
      rgba(61, 214, 198, 0.03) 8px,
      rgba(61, 214, 198, 0.03) 9px
    );
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sch--nether { grid-template-columns: repeat(4, 1.55rem); }
.sch--plate { grid-template-columns: repeat(4, 1.55rem); }
.sch--wool { grid-template-columns: repeat(3, 1.55rem); }

.b--miss {
  background: transparent;
  box-shadow: none;
}

.b {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.b--stone {
  background: linear-gradient(145deg, #6b7280, #4b5563);
}
.b--air {
  background: rgba(61, 214, 198, 0.08);
  box-shadow: inset 0 0 0 1px rgba(61, 214, 198, 0.15);
}
.b--wool {
  background: linear-gradient(145deg, #f0a35e, #d4783a);
}
.b--plate {
  background: linear-gradient(180deg, #c4b5a0, #8a7a66);
  border-radius: 2px;
  transform: scaleY(0.45);
  align-self: end;
  height: 1.55rem;
}
.b--sign {
  position: relative;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.b--sign::after {
  content: "";
  position: absolute;
  inset: 18% 28% 18% 28%;
  background: #e8d5a8;
  border-radius: 1px;
  box-shadow: 0 0 0 1px #8b6914;
}

.sch-key {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.key {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.key--stone { background: #5b6472; }
.key--air { background: rgba(61, 214, 198, 0.15); box-shadow: inset 0 0 0 1px rgba(61, 214, 198, 0.35); }
.key--sign { background: #e8d5a8; outline: 1px solid var(--accent); }
.key--plate { background: #a89880; transform: scaleY(0.55); }
.key--wool { background: #e09050; }

.sign-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1rem 0 1.5rem;
}

.sign-type h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.sign-face {
  margin: 0 0 0.65rem;
  padding: 0.7rem 0.85rem;
  width: 11rem;
  min-height: 5.6rem;
  background: linear-gradient(180deg, #c9a66b, #a8844a);
  color: #1a1208;
  font: 600 0.9rem/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 2px #8b6914,
    0 6px 16px rgba(0, 0, 0, 0.25);
  white-space: pre;
  overflow: hidden;
}

.sign-type p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 28rem;
}

.activate {
  margin: 0.5rem 0 0.5rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
  max-width: 44rem;
}

.activate h4 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.activate ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.activate li { margin-bottom: 0.4rem; }

footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem clamp(1.25rem, 4vw, 2rem) 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
}
footer a { color: var(--accent); }

@media (max-width: 640px) {
  .hero { min-height: 78vh; align-items: flex-end; }
  .server-list li { grid-template-columns: 1fr; }
}
