/* ===== Emoji Cursor for Interactive Elements ===== */
#landing a,
#landing button,
#landing .game-card,
.story-close,
.postgame-nudge-close,
.postgame-nudge-tip,
.postgame-nudge-share {
  cursor: url("../assets/emoji/cursors/hand-point-32.png") 16 4, pointer;
}

/* ===== Landing Page ===== */
#landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 10;
  padding: 0 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  min-height: 100svh;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Soft glow behind center */
.hero-glow {
  position: absolute;
  width: clamp(300px, 50vw, 550px);
  height: clamp(300px, 50vw, 550px);
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(255, 240, 220, 0.5) 0%,
    rgba(221, 208, 255, 0.4) 30%,
    rgba(200, 232, 240, 0.2) 55%,
    transparent 75%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

/* ---- Parallax Layers ---- */
.hero-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}
.hero-layer--bg  { z-index: 1; }
.hero-layer--mid { z-index: 2; }
.hero-layer--fg  { z-index: 4; will-change: transform; -webkit-backface-visibility: hidden; backface-visibility: hidden; }

/* ---- Hero Text (center, static) ---- */
.hero-text {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  animation: headerFadeIn 0.8s ease forwards;
}

@keyframes headerFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Cloud Cluster (positioned ABOVE hero text) ---- */
.hero-cloud-cluster {
  position: absolute;
  bottom: 60%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(320px, 45vw, 520px);
  height: clamp(140px, 15vw, 220px);
  pointer-events: none;
}
.hero-cloud-cluster::before {
  content: '';
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 60%, rgba(255,255,255,0.9) 0%, rgba(255,240,245,0.5) 35%, transparent 65%),
    radial-gradient(circle at 25% 50%, rgba(255,255,255,0.7) 0%, transparent 55%),
    radial-gradient(circle at 75% 50%, rgba(255,255,255,0.7) 0%, transparent 55%);
  filter: blur(18px);
  z-index: -1;
}

/* ---- Hero Icons (absolute within cloud cluster) ---- */
.hero-icon {
  position: absolute;
  width: clamp(40px, 5.5vw, 72px);
  height: auto;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both,
             heroBob 4s ease-in-out 0.6s infinite;
}
/* Semi-circle arc: top-center high, sides lower */
.hero-icon--rocket  { top: 0%;  left: 45%;  width: clamp(48px, 6vw, 76px);  animation-delay: 0.1s, 0.6s; }
.hero-icon--teddy   { top: 10%; left: 18%;  width: clamp(52px, 7vw, 90px);  animation-delay: 0.2s, 0.7s; }
.hero-icon--balloon { top: 12%; left: 70%;  width: clamp(44px, 5.5vw, 68px); animation-delay: 0.3s, 0.8s; }
.hero-icon--whale   { top: 42%; left: 3%;   width: clamp(36px, 4.5vw, 56px); animation-delay: 0.4s, 0.9s; }
.hero-icon--lion    { top: 38%; left: 82%;  width: clamp(36px, 4.5vw, 56px); animation-delay: 0.5s, 1.0s; }
.hero-icon--pizza   { top: 55%; left: 30%;  width: clamp(32px, 4vw, 52px);  animation-delay: 0.6s, 1.1s; }
.hero-icon--donut   { top: 50%; left: 60%;  width: clamp(32px, 4vw, 52px);  animation-delay: 0.7s, 1.2s; }

@keyframes popIn {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes heroBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(3deg); }
}

/* ---- Foreground Props (custom PNGs, large + bottom-anchored) ---- */
.hero-prop {
  position: absolute;
  bottom: 0%;
  width: clamp(200px, 25vw, 400px);
  height: auto;
  pointer-events: auto;
  animation: heroPropBob 5s ease-in-out infinite;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.hero-prop:hover {
  transform: scale(1.08) translateY(-15px) !important;
  filter: brightness(1.1);
}
.hero-prop--piano  { left: 18%; transform: rotate(-5deg); animation-delay: 0.5s; animation-name: heroPianoBob; }
.hero-prop--blocks { right: 10%; width: clamp(150px, 18vw, 300px); animation-delay: 1s; }

@keyframes heroPropBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes heroPianoBob {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-6px) rotate(-5deg); }
}

/* ---- Melody Sparkle Particles ---- */
.hero-sparkle {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  opacity: 1;
  animation: sparkleFloat 1.5s ease-out forwards;
  z-index: 5;
}
@keyframes sparkleFloat {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) rotate(45deg) scale(0.5); opacity: 0; }
}

