/* Picture Hunt — Paywall styles. Matches 2026 sticker-playground palette. */

.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 17, 64, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  /* flex-start is the fallback (always top-anchored → close button reachable);
     `safe center` centers when the modal fits but top-anchors + lets the overlay
     scroll when it doesn't — fixes iOS Safari, where the centered modal's top (the
     X) hid behind the URL bar and scrolling the modal just bounced back. */
  align-items: flex-start;
  align-items: safe center;
  justify-content: center;
  z-index: 10000;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: paywallFadeIn 0.2s ease;
}

@keyframes paywallFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.paywall-modal {
  background:
    radial-gradient(ellipse 60% 40% at 0% 0%,   rgba(255,201,60,0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(255,79,168,0.25) 0%, transparent 60%),
    #FFF6EE;
  border: 3px solid #1B1140;
  border-radius: 32px;
  max-width: 460px;
  width: 100%;
  /* The overlay scrolls now (so the close button at the modal's top stays
     reachable on iOS); the modal itself is its natural height. */
  padding: 32px 24px 24px;
  box-shadow: 0 6px 0 #1B1140, 0 28px 60px rgba(27,17,64,0.30);
  position: relative;
  animation: paywallSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
}

@keyframes paywallSlideUp {
  from { transform: translateY(40px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.paywall-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: #FFFFFF;
  border: 2px solid #1B1140;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1B1140;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  line-height: 1;
  padding: 0;
  box-shadow: 0 3px 0 #1B1140;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.paywall-close:hover { background: #FFF3B0; }
.paywall-close:active { transform: translateY(3px); box-shadow: 0 0 0 #1B1140; }

.paywall-fox {
  display: block;
  width: clamp(104px, 28vw, 138px);
  height: auto;
  aspect-ratio: 571 / 640;
  margin: 4px auto -4px;
  filter: drop-shadow(0 8px 16px rgba(27,17,64,0.26));
}

.paywall-headline {
  font-size: 1.7rem;
  font-weight: 700;
  color: #1B1140;
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: -0.01em;
}

.paywall-sub {
  font-size: 1.05rem;
  color: #44366E;
  margin: 0 0 20px;
  text-align: center;
  line-height: 1.4;
  font-weight: 500;
}
.paywall-sub b { color: #1B1140; }

.paywall-features {
  background: linear-gradient(180deg, #FFF3B0 0%, #FFE38B 100%);
  border: 3px solid #E6A800;
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  box-shadow: 0 4px 0 #E6A800;
}
.pf {
  font-size: 0.95rem;
  color: #1B1140;
  font-weight: 600;
  line-height: 1.35;
}

/* One-time purchase button (replaces the old monthly/yearly plan grid) */
.paywall-buy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  background: linear-gradient(180deg, #D62A87 0%, #B8226A 100%);
  color: #FFFFFF;
  border-radius: 22px;
  padding: 18px 20px;
  margin-bottom: 6px;
  box-shadow: 0 5px 0 #8E1A52, 0 12px 24px rgba(184,34,106,0.32);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease;
  font-family: inherit;
}
.paywall-buy:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #8E1A52, 0 16px 30px rgba(184,34,106,0.36);
}
.paywall-buy:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #8E1A52;
}
.paywall-buy.is-loading {
  opacity: 0.85;
  pointer-events: none;
}
.paywall-buy-price {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.paywall-buy-label {
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.95;
}
.paywall-buy-note {
  text-align: center;
  font-size: 0.85rem;
  color: #44366E;
  margin: 0 0 18px;
}

.paywall-coming-soon {
  background: linear-gradient(180deg, #FFF3B0 0%, #FFE38B 100%);
  border: 3px solid #E6A800;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 22px;
  text-align: center;
  box-shadow: 0 4px 0 #E6A800;
}
.paywall-coming-soon p {
  margin: 0;
  color: #1B1140;
  font-weight: 600;
  line-height: 1.45;
}
.paywall-coming-soon a { color: #B8226A; font-weight: 700; text-decoration: underline; }

.paywall-code {
  border-top: 2px dashed #44366E;
  padding-top: 18px;
}
.paywall-code-label {
  font-size: 0.95rem;
  color: #44366E;
  margin: 0 0 10px;
  text-align: center;
  font-weight: 600;
}
.paywall-code-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.paywall-code-row input {
  flex: 1 1 140px;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 14px;
  border: 3px solid #1B1140;
  border-radius: 16px;
  background: #FFFFFF;
  color: #1B1140;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(27,17,64,0.08);
}
.paywall-code-row input:focus {
  border-color: #2DD4A4;
  box-shadow: 0 0 0 3px rgba(45,212,164,0.30);
}
.paywall-redeem-btn {
  background: linear-gradient(180deg, #5FEAC0 0%, #34D6A4 100%);
  color: #0A3D2C;
  border: 3px solid #0F8666;
  border-radius: 16px;
  padding: 12px 20px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 0 #0F8666, 0 8px 16px rgba(45,212,164,0.35);
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex: 1 1 auto;
}
.paywall-redeem-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0F8666;
}

.paywall-code-msg {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #44366E;
  text-align: center;
  min-height: 18px;
  font-weight: 500;
}
.paywall-code-msg.err { color: #B8226A; font-weight: 700; }
.paywall-code-msg.ok  { color: #0C7A59; font-weight: 700; }

/* Splash: lock badge on premium category cards */
.category-card.locked {
  position: relative;
}
.category-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.2rem;
  background: #FFFFFF;
  border: 2px solid #1B1140;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #1B1140;
  z-index: 2;
}

/* Splash: free-tier play counter */
.play-meter {
  font-size: 0.95rem;
  color: #44366E;
  text-align: center;
  margin: 12px 0 8px;
  font-weight: 600;
}
.play-meter.warn { color: #D62A87; font-weight: 700; }

/* Splash: "Get Premium" button */
.upgrade-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 14px auto 8px;
  background: linear-gradient(180deg, #D62A87 0%, #B8226A 100%);
  color: #FFFFFF;
  border: 3px solid #FFFFFF;
  border-radius: 999px;
  padding: 12px 26px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  min-height: 52px;
  letter-spacing: 0.02em;
  box-shadow:
    0 5px 0 #8E1A52,
    0 12px 24px rgba(184,34,106,0.45);
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.upgrade-cta:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #8E1A52, 0 4px 10px rgba(184,34,106,0.30);
}

/* PWA install prompt pill */
.install-pill {
  position: fixed;
  /* Anchor BOTH edges so the box can size against the full viewport, then center
     with auto margins. The old `left:50%` made shrink-to-fit resolve against only
     the right half (~195px on a phone), so max-width never engaged and the text
     wrapped one word per line into a tall blob. width:max-content keeps it a
     compact pill for short text; max-width wraps the longer iOS text gracefully. */
  left: 12px;
  right: 12px;
  margin-inline: auto;
  width: max-content;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateY(80px);
  background: #FFFFFF;
  color: #1B1140;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 #1B1140, 0 14px 30px rgba(27,17,64,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9000;
  max-width: calc(100vw - 24px);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
  border: 3px solid #1B1140;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.install-pill.install-pill-visible {
  transform: translateY(0);
  opacity: 1;
}
.install-pill-text {
  flex: 1 1 auto;
  line-height: 1.3;
  min-width: 0;
}
.install-pill-text b { font-weight: 700; }
.install-pill-btn {
  background: linear-gradient(180deg, #5FEAC0 0%, #34D6A4 100%);
  color: #0A3D2C;
  border: 2px solid #0F8666;
  border-radius: 999px;
  padding: 8px 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 0 #0F8666;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.install-pill-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #0F8666;
}
.install-pill-x {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  font-weight: 700;
  color: #44366E;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.install-pill-x:hover { background: rgba(27,17,64,0.08); }

/* Premium badge for already-unlocked users */
.premium-badge {
  display: inline-block;
  background: linear-gradient(180deg, #FFE38B 0%, #FFC93C 100%);
  color: #1B1140;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 14px;
  border-radius: 999px;
  margin: 8px auto;
  border: 2px solid #E6A800;
  box-shadow: 0 3px 0 #E6A800;
}

/* Parental gate — adult check before outbound buy/email taps (Kids-category
   requirement). Uses the scroll/safe-center pattern from LESSONS-LEARNED so it
   can't clip on a short iOS viewport. */
.parent-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(27,17,64,0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
@supports (justify-content: safe center) {
  .parent-gate-overlay { justify-content: safe center; }
}
.parent-gate-card {
  background: #FFF8E7;
  border: 3px solid #1B1140;
  border-radius: 24px;
  box-shadow: 0 6px 0 #1B1140, 0 18px 40px rgba(27,17,64,0.30);
  padding: 28px 22px;
  max-width: 360px;
  width: 92%;
  margin: auto;
  text-align: center;
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
}
.parent-gate-card h2 { color: #1B1140; font-size: 1.4rem; margin: 0 0 6px; }
.parent-gate-card .pg-sub { color: #6B5240; font-size: 1rem; margin: 0 0 16px; }
.parent-gate-q { font-size: 1.8rem; font-weight: 700; color: #1B1140; margin: 8px 0 14px; }
.parent-gate-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 1.5rem;
  text-align: center;
  padding: 14px;
  border: 3px solid #1B1140;
  border-radius: 14px;
  margin-bottom: 14px;
  font-family: inherit;
  -moz-appearance: textfield;
}
.parent-gate-input::-webkit-outer-spin-button,
.parent-gate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.parent-gate-go {
  width: 100%;
  min-height: 56px;
  background: linear-gradient(180deg, #5FEAC0 0%, #34D6A4 100%);
  color: #0A3D2C;
  border: 2px solid #0F8666;
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 #0F8666;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.parent-gate-go:active { transform: translateY(4px); box-shadow: 0 0 0 #0F8666; }
.parent-gate-msg { min-height: 1.2em; margin: 10px 0 0; font-size: 0.95rem; color: #C0392B; font-weight: 600; }
.parent-gate-cancel {
  margin-top: 10px;
  background: none;
  border: none;
  color: #6B5240;
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}
