:root {
  --bg: #05070a;
  --panel: rgba(12, 18, 26, 0.72);
  --line: rgba(120, 180, 220, 0.14);
  --text: #eef4fa;
  --muted: #8ea0b3;
  --cyan: #4fd6ff;
  --cyan-2: #2bb8ff;
  --ok: #3dd68c;
  --warn: #f0b429;
  --bad: #f07178;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  height: 100dvh;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 18px 16px calc(14px + var(--safe-b));
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.app__stack {
  width: 100%;
  display: grid;
  gap: 12px;
}

/* ——— stage ——— */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(700px 380px at 8% -8%, rgba(47, 180, 255, 0.18), transparent 55%),
    radial-gradient(560px 360px at 100% 0%, rgba(18, 80, 130, 0.2), transparent 50%),
    linear-gradient(180deg, #070b12, #05070a 55%, #040608);
}

.stage__grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(79, 214, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 214, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, #000 20%, transparent 70%);
  animation: gridDrift 28s linear infinite;
}

.stage__glow {
  position: absolute;
  width: 420px;
  height: 420px;
  left: 50%;
  top: -120px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(79, 214, 255, 0.12), transparent 65%);
  animation: breath 5.5s ease-in-out infinite;
}

.stage__logo {
  position: absolute;
  right: max(2vw, 10px);
  bottom: max(4vh, 18px);
  width: min(240px, 34vw);
  opacity: 0.22;
  pointer-events: none;
  filter: drop-shadow(0 0 28px rgba(79, 214, 255, 0.18));
  animation: stageLogoFloat 7s ease-in-out infinite;
}

.stage__logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* ——— nav ——— */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: rise 0.45s ease both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(79, 214, 255, 0.22);
  animation: brandGlow 3.2s ease-in-out infinite;
}

.brand__mark img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  animation: brandMarkPulse 3.2s ease-in-out infinite;
}

.brand:hover .brand__mark {
  box-shadow: 0 0 0 1px rgba(79, 214, 255, 0.5), 0 0 22px rgba(210, 75, 255, 0.28);
  transform: translateY(-1px) scale(1.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand span {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.brand strong {
  font-weight: 700;
}

.brand em {
  font-style: normal;
  color: var(--cyan);
  font-weight: 600;
}

.nav__actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.18s, box-shadow 0.2s, color 0.2s;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn:not(:disabled):hover {
  border-color: rgba(79, 214, 255, 0.45);
  background: rgba(79, 214, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.icon-btn:not(:disabled):hover svg {
  transform: scale(1.08);
}

.icon-btn:not(:disabled):active {
  transform: translateY(0);
}

.icon-btn--accent {
  background: linear-gradient(135deg, rgba(79, 214, 255, 0.18), rgba(43, 184, 255, 0.08));
  border-color: rgba(79, 214, 255, 0.32);
}

.icon-btn--accent:hover {
  border-color: rgba(79, 214, 255, 0.6);
  background: linear-gradient(135deg, rgba(79, 214, 255, 0.28), rgba(43, 184, 255, 0.14));
}

/* ——— HUD ——— */
.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.55s ease both;
  position: relative;
}

.hud__pulse {
  width: 46px;
  height: 46px;
  position: relative;
  display: grid;
  place-items: center;
}

.hud__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(79, 214, 255, 0.25);
}

.hud__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(79, 214, 255, 0.4);
}

.hud__pulse[data-state="ACTIVE"] .hud__dot {
  background: var(--ok);
  animation: pulseOk 2s ease-out infinite;
}

.hud__pulse[data-state="ACTIVE"] .hud__ring {
  border-color: rgba(61, 214, 140, 0.45);
  animation: ringSpin 8s linear infinite;
}

.hud__pulse[data-state="LIMITED"] .hud__dot,
.hud__pulse[data-state="EXPIRED"] .hud__dot,
.hud__pulse[data-state="DISABLED"] .hud__dot {
  background: var(--bad);
}

.hud__pulse[data-state="loading"] .hud__dot {
  background: var(--cyan);
  animation: pulseOk 1.2s ease-out infinite;
}

.hud__user {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hud__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hud__lead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(139, 154, 171, 0.14);
  color: var(--muted);
}

.badge[data-tone="ok"] {
  background: rgba(61, 214, 140, 0.14);
  color: var(--ok);
}

.badge[data-tone="warn"] {
  background: rgba(240, 180, 41, 0.14);
  color: var(--warn);
}

.badge[data-tone="bad"] {
  background: rgba(240, 113, 120, 0.14);
  color: var(--bad);
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.hud__metrics {
  display: flex;
  gap: 14px;
  align-items: center;
}

.metric__label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.metric__value {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.metric--with-ring {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ring {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.ring svg {
  width: 34px;
  height: 34px;
  transform: rotate(-90deg);
}

.ring__track,
.ring__fill {
  fill: none;
  stroke-width: 3;
}

.ring__track {
  stroke: rgba(255, 255, 255, 0.08);
}

.ring__fill {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-dasharray: 94.2477796077;
  stroke-dashoffset: 94.2477796077;
  transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.ring[data-tone="ok"] .ring__fill { stroke: var(--ok); }
.ring[data-tone="warn"] .ring__fill { stroke: var(--warn); }
.ring[data-tone="bad"] .ring__fill { stroke: var(--bad); }
.ring[data-tone="cyan"] .ring__fill { stroke: var(--cyan); }

/* бессрочная подписка — полный мягкий круг */
.ring.is-infinite .ring__fill {
  stroke: var(--ok);
  stroke-dashoffset: 0 !important;
  opacity: 0.45;
  animation: infiniteRing 3.2s ease-in-out infinite;
}

/* безлимитный трафик — пустая дуга, живой трек */
.ring.is-unlimited .ring__fill {
  opacity: 0;
}

.ring.is-unlimited .ring__track {
  stroke: rgba(79, 214, 255, 0.35);
  stroke-dasharray: 3 5;
  animation: trackSpin 6s linear infinite;
  transform-origin: 18px 18px;
}

.error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--bad);
  font-size: 0.86rem;
}

/* ——— deck ——— */
.deck {
  display: grid;
  gap: 12px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  animation: rise 0.65s ease both;
}

.deck__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.deck__head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.deck__head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress {
  display: flex;
  gap: 5px;
  padding-top: 4px;
}

.progress__seg {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.progress__seg.is-on {
  background: rgba(79, 214, 255, 0.18);
}

.progress__seg.is-on::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--cyan-2), var(--cyan));
  animation: segShine 2.4s ease-in-out infinite;
}

.platforms {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.platforms::-webkit-scrollbar {
  display: none;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.18s, box-shadow 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(79, 214, 255, 0.4);
  background: rgba(79, 214, 255, 0.08);
  transform: translateY(-1px);
}

.chip.is-active {
  color: #041018;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(43, 184, 255, 0.25);
}

.chip.is-active:hover {
  filter: brightness(1.06);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 10px 24px rgba(43, 184, 255, 0.35);
}

.actions {
  display: grid;
  gap: 8px;
  position: relative;
}

.actions::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(79, 214, 255, 0.55), rgba(79, 214, 255, 0.08));
  animation: lineFlow 2.8s ease-in-out infinite;
  pointer-events: none;
}

.step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.025);
  position: relative;
  z-index: 1;
  transition: border-color 0.2s, background 0.2s, transform 0.18s, box-shadow 0.2s;
  animation: rise 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 0.06s);
}

