/* ================= Токены ================= */
:root {
  --bg: #fff8f1;
  --bg-2: #ffeede;
  --surface: #ffffff;
  --surface-2: #f6f0ff;
  --text: #1d1530;
  --muted: #6e6585;
  --border: rgba(29, 21, 48, 0.1);
  --shadow: 0 10px 30px -12px rgba(60, 30, 110, 0.25);
  --shadow-lg: 0 24px 60px -20px rgba(60, 30, 110, 0.35);
  --grad: linear-gradient(100deg, #ff5f8f 0%, #ff9a3c 35%, #7c5cff 70%, #22c1c3 100%);
  --accent: #7c5cff;
  --radius: 22px;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0b17;
    --bg-2: #1a1330;
    --surface: #18132a;
    --surface-2: #221a3c;
    --text: #f3eeff;
    --muted: #a59cc0;
    --border: rgba(255, 255, 255, 0.09);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0b17;
  --bg-2: #1a1330;
  --surface: #18132a;
  --surface-2: #221a3c;
  --text: #f3eeff;
  --muted: #a59cc0;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  color-scheme: dark;
}

/* ================= База ================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, #ff5f8f 18%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, #7c5cff 18%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
  transition: background-color .4s, color .4s;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--surface-2);
  padding: .1em .4em;
  border-radius: 6px;
}
.muted { color: var(--muted); }

/* ================= Кнопки ================= */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 700 15px/1 var(--font-body);
  padding: 14px 22px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  transition: transform .15s, box-shadow .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px var(--accent); }
.btn--ghost { background: transparent; border: 1.5px solid var(--border); }
.btn--party {
  background: var(--grad);
  background-size: 200% 100%;
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(255, 95, 143, .7);
  animation: slide-bg 6s linear infinite;
}

/* ================= Шапка ================= */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 110px) 16px clamp(40px, 7vw, 80px);
  text-align: center;
  overflow: hidden;
}

.hero__inner { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; }

.hero__kicker {
  display: inline-block;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 14px;
  border: 1.5px dashed var(--border);
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero__title { display: flex; flex-direction: column; gap: .15em; margin-bottom: 20px; }

.hero__name {
  font-weight: 900;
  font-size: clamp(38px, 9vw, 104px);
  letter-spacing: -.02em;
  background: var(--grad);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: slide-bg 8s linear infinite;
  word-break: break-word;
}

.hero__sub {
  font-weight: 800;
  font-size: clamp(22px, 4.6vw, 48px);
  display: inline-block;
  transform: rotate(-2deg);
}

.hero__lead { color: var(--muted); font-size: clamp(15px, 2vw, 18px); max-width: 520px; margin: 0 auto 26px; }

.hero__balloons span {
  position: absolute;
  bottom: -60px;
  font-size: clamp(28px, 5vw, 48px);
  animation: float-up 14s linear infinite;
  opacity: .85;
  user-select: none;
}
.hero__balloons span:nth-child(1) { left: 4%;  animation-delay: 0s; }
.hero__balloons span:nth-child(2) { left: 18%; animation-delay: 5s;  animation-duration: 17s; }
.hero__balloons span:nth-child(3) { left: 32%; animation-delay: 9s;  animation-duration: 12s; }
.hero__balloons span:nth-child(4) { left: 62%; animation-delay: 2s;  animation-duration: 16s; }
.hero__balloons span:nth-child(5) { left: 76%; animation-delay: 7s; }
.hero__balloons span:nth-child(6) { left: 88%; animation-delay: 11s; animation-duration: 15s; }
.hero__balloons span:nth-child(7) { left: 48%; animation-delay: 13s; animation-duration: 18s; }

.theme-btn {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 5;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 22px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s;
}
.theme-btn:hover { transform: rotate(-12deg) scale(1.06); }
.theme-btn__lock {
  position: absolute;
  right: -4px; bottom: -4px;
  font-size: 14px;
  background: var(--surface);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}

/* ================= Табы ================= */
.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  color: var(--muted);
  transition: background .2s, color .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text); background: color-mix(in srgb, var(--tab) 12%, transparent); }
.tab.is-active {
  color: #fff;
  background: var(--tab);
  box-shadow: 0 8px 20px -8px var(--tab);
}
.tab__emoji { font-size: 20px; line-height: 1; }
.tab__from { font-weight: 500; opacity: .75; }
.tab__count {
  font-size: 11px;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: color-mix(in srgb, currentColor 15%, transparent);
}

/* ================= Контент ================= */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 16px 60px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}
.section-head__emoji {
  font-size: 34px;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  flex-shrink: 0;
}
.section-head__title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; }
.section-head__meta { color: var(--muted); font-weight: 700; margin: 4px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: card-in .5s cubic-bezier(.2, .8, .2, 1.1) both;
  transition: transform .25s, box-shadow .25s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card--wide { grid-column: 1 / -1; }

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 0;
}
.card__emoji { font-size: 26px; line-height: 1; }
.card__title { font-size: 18px; font-weight: 800; }
.card__body { padding: 16px 22px 22px; flex: 1; }

.card--empty { text-align: center; }
.card--empty .card__body { padding: 48px 22px; }
.card--empty h3 { margin-bottom: 8px; font-size: 22px; }
.empty__emoji { font-size: 56px; margin-bottom: 10px; }

