@font-face {
  font-family: "Helvetica";
  src: url("../Assets/fonts/helvetica-255/Helvetica.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica";
  src: url("../Assets/fonts/helvetica-255/Helvetica-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Helvetica";
  src: url("../Assets/fonts/helvetica-255/helvetica-light-587ebe5a59211.ttf")
    format("truetype");
  font-weight: 300;
  font-display: swap;
}

:root {
  --bg: #e91e63;
  --text: #ffffff;
  --accent: #ff4081;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --design-w: 1080;
  --design-h: 1920;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Helvetica", Arial, sans-serif;
  color: var(--text);
  touch-action: none;
}

.viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.app {
  position: relative;
  width: 1080px;
  height: 1920px;
  flex-shrink: 0;
  transform-origin: center center;
  overflow: hidden;
  background: var(--bg);
  visibility: hidden;
}

.app.is-scaled {
  visibility: visible;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  pointer-events: none;
}

.screen.active,
.screen.is-active {
  display: block;
  opacity: 1;
  pointer-events: auto;
  animation: screen-fade-in 0.38s var(--ease) forwards;
}

.screen[hidden] {
  display: none !important;
}

.screen.active[hidden],
.screen.is-active[hidden] {
  display: block !important;
}

@keyframes screen-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.screen__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.screen__content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Loading ---------- */
.screen__content--loading {
  justify-content: center;
}

.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  margin-top: 120px;
}

.loading-logo {
  width: 280px;
  height: auto;
  animation: logo-pulse 2s ease-in-out infinite;
}

.loading-text {
  font-size: 28px;
  letter-spacing: 0.35em;
  font-weight: 300;
  opacity: 0.9;
}

.load-bar {
  width: 420px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.load-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff 0%, #ffcdd2 100%);
  transition: width 0.18s linear;
}

.load-bar.is-full {
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.55);
}

/* ---------- Start screen (flow layout) ---------- */
/* Keep full-screen absolute content box — do NOT set position:relative (collapses height) */

.start-bg-breathe {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    165deg,
    rgba(233, 30, 99, 0.45) 0%,
    rgba(255, 64, 129, 0.2) 35%,
    rgba(255, 112, 67, 0.35) 70%,
    rgba(233, 30, 99, 0.4) 100%
  );
  animation: start-bg-breathe 5.5s ease-in-out infinite;
}

.start-sparkles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.start-sparkle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 220, 240, 0.5) 45%,
    transparent 70%
  );
  opacity: 0;
  animation: start-sparkle-float ease-in-out infinite;
}

.screen__content--start {
  z-index: 2;
}

.start-tagline {
  position: absolute;
  top: 130px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.08em;
  opacity: 0;
}

#screen-start.intro-play .start-tagline {
  animation: fade-down 0.55s var(--ease) 0.2s forwards;
}

.start-title {
  position: absolute;
  top: 210px;
  left: 0;
  right: 0;
  text-align: center;
}

.start-title__line {
  display: block;
  font-size: 96px;
  font-weight: 700;
  font-style: italic;
  line-height: 1.05;
  opacity: 0;
  text-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 10px 36px rgba(233, 30, 99, 0.22),
    0 0 48px rgba(255, 255, 255, 0.12);
}

#screen-start.intro-play .start-title__line:first-child {
  animation: title-drop-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards;
}

.start-title__line--light {
  text-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 10px 40px rgba(255, 112, 67, 0.35),
    0 0 56px rgba(255, 255, 255, 0.32);
}

#screen-start.intro-play .start-title__line--light {
  animation:
    title-drop-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.58s forwards,
    title-light-pulse 2.4s ease-in-out 1.5s infinite;
}

.start-logo-wrap {
  position: absolute;
  top: 520px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
}

#screen-start.intro-play .start-logo-wrap {
  animation: fade-in 0.9s var(--ease) 0.75s forwards;
}

.start-logo-inner {
  will-change: transform;
}

#screen-start.intro-play .start-logo-inner {
  animation: logo-bob 4s ease-in-out 1.7s infinite;
}

.start-logo {
  width: 700px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.35));
}

#screen-start.intro-play .start-logo {
  animation: logo-pulse 2.4s ease-in-out 1.7s infinite;
}

/* ---------- Buttons ---------- */
.img-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease);
  transform-origin: center center;
}

.img-btn img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  pointer-events: none;
}