/* ---- CTA Buttons ---- */
.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}
.hero-btn {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  font-weight: 700;
  padding: 0.6em 2em;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.hero-btn--primary {
  background: var(--color-primary, #7c5cbf);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  border: 1.5px solid transparent;
}
.hero-btn--secondary {
  background: transparent;
  color: var(--color-primary, #7c5cbf);
  border: 1.5px solid var(--color-primary, #7c5cbf);
}
.hero-btn:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}
.hero-btn:active {
  transform: scale(0.97);
}

/* ---- Hero Responsive (Tablet 769–1100px) ---- */
@media (min-width: 769px) and (max-width: 1100px) {
  .hero-prop { bottom: 5%; }
  .hero-prop--piano  { left: 8%; }
  .hero-prop--blocks { right: 5%; }
}

/* ---- iPad Portrait: bigger emojis + props ---- */
@media (min-width: 769px) and (max-width: 1100px) and (orientation: portrait) {
  .hero-cloud-cluster { width: clamp(380px, 55vw, 520px); height: clamp(180px, 22vw, 260px); }
  .hero-icon { width: clamp(44px, 7vw, 80px); }
  .hero-prop { width: clamp(240px, 32vw, 380px); bottom: 3%; }
  .hero-prop--blocks { width: clamp(190px, 26vw, 320px); }
}

/* ---- Hero Responsive (Mobile < 768px) ---- */
@media (max-width: 768px) {
  .hero-prop {
    width: clamp(130px, 32vw, 190px);
    bottom: 2%;
  }
  .hero-prop--piano  { left: -5%; }
  .hero-prop--blocks { right: -5%; width: clamp(110px, 28vw, 160px); }
  .hero-cloud-cluster { width: 280px; height: 140px; bottom: 68%; }
  .hero-icon { width: clamp(28px, 9vw, 48px); }
  .hero-glow { width: 280px; height: 280px; }
  .hero-cta { flex-direction: column; gap: 0.75rem; }
  .hero-btn { width: 100%; text-align: center; }
}

/* ---- Hero Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .hero-icon, .hero-prop { animation: heroBob 4s ease-in-out infinite !important; }
  .hero-icon { opacity: 1 !important; transform: scale(1) !important; }
  .hero-sparkle { animation: none !important; display: none; }
  .hero-text { animation: none; opacity: 1; }
}

#landing h1 {
  font-family: 'Fredoka', cursive;
  font-size: clamp(2.5rem, 7vw, 3.5rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.1em;
}

/* Victory hand emoji floating animation in title */
#landing h1 .emoji-img {
  display: inline-block;
  animation: titleHandFloat 3s ease-in-out infinite;
}

@keyframes titleHandFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

#landing .domain {
  margin-top: 1.5em;
  font-size: 0.9rem;
  color: var(--color-text-light);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.footer-tip-copy {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: center;
  margin-bottom: 0.6em;
}

.footer-tip-buttons {
  display: flex;
  gap: 0.6em;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 10;
  position: relative;
}

.footer-tip-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 30px;
  border: 1.5px solid var(--color-primary);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
  position: relative;
}

.footer-tip-btn:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 107, 191, 0.25);
}

#landing .qr-code {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

#landing .qr-code:hover {
  opacity: 1;
  transform: scale(1.1);
}

#landing .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: center;
  margin-bottom: 1.2em;
  max-width: 500px;
  padding: 0 1rem;
}

#landing .sub-subtitle {
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--color-text-light);
  font-weight: 500;
  text-align: center;
  margin-bottom: 1.2em;
}

.why-top-link {
  color: var(--color-primary);
  font-weight: 700;
  font-style: normal;
  text-decoration: none;
  opacity: 1 !important;
  cursor: pointer;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}
.why-top-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

#landing footer {
  margin-top: auto;
  padding: 2rem 1rem 1.2rem;
  padding-bottom: calc(1.2rem + 60px); /* extra space for fixed PWA banner */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  z-index: 10;
  position: relative;
  width: 100%;
}

/* Only add generous footer padding on very tall screens */
@media (min-height: 900px) {
  #landing footer {
    padding-top: 3.5rem;
  }
}

#landing footer .footer-feedback {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

#landing footer .footer-feedback:hover {
  opacity: 1;
  color: var(--color-primary);
  transform: translateX(2px);
}

