:root {
  --ink: #070c16;
  --ink-soft: #152238;
  --fog: #e8eef8;
  --muted: #8a9bb5;
  --mint: #ff3b4a;
  --mint-dim: rgba(255, 59, 74, 0.18);
  --steel: #5d7a9a;
  --line: rgba(232, 238, 248, 0.08);
  --font-display: "Syne", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--fog);
  background: var(--ink);
  font-family: var(--font-mono);
  overflow-x: hidden;
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  padding-bottom: clamp(3rem, 8vh, 5.5rem);
  max-width: 56rem;
}

.brand {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 12vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--fog);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.headline {
  margin: 0 0 1rem;
  max-width: 18ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.6vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.lede {
  margin: 0 0 2rem;
  max-width: 36ch;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease,
    color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--mint);
  color: var(--ink);
}

.btn.primary:hover {
  background: #ff5c69;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--fog);
}

.btn.ghost:hover {
  border-color: var(--mint);
  color: var(--mint);
}

.work {
  position: relative;
  z-index: 2;
  padding: clamp(4.5rem, 13vh, 8rem) clamp(1.5rem, 4vw, 3.5rem)
    clamp(3rem, 8vh, 5rem);
  background: linear-gradient(
    180deg,
    rgba(7, 12, 22, 0) 0%,
    rgba(7, 12, 22, 0.62) 20%,
    rgba(7, 12, 22, 0.93) 48%,
    rgba(7, 12, 22, 0.99) 100%
  );
  border-top: 1px solid var(--line);
}

.work::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 59, 74, 0.5) 22%,
    rgba(93, 122, 154, 0.4) 60%,
    transparent
  );
}

.work-inner {
  max-width: 40rem;
}

.work-label {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--mint);
}

.work h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.work-copy {
  margin: 0 0 2rem;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.signal-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  transition: background 0.25s ease, padding 0.25s ease;
}

.signal-list li:hover {
  background: linear-gradient(90deg, rgba(255, 59, 74, 0.07), transparent 72%);
  padding-left: 1.1rem;
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 var(--mint-dim);
  animation: pulse 2.4s ease-out infinite;
}

.dot.idle {
  background: var(--steel);
  box-shadow: none;
  animation: none;
}

.name {
  font-weight: 500;
}

.meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem clamp(1.5rem, 4vw, 3.5rem) 2.25rem;
  font-size: 0.75rem;
  color: var(--steel);
  background: #070c16;
  border-top: 1px solid var(--line);
}

.foot .sep {
  opacity: 0.5;
}

.row-link {
  justify-self: end;
  padding: 0.2rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--mint);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.row-link:hover {
  color: #ff5c69;
}

/* ---------- Servers popup ---------- */
.modal {
  position: absolute;
  top: clamp(1.5rem, 6vh, 3.5rem);
  right: clamp(1.25rem, 5vw, 3.5rem);
  z-index: 5;
  width: min(36rem, calc(100vw - 2.5rem));
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 5rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(15, 24, 40, 0.97), rgba(8, 13, 23, 0.99));
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 59, 74, 0.05);
  animation: drop-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 59, 74, 0.55) 30%,
    rgba(93, 122, 154, 0.4) 70%,
    transparent
  );
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.modal-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.bar-leds {
  display: inline-flex;
  gap: 0.35rem;
}

.led {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: block;
}

.led.red {
  background: #ff3b4a;
}

.led.amber {
  background: #e7a94b;
}

.led.green {
  background: #4bbd86;
}

.bar-path {
  flex: 1;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--steel);
}

.modal-x {
  padding: 0.25rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.modal-x:hover {
  color: var(--fog);
  border-color: var(--mint);
}

.modal-head {
  padding: 1.4rem 1.5rem 0.9rem;
}

.modal-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--mint);
}

.modal-sub {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

.modal-split {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.9rem 1.2rem 1.5rem;
  border-right: 1px solid var(--line);
}

.tab {
  position: relative;
  padding: 0.55rem 0.7rem 0.55rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.tab:hover {
  color: var(--fog);
  background: rgba(255, 255, 255, 0.02);
}

.tab.is-active {
  color: var(--fog);
  border-left-color: var(--mint);
  background: rgba(255, 59, 74, 0.07);
}

.panels {
  padding: 1.1rem 1.5rem 1.2rem 1.3rem;
}

.tab-panel {
  animation: panel-fade 0.3s ease both;
}

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

.node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.node-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--steel);
}

