:root {
  --ink: #121826;
  --muted: #8d97a8;
  --line: #e6ebf2;
  --blue: #3b82f6;
  --blue-deep: #2563eb;
  --paper: #f6f8fb;
  --card: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(18, 24, 38, 0.09) 1px, transparent 1px);
  background-size: 18px 18px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

.bar {
  position: sticky;
  top: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 8px 8px 8px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(22, 40, 80, 0.05);
  backdrop-filter: blur(14px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}

.btn:hover { background: var(--blue-deep); }

.btn:focus-visible,
.logo:focus-visible,
.switch button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

main { padding-top: 72px; }

h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(40px, 5.4vw, 68px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

h1 span {
  background: linear-gradient(100deg, #2563eb 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 28px auto 0;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #667085;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.switch button[aria-selected="true"] {
  background: #eaf4ff;
  color: #17315c;
  box-shadow: inset 0 0 0 1px #c5e2ff;
}

.num {
  margin-right: 6px;
  color: #98a2b3;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.switch button[aria-selected="true"] .num { color: var(--blue); }

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 48px;
}

.wires {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.wire {
  fill: none;
  stroke: #bfd6fb;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 1.4 7;
}

.bead {
  fill: #3b82f6;
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.7));
}

.side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px 14px 16px;
  box-shadow: 0 12px 32px rgba(22, 40, 80, 0.045);
}

.side-label {
  margin: 0 0 12px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.tiles li {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #f7f9fc;
  border: 1px solid #e7edf4;
  color: #2a303a;
  transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}

.tiles li.is-picked {
  background: #fff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.tiles svg {
  width: 28px;
  height: 28px;
  display: block;
}

.mark-vk { transform: scale(1.12); }
.mark-cr { transform: scale(1.06); }
.mark-ec { transform: scale(1.08); }
.mark-rt { transform: scale(1.12); }

.link {
  width: 72px;
  height: 220px;
  flex: none;
}

.link svg {
  width: 100%;
  height: 100%;
}

.hub {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  flex: none;
}

.hub-orbit {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed #c7ddfc;
  animation: spin 18s linear infinite;
}

.hub-orbit::before,
.hub-orbit::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.hub-orbit::before { top: -3px; left: 50%; margin-left: -3.5px; }
.hub-orbit::after { bottom: -3px; left: 50%; margin-left: -3.5px; background: #60a5fa; }

.hub-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: linear-gradient(160deg, #60a5fa, #3b82f6 56%, #2563eb);
  box-shadow:
    0 18px 40px rgba(37, 99, 235, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.hub-mark::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 34px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 68%);
  animation: glow 3.4s ease-in-out infinite;
  z-index: -1;
}

.hub-logo {
  width: 52px;
  height: 52px;
}

.hub-arrow { animation: nudge 1.6s ease-in-out infinite; }

@keyframes glow {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

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

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(1.6px); }
}

.caption {
  margin: 28px 0 0;
  text-align: center;
  color: #3d4a5c;
  font-size: 16px;
}

.names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  max-width: 980px;
  margin: 36px auto 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.footer {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  margin-bottom: 28px;
  color: #98a2b3;
  font-size: 13px;
}

@media (max-width: 820px) {
  .wrap { width: min(1080px, calc(100% - 28px)); }

  main { padding-top: 28px; }

  h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  .switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-top: 22px;
    border-radius: 18px;
  }

  .switch button {
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .wires { display: none; }

  .stage {
    flex-direction: column;
    gap: 0;
    margin-top: 28px;
  }

  .link {
    position: relative;
    width: 2px;
    height: 28px;
    background: repeating-linear-gradient(to bottom, #93c5fd 0 2px, transparent 2px 7px);
  }

  .link::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 7px;
    height: 7px;
    margin-left: -3.5px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
    animation: fall 1.2s linear infinite;
  }

  .side { width: min(100%, 236px); }

  .hub {
    width: 124px;
    height: 124px;
  }

  .hub-orbit { inset: 8px; }

  .hub-mark {
    width: 80px;
    height: 80px;
    border-radius: 24px;
  }

  .hub-logo {
    width: 42px;
    height: 42px;
  }

  .caption {
    margin-top: 22px;
    font-size: 15px;
  }

  .names {
    gap: 8px 16px;
    margin-top: 22px;
    font-size: 12px;
  }

  .footer { margin-top: 36px; }
}

@keyframes fall {
  from { transform: translateY(0); opacity: 0; }
  25% { opacity: 1; }
  75% { opacity: 1; }
  to { transform: translateY(22px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-orbit,
  .hub-mark::after,
  .hub-arrow,
  .link::after { animation: none; }
  .bead { display: none; }
}