/* ===== Feedback Overlay ===== */
.feedback-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.feedback-backdrop.show {
  display: block;
  opacity: 1;
}
.feedback-frame {
  width: 100%;
  height: 100%;
  border: none;
}
.feedback-close {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 10001;
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s;
}
.feedback-close:hover {
  background: rgba(0, 0, 0, 0.6);
}

/* ===== Story Modal ===== */
.story-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.story-backdrop.show {
  display: flex;
  opacity: 1;
}
.story-modal {
  background: var(--color-background);
  border-radius: 24px;
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.4rem 2.4rem 1.8rem;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}
@media (max-width: 640px) {
  .story-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 2rem 1.5rem;
  }
}
.story-backdrop.show .story-modal {
  transform: scale(1);
}
.story-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  line-height: 1;
  padding: 4px;
}
.story-close:hover { color: var(--color-text); }
.story-modal .story-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.2em;
  line-height: 1.4;
}
.story-modal p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: 1em;
}
.story-modal .story-sign {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7em;
  font-style: italic;
  color: var(--color-text-light);
  margin-top: 1em;
}
.story-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== Game Cards Grid ===== */
.games-grid {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 10;
  position: relative;
  scroll-margin-top: 2rem;
}

.game-card {
  position: relative;
  background: var(--color-surface);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  animation: cardBounceIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* ===== Card Flip (3D) ===== */
.game-card {
  perspective: 800px;
}
.card-flipper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  pointer-events: none;
}
.game-card.flipped .card-flipper {
  transform: rotateY(180deg);
}

.card-front {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  pointer-events: auto;
}

.card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  padding: 1.8rem 1rem 1.4rem;
  border-radius: 24px;
  background: var(--color-surface);
  pointer-events: auto;
}

/* ===== Card Info Button ===== */
.card-info-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-light);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 50;
  pointer-events: auto;
  transform: translateZ(0);
  transition: color 0.2s ease, background 0.2s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.card-info-btn:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}
/* Hide info button when flipped */
.game-card.flipped .card-info-btn {
  pointer-events: none;
  opacity: 0;
}

/* Hide card front content when flipped (Safari backface-visibility fix) */
.game-card.flipped .card-front {
  visibility: hidden;
}

/* ===== Card Back Content ===== */
.card-info-desc {
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.55;
  text-align: center;
}
.card-info-edu {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  text-align: center;
}
.card-info-edu strong {
  color: var(--color-text);
}
.card-back-hint {
  font-size: 0.7rem;
  color: var(--color-text-light);
  margin-top: 0.4em;
}

/* Disable card hover lift when flipped */
.game-card.flipped:hover {
  transform: none;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
}
.game-card.flipped:active {
  transform: none;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
}

.game-card:nth-child(1) { animation-delay: 100ms; }
.game-card:nth-child(2) { animation-delay: 250ms; }
.game-card:nth-child(3) { animation-delay: 400ms; }
.game-card:nth-child(4) { animation-delay: 550ms; }
.game-card:nth-child(5) { animation-delay: 700ms; }
.game-card:nth-child(6) { animation-delay: 850ms; }

@keyframes cardBounceIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card, #landing header {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .game-card .card-icon {
    animation: none;
  }
  .bg-emoji {
    animation: none !important;
    opacity: 0.08 !important;
  }
}

/* ===== Floating Background Emojis ===== */
.bg-emoji {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  animation: bgEmojiFloat 6s ease-in-out infinite;
}

body.game-active .bg-emoji {
  display: none;
}

@keyframes bgEmojiFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-15px) rotate(8deg); }
}

.game-card:hover {
  transform: scale(1.04) translateY(-4px);
  box-shadow: 0 12px 40px rgba(124, 107, 191, 0.12);
}


.game-card .card-icon {
  font-size: 4rem;
  line-height: 1;
  animation: iconFloat 3s ease-in-out infinite;
  animation-delay: inherit;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.game-card .card-icon .emoji-img {
  width: 4rem;
  height: 4rem;
}

.game-card:nth-child(1) .card-icon { animation-delay: 0s; }
.game-card:nth-child(2) .card-icon { animation-delay: 1s; }
.game-card:nth-child(3) .card-icon { animation-delay: 2s; }
.game-card:nth-child(4) .card-icon { animation-delay: 3s; }
.game-card:nth-child(5) .card-icon { animation-delay: 4s; }
.game-card:nth-child(6) .card-icon { animation-delay: 5s; }

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.game-card h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.game-card .age-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.game-card .card-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.4;
  min-height: 2.5em;
}