.node-status i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--steel);
}

.node-status.online {
  color: var(--mint);
}

.node-status.online i {
  background: var(--mint);
  box-shadow: 0 0 0 0 var(--mint-dim);
  animation: pulse 2.4s ease-out infinite;
}

.node-status.offline {
  color: #7c8aa0;
}

.node-status.offline i {
  background: #7c8aa0;
}

.node-status.checking {
  color: var(--steel);
}

.node-status.checking i {
  background: var(--steel);
  animation: pulse 1.4s ease-out infinite;
}

.node-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.node-name span {
  color: var(--muted);
  font-weight: 600;
}

.node-desc {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

.node-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.node-meta > div {
  padding: 0.7rem 0.85rem;
  background: rgba(9, 14, 24, 0.7);
}

.node-meta dt {
  margin-bottom: 0.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel);
}

.node-meta dd {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fog);
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  text-align: left;
  color: var(--fog);
  background: rgba(255, 59, 74, 0.08);
  border: 1px solid rgba(255, 59, 74, 0.35);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 59, 74, 0.14);
  border-color: var(--mint);
}

.copy-btn:active {
  transform: translateY(1px);
}

.copy-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
}

.copy-addr {
  font-size: 0.92rem;
  font-weight: 500;
}

.copy-btn.copied {
  background: rgba(75, 189, 134, 0.14);
  border-color: #4bbd86;
}

.copy-btn.copied .copy-label {
  color: #6fd6a3;
}

.panel-link {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.panel-link:hover {
  color: var(--mint);
}

/* ---------- Server landing pages ---------- */
.substage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  min-height: 100vh;
  max-width: 46rem;
  padding: clamp(1.5rem, 5vw, 3.5rem);
}

.back {
  align-self: flex-start;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back:hover {
  color: var(--mint);
}

.sub-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mint);
}

.sub-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.sub-title--long {
  font-size: clamp(1.9rem, 7.5vw, 4.5rem);
}

.sub-lede {
  margin: 0;
  max-width: 44ch;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
}

.sub-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--steel);
}

.status-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--steel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-pill i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.online {
  color: var(--mint);
  border-color: rgba(255, 59, 74, 0.35);
}

.status-pill.online i {
  animation: pulse 2.4s ease-out infinite;
}

.status-pill.checking i {
  animation: pulse 1.4s ease-out infinite;
}

.addr-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
  padding: 0.7rem 0.7rem 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.addr-value {
  flex: 1;
  font-size: 1rem;
  color: var(--fog);
  overflow-wrap: anywhere;
}

.addr-copy {
  padding: 0.45rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint);
  background: rgba(255, 59, 74, 0.08);
  border: 1px solid rgba(255, 59, 74, 0.35);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.addr-copy:hover {
  background: rgba(255, 59, 74, 0.16);
  border-color: var(--mint);
}

.addr-copy.copied {
  background: rgba(75, 189, 134, 0.15);
  border-color: #4bbd86;
  color: #6fd6a3;
}

.specs {
  max-width: 32rem;
}

.modal-hint {
  margin: 1rem 1.5rem 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--steel);
}

kbd {
  padding: 0.1rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fog);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  color: var(--fog);
  background: rgba(9, 14, 24, 0.95);
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panel-fade {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--mint-dim);
  }
  70% {
    box-shadow: 0 0 0 0.55rem transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .headline,
  .lede,
  .actions,
  .dot,
  .modal-panel,
  .tab-panel,
  .node-status.online i,
  .node-status.checking i,
  .status-pill.online i,
  .status-pill.checking i {
    animation: none;
  }
}

@media (max-width: 560px) {
  .signal-list li {
    grid-template-columns: auto 1fr;
  }

  .meta,
  .row-link {
    grid-column: 2;
    justify-self: start;
  }

  .node-meta {
    grid-template-columns: 1fr;
  }

  .modal-split {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: row;
    padding: 0.6rem 1.5rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tab {
    padding: 0.55rem 0.7rem;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .tab.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--mint);
    background: transparent;
  }
}
