:root {
  --bg: #101018;
  --panel: #191a26;
  --line: #262838;
  --ink: #f2f3f8;
  --mute: #8b90a8;
  --blue: #4f8cff;
  --blue-dim: #2f5cb0;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Manrope, "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

main { max-width: 940px; margin: 0 auto; padding: 0 22px; }

/* ---------------------------------------------------------- шапка */

.top {
  max-width: 940px;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand b { color: var(--blue); font-weight: 800; }
.brand-mark { width: 34px; height: 34px; color: var(--blue); flex: none; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 15px;
}
.top-nav a { color: var(--mute); }
.top-nav a:hover { color: var(--ink); text-decoration: none; }

.top-balance {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--mute);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

/* ---------------------------------------------------------- герой */

.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 42px;
  align-items: start;
  padding: 34px 0 60px;
}

/* когда услуг с ценой за единицу нет, калькулятора не будет —
   не оставляем пустую вторую колонку */
.hero-solo { grid-template-columns: 1fr; }

.hero h1 {
  margin: 0 0 16px;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero-text p {
  margin: 0;
  color: var(--mute);
  max-width: 46ch;
}

/* ---------------------------------------------------------- калькулятор */

.calc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.calc-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

.calc-tab {
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--mute);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.calc-tab.is-on {
  border-color: var(--blue-dim);
  background: rgba(79, 140, 255, 0.12);
  color: var(--ink);
}

.calc-field { display: block; }

.calc-label {
  display: block;
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 6px;
}

#calc-qty {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calc-out {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 14px;
}
.calc-out strong {
  font-size: 27px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.calc-note { margin: 10px 0 0; font-size: 13px; color: var(--mute); min-height: 1.2em; }
.calc-note.is-warn { color: #ffb27a; }

/* ---------------------------------------------------------- услуги */

.group { padding-bottom: 46px; }

.group h2, .how h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--mute);
  margin: 0 0 14px;
}

.services { list-style: none; margin: 0; padding: 0; }

.service + .service { margin-top: 8px; }

.service a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}
.service a:hover { border-color: var(--blue-dim); text-decoration: none; }

.service-name { font-weight: 700; }
.service-price { color: var(--mute); font-size: 15px; text-align: right; }

/* ---------------------------------------------------------- как работает */

.how { padding-bottom: 60px; }

.steps {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink);
}
.steps li { margin-bottom: 6px; }

.how-note { margin: 0; color: var(--mute); font-size: 15px; max-width: 62ch; }

/* ---------------------------------------------------------- карточка услуги */

.detail { padding: 10px 0 70px; max-width: 620px; }

.back { font-size: 15px; color: var(--mute); }

.detail h1 {
  margin: 14px 0 10px;
  font-size: 32px;
  letter-spacing: -0.02em;
}

.detail-price { margin: 0; font-size: 21px; font-weight: 700; }
.detail-limits { margin: 6px 0 0; color: var(--mute); font-size: 15px; }

.detail-body {
  margin: 22px 0;
  white-space: pre-wrap;
  color: var(--ink);
}

.detail-out { color: #ffb27a; }

.cta {
  display: inline-block;
  margin-top: 22px;
  padding: 13px 26px;
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
}
.cta:hover { text-decoration: none; background: #6b9dff; }

.cta-note { margin: 12px 0 0; color: var(--mute); font-size: 14px; max-width: 52ch; }

.tg-widget { margin: 26px 0; min-height: 46px; }

/* ---------------------------------------------------------- кабинет */

.cab { padding: 10px 0 70px; }
.cab h1 { margin: 0 0 22px; font-size: 32px; letter-spacing: -0.02em; }
.cab h2 { font-size: 15px; color: var(--mute); margin: 34px 0 14px; }

.cab-top { display: flex; gap: 12px; flex-wrap: wrap; }

.cab-balance, .cab-refs {
  flex: 1 1 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.cab-balance span, .cab-refs span {
  display: block;
  color: var(--mute);
  font-size: 14px;
  margin-bottom: 4px;
}
.cab-balance strong, .cab-refs strong {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.orders { width: 100%; border-collapse: collapse; font-size: 15px; }
.orders th {
  text-align: left;
  font-weight: 500;
  color: var(--mute);
  font-size: 13px;
  padding: 0 12px 8px 0;
}
.orders td { padding: 11px 12px 11px 0; border-top: 1px solid var(--line); }
.orders td:nth-child(3) { font-variant-numeric: tabular-nums; white-space: nowrap; }

.empty { color: var(--mute); }

/* ---------------------------------------------------------- документы */

.legal { padding: 10px 0 70px; max-width: 68ch; }
.legal h1 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 22px; }
.legal-body { white-space: pre-wrap; color: #d7dae6; font-size: 16px; }
.legal-body b { color: var(--ink); }

/* ---------------------------------------------------------- подвал */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 26px 22px 46px;
  max-width: 940px;
  margin-inline: auto;
}
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; font-size: 15px; }
.foot-legal { margin: 16px 0 0; color: var(--mute); font-size: 14px; }

/* ---------------------------------------------------------- мобильные */

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-bottom: 44px; }
  .hero h1 { font-size: 31px; }
  .top { flex-wrap: wrap; }
  .service a { flex-direction: column; align-items: flex-start; gap: 6px; }
  .service-price { text-align: left; }
  .orders th:last-child, .orders td:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------- формы заказа */

.form-error {
  margin: 18px 0 0;
  padding: 12px 15px;
  background: rgba(255, 120, 90, 0.10);
  border: 1px solid rgba(255, 120, 90, 0.35);
  border-radius: 10px;
  color: #ffb0a0;
  font-size: 15px;
}

.order, .topup { margin-top: 24px; }

.order-field { display: block; max-width: 290px; margin-bottom: 16px; }
.order-field span {
  display: block;
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 6px;
}
.order-field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.order-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

button.cta { border: 0; cursor: pointer; font: inherit; font-weight: 700; }

button.cta-ghost, a.cta-ghost {
  background: transparent;
  border: 1px solid var(--blue-dim);
  color: var(--ink);
  padding: 12px 25px;
}
button.cta-ghost:hover, a.cta-ghost:hover { background: rgba(79, 140, 255, 0.12); border-color: var(--blue); }
button.cta-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.topup .cta { margin-top: 0; }

/* ---------------------------------------------------------- орбиты */

/* container-type даёт правилу @container ниже мерить эту колонку,
   а не окно целиком — блок ведёт себя правильно внутри любой вёрстки */
.orbit-wrap {
  container-type: inline-size;
}

.orbits {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.orbit-star {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #7ea9ff, var(--blue) 46%, var(--blue-dim) 100%);
  box-shadow: 0 0 0 8px rgba(79, 140, 255, 0.08), 0 0 44px 6px rgba(79, 140, 255, 0.22);
}

/* --r, --dur, --dir, --dir-rev приходят из шаблона, их считает build_orbits() */
.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--r) * 2);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.ring-line {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(79, 140, 255, 0.16);
  border-radius: 50%;
}

