/* Охота за печеньками */
:root {
  --mch-grad: linear-gradient(135deg, #7b2ff7 0%, #f107a3 100%);
  --mch-accent: #a020f0;
  --mch-z-cookie: 50;   /* ниже типичной фиксированной шапки */
  --mch-z-bar: 99990;
}

/* Кнопка старта */
.mch-start {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .9em 1.8em; border: 0; border-radius: 999px;
  background: var(--mch-grad); color: #fff;
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer;
  box-shadow: 0 8px 24px rgba(161, 32, 240, .3);
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.mch-start:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(161, 32, 240, .4); }
.mch-start.is-started { opacity: .85; }

/* Печенька */
.mch-cookie {
  position: absolute; z-index: var(--mch-z-cookie);
  padding: 0; margin: 0; border: 0; background: none; line-height: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: mch-pop .5s cubic-bezier(.3, 1.6, .5, 1) both, mch-float 3s ease-in-out .5s infinite;
}
.mch-cookie img {
  width: 100%; height: 100%; object-fit: contain;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2));
  transition: transform .2s;
}
.mch-cookie:hover img { transform: scale(1.15) rotate(-10deg); }
.mch-cookie:focus-visible { outline: 2px solid var(--mch-accent); outline-offset: 4px; border-radius: 50%; }
.mch-cookie--fly {
  position: fixed; z-index: 100001; pointer-events: none; animation: none;
  transition: transform .7s cubic-bezier(.55, -.2, .6, 1), opacity .7s ease-in;
}
@keyframes mch-pop { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mch-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(6deg); } }

