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

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  transition:
    background 0.4s var(--ease),
    color 0.4s var(--ease);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- ambient background ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient span {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  animation: drift 26s ease-in-out infinite alternate;
}

.ambient span:nth-child(1) {
  top: -10%;
  left: -8%;
  background: var(--c1);
}

.ambient span:nth-child(2) {
  bottom: -15%;
  right: -10%;
  background: var(--c2);
  animation-duration: 32s;
  animation-delay: -6s;
}

.ambient span:nth-child(3) {
  top: 40%;
  left: 60%;
  width: 30vw;
  height: 30vw;
  background: var(--sandbox-a);
  opacity: 0.08;
  animation-duration: 40s;
  animation-delay: -14s;
}

body.no-ambient .ambient {
  display: none;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(6%, 8%) scale(1.12);
  }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */

.site-header {
  position: relative;
  z-index: 10;
  padding: 22px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text-1);
}

.wordmark .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 14%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}

.wordmark strong {
  font-weight: 600;
}

.wordmark span {
  color: var(--text-3);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 24%, transparent);
  }
  50% {
    opacity: 1.4;
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--c1) 14%, transparent);
  }
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 38px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.lang-pill {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.lang-pill:hover { color: var(--text-1); }
.lang-pill.active { color: var(--bg); background: var(--c1); }

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.82rem;
  transition:
    border-color 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.ctrl-btn:hover {
  color: var(--text-1);
  border-color: var(--c1);
  transform: translateY(-1px);
}

.ctrl-btn.square {
  width: 38px;
  padding: 0;
  justify-content: center;
}

.ctrl-btn .glyph {
  font-size: 0.95rem;
  line-height: 1;
}

.login-btn {
  border-color: var(--line);
}

.login-btn .glyph {
  font-weight: 700;
  font-family: var(--font-display);
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-btn .avatar-img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.palette-wrap {
  position: relative;
}

.palette-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--grad);
  border: 1px solid color-mix(in srgb, var(--text-1) 20%, transparent);
}

.palette-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease);
  z-index: 20;
}

.palette-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.palette-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.palette-option.active {
  border-color: var(--text-1);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 2;
  padding: 96px 0 88px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 28px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5.4vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 22px;
}

.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .rotator-line {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  color: var(--text-2);
  min-height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.rotator-word {
  color: var(--text-1);
  display: inline-block;
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
}

.rotator-word.swap {
  opacity: 0;
  transform: translateY(6px);
}

.hero .sub {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-3);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero .sub code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.86em;
}

/* ---------- track / transit map ---------- */

.map-section {
  position: relative;
  z-index: 2;
  padding-bottom: 60px;
}

.hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 40px;
  text-align: center;
}

.hub-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grad);
  position: relative;
}

.hub-dot::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c1) 40%, transparent);
  animation: ring 2.6s var(--ease) infinite;
}

@keyframes ring {
  from {
    transform: scale(0.9);
    opacity: 1;
  }
  to {
    transform: scale(1.9);
    opacity: 0;
  }
}

.hub-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2);
}

.hub-label strong {
  color: var(--text-1);
}

.track {
  position: relative;
  padding: 0;
  list-style: none;
}

.track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--line) 0%,
    var(--line) 82%,
    var(--sandbox-a) 92%,
    var(--sandbox-b) 100%
  );
  transform: translateX(-50%);
}

.stop {
  position: relative;
  padding: 30px 0;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.6s var(--ease);
}

.stop.in-view {
  opacity: 1;
  transform: translateY(0);
}

.stop-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.stop-marker .stop-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--wip);
}

.stop--live .stop-dot {
  background: var(--grad);
  animation: pulse 2.4s ease-in-out infinite;
}

.stop--sandbox .stop-marker {
  border-color: var(--sandbox-a);
}

.stop--sandbox .stop-dot {
  background: var(--sandbox-grad);
  animation: pulse-sandbox 2.4s ease-in-out infinite;
}

@keyframes pulse-sandbox {
  0%,
  100% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sandbox-a) 24%, transparent);
  }
  50% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--sandbox-a) 14%, transparent);
  }
}

.card-wrap {
  width: calc(50% - 54px);
}

.stop[data-side="left"] .card-wrap {
  margin-right: auto;
}

.stop[data-side="right"] .card-wrap {
  margin-left: auto;
}
.stop[data-side="left"] .stop-marker {
  transform: translate(-130%, -50%);
}

.stop[data-side="right"] .stop-marker {
  transform: translate(30%, -50%);
}

.card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 26px 26px 22px;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease),
    border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.stop--live .card:hover {
  transform: translateY(-5px);
  border-color: var(--c1);
  box-shadow: var(--shadow);
}

.stop--live.card-hovered .stop-marker,
.stop--sandbox.card-hovered .stop-marker,
.stop--wip.card-hovered .stop-marker {
  border-color: var(--line);
}

.stop--live.card-hovered .stop-marker {
  border-color: var(--c1);
}

.stop--sandbox.card-hovered .stop-marker {
  border-color: var(--sandbox-a);
}

.stop--wip.card-hovered .stop-marker {
  border-color: var(--wip-line);
}

.stop[data-side="left"].card-hovered .stop-marker {
  transform: translate(-130%, -50%) scale(1.04);
}