.img-btn.is-ready:not(.img-btn--start):not(.img-btn--play):not(.img-btn--claim):not(.img-btn--try-again):not(.img-btn--home) {
  animation: btn-pulse 1.6s ease-in-out infinite;
}

.img-btn.is-tapping {
  transform: scale(0.95) !important;
  animation: none !important;
}

.img-btn--start {
  position: absolute;
  top: 1637px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  opacity: 0;
  width: 410px;
  height: 113px;
}

.img-btn--start img {
  width: 410px;
  height: 113px;
}

#screen-start.intro-play .img-btn--start {
  animation:
    fade-up-btn 0.55s var(--ease) 1.15s forwards,
    btn-pulse-centered 1.6s ease-in-out 1.85s infinite;
}

.img-btn--play {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: auto;
  height: auto;
  line-height: 0;
}

.img-btn--play img {
  display: block;
  width: 585px;
  height: auto;
  max-width: none;
  object-fit: contain;
}

.img-btn--claim,
.img-btn--try-again,
.img-btn--home {
  position: absolute;
  top: 1637px;
  left: 50%;
  transform: translateX(-50%);
}

.img-btn--claim img {
  width: 429px;
  height: 113px;
}

.img-btn--try-again img {
  width: 388px;
  height: 113px;
}

.img-btn--home img {
  width: 404px;
  height: 113px;
}

#screen-thanks .img-btn--home {
  top: calc(50% + 50px);
  transform: translate(-50%, -50%);
}

#screen-thanks .img-btn--home.is-ready {
  animation: btn-pulse-centered-v 1.6s ease-in-out infinite;
}

.img-btn--play.is-ready,
.img-btn--claim.is-ready,
.img-btn--try-again.is-ready,
.img-btn--home.is-ready {
  animation: btn-pulse-centered 1.6s ease-in-out infinite;
}


.img-btn--start.is-tapping,
.img-btn--play.is-tapping,
.img-btn--claim.is-tapping,
.img-btn--try-again.is-tapping,
.img-btn--home.is-tapping {
  transform: translateX(-50%) scale(0.95) !important;
}

#screen-thanks .img-btn--home.is-tapping {
  transform: translate(-50%, -50%) scale(0.95) !important;
}

@media (hover: hover) {
  .img-btn:hover {
    transform: scale(1.04);
  }

  .img-btn--start:hover,
  .img-btn--play:hover,
  .img-btn--claim:hover,
  .img-btn--try-again:hover,
  .img-btn--home:hover {
    transform: translateX(-50%) scale(1.04);
  }

  #screen-thanks .img-btn--home:hover {
    transform: translate(-50%, -50%) scale(1.04);
  }
}

/* ---------- Game screen (flow layout) ---------- */
.screen__content--game {
  padding: 0;
}

.game-header {
  position: absolute;
  top: 202px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.game-header__tagline {
  font-size: 48px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.08;
  max-width: 920px;
}

.game-header__tagline span {
  display: block;
}

.game-hud {
  position: absolute;
  top: 368px;
  left: 72px;
  right: 72px;
  display: flex;
  justify-content: space-between;
  z-index: 3;
}

.game-hud__score,
.game-hud__timer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-hud__timer {
  align-items: flex-end;
}

.game-hud__label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.9;
}

.game-hud__value {
  font-size: 44px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.game-hud__value.is-pop {
  animation: score-pop 0.35s var(--ease);
}

.game-hud__timer.is-urgent .game-hud__value {
  color: #ffeb3b;
  animation: timer-urgent 0.6s ease-in-out infinite;
}

.game-board {
  position: absolute;
  top: 508px;
  left: 50%;
  transform: translateX(-50%);
  width: 968px;
  height: 979px;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../Assets/images/tile-dark.png") center / 100% 100% no-repeat;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.product-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  width: 100%;
  height: 100%;
}

.product-cell {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  opacity: 0.75;
  transition: opacity 0.2s var(--ease);
}

.product-cell.is-glowing {
  opacity: 1;
}

.product-cell__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  height: 150%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
  transition: filter 0.2s var(--ease);
}

.product-cell__product {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 60%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  transition: transform 0.15s var(--ease);
}

.product-cell.is-glowing .product-cell__ring {
  filter: drop-shadow(0 0 17px rgba(255, 255, 255, 0.75)) brightness(1.08);
  animation: ring-glow-shimmer 0.9s ease-in-out infinite;
}

