:root{
  --accent-1:#f43f5e;
  --accent-2:#a855f7;
  --accent-3:#38bdf8;
  --bg:#05050b;
  --bg-soft:#0c0c16;
  --card:rgba(255,255,255,.045);
  --card-strong:rgba(255,255,255,.08);
  --stroke:rgba(255,255,255,.1);
  --stroke-strong:rgba(255,255,255,.18);
  --text:#f2f2f7;
  --muted:#9a9ab0;
  --font-body:"Inter",system-ui,-apple-system,sans-serif;
  --font-display:"Unbounded","Inter",sans-serif;
  --radius:20px;
  --ease:cubic-bezier(.22,1,.36,1);
}

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

html{scroll-behavior:smooth}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:16px;
  line-height:1.6;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}

h1,h2,h3{margin:0;font-family:var(--font-display);line-height:1.1;letter-spacing:-.02em}

p{margin:0}

button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}

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

.visually-hidden{
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;
}

/* ---------- Звёздное небо ---------- */
.stars{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  z-index:0;
  pointer-events:none;
}

/* ---------- Контейнер ---------- */
.container{
  width:100%;
  max-width:720px;
  margin:0 auto;
  padding:0 20px;
}
.container--narrow{max-width:620px}

/* ---------- Шапка ---------- */
.header{
  position:relative;
  z-index:2;
  padding:18px 0;
}
.header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.logo{
  display:flex;
  align-items:center;
  gap:10px;
}
.logo__mark{
  display:grid;
  place-items:center;
  width:36px;height:36px;
  border-radius:11px;
  background:linear-gradient(135deg,var(--accent-1),var(--accent-2),var(--accent-3));
  color:#fff;
  box-shadow:0 6px 24px -6px rgba(168,85,247,.6);
}
.logo__mark svg{width:22px;height:22px}
.logo__text{
  font-family:var(--font-display);
  font-weight:800;
  font-size:1.15rem;
  letter-spacing:.06em;
}
.header__counter{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  line-height:1.2;
}
.header__counter-label{
  font-size:.68rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.12em;
}
.header__counter-value{
  font-family:var(--font-display);
  font-weight:700;
  font-size:1.15rem;
  color:var(--accent-3);
  transition:color .4s var(--ease),transform .3s var(--ease);
}
.header__counter-value.bump{
  transform:scale(1.35);
}

/* ---------- Hero ---------- */
.hero{
  position:relative;
  z-index:1;
  padding:60px 0 80px;
  min-height:calc(100vh - 80px);
  display:flex;
  align-items:flex-start;
}
.hero__glow{
  position:absolute;
  top:-140px;
  left:50%;
  transform:translateX(-50%);
  width:760px;
  max-width:120vw;
  height:560px;
  background:radial-gradient(circle at 30% 40%,rgba(244,63,94,.22),transparent 60%),
             radial-gradient(circle at 70% 30%,rgba(168,85,247,.22),transparent 60%),
             radial-gradient(circle at 50% 70%,rgba(56,189,248,.16),transparent 60%);
  filter:blur(20px);
  pointer-events:none;
  transition:opacity .8s var(--ease);
}
.hero__head{
  text-align:center;
  margin-bottom:34px;
}
.hero__eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 16px;
  border-radius:99px;
  background:var(--card);
  border:1px solid var(--stroke);
  font-size:.75rem;
  color:var(--muted);
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:22px;
}
.hero__eyebrow span{color:var(--accent-2)}
.hero__title{
  font-size:clamp(2.3rem,7vw,3.8rem);
  font-weight:800;
  margin-bottom:18px;
}
.gradient-text{
  background:linear-gradient(100deg,var(--accent-1),var(--accent-2) 45%,var(--accent-3));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  transition:background .6s var(--ease);
}
.hero__subtitle{
  color:var(--muted);
  font-size:1.02rem;
  max-width:480px;
  margin:0 auto;
}

/* ---------- Категории ---------- */
.categories{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:9px;
  margin-bottom:26px;
}
.chip{
  padding:9px 17px;
  border-radius:99px;
  background:var(--card);
  border:1px solid var(--stroke);
  color:var(--muted);
  font-size:.85rem;
  font-weight:600;
  transition:all .3s var(--ease);
}
.chip:hover{
  color:var(--text);
  border-color:var(--stroke-strong);
  transform:translateY(-2px);
}
.chip.is-active{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(120deg,var(--accent-1),var(--accent-2) 55%,var(--accent-3));
  box-shadow:0 8px 26px -10px rgba(168,85,247,.8);
}

