/* =========================================================
   Ретро / пиксельные анимации
   ========================================================= */

/* ---------- Пиксельные курсоры в стиле Windows 98 ---------- */
html {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='38' viewBox='0 0 12 19' shape-rendering='crispEdges'%3E%3Cpath d='M.5.5v16l4-4 3 6 2-1-3-6h5.5z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E") 1 1, auto;
}
a, button, label, .dino, [data-dialog-close] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='36' viewBox='0 0 16 18' shape-rendering='crispEdges'%3E%3Cpath d='M5.5 1.5h1v-1h1v1h1v5h1v-1h1v1h1v1h1v1h1v1h1v5h-1v1h-1v3h-7v-2h-1v-2h-1v-2h-1v-2h-1v-1h1v-1h1v1h1v1h1z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E") 12 1, pointer;
}
input, textarea { cursor: text; }

/* ---------- Экран загрузки ---------- */
.boot { display: none; }
.js .boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: block;
}
.boot.is-done { pointer-events: none; }
.boot__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.boot__screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 20px;
  font-family: "Press Start 2P", monospace;
  color: #fff;
  text-align: center;
}
.boot__title { font-size: clamp(22px, 4vw, 44px); color: #ffd6f3; text-shadow: 4px 4px 0 #cb693d; animation: px-blink 1s steps(1) infinite; }
.boot__text { font-size: clamp(10px, 1.4vw, 14px); line-height: 1.8; }
.boot__dots::after { content: ""; animation: px-dots 1.2s steps(1) infinite; }
.boot__bar {
  width: min(420px, 80vw);
  height: 32px;
  padding: 4px;
  border: 3px solid #fff;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .4);
}
.boot__bar i {
  display: block;
  width: 100%;
  height: 100%;
  /* сегменты, как в индикаторе прогресса Windows */
  background: repeating-linear-gradient(90deg, #f6a3d6 0 16px, transparent 16px 20px);
  clip-path: inset(0 100% 0 0);
  animation: boot-progress 1.3s steps(20) forwards;
}

@keyframes boot-progress { to { clip-path: inset(0 0 0 0); } }
@keyframes px-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes px-blink { 50% { opacity: .55; } }

/* ---------- Окна: «открытие» как в Win98 ---------- */
@keyframes win-open {
  0% { transform: scale(.08); opacity: 0; }
  1% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.js .hero__window,
.js .participate__win { opacity: 0; }
.hero__window.is-open,
.participate__win.is-open { animation: win-open .55s steps(7) forwards; }

/* Ошибка формы — панель в стиле Win98 под кнопкой отправки */
.form__message.is-error {
  position: absolute;
  top: 479px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 8px 16px 8px 10px;
  font-weight: 700;
  color: #000;
  background: var(--c-gray);
  box-shadow: inset 2px 2px #fff, inset -2px -2px #565656, 3px 3px 0 rgba(0, 0, 0, .2);
  animation: px-pop .3s steps(3);
}
.form__message.is-error::before {
  content: "!";
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #fff;
  background: #d03246;
  box-shadow: 2px 2px 0 #000;
  animation: px-blink .6s steps(1) 3;
}
@media (max-width: 1240px) {
  .form__message.is-error { position: static; margin: 20px auto 0; }
}

/* ---------- Печатная машинка ---------- */
.type-char { visibility: hidden; }
.type-char.is-on { visibility: visible; }
.type-cursor {
  display: inline-block;
  width: .5em;
  height: .12em;
  margin-left: .06em;
  vertical-align: baseline;
  background: currentColor;
  animation: cursor-blink .9s steps(1) infinite;
}
.hero__title .type-cursor { height: .78em; width: .32em; vertical-align: -.02em; }
@keyframes cursor-blink { 50% { opacity: 0; } }

/* ---------- Hero ---------- */
.hero::after {
  /* CRT-строки развёртки */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(40, 20, 70, .07) 0 2px, transparent 2px 4px);
  animation: crt-flicker 6s steps(1) infinite;
}
@keyframes crt-flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: .4; }
  98% { opacity: .9; }
  99% { opacity: .55; }
}
.hero__content { position: relative; z-index: 2; }

.js .hero__buttons .btn { opacity: 0; transform: translateY(16px); }
.hero__buttons.is-shown .btn { animation: px-pop .4s steps(4) forwards; }
.hero__buttons.is-shown .btn:nth-child(2) { animation-delay: .15s; }
@keyframes px-pop {
  0% { opacity: 0; transform: translateY(16px) scale(.6); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.06); }
  100% { opacity: 1; transform: none; }
}

