@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald/static/Oswald-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald/static/Oswald-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald/static/Oswald-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald/static/Oswald-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald/static/Oswald-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("../fonts/Lato/Lato-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("../fonts/Lato/Lato-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #1a0405;
  --accent: #d21417;
  --fill-hi: #ff5e5e;
  --fill-lo: #ff0000;
  --text: #ffffff;
  --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: "Lato", sans-serif;
  color: var(--text);
}

.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: 36px;
  margin-top: 80px;
}

.load-shades {
  width: 420px;
  filter: drop-shadow(0 0 18px rgba(210, 20, 23, 0.45));
  transition: filter 0.4s var(--ease);
}

.load-shades.is-full {
  filter: drop-shadow(0 0 28px rgba(255, 94, 94, 0.85));
  animation: shades-gleam 0.7s var(--ease);
}

.load-shades__svg {
  display: block;
  width: 100%;
  height: auto;
}

#load-lens-fill-L,
#load-lens-fill-R {
  transition: y 0.18s linear, height 0.18s linear;
}

.load-shades__wave {
  transition: opacity 0.2s ease;
  animation: wave-shim 1.1s ease-in-out infinite;
}

@keyframes wave-shim {
  0%,
  100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(1.06);
  }
}

@keyframes shades-gleam {
  0% {
    filter: drop-shadow(0 0 12px rgba(210, 20, 23, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 40px rgba(255, 180, 180, 1));
  }
  100% {
    filter: drop-shadow(0 0 28px rgba(255, 94, 94, 0.85));
  }
}

.loading-text {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 36px;
  letter-spacing: 0.35em;
  color: #fff;
  text-indent: 0.35em;
}

/* ---------- Buttons ---------- */
.img-btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  transition: transform 0.15s var(--ease), filter 0.25s ease;
}

.img-btn img {
  display: block;
  height: auto;
  pointer-events: none;
}

.img-btn--start img {
  width: 320px;
}

.img-btn--howto img {
  width: 600px;
}

.img-btn--result img {
  width: 420px;
}

.img-btn--thanks img {
  width: 300px;
}

.img-btn.is-ready {
  animation: btn-pulse 1.6s ease-in-out infinite;
}

.img-btn.is-tapping {
  transform: scale(0.95);
}

@keyframes btn-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(210, 20, 23, 0));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(210, 20, 23, 0.7));
    transform: scale(1.03);
  }
}

/* ---------- Start ---------- */
.screen__content--start {
  justify-content: flex-end;
  padding-bottom: 180px;
}

.start-shimmer {
  position: absolute;
  inset: 28% 8% 38% 8%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 62%
  );
  background-size: 220% 100%;
  mix-blend-mode: screen;
  animation: lens-sweep 3.2s ease-in-out infinite;
  border-radius: 40%;
  filter: blur(8px);
}

@keyframes lens-sweep {
  0% {
    background-position: 120% 0;
    opacity: 0.2;
  }
  40% {
    opacity: 0.85;
  }
  100% {
    background-position: -40% 0;
    opacity: 0.2;
  }
}

#screen-start.intro-play .screen__bg {
  animation: ripple-pulse 4.5s ease-in-out infinite;
}

@keyframes ripple-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.08);
  }
}

/* ---------- How to ---------- */
.screen__content--howto {
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 550px;
}

.screen__content--howto .img-btn--howto {
  position: relative;
  z-index: 2;
}

#screen-howto.active .img-btn {
  animation: fade-up 0.5s var(--ease) both, btn-pulse 1.6s ease-in-out 0.5s infinite;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Game ---------- */
.stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.35;
  animation: star-twinkle ease-in-out infinite;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.2);
  }
}

.playfield {
  position: absolute;
  inset: 0;
  z-index: 3;
  touch-action: none;
  overflow: hidden;
}

.playfield.is-shake {
  animation: hit-shake 0.28s ease;
}

@keyframes hit-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-10px, 4px);
  }
  40% {
    transform: translate(10px, -4px);
  }
  60% {
    transform: translate(-6px, -2px);
  }
  80% {
    transform: translate(6px, 2px);
  }
}

.product-hit-zone {
  position: absolute;
  left: 360px;
  top: 880px;
  width: 360px;
  height: 200px;
  z-index: 11;
  pointer-events: none;
  border: 3px solid rgba(255, 60, 60, 0.95);
  background: rgba(255, 0, 0, 0.22);
  box-sizing: border-box;
  border-radius: 8px;
}

.product-hit-zone.is-hidden {
  opacity: 0;
  border-color: transparent;
  background: transparent;
}

.product {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 460px;
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  animation: product-breathe 3.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  transition: filter 0.15s ease;
}

.product.is-hit {
  filter: drop-shadow(0 0 28px rgba(255, 80, 80, 0.95));
}

@keyframes product-breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
}

.asteroid {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 8px rgba(255, 160, 80, 0.35));
  transition: filter 0.15s ease, opacity 0.35s ease;
  pointer-events: none;
  opacity: 1;
}

.asteroid.is-deflect {
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.45));
  transition: filter 0.15s ease, opacity 0.35s ease;
}

.asteroid.is-reject {
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.55));
}

.asteroid.is-fading {
  opacity: 0 !important;
  pointer-events: none;
}

.asteroid.is-collapse {
  filter: drop-shadow(0 0 24px rgba(255, 80, 80, 0.9));
}

.tap-fx {
  position: absolute;
  width: 160px;
  height: 160px;
  margin-left: -80px;
  margin-top: -80px;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.12s ease, transform 0.35s var(--ease);
}