/* ================= Классы для приколов (x-*) ================= */
.x-big { font-family: var(--font-display); font-weight: 800; font-size: clamp(20px, 3vw, 26px); line-height: 1.25; }

.x-quote {
  margin: 16px 0 0;
  padding: 16px 20px;
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 16px 16px 0;
  font-style: italic;
  font-weight: 500;
}
.x-quote cite { display: block; margin-top: 6px; font-style: normal; font-weight: 700; color: var(--muted); font-size: 14px; }

.x-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.x-list li { position: relative; padding: 10px 14px 10px 40px; background: var(--surface-2); border-radius: 14px; }
.x-list li::before { content: '👉'; position: absolute; left: 12px; top: 10px; }

.x-row { position: relative; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.x-row--runaway { min-height: 160px; align-items: flex-start; }
.x-row--runaway [data-no] { transition: left .18s, top .18s; }

.x-result { min-height: 1.5em; margin-top: 12px; font-weight: 700; }
.x-result--box {
  padding: 18px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: 17px;
}
.x-pop { animation: pop .35s cubic-bezier(.2, .8, .2, 1.3); }

.x-progress { height: 16px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 12px 0 6px; }
.x-progress__bar {
  width: 0; height: 100%;
  border-radius: inherit;
  background: var(--grad);
  background-size: 200% 100%;
  animation: slide-bg 3s linear infinite;
  transition: width .8s cubic-bezier(.3, .9, .3, 1);
}

.x-stats { display: grid; gap: 12px; }
.x-stats__row { display: grid; grid-template-columns: 140px 1fr 36px; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.x-stats__row b { height: 10px; border-radius: 999px; background: var(--surface-2); position: relative; overflow: hidden; }
.x-stats__row b::after { content: ''; position: absolute; inset: 0; width: var(--v); background: var(--grad); border-radius: inherit; }
.x-stats__row em { font-style: normal; text-align: right; color: var(--muted); }

.x-poll { display: grid; gap: 8px; }
.x-poll .btn { text-align: left; border-radius: 14px; font-weight: 600; line-height: 1.3; }
.x-poll .btn.is-picked { background: var(--accent); color: #fff; border-color: transparent; }

.x-cert {
  position: relative;
  text-align: center;
  padding: clamp(24px, 5vw, 44px);
  border-radius: 18px;
  border: 3px double color-mix(in srgb, #d4a017 70%, transparent);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, #ffd166 22%, transparent), transparent 70%),
    var(--surface-2);
  max-width: 720px;
  margin: 0 auto;
}
.x-cert__seal { font-size: 48px; }
.x-cert__label { text-transform: uppercase; letter-spacing: .2em; font-size: 12px; font-weight: 800; color: var(--muted); }
.x-cert__title {
  font-size: clamp(24px, 4.5vw, 38px);
  margin: 4px 0 14px;
  background: linear-gradient(90deg, #b8860b, #ffd166, #b8860b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.x-cert__sign { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 14px; font-weight: 700; color: var(--muted); }
.x-cert__sign i { font-family: var(--font-display); color: var(--text); }

.card img, .card video, .card iframe { max-width: 100%; border-radius: 14px; display: block; }

/* ================= Модалка ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10, 6, 20, .55); backdrop-filter: blur(6px); animation: fade .2s; }
.modal__card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 28px;
  padding: 30px 24px 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop .3s cubic-bezier(.2, .8, .2, 1.2);
}
.modal__emoji { font-size: 44px; margin-bottom: 6px; }
.modal__title { font-size: 20px; margin-bottom: 8px; }
.modal__text { color: var(--muted); }
.modal__input {
  width: 100%;
  margin-top: 8px;
  padding: 14px 18px;
  font: 700 18px var(--font-body);
  text-align: center;
  letter-spacing: .2em;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 16px;
  outline: none;
  transition: border-color .2s;
}
.modal__input:focus { border-color: var(--accent); }
.modal__error { min-height: 1.5em; margin: 10px 0 4px; color: #ff4d6d; font-weight: 700; font-size: 14px; }
.modal__actions { display: flex; gap: 10px; justify-content: center; }
.modal__actions .btn { flex: 1; }
.modal__hint { margin-top: 16px; font-size: 12px; color: var(--muted); }
.shake { animation: shake .45s; }

/* ================= Футер ================= */
.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 16px 40px; }

/* ================= Анимации ================= */
@keyframes slide-bg { to { background-position: -200% 0; } }
@keyframes float-up {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  10%  { opacity: .85; }
  100% { transform: translateY(-120vh) rotate(25deg); opacity: 0; }
}
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
@keyframes shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .hero__balloons { display: none; }
}

/* ================= Мобилка ================= */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .tabs {
    margin: 0 10px;
    border-radius: 22px;
    gap: 4px;
    padding: 6px;
    top: 8px;
  }
  .tab { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 13px; border-radius: 16px; }
  .tab__from { display: none; }
  .tab__count { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .content { padding-top: 28px; }
  .section-head__emoji { width: 52px; height: 52px; font-size: 28px; border-radius: 16px; }
  .card__head { padding: 18px 18px 0; }
  .card__body { padding: 14px 18px 18px; }
  .x-stats__row { grid-template-columns: 110px 1fr 30px; font-size: 13px; }
  .theme-btn { top: 12px; right: 12px; width: 46px; height: 46px; font-size: 19px; }
}