/* ---------- Карточка результата ---------- */
.result{
  position:relative;
  overflow:hidden;
  border-radius:var(--radius);
  background:linear-gradient(160deg,rgba(255,255,255,.07),rgba(255,255,255,.02));
  border:1px solid var(--stroke-strong);
  padding:34px 28px;
  text-align:center;
  margin-bottom:26px;
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  box-shadow:0 30px 80px -40px rgba(0,0,0,.9),inset 0 1px 0 rgba(255,255,255,.08);
}
.result::after{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius:var(--radius);
  padding:1px;
  background:linear-gradient(140deg,rgba(244,63,94,.5),transparent 40%,transparent 60%,rgba(56,189,248,.4));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  pointer-events:none;
  opacity:.7;
}
.result__icon{
  width:58px;height:58px;
  margin:0 auto 16px;
  display:grid;
  place-items:center;
  border-radius:17px;
  background:linear-gradient(135deg,var(--accent-1),var(--accent-2),var(--accent-3));
  color:#fff;
  box-shadow:0 12px 34px -12px rgba(168,85,247,.75);
  transition:transform .5s var(--ease);
}
.result__icon svg{width:30px;height:30px}
.result__tag{
  font-family:var(--font-display);
  font-weight:700;
  font-size:.78rem;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--accent-3);
  margin-bottom:12px;
  transition:color .4s var(--ease);
}
.result__text{
  font-size:1.28rem;
  font-weight:500;
  line-height:1.45;
  min-height:3.7em;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text);
  transition:opacity .25s var(--ease),transform .25s var(--ease);
}
.result.spinning .result__text{
  opacity:.45;
  filter:blur(.4px);
}
.result.pop .result__icon{
  transform:scale(1.12) rotate(-4deg);
}
.result__text.swap{
  opacity:0;
  transform:translateY(8px);
}

/* ---------- Кнопки ---------- */
.hero__actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  justify-content:center;
  margin-bottom:18px;
}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  border-radius:14px;
  font-weight:600;
  font-size:.98rem;
  transition:transform .25s var(--ease),box-shadow .25s var(--ease),background .3s var(--ease);
}
.btn svg{width:18px;height:18px}
.btn--sm{padding:9px 16px;font-size:.88rem}
.btn--lg{padding:15px 28px;font-size:1.04rem}
.btn--primary{
  color:#fff;
  background:linear-gradient(120deg,var(--accent-1),var(--accent-2) 55%,var(--accent-3));
  box-shadow:0 14px 40px -14px rgba(168,85,247,.9);
}
.btn--primary:hover{
  transform:translateY(-3px);
  box-shadow:0 20px 50px -14px rgba(168,85,247,1);
}
.btn--ghost{
  color:var(--text);
  background:var(--card);
  border:1px solid var(--stroke);
}
.btn--ghost:hover{
  transform:translateY(-3px);
  border-color:var(--stroke-strong);
  background:var(--card-strong);
}
.btn__dice{
  display:inline-block;
  font-size:1.2em;
  line-height:1;
  transition:transform .4s var(--ease);
}
.btn--primary:hover .btn__dice{transform:rotate(90deg) scale(1.15)}
.btn--primary:active{transform:translateY(-1px) scale(.98)}

.hero__note{
  text-align:center;
  color:var(--muted);
  font-size:.84rem;
  margin-bottom:44px;
}
.hero__note-mark{color:var(--accent-1)}

/* ---------- Лента хаоса ---------- */
.history{
  border-radius:var(--radius);
  background:var(--card);
  border:1px solid var(--stroke);
  padding:20px 22px;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.history__head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.history__title{
  font-family:var(--font-display);
  font-weight:700;
  font-size:.95rem;
  letter-spacing:.04em;
}
.history__hint{
  font-size:.72rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.1em;
}
.history__list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.history__empty{
  color:var(--muted);
  font-size:.88rem;
  opacity:.7;
}
.history__item{
  max-width:100%;
  padding:8px 13px;
  border-radius:11px;
  background:var(--card-strong);
  border:1px solid var(--stroke);
  font-size:.82rem;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  animation:slideIn .45s var(--ease);
}
@keyframes slideIn{
  from{opacity:0;transform:translateY(-8px) scale(.96)}
  to{opacity:1;transform:none}
}
.history__item b{
  font-weight:700;
  color:var(--accent-3);
  margin-right:6px;
}

/* ---------- Футер ---------- */
.footer{
  position:relative;
  z-index:1;
  border-top:1px solid var(--stroke);
  padding:22px 0;
}
.footer__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}
.footer__copy{
  color:var(--muted);
  font-size:.82rem;
}
.footer__link{
  color:var(--accent-3);
  font-size:.82rem;
  font-weight:600;
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
  transition:opacity .25s var(--ease);
}
.footer__link:hover{opacity:.7}

/* ---------- Анимации появления ---------- */
.reveal{
  opacity:0;
  transform:translateY(22px);
  transition:opacity .8s var(--ease),transform .8s var(--ease);
}
.reveal.is-visible{
  opacity:1;
  transform:none;
}
.reveal--delay{transition-delay:.1s}
.reveal--delay-1{transition-delay:.18s}
.reveal--delay-2{transition-delay:.26s}

/* ---------- Адаптив ---------- */
@media (max-width:560px){
  .hero{padding:36px 0 60px}
  .result{padding:26px 18px}
  .result__text{font-size:1.08rem;min-height:4.4em}
  .header__counter-label{display:none}
  .btn--lg{padding:14px 22px;width:100%}
  .hero__actions{flex-direction:column}
  .footer__inner{flex-direction:column;text-align:center}
}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
  .reveal{opacity:1;transform:none}
}