.hero__sprite--hourglass { animation: hourglass 2.4s steps(1) infinite; transform-origin: 50% 50%; }
@keyframes hourglass {
  0%, 70% { transform: rotate(0); }
  75% { transform: rotate(45deg); }
  80% { transform: rotate(90deg); }
  85% { transform: rotate(135deg); }
  90%, 100% { transform: rotate(180deg); }
}
.hero__sprite--files { animation: px-float 1.6s steps(2) infinite alternate; }
@keyframes px-float { to { transform: translateY(-8px); } }
.hero__sprite--cursor { animation: cursor-click 2.8s steps(1) infinite; }
@keyframes cursor-click {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-6px, -6px); }
  30% { transform: translate(-12px, -12px); }
  45% { transform: translate(-12px, -12px) scale(.82); }
  52% { transform: translate(-12px, -12px); }
  70% { transform: translate(-6px, -6px); }
}

/* ---------- Пиксельные звёздочки ---------- */
.px-star {
  position: absolute;
  z-index: 1;
  width: 4px;
  height: 4px;
  pointer-events: none;
  color: #fff;
  background: currentColor;
  box-shadow:
    4px 0 currentColor, -4px 0 currentColor, 0 4px currentColor, 0 -4px currentColor,
    8px 0 currentColor, -8px 0 currentColor, 0 8px currentColor, 0 -8px currentColor;
  animation: px-twinkle var(--dur, 2s) steps(1) var(--delay, 0s) infinite;
}
@keyframes px-twinkle {
  0%, 100% { opacity: 0; transform: scale(.5); }
  20% { opacity: .6; transform: scale(.75); }
  40% { opacity: 1; transform: scale(1); }
  60% { opacity: .6; transform: scale(.75); }
  80% { opacity: 0; }
}
.stats, .winners, .prizes, .participate { position: relative; }

/* ---------- Появление блоков: ступенчато, без плавности ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s steps(5), transform .5s steps(5);
}
.reveal.is-visible { opacity: 1; transform: none; }
.stats__item.reveal:nth-child(2) { transition-delay: .15s; }
.stats__item.reveal:nth-child(3) { transition-delay: .3s; }

/* Картинки «загружаются» как по dial-up: от крупных пикселей к чёткости */
.prize, .winner { position: relative; }
.px-canvas { position: absolute; pointer-events: none; image-rendering: pixelated; }
.is-pixelating { visibility: hidden; }

/* ---------- Кнопки ---------- */
.btn { overflow: hidden; }
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 24px;
  background: rgba(255, 255, 255, .45);
  box-shadow: 12px 0 0 rgba(255, 255, 255, .25);
  transform: translateX(0) skewX(-20deg);
  opacity: 0;
}
.btn:hover::after { animation: btn-shine .6s steps(8); }
@keyframes btn-shine {
  0% { opacity: 1; transform: translateX(0) skewX(-20deg); }
  100% { opacity: 1; transform: translateX(400px) skewX(-20deg); }
}

