/* ============================================================
   Choco Dubai Football Shootout — Styles
   Mobile-first, portrait-optimized penalty kick game
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Game wrapper — locked 9:16 to match stadium creative ---- */
#game-wrapper {
  position: relative;
  aspect-ratio: 9 / 16;
  width: min(100vw, 56.25vh, 480px);
  height: auto;
  max-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: #0a0a1a;
}

/* ---- Full stadium background — 1:1 mapped to canvas ---- */
#stadium-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/background.png') center center / 100% 100% no-repeat;
  z-index: 1;
}

/* ---- Stadium floodlight glow pulse ---- */
#stadium-glow {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% 8%, rgba(100, 200, 255, 0.35) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 8%, rgba(100, 200, 255, 0.35) 0%, transparent 70%),
    radial-gradient(ellipse 80% 30% at 50% 0%, rgba(150, 100, 255, 0.2) 0%, transparent 60%);
  animation: glowPulse 3s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ---- Crowd shimmer / wave effect ---- */
#crowd-layer {
  position: absolute;
  top: 18%;
  left: 5%;
  right: 5%;
  height: 22%;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  border-radius: 4px;
}

.crowd-wave {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: crowdWave 2.5s linear infinite;
}

.crowd-wave--delay {
  animation-delay: 1.25s;
  opacity: 0.5;
}

@keyframes crowdWave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Crowd cheer burst on goal */
#crowd-layer.cheering {
  animation: crowdCheer 0.6s ease-out;
}

@keyframes crowdCheer {
  0%   { transform: scaleY(1); }
  30%  { transform: scaleY(1.08) translateY(-3px); }
  60%  { transform: scaleY(0.97); }
  100% { transform: scaleY(1); }
}

/* ---- Game canvas ---- */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: crosshair;
}

/* ---- HUD scoreboard ---- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  pointer-events: none;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.hud-timer .hud-value {
  font-size: 1.6rem;
  color: #ffe566;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.hud-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
}

.hud-value.timer-warning {
  color: #ff4444;
  animation: timerBlink 0.5s ease-in-out infinite alternate;
}

@keyframes timerBlink {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}

/* ---- Aim drag line ---- */
#aim-line {
  position: absolute;
  z-index: 15;
  pointer-events: none;
  display: none;
  height: 3px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,230,80,0.8));
  border-radius: 2px;
  transform-origin: left center;
  box-shadow: 0 0 8px rgba(255, 230, 80, 0.6);
}

/* ---- Goal celebration ---- */
#goal-celebration {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#goal-celebration.hidden {
  display: none;
}

.goal-text {
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  color: #ffe566;
  text-shadow:
    0 0 20px rgba(255, 230, 80, 0.9),
    0 4px 0 #c9a000,
    0 8px 20px rgba(0, 0, 0, 0.6);
  animation: goalPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  letter-spacing: 0.05em;
}

@keyframes goalPop {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.3; }
}

/* ---- Save flash ---- */
#save-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 80, 200, 0.25);
}

#save-flash.hidden {
  display: none;
}

.save-text {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 900;
  color: #88ccff;
  text-shadow: 0 0 20px rgba(100, 180, 255, 0.9), 0 4px 12px rgba(0,0,0,0.6);
  animation: saveShake 0.5s ease-out forwards;
}

@keyframes saveShake {
  0%   { transform: scale(0.5); opacity: 0; }
  40%  { transform: scale(1.15); opacity: 1; }
  70%  { transform: scale(0.95) translateX(-5px); }
  85%  { transform: scale(1) translateX(5px); }
  100% { transform: scale(1) translateX(0); }
}

/* ---- Overlay screens (start / win / lose) ---- */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 20, 0.82);
  backdrop-filter: blur(4px);
}

.overlay-screen.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  padding: 2rem 1.5rem;
  color: #fff;
  max-width: 90%;
}

.overlay-content h1 {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffe566;
  text-shadow: 0 0 30px rgba(255, 230, 80, 0.5);
  margin-bottom: 0.5rem;
}

.overlay-content h2 {
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.2rem;
}