/* ===== Play Buttons ===== */
.game-card .play-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5em 2em;
  border: none;
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, filter 0.15s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  margin-top: 0.4rem;
}

.play-btn.accent-salmon { background: #F4845F; }
.play-btn.accent-amber  { background: #F4845F; }
.play-btn.accent-purple { background: #F4845F; }
.play-btn.accent-teal   { background: #F4845F; }
.play-btn.accent-sky    { background: #F4845F; }
.play-btn.accent-indigo { background: #F4845F; }
.play-btn.accent-green  { background: #F4845F; }

.play-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

.play-btn:active {
  transform: scale(0.95);
}

/* ===== Transition Overlay (game entry animation) ===== */
#transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  display: none;
}

#transition-overlay .boom-emoji {
  position: absolute;
  font-size: 60px;
  pointer-events: none;
  animation: boomFly 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes boomFly {
  0%   { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 1; }
  50%  { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.2) rotate(var(--tr)); opacity: 0; }
}

#transition-overlay .flash {
  position: absolute;
  inset: 0;
  background: white;
  animation: flashBang 0.6s ease-out forwards;
  border-radius: 0;
}

@keyframes flashBang {
  0%   { opacity: 0; }
  30%  { opacity: 0.8; }
  100% { opacity: 0; }
}

/* ===== Post-Game Nudge Banner ===== */
.postgame-nudge {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  flex-wrap: wrap;
  width: 100%;
  padding: 0.6rem 2rem;
  background: var(--color-background);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 50;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.postgame-nudge.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

body.game-active .postgame-nudge {
  display: none !important;
}

.postgame-nudge-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

.postgame-nudge-close:hover {
  color: var(--color-text);
}

.postgame-nudge-text {
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 600;
  margin: 0;
}

.postgame-nudge-sub {
  display: none;
}

.postgame-nudge-actions {
  display: flex;
  gap: 0.6em;
  flex-wrap: wrap;
  justify-content: center;
}

.postgame-nudge-tip {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 30px;
  border: 1.5px solid var(--color-primary);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.postgame-nudge-tip:hover {
  background: var(--color-primary);
  color: #fff;
}

.postgame-nudge-share {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 7px 16px;
  border-radius: 30px;
  border: 1.5px solid var(--color-text-light);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.postgame-nudge-share:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.postgame-nudge-copied {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.postgame-nudge-copied.visible {
  opacity: 1;
}

@media (max-width: 540px) {
  .postgame-nudge {
    padding: 0.5rem 1rem;
    gap: 0.5em;
  }
}

/* ===== PWA Install Banner (Fixed Bottom Bar) ===== */

.pwa-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--color-primary-light);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
  opacity: 0;
  animation: bannerSlideUp 0.5s ease forwards;
  animation-delay: 1s;
}

@keyframes bannerSlideUp {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hide banner during active game */
body.game-active .pwa-banner {
  display: none !important;
}

.pwa-banner-row {
  display: flex;
  align-items: center;
  gap: 0.6em;
  flex-wrap: wrap;
  max-width: 520px;
  margin: 0 auto;
}

.pwa-banner-text {
  font-size: 0.85rem;
  color: var(--color-text);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.pwa-banner-expand {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  text-decoration: underline;
  white-space: nowrap;
  cursor: url("../assets/emoji/cursors/hand-point-32.png") 16 4, pointer;
}

.pwa-banner-close {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--color-text);
  opacity: 0.5;
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: url("../assets/emoji/cursors/hand-point-32.png") 16 4, pointer;
}
.pwa-banner-close:hover { opacity: 1; }

.pwa-copy-url {
  font-size: 0.75rem;
  color: var(--color-primary, #7c5cbf);
  text-decoration: underline;
  margin-left: 6px;
  cursor: pointer;
}

.pwa-banner-steps {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(124, 107, 191, 0.15);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.pwa-banner-steps.expanded {
  display: flex;
}

/* iOS-native inline SVG icons (Share, Add to Home Screen) */
.ios-icon {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* ===== PWA Step Style (banner) ===== */

.pwa-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--color-text);
  font-weight: 500;
}

.pwa-step-num {
  background: var(--color-primary);
  color: #fff;
  width: 26px;
  height: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

