* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: #0f1419;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 100%;
  max-width: 1440px;
  padding: 16px 72px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-bar__brand {
  display: flex;
  align-items: center;
}

.nav-bar__logo {
  width: 144px;
  height: 48px;
  object-fit: contain;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 79px 20px 0;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background: url(../img/bg-main.png) center top / cover no-repeat;
  pointer-events: none;
}

.hero__intro {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: #fff;
  width: 100%;
  max-width: 640px;
  margin-bottom: 24px;
}

@media screen and (min-width: 771px) {
  .site-header {
    position: static;
    transform: none;
    left: auto;
    max-width: none;
    background-color: #0f1419;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .hero {
    padding-top: 64px;
  }

  .hero__intro {
    max-width: none;
  }

  .hero__subtitle {
    white-space: nowrap;
  }
}

.hero__title {
  font-family: "Mont", sans-serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 800;
  line-height: 1;
}

.hero__title-line--mobile {
  display: none;
}

.hero__subtitle {
  font-family: "Mont", sans-serif;
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 400;
  line-height: 1.2;
}

/* ===== Game ===== */
.game {
  position: relative;
  z-index: 2;
  width: min(538px, 92vw);
  height: min(524px, 88vw);
  margin: 0 auto;
  flex-shrink: 0;
}

.game__goal {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.game__grid {
  position: absolute;
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
  width: 94%;
  aspect-ratio: 507 / 284;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px 6px;
  z-index: 2;
}

.game__cell {
  appearance: none;
  border: 1px solid #ff4dad;
  border-radius: 8px;
  background: rgba(255, 77, 173, 0.15);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  color: #fff;
  font-family: "Mont", sans-serif;
  font-size: clamp(28px, 6vw, 64px);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.game__cell:hover:not(:disabled) {
  background: rgba(255, 77, 173, 0.28);
  transform: scale(1.03);
}

.game__cell:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.game__cell:disabled {
  cursor: default;
  opacity: 0.85;
}

.game__cell.is-active {
  border: 3px solid #fff;
}

.game__bear {
  position: absolute;
  top: 9%;
  left: 52%;
  transform: translateX(-50%) rotate(-10.55deg);
  width: 73%;
  max-width: 395px;
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 3;
}

.game__ball {
  position: absolute;
  left: 50%;
  bottom: -18%;
  width: 39px;
  height: 39px;
  transform: translate(-50%, 0);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: none;
}

.game__ball.is-visible {
  opacity: 1;
}

.game__ball.is-flying {
  transition:
    left 0.55s cubic-bezier(0.25, 0.8, 0.35, 1),
    top 0.55s cubic-bezier(0.25, 0.8, 0.35, 1),
    transform 0.55s cubic-bezier(0.25, 0.8, 0.35, 1),
    opacity 0.15s ease;
}

.game.is-locked .game__cell {
  pointer-events: none;
}

/* ===== Promo bar ===== */
.promo-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  background: #b21a6c;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px 0;
  overflow: hidden;
}

.promo-bar__track {
  width: 100%;
  overflow: hidden;
}

.promo-bar__content {
  display: flex;
  width: max-content;
  animation: promoMarquee 28s linear infinite;
}

.promo-bar__content p {
  flex-shrink: 0;
  padding-right: 80px;
  color: #fff;
  font-family: "Mont", sans-serif;
  font-size: clamp(14px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

@keyframes promoMarquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ===== Footer ===== */
footer {
  background: #0f1419;
  border-top: 1px solid #2a2a32;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

footer img {
  width: 150px;
  height: 35px;
}

footer p {
  color: rgba(255, 255, 255, 0.5);
  font-family: "Poppins", sans-serif;
  font-size: 10px;
  line-height: 14px;
}

/* ===== Popups ===== */
.popup {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.popup--success,
.popup--fail {
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.popup-success {
  background: #0f1419;
  border-radius: 12px;
  padding: 40px;
  max-width: 523px;
  width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.popup-success__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  width: 100%;
}

.popup-success__title {
  color: #fff;
  font-family: "Mont", sans-serif;
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.popup-success__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-success__text p {
  color: #fff;
  font-family: "Mont", sans-serif;
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 400;
  line-height: 1;
  margin: 0;
}

.popup-success__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: linear-gradient(
    -82.45deg,
    #b21a6c 10.51%,
    #ff4dad 53.84%,
    #b21a6c 88.85%
  );
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: normal;
  text-decoration: none;
  text-shadow:
    0 12.581px 12.581px rgba(16, 24, 40, 0.03),
    0 31.452px 37.743px rgba(16, 24, 40, 0.08);
  cursor: pointer;
  transition:
    filter 0.2s,
    transform 0.15s;
}

.popup-success--fail {
  max-width: 680px;
  width: calc(100% - 24px);
  padding: 40px 32px;
}

.popup-success--fail .popup-success__title {
  white-space: nowrap;
  max-width: none;
  font-size: clamp(28px, 7vw, 56px);
}

.popup-success__btn:hover {
  filter: brightness(1.08);
}

.popup-success__btn:active {
  transform: scale(0.98);
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game__ball.is-flying {
    transition-duration: 0.01ms;
  }
  .promo-bar__content {
    animation: none;
  }
}

/* ===== Mobile ===== */
@media screen and (max-width: 770px) {
  .site-header {
    padding: 8px 16px;
  }

  .nav-bar__logo {
    width: 144px;
    height: 48px;
  }

  .hero {
    min-height: auto;
    padding: 110px 16px 24px;
    gap: 40px;
  }

  .hero__intro {
    max-width: 100%;
    margin-bottom: 0;
    gap: 16px;
  }

  .hero__title {
    font-size: 40px;
    width: 100%;
  }

  .hero__title-line--desktop {
    display: none;
  }

  .hero__title-line--mobile {
    display: inline;
  }

  .hero__subtitle {
    font-size: 16px;
    line-height: 1;
    width: 100%;
    white-space: normal;
  }

  .game {
    width: 100%;
    max-width: 390px;
    height: 622px;
  }

  .game__goal {
    top: 15.76%;
    width: 93.33%;
  }

  .game__grid {
    top: 17.36%;
    width: 90.26%;
    aspect-ratio: 352 / 192;
    gap: 4px 6px;
  }

  .game__cell {
    border-radius: 4px;
    font-size: 40px;
    font-weight: 800;
  }

  .game__cell.is-active {
    border-width: 2px;
  }

  .game__bear {
    top: 19.93%;
    left: calc(50% + 8px);
    width: 75.1%;
    max-width: 293px;
    transform: translateX(-50%) rotate(-10.55deg);
  }

  .game__ball {
    width: 32px;
    height: 32px;
    bottom: -6%;
  }

  .promo-bar {
    padding: 24px 0;
  }

  .promo-bar__content p {
    padding-right: 48px;
    font-size: 24px;
  }

  .popup-success {
    padding: 32px 24px;
  }

  .popup-success__title {
    white-space: normal;
  }

  .popup-success--fail {
    width: calc(100% - 16px);
    max-width: none;
    padding: 32px 20px;
  }

  .popup-success--fail .popup-success__title {
    white-space: nowrap;
    font-size: clamp(22px, 6vw, 56px);
  }
}