.overlay-content p {
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.overlay-content .hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.8rem;
  margin-bottom: 1.5rem;
}

.trophy {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: trophyBounce 1s ease-in-out infinite alternate;
}

@keyframes trophyBounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

.win-content h1 {
  color: #ffe566;
}

.lose-content h1 {
  color: #ff6b6b;
  font-size: clamp(2rem, 8vw, 3rem);
}

/* ---- Buttons ---- */
.game-btn {
  display: inline-block;
  margin-top: 1.2rem;
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1a0a00;
  background: linear-gradient(135deg, #ffe566 0%, #f5a623 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 200, 50, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}

.game-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(255, 200, 50, 0.6);
}

.game-btn:active {
  transform: scale(0.97);
}

/* ---- Responsive: landscape phones ---- */
@media (orientation: landscape) and (max-height: 500px) {
  #game-wrapper {
    max-width: 100%;
    max-height: 100vh;
  }

  #hud {
    padding: 6px 10px;
  }

  .hud-value {
    font-size: 1rem;
  }

  .hud-timer .hud-value {
    font-size: 1.2rem;
  }
}

/* ---- Large screens ---- */
@media (min-width: 481px) {
  #game-wrapper {
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(100, 150, 255, 0.15);
  }
}

.overlay-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  align-items: flex-start;
  padding: 0.75rem 0 1rem;
}

.overlay-scroll .overlay-content {
  margin: 0 auto;
}

#select-screen .overlay-content--wide {
  max-width: 96%;
  width: 100%;
  max-height: none;
  padding: 1rem 1rem 1.25rem;
}

.overlay-content--wide {
  max-width: 96%;
  width: 100%;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 1rem 0 1.2rem;
  max-height: min(48vh, 380px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px 4px 4px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  touch-action: manipulation;
}

.product-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.product-card.selected {
  border-color: #ffe566;
  background: rgba(255, 230, 80, 0.12);
  box-shadow: 0 0 20px rgba(255, 230, 80, 0.25);
}

.product-card__img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 88px;
  overflow: hidden;
}

.product-card__img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: scale(var(--thumb-scale, 1));
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.product-card__name {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.9);
}

.selected-product-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0.8rem 0 1rem;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.selected-product-banner__img {
  width: 56px;
  height: 76px;
  object-fit: contain;
  transform: scale(var(--thumb-scale, 1));
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.selected-product-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}

.selected-product-banner strong,
.selected-product-banner span {
  color: #ffe566;
}

/* ---- Prize / win ---- */
.prize-product-img {
  width: 100px;
  height: 130px;
  object-fit: contain;
  margin: 0.6rem auto;
  transform: scale(var(--thumb-scale, 1));
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

.prize-product-img--small {
  width: 72px;
  height: 94px;
  margin: 0;
}

.prize-text {
  font-size: clamp(0.95rem, 3.8vw, 1.15rem) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 0.4rem !important;
}

.prize-text strong {
  color: #ffe566;
}

.claim-prize-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0.8rem 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.claim-product-label {
  font-size: 1rem;
  font-weight: 700;
  color: #ffe566;
  margin: 0;
  text-align: left;
}

/* ---- Claim form ---- */
.claim-form {
  text-align: left;
  margin-top: 0.5rem;
}

.claim-field {
  display: block;
  margin-bottom: 14px;
}

.claim-field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 6px;
}

.claim-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}

.claim-field input:focus {
  border-color: #ffe566;
}

.claim-field input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.field-error {
  display: block;
  min-height: 1.1em;
  font-size: 0.75rem;
  font-style: normal;
  color: #ff6b6b;
  margin-top: 4px;
}

.claim-form .game-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.claim-form .game-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Secondary button ---- */
.game-btn--ghost {
  background: transparent;
  color: #ffe566;
  border: 2px solid rgba(255, 230, 80, 0.45);
  box-shadow: none;
  margin-top: 0.6rem;
  padding: 10px 28px;
  font-size: 0.85rem;
}

.game-btn--ghost:hover {
  background: rgba(255, 230, 80, 0.1);
  box-shadow: none;
}