.step:hover {
  border-color: rgba(79, 214, 255, 0.28);
  background: rgba(79, 214, 255, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.step__num {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  color: #041018;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  box-shadow: 0 0 0 4px rgba(5, 7, 10, 0.9);
  transition: transform 0.2s ease;
}

.step:hover .step__num {
  transform: scale(1.06);
}

.step__body {
  min-width: 0;
}

.step__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.step p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.step__tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.step__tag.is-ready {
  color: var(--ok);
  border-color: rgba(61, 214, 140, 0.28);
  background: rgba(61, 214, 140, 0.1);
}

.step__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: filter 0.18s, border-color 0.2s, background 0.2s, transform 0.18s, box-shadow 0.2s;
}

.btn--primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  color: #041018;
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: btnShimmer 3.2s ease-in-out infinite;
}

.btn--primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(43, 184, 255, 0.32);
}

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

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

.btn--ghost:hover {
  border-color: rgba(79, 214, 255, 0.45);
  background: rgba(79, 214, 255, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

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

.btn:disabled,
.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.foot {
  display: flex;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  animation: rise 0.7s ease both;
}

.foot a {
  transition: color 0.2s, transform 0.18s;
  display: inline-block;
}

.foot a:hover {
  color: var(--cyan);
  transform: translateY(-1px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulseOk {
  0% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(61, 214, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0); }
}

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

@keyframes barWave {
  0%, 100% { transform: scaleY(0.55); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

@keyframes breath {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

@keyframes gridDrift {
  to { transform: translateY(48px); }
}

@keyframes brandGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(79, 214, 255, 0.2), 0 0 0 rgba(79, 214, 255, 0); }
  50% { box-shadow: 0 0 0 1px rgba(79, 214, 255, 0.45), 0 0 18px rgba(210, 75, 255, 0.28); }
}

@keyframes brandMarkPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes stageLogoFloat {
  0%, 100% { transform: translateY(0); opacity: 0.18; }
  50% { transform: translateY(-10px); opacity: 0.28; }
}

@keyframes segShine {
  0%, 100% { transform: translateX(-100%); opacity: 0.55; }
  50% { transform: translateX(0); opacity: 1; }
}

@keyframes lineFlow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

@keyframes btnShimmer {
  0%, 55%, 100% { transform: translateX(-120%); }
  70% { transform: translateX(120%); }
}

@keyframes infiniteRing {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.55; }
}

@keyframes trackSpin {
  to { stroke-dashoffset: -64; }
}

/* short / mobile: keep one screen */
@media (max-width: 760px) {
  .app {
    align-items: stretch;
    padding: 10px 12px calc(8px + var(--safe-b));
  }

  .app__stack {
    gap: 8px;
  }

  .hud {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
  }

  .hud__metrics {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

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

  .step__btns {
    grid-column: 2;
    justify-content: flex-start;
  }

  .step p {
    display: none;
  }

  .icon-btn span {
    display: none;
  }

  .icon-btn {
    padding: 9px;
    border-radius: 12px;
  }

  .deck__head p {
    display: none;
  }

  .actions::before {
    left: 20px;
  }
}

@media (max-height: 740px) {
  .stage__logo { display: none; }
  .deck { padding: 10px; }
  .step p { display: none; }
  .hud__lead { display: none; }
}

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