.product-cell.is-glowing .product-cell__product {
  transform: translate(-50%, -50%) scale(1.04);
}

.product-cell.is-hit .product-cell__product {
  animation: hit-flash-centered 0.22s var(--ease);
}

.product-cell:not(.is-glowing) .product-cell__ring {
  filter: brightness(0.92) saturate(0.95);
}

.score-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff2d6a 0%, #ff6b35 100%);
  border: 3px solid #ffffff;
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.85),
    0 4px 14px rgba(0, 0, 0, 0.45);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.35);
  animation: float-up 0.75s var(--ease) forwards;
  pointer-events: none;
  z-index: 15;
  white-space: nowrap;
}

.score-pop--cell {
  left: 50%;
  top: 28%;
}

/* ---------- How-to overlay ---------- */
.howto-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.howto-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.howto-overlay__dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.howto-overlay__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fade-up 0.45s var(--ease) forwards;
}

.howto-overlay__card-wrap {
  position: relative;
  width: 920px;
}

.howto-overlay__card {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Result screens ---------- */
.screen__content--result,
.screen__content--thanks {
  justify-content: flex-end;
}

.prize-slot {
  position: absolute;
  /* Centered between headline (~480px) and footer text (~1520px) */
  top: 990px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 737px;
  height: 704px;
  z-index: 2;
}

.prize-slot__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.prize-slot__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 58%;
  height: 58%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}

.prize-slot__content--mascot {
  width: 48%;
  height: 72%;
}

#screen-win.is-enter .prize-slot__content,
#screen-lose.is-enter .prize-slot__content {
  animation: prize-pop-in-centered 0.55s var(--ease) 0.15s both;
}

#screen-win.is-enter .screen__bg {
  animation: win-bg-glow 1.2s var(--ease);
}

#screen-lose.is-enter .screen__bg {
  animation: lose-shake 0.6s var(--ease);
}

#screen-thanks.is-enter .screen__bg {
  animation: thanks-fade-up 0.8s var(--ease);
}

.result-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 8%),
    radial-gradient(circle at 80% 25%, rgba(255, 255, 255, 0.35) 0%, transparent 6%),
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.25) 0%, transparent 10%);
  animation: sparkle-twinkle 2s ease-in-out infinite;
  z-index: 1;
}

/* ---------- Keyframes ---------- */
@keyframes btn-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes btn-pulse-centered {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.04);
  }
}

@keyframes btn-pulse-centered-v {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.04);
  }
}

@keyframes fade-up-btn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes logo-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes logo-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes ring-glow-shimmer {
  0%,
  100% {
    filter: drop-shadow(0 0 17px rgba(255, 255, 255, 0.75)) brightness(1.08);
  }
  50% {
    filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.95)) brightness(1.14);
  }
}

@keyframes prize-pop-in {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes start-bg-breathe {
  0%,
  100% {
    opacity: 0.35;
    filter: hue-rotate(0deg) brightness(1);
  }
  50% {
    opacity: 0.65;
    filter: hue-rotate(-6deg) brightness(1.08);
  }
}

@keyframes start-sparkle-float {
  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  20% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.45;
    transform: translateY(-18px) scale(1);
  }
  80% {
    opacity: 0;
  }
}

@keyframes title-light-pulse {
  0%,
  100% {
    text-shadow:
      0 4px 10px rgba(0, 0, 0, 0.35),
      0 10px 40px rgba(255, 112, 67, 0.35),
      0 0 56px rgba(255, 255, 255, 0.32);
  }
  50% {
    text-shadow:
      0 4px 10px rgba(0, 0, 0, 0.35),
      0 12px 48px rgba(255, 112, 67, 0.48),
      0 0 72px rgba(255, 255, 255, 0.5),
      0 0 110px rgba(255, 180, 200, 0.22);
  }
}

@keyframes title-drop-in {
  from {
    opacity: 0;
    transform: translateY(-90px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up-centered {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ring-glow-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.75)) brightness(1.08);
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.95)) brightness(1.14);
  }
}

@keyframes hit-flash-centered {
  0% {
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
  40% {
    transform: translate(-50%, -50%) scale(1.12);
    filter: brightness(1.6);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
}

@keyframes prize-pop-in-centered {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -145%) scale(1.05);
  }
}

@keyframes score-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes timer-urgent {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes win-bg-glow {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes lose-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes thanks-fade-up {
  from {
    opacity: 0.85;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparkle-twinkle {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