.ring-rot {
  position: absolute;
  inset: 0;
  animation: orbit-spin var(--dur) linear infinite;
  animation-direction: var(--dir);
}

.arm { position: absolute; inset: 0; transform: rotate(var(--a)); }

/* якорь нулевого размера на верхней точке кольца */
.node { position: absolute; left: 50%; top: 0; width: 0; height: 0; }

/* CSS не даёт смешать статичный поворот с анимированным на одном элементе,
   отсюда две обёртки: одна гасит поворот руки, вторая — вращение кольца */
.node-fix { position: absolute; transform: rotate(calc(-1 * var(--a))); }

.node-spin {
  position: absolute;
  animation: orbit-spin var(--dur) linear infinite;
  animation-direction: var(--dir-rev);
}

.planet { position: absolute; display: block; }

.planet-dot {
  position: absolute;
  left: -19px;
  top: -19px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--blue-dim);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--blue);
  transition: border-color .18s, background .18s, color .18s;
}

.planet-label {
  position: absolute;
  top: 24px;
  left: -66px;
  width: 132px;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .18s;
  pointer-events: none;
}

.planet:hover { text-decoration: none; }
.planet:hover .planet-dot {
  border-color: var(--blue);
  background: rgba(79, 140, 255, 0.16);
  color: var(--ink);
}
.planet:hover .planet-label { color: var(--ink); }

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

/* узкая колонка — кольца нечитаемы, навигацией остаётся список услуг ниже */
@container (max-width: 400px) {
  .orbits { display: none; }
  .orbit-wrap { padding: 0; }
}

/* позиции заданы трансформами, поэтому остановка просто замораживает
   систему в исходных углах; глобальное правило выше это уже делает,
   дублируем на случай, если оно когда-нибудь уедет */
@media (prefers-reduced-motion: reduce) {
  .ring-rot, .node-spin { animation: none; }
}

/* ---------------------------------------------------------- главная и каталог */

.hero-actions { margin-top: 26px; }
.hero-actions .cta { margin-top: 0; }

.page-head { padding: 34px 0 30px; max-width: 52ch; }
.page-head h1 {
  margin: 0 0 14px;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.page-head p { margin: 0; color: var(--mute); }

.calc-section { padding-bottom: 46px; max-width: 420px; }

@media (max-width: 760px) {
  .page-head { padding: 22px 0 24px; }
  .page-head h1 { font-size: 28px; }
}

/* ---------------------------------------------------------- герой с орбитой */

.hero-orbit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 50px;
  align-items: center;
  padding: 30px 0 70px;
  min-height: 66vh;
}

/* если услуг нет, орбиты не будет — не оставляем пустую колонку */
.hero-orbit-solo { grid-template-columns: 1fr; min-height: 0; }

.hero-orbit h1 {
  margin: 0 0 18px;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero-orbit .hero-text > p {
  margin: 0;
  color: var(--mute);
  max-width: 42ch;
}

.hero-points {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  font-size: 15px;
  color: var(--mute);
}
.hero-points li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 9px;
}
.hero-points li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

/* ---------------------------------------------------------- шаги карточками */

.steps-grid {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.steps-grid li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 20px;
  font-size: 15px;
  line-height: 1.4;
}

.step-num {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1000px) {
  .hero-orbit { grid-template-columns: 1fr; gap: 20px; min-height: 0; }
  .hero-orbit h1 { font-size: 31px; }
  .orbits { max-width: 420px; }
  .planet-label { left: -56px; width: 112px; font-size: 12px; }
}

/* ---------------------------------------------------------- страница заказа */

.pay-box {
  margin: 24px 0 26px;
  padding: 20px 22px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.pay-label {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--mute);
}
.pay-box .pay-label + .pay-label,
.pay-note + .pay-label { margin-top: 20px; }

.pay-amount {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pay-note { margin: 10px 0 0; font-size: 14px; color: #ffb27a; max-width: 46ch; }

.pay-details {
  margin: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 16px;
  word-break: break-all;
  user-select: all;
}

.pay-state {
  margin: 22px 0 0;
  font-size: 21px;
  font-weight: 700;
}
.pay-ok { color: #7ee2a8; }
.pay-bad { color: #ffb0a0; }

.order-field-wide { max-width: 420px; }
.order-buttons form { margin: 0; }