.stop[data-side="right"].card-hovered .stop-marker {
  transform: translate(30%, -50%) scale(1.04);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.card-tagline {
  color: var(--text-3);
  font-size: 0.86rem;
  margin: 0;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stop--live .status-badge {
  color: var(--c1);
  background: color-mix(in srgb, var(--c1) 14%, transparent);
}

.stop--wip .status-badge {
  color: var(--text-2);
  background: var(--line-soft);
}

.stop--sandbox .status-badge {
  color: var(--sandbox-a);
  background: color-mix(in srgb, var(--sandbox-a) 14%, transparent);
}

.card-desc {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.card-tags span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--grad-soft);
  color: var(--c1);
}

.stop--wip .card-tags span,
.stop--sandbox .card-tags span {
  color: var(--text-2);
  background: var(--line-soft);
}

.stop--sandbox .card-tags span {
  color: var(--sandbox-a);
  background: color-mix(in srgb, var(--sandbox-a) 12%, transparent);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2);
}

.counter .num {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-1);
}

.counter .num.skeleton {
  display: inline-block;
  width: 3.4em;
  height: 1em;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--line-soft) 25%,
    var(--line) 50%,
    var(--line-soft) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}

.counter .num.offline {
  color: var(--text-3);
  font-weight: 400;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.card-cta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--c1);
}

.stop--wip .card-cta {
  color: var(--text-3);
}

.stop--sandbox .card-cta {
  color: var(--sandbox-a);
}

.card-cta .arrow {
  transition: transform 0.25s var(--ease);
}

.stop--live .card:hover .card-cta .arrow {
  transform: translate(3px, -3px);
}

.stop--wip .card,
.stop--sandbox .card {
  filter: grayscale(0.65);
}

.stop--wip .card:hover {
  filter: grayscale(0.35);
  border-color: var(--wip-line);
}

.stop--sandbox .card {
  filter: none;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--sandbox-a) 35%, var(--line));
  background: linear-gradient(
    160deg,
    var(--bg-card),
    color-mix(in srgb, var(--sandbox-b) 4%, var(--bg-card))
  );
}

.stop--sandbox .card:hover {
  border-color: var(--sandbox-a);
  transform: translateY(-5px);
  box-shadow: 0 24px 60px -28px
    color-mix(in srgb, var(--sandbox-a) 45%, transparent);
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line);
  padding: 52px 0 34px;
  margin-top: 40px;
}

footer {
  position: relative;
  overflow: hidden;
  padding: 40px 20px;

  /* Эффект матового стекла */
  background-color: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border-top: 1px solid rgba(255, 255, 255, 0.1);

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://w3.org' viewBox='0 0 1000 400' fill='none' stroke='rgba(255,255,255,0.25)' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M500,200 L450,150 L350,160 L280,110 L200,130 L100,80' /%3E%3Cpath d='M450,150 L420,80 L460,20 L530,0' /%3E%3Cpath d='M350,160 L310,240 L220,260 L150,350' /%3E%3Cpath d='M500,200 L580,180 L640,230 L720,210 L850,270 L1000,250' /%3E%3Cpath d='M580,180 L610,100 L700,70 L780,20' /%3E%3Cpath d='M640,230 L670,320 L760,350 L820,400' /%3E%3Cpath d='M500,200 L480,280 L520,340 L490,400' /%3E%3Cpath d='M480,280 L390,310 L330,390' /%3E%3Cpath d='M500,200 L540,120 L620,80' /%3E%3Cpath d='M540,120 L490,70 L510,30' /%3E%3Cpath d='M480,170 L520,160 L510,190 L470,185 Z' /%3E%3Cpath d='M530,210 L550,180 L570,220 Z' /%3E%3Cpath d='M460,210 L440,230 L480,240 Z' /%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
  position: relative;
  z-index: 2;
}

.footer-col h3 {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 14px;
}

.footer-col p {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 10px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.9rem;
  transition: color 0.2s var(--ease);
}

.footer-col a:hover {
  color: var(--c1);
}

.dev-credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--text-1);
  margin-bottom: 10px;
}

.dev-credit .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-3);
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .track::before {
    left: 27px;
  }

  .stop-marker,
  .stop[data-side="left"] .stop-marker,
  .stop[data-side="right"] .stop-marker {
    left: 27px;
    transform: translate(-50%, -50%);
  }

  .card-wrap,
  .stop[data-side="left"] .card-wrap,
  .stop[data-side="right"] .card-wrap {
    width: calc(100% - 60px);
    margin-left: 60px;
    margin-right: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 64px 0 56px;
  }

  .controls .ctrl-btn:not(.square) span.label {
    display: none;
  }

  .card {
    padding: 20px 20px 18px;
  }
}

@media (max-width: 400px) {
  .controls {
    gap: 6px;
  }
  .ctrl-btn,
  .lang-switcher {
    height: 34px;
  }
  .ctrl-btn.square {
    width: 34px;
  }
  .lang-pill {
    padding: 3px 5px;
    font-size: 0.62rem;
  }
  .wordmark span:not(.dot) {
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- toastify overrides ---------- */

.toastify {
  font-family: var(--font-body) !important;
  border-radius: var(--radius-m) !important;
  box-shadow: var(--shadow) !important;
  padding: 14px 18px !important;
}

/* ---------- кастомний скрол — той самий вигляд, що й в tg-stats ---------- */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