.tap-fx.impact-fx {
  width: 220px;
  height: 220px;
  margin-left: -110px;
  margin-top: -110px;
  filter: hue-rotate(-10deg) brightness(1.2);
}

.tap-fx.is-on {
  opacity: 1;
  transform: scale(1.15);
}

.timer-wrap {
  position: absolute;
  top: 48px;
  right: 36px;
  z-index: 8;
  width: 220px;
  height: 88px;
}

.timer-label {
  display: block;
  width: 100%;
  height: auto;
}

.timer-value {
  position: absolute;
  inset: 0;
  left: 52px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 42px;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  padding-top: 4px;
}

.timer-wrap.is-urgent .timer-value {
  color: #ff6b6b;
  animation: timer-pulse 0.7s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.shield-hud {
  position: absolute;
  left: 50%;
  top: 445px;
  transform: translateX(-50%);
  width: 90%;
  max-width: 900px;
  z-index: 8;
  pointer-events: none;
}

.shield-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.shield-label {
  order: -1;
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  align-self: flex-start;
  margin: 0 0 2px 4px;
  line-height: 1;
}

.shield-bar {
  position: relative;
  width: 100%;
  height: 46px;
}

.shield-track {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 38px;
  object-fit: fill;
  display: block;
}

.shield-fill-clip {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  max-width: calc(100% - 24px);
  height: 20px;
  overflow: hidden;
  border-radius: 20px;
  transition: width 0.25s var(--ease);
}

.shield-fill {
  display: block;
  height: 20px;
  width: 100%;
  max-width: none;
  border-radius: 20px;
  pointer-events: none;
  /* 20 hard boxes — matches 5-point shield steps (100 / 5) */
  background: linear-gradient(
    90deg,
    #e61e1e 0%,
    #e61e1e 5%,
    #ed2f1a 5%,
    #ed2f1a 10%,
    #f04a1a 10%,
    #f04a1a 15%,
    #f46a1c 15%,
    #f46a1c 20%,
    #f7941d 20%,
    #f7941d 25%,
    #fbb01c 25%,
    #fbb01c 30%,
    #ffc20e 30%,
    #ffc20e 35%,
    #ffe000 35%,
    #ffe000 40%,
    #fff200 40%,
    #fff200 45%,
    #e8e820 45%,
    #e8e820 50%,
    #c5d82e 50%,
    #c5d82e 55%,
    #a8cf35 55%,
    #a8cf35 60%,
    #8cc63f 60%,
    #8cc63f 65%,
    #6abe44 65%,
    #6abe44 70%,
    #39b54a 70%,
    #39b54a 75%,
    #22ab4e 75%,
    #22ab4e 80%,
    #00a651 80%,
    #00a651 85%,
    #009a4a 85%,
    #009a4a 90%,
    #008f44 90%,
    #008f44 95%,
    #00843e 95%,
    #00843e 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.shield-tag {
  position: absolute;
  top: calc(100% + 2px);
  left: 100%;
  transform: translateX(-50%);
  width: 64px;
  transition: left 0.25s var(--ease);
  pointer-events: none;
}

.shield-tag img {
  display: block;
  width: 100%;
  height: auto;
}

.shield-tag span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Oswald", sans-serif;
  font-weight: 300;
  font-size: 24px;
  color: #fff;
  padding-top: 4px;
}

/* ---------- Results ---------- */
.screen__content--result {
  justify-content: center;
  padding-top: 590px;
  gap: 36px;
}

.result-stage {
  position: relative;
  width: min(640px, 70%);
  aspect-ratio: 737 / 704;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  z-index: 3;
}

.gift-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 0;
  pointer-events: none;
}

.result-art {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: 78%;
  max-height: 68%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.35));
}

/* Winner: glasses grow out of the gift box, then gentle float */
.result-stage--winner {
  overflow: visible;
}

.result-stage--winner .gift {
  max-width: 104%;
  max-height: 92%;
  z-index: 2;
}

.gift.is-anim {
  animation:
    gift-emerge 1.15s cubic-bezier(0.22, 1, 0.36, 1) both,
    gift-float 2.4s ease-in-out 1.15s infinite;
}

@keyframes gift-emerge {
  0% {
    opacity: 0.7;
    transform: translateY(36%) scale(0.32);
  }
  55% {
    opacity: 1;
    transform: translateY(-6%) scale(1.28);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1.13);
  }
}

@keyframes gift-float {
  0%,
  100% {
    transform: translateY(0) scale(1.13);
  }
  50% {
    transform: translateY(-14px) scale(1.17);
  }
}

.loose-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.loose-wrap .loose {
  transform-origin: 50% 50%;
  display: block;
  margin: 0;
  max-width: 78%;
  max-height: 68%;
}

.loose-wrap.is-anim {
  animation: loose-bob 1.8s ease-in-out infinite;
  transform-origin: 50% 50%;
}

.loose-wrap.is-anim .loose {
  animation: loose-spin 1.8s ease-in-out infinite;
  transform-origin: 50% 50%;
}

@keyframes loose-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

@keyframes loose-spin {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

.screen__content--result .img-btn {
  margin-top: auto;
  margin-bottom: 160px;
}

.screen__content--thanks {
  justify-content: flex-end;
  padding-bottom: 160px;
}

#screen-thanks.active .screen__bg {
  animation: thanks-drift 8s ease-in-out infinite alternate;
}

@keyframes thanks-drift {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.04) translateY(-1%);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .start-shimmer,
  .stars {
    display: none;
  }
}