/* ---------- Окно формы: кнопки управления ---------- */
.participate__win .win__ctl { cursor: inherit; }
.win__ctl:active { box-shadow: inset 2px 2px #565656, inset -2px -2px #fff; }
button.win__ctl { border: 0; padding: 0; }

/* ---------- Взрыв пикселей по клику ---------- */
.px-burst {
  position: fixed;
  z-index: 900;
  width: 4px;
  height: 4px;
  pointer-events: none;
  color: var(--c, #f45bb1);
}
.px-burst--heart {
  box-shadow:
    4px 0 currentColor, 12px 0 currentColor,
    0 4px currentColor, 4px 4px currentColor, 8px 4px currentColor, 12px 4px currentColor, 18px 4px currentColor,
    4px 8px currentColor, 8px 8px currentColor, 12px 8px currentColor,
    8px 12px currentColor;
}
.px-burst--star {
  background: currentColor;
  box-shadow: 4px 0 currentColor, -4px 0 currentColor, 0 4px currentColor, 0 -4px currentColor;
}

/* ---------- Мини-игра с динозавром ---------- */
.dino { height: 220px; }
.dino.is-running .dino__rex { animation: dino-run .24s steps(1) infinite; }
@keyframes dino-run { 50% { translate: 0 -3px; } }

/* ---------- Ретро-диалог ---------- */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 20, 70, .35);
  background-image: repeating-conic-gradient(rgba(0, 0, 0, .12) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
}
.dialog[hidden] { display: none; }
.dialog__win { width: min(420px, 100%); animation: win-open .45s steps(6) both; }
.dialog .win__bar { height: 40px; }
.dialog__title { font-size: 22px; }
.dialog__body {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 28px 26px 24px;
}
.dialog__icon {
  width: 6px;
  height: 6px;
  margin: 0 42px 42px 0;
  color: #3e8a3a;
  /* пиксельная галочка */
  box-shadow:
    36px 0 currentColor, 30px 6px currentColor, 36px 6px currentColor,
    24px 12px currentColor, 30px 12px currentColor,
    0 18px currentColor, 18px 18px currentColor, 24px 18px currentColor,
    0 24px currentColor, 6px 24px currentColor, 12px 24px currentColor, 18px 24px currentColor,
    6px 30px currentColor, 12px 30px currentColor;
  animation: px-blink 1s steps(1) infinite;
}
.dialog__text { font-weight: 700; font-size: 18px; line-height: 1.3; }
.dialog__ok { grid-column: 1 / -1; justify-self: center; min-width: 110px; height: 44px; }

/* ---------- Без анимаций для тех, кто их отключил ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .boot { display: none; }
  .js .hero__window,
  .js .participate__win,
  .js .hero__buttons .btn { opacity: 1; transform: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Отправка формы ---------- */
.participate__submit.is-loading {
  cursor: progress;
  animation: px-blink .8s steps(1) infinite;
}
.participate__submit:disabled { pointer-events: none; }

/* ---------- Пиксельное табло в «Розыгрыше в цифрах» ---------- */
.px-num {
  --dot: 8px;
  --gap: 1px;
  display: inline-flex;
  gap: calc(var(--dot) + var(--gap));
  vertical-align: top;
}
.px-num__digit {
  display: grid;
  grid-template-columns: repeat(5, var(--dot));
  grid-auto-rows: var(--dot);
  gap: var(--gap);
}
.px-num__digit i {
  background: rgba(115, 92, 163, .1);
}
.px-num__digit i.is-on {
  background: var(--c);
  /* объём «лампочки»: светлый блик сверху-слева, тень снизу-справа */
  box-shadow: inset 1px 1px rgba(255, 255, 255, .5), inset -1px -1px rgba(0, 0, 0, .25), 0 0 5px color-mix(in srgb, var(--c) 55%, transparent);
}
/* Табло вспыхивает дважды сразу после подсчёта, затем повторяет раз в 30 секунд.
   Счётчики мигают «волной» — с небольшой задержкой друг за другом. */
.stats__num.is-done .px-num { animation: px-flash 30s steps(1) infinite; }
.stats__item:nth-child(2) .stats__num.is-done .px-num { animation-delay: .15s; }
.stats__item:nth-child(3) .stats__num.is-done .px-num { animation-delay: .3s; }
@keyframes px-flash {
  0%, 1.6% { filter: brightness(1.35) drop-shadow(0 0 6px rgba(236, 116, 189, .6)); }
  .8%, 2.4%, 100% { filter: none; }
}
@media (max-width: 900px) {
  .px-num { --dot: 7px; }
  .stats__num { min-height: 54px; }
}

/* =========================================================
   Шапка и подвал
   ========================================================= */

/* Пиксельная шахматная кромка — как узор на баннере */
.header::after,
.footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 12px;
  pointer-events: none;
  background: repeating-conic-gradient(#f6a3d6 0 25%, #735ca3 0 50%) 0 0 / 12px 12px;
}
.header::after { top: 100%; }
.footer { position: relative; }
.footer::before { top: -12px; }

/* Логотип: глитч при наведении */
.header__logo:hover img,
.footer__logo:hover { animation: logo-glitch .45s steps(1) infinite; }
@keyframes logo-glitch {
  0%, 100% { filter: none; transform: none; }
  25% { filter: drop-shadow(3px 0 #f45bb1) drop-shadow(-3px 0 #7fd3ff); transform: translateX(1px); }
  50% { filter: none; transform: translateX(-1px); }
  75% { filter: drop-shadow(-3px 0 #f45bb1) drop-shadow(3px 0 #7fd3ff); }
}

/* Шапка — заголовок окна Windows 98: градиент как у окон на сайте */
.header {
  background: linear-gradient(90deg, #643f8a 0%, #8a5d9e 35%, #b179ae 62%, #e6a8d2 100%);
  box-shadow: inset 0 2px rgba(255, 255, 255, .25);
}
.header::before {
  /* лёгкий пиксельный дизеринг */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 255, 255, .06) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
}
.header__inner { position: relative; z-index: 1; }

/* Пункты меню — кнопки панели задач */
.nav { gap: 8px; }
.nav__link {
  padding: 9px 16px;
  font-size: 15px;
  color: #000;
  background: var(--c-gray);
  box-shadow: inset 2px 2px #fff, inset -2px -2px #565656, 2px 2px 0 rgba(40, 20, 70, .25);
  transition: none;
}
.nav__link:hover { color: var(--c-purple); background: #e4e4e4; }
.nav__link.is-active {
  font-weight: 700;
  color: var(--c-purple);
  /* «нажатая» кнопка с точечной заливкой, как в Win98 */
  background: repeating-conic-gradient(#fff 0 25%, var(--c-gray) 0 50%) 0 0 / 2px 2px;
  box-shadow: inset 2px 2px #565656, inset -2px -2px #fff;
}
.nav__link:active { box-shadow: inset 2px 2px #565656, inset -2px -2px #fff; }

/* «Бегущие муравьи» у ссылки на сайт в подвале, как выделение в Paint */
.footer__site { position: relative; }
.footer__site::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 8px);
  opacity: 0;
}
.footer__site:hover::after { opacity: 1; animation: ants .6s steps(4) infinite; }
@keyframes ants { to { background-position: 8px 0; } }

/* Соцсети: «пиксельный» круг со ступенчатыми краями */
.social__link {
  border-radius: 0;
  clip-path: polygon(30% 0, 70% 0, 70% 10%, 85% 10%, 85% 15%, 90% 15%, 90% 30%, 100% 30%, 100% 70%, 90% 70%, 90% 85%, 85% 85%, 85% 90%, 70% 90%, 70% 100%, 30% 100%, 30% 90%, 15% 90%, 15% 85%, 10% 85%, 10% 70%, 0 70%, 0 30%, 10% 30%, 10% 15%, 15% 15%, 15% 10%, 30% 10%);
  transition: background .2s steps(2), transform .15s steps(2);
}
.social__link:hover { transform: translateY(-3px); }
.header .social__link { width: 30px; height: 30px; background: var(--c-purple); }
.header .social__link:hover { background: #4a3770; }

/* Часы в «системном трее» Windows 98 */
.tray {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #000;
  background: var(--c-gray);
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff, 0 0 0 1px rgba(40, 20, 70, .2);
}
.tray__time b { font-weight: 400; animation: px-blink 1s steps(1) infinite; }
.tray__heart { position: relative; width: 10px; height: 8px; animation: heartbeat 1.2s steps(1) infinite; }
.tray__heart::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  color: #e64fa6;
  box-shadow:
    2px 0, 6px 0,
    0 2px, 2px 2px, 4px 2px, 6px 2px, 8px 2px,
    2px 4px, 4px 4px, 6px 4px,
    4px 6px;
}
@keyframes heartbeat {
  0%, 30%, 100% { transform: none; }
  10% { transform: scale(1.3); }
  20% { transform: scale(1.1); }
}

/* Бегущая светодиодная строка в подвале */
.ticker {
  position: relative;
  margin: -31px 0 30px;
  padding: 12px 0;
  overflow: hidden;
  background: #140b22;
  box-shadow: inset 0 -2px #2a1a40;
}
.ticker::after {
  /* сетка «светодиодов» поверх текста */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, transparent 1px, rgba(20, 11, 34, .55) 1.6px) 0 0 / 3px 3px;
}
.ticker__track { display: flex; width: max-content; animation: ticker 45s steps(450) infinite; }
.ticker__track span {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  color: #f6a3d6;
  text-shadow: 0 0 6px rgba(246, 163, 214, .7);
}
@keyframes ticker { to { transform: translateX(-50%); } }

@media (max-width: 1100px) {
  .social { margin-right: 22px; }
  .nav { margin-left: 32px; }
  .nav__link { padding: 9px 12px; font-size: 14px; }
}

@media (max-width: 900px) {
  .tray { display: none; }
  .social { margin-right: 0; }

  /* Бургер — серая кнопка, как «Пуск» */
  .burger {
    background: var(--c-gray);
    box-shadow: inset 2px 2px #fff, inset -2px -2px #565656;
  }
  .burger span,
  .burger span::before,
  .burger span::after { background: #000; transition: none; }
  .header.is-open .burger { box-shadow: inset 2px 2px #565656, inset -2px -2px #fff; }

  /* Мобильное меню — как меню «Пуск» Windows 98 */
  .nav {
    left: auto;
    right: 12px;
    top: calc(100% + 14px);
    width: 270px;
    padding: 4px 4px 4px 36px;
    background: var(--c-gray);
    box-shadow: inset 2px 2px #fff, inset -2px -2px #565656, 4px 4px 0 rgba(0, 0, 0, .35);
    transform: none;
    transition: none;
  }
  .nav::before {
    content: "VIVAT 98";
    position: absolute;
    left: 4px;
    top: 4px;
    bottom: 4px;
    width: 28px;
    padding-top: 10px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--f-title);
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(0deg, #e6a8d2, #643f8a);
  }
  .header.is-open .nav { animation: start-menu .3s steps(5); }
  @keyframes start-menu {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 0 0); }
  }
  .nav__link { padding: 12px 14px; font-size: 17px; font-weight: 400; color: #000; background: none; box-shadow: none; }
  .nav__link:hover,
  .nav__link.is-active { color: #fff; background: var(--c-purple); box-shadow: none; }

  .ticker__track span { font-size: 11px; }
}