/* Крошки / конфетти */
.mch-crumb {
  position: fixed; z-index: 100002; width: 7px; height: 7px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #d99a4e; pointer-events: none;
  animation: mch-crumb .7s ease-out forwards;
}
.mch-crumb--dark { width: 5px; height: 5px; background: #6b3d16; }
.mch-crumb--fest0 { background: #7b2ff7; border-radius: 2px; }
.mch-crumb--fest1 { background: #f107a3; }
.mch-crumb--fest2 { background: #ffc531; border-radius: 2px; }
@keyframes mch-crumb { to { transform: translate(var(--dx), var(--dy)) scale(.3) rotate(200deg); opacity: 0; } }

/* Плашка */
.mch-bar {
  position: fixed; left: 50%; bottom: 16px; z-index: var(--mch-z-bar);
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 24px); box-sizing: border-box;
  padding: 7px 18px 7px 7px; border-radius: 999px;
  background: #fff; color: #1d1d1f; font-family: inherit; font-size: 15px; line-height: 1.2;
  box-shadow: 0 10px 30px rgba(40, 0, 80, .22);
  transform: translate(-50%, 150%);
  transition: transform .45s cubic-bezier(.3, 1.4, .5, 1);
}
.mch-bar.is-visible { transform: translate(-50%, 0); }
.mch-bar.is-complete { padding-right: 7px; }
.mch-bar__icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--mch-grad);
}
.mch-bar__icon svg { width: 22px; height: 22px; display: block; }
.mch-bar__text { white-space: nowrap; }
.mch-bar__num { display: inline-block; color: var(--mch-accent); font-weight: 700; }
.mch-bar.is-bump .mch-bar__num,
.mch-bar.is-bump .mch-bar__icon { animation: mch-bump .5s; }
.mch-bar__dots { display: flex; gap: 5px; }
.mch-bar__dots i { width: 9px; height: 9px; border-radius: 50%; background: #e9e0f3; transition: background .3s; }
.mch-bar__dots i.is-on { background: var(--mch-grad); }
.mch-bar__dots i.is-new { animation: mch-bump .5s; }
.mch-bar__claim {
  border: 0; border-radius: 999px; padding: 11px 20px;
  background: var(--mch-grad); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
  animation: mch-pulse 1.6s infinite;
}
.mch-bar.is-done .mch-bar__text { font-weight: 600; }
@keyframes mch-bump { 30% { transform: scale(1.45); } 60% { transform: scale(.9); } 100% { transform: none; } }
@keyframes mch-pulse {
  0% { box-shadow: 0 0 0 0 rgba(241, 7, 163, .5); }
  70% { box-shadow: 0 0 0 12px rgba(241, 7, 163, 0); }
  100% { box-shadow: 0 0 0 0 rgba(241, 7, 163, 0); }
}
@media (max-width: 480px) {
  .mch-bar { font-size: 14px; gap: 10px; }
  .mch-bar__dots { display: none; }
}

/* Модальное окно */
.mch-lock, .mch-lock body { overflow: hidden; }
.mch-modal {
  position: fixed; inset: 0; z-index: 100000;
  display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 10, 35, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.mch-modal.is-open { display: flex; animation: mch-fade .25s; }
.mch-modal__box {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto;
  box-sizing: border-box; padding: 28px 24px 24px; border-radius: 20px;
  background: #fff; color: #1d1d1f; font-family: inherit; font-size: 15px; line-height: 1.4;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: mch-up .35s cubic-bezier(.3, 1.3, .5, 1);
}
.mch-modal__close {
  position: absolute; top: 10px; right: 12px; width: 36px; height: 36px;
  border: 0; background: none; color: #999; font-size: 28px; line-height: 1; cursor: pointer;
}
.mch-modal__close:hover { color: #333; }
.mch-modal__head { text-align: center; margin-bottom: 18px; }
.mch-modal__img { width: 64px; height: 64px; object-fit: contain; animation: mch-float 3s ease-in-out infinite; }
.mch-modal h3 { margin: 8px 0 6px; font-size: 22px; line-height: 1.2; color: inherit; }
.mch-modal__gift { margin: 0; color: #6b6b76; }
.mch-gift {
  display: block; margin-top: 8px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(123, 47, 247, .1), rgba(241, 7, 163, .1));
  color: #1d1d1f; font-size: 17px;
}
.mch-modal.is-loading .mch-form { opacity: .5; pointer-events: none; }

.mch-field { display: block; margin: 0 0 12px; }
.mch-field span { display: block; margin: 0 0 4px; font-size: 13px; color: #6b6b76; }
.mch-field input {
  display: block; width: 100%; height: 46px; box-sizing: border-box; margin: 0; padding: 0 14px;
  border: 1px solid #ddd3ea; border-radius: 12px; background: #fff; color: #1d1d1f;
  font: inherit; font-size: 16px;
}
.mch-field input:focus { outline: 0; border-color: var(--mch-accent); box-shadow: 0 0 0 3px rgba(160, 32, 240, .15); }
.mch-field--captcha { display: flex; align-items: center; gap: 12px; }
.mch-field--captcha span { flex: 1; margin: 0; font-size: 15px; color: inherit; }
.mch-field--captcha input { width: 90px; flex: none; text-align: center; }
.mch-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.mch-consent { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 14px; font-size: 13px; color: #6b6b76; cursor: pointer; }
.mch-consent input { flex: none; margin: 2px 0 0; accent-color: var(--mch-accent); }
.mch-consent a { color: var(--mch-accent); }
.mch-form__error { margin: 0 0 12px; color: #d0164a; font-size: 14px; }
.mch-form__error:empty { display: none; }
.mch-btn {
  display: block; width: 100%; height: 50px; border: 0; border-radius: 999px;
  background: var(--mch-grad); color: #fff; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
}
.mch-btn[disabled] { opacity: .6; cursor: wait; }
.mch-success { text-align: center; }
.mch-success__icon { font-size: 48px; line-height: 1; }
.mch-success__text { margin: 0 0 20px; color: #4a4a55; }
[hidden].mch-form, [hidden].mch-success, [hidden].mch-modal__head { display: none !important; }

@keyframes mch-fade { from { opacity: 0; } }
@keyframes mch-up { from { transform: translateY(30px) scale(.96); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mch-cookie, .mch-bar__claim, .mch-modal.is-open, .mch-modal__box, .mch-modal__img { animation: none !important; }
  .mch-bar { transition: none; }
}
