/* =========================
CSS (ab_words.css)
========================= */
@font-face {
  font-family: "MyCustomFont";
  src: url("Quicksand-SemiBold.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root{
  --bg1:#eaf6ff;
  --card:#ffffff;
  --ink:#1f2937;
  --muted:#6b7280;
  --brand:#1f2a66;
  --accent:#6ee7b7;
  --accent2:#22c55e;
  --danger:#ef4444;
  --shadow: 0 18px 40px rgba(0,0,0,.18);
  --r: 22px;
  --purple-1: #b794f4;
  --purple-2: #805ad5;
  --purple-3: #6b46c1;
  --lavender-bg: #f6f3ff;
  --lavender-border: #d6ccff;
  --tile-shadow: 0 8px 20px rgba(128,90,213,0.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"url(Quicksand-SemiBold.ttf)","Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background: var(--bg1);
  overflow:hidden;
}

/* Background video */
.bg-video{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:-3;
}
.bg-overlay{
  position:fixed;
  inset:0;
  background: rgba(255,255,255,.25);
  z-index:-2;
}

/* Screens */
.screen{
  position:absolute;
  inset:0;
  display:none;
  padding:16px;
}
.screen.active{display:block}

.topbar{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding-top:8px;
}
.logo{
  height:52px;
  object-fit:contain;
}

.card{
  background:var(--card);
  border-radius:var(--r);
  box-shadow:var(--shadow);
}

.hero{
  width:min(520px, 92vw);
  margin: 70px auto 0;
  padding:26px 22px;
  text-align:center;
}
.hero h1{
  margin:0;
  font-size: clamp(30px, 6vw, 44px);
  color:var(--brand);
}
.sub{
  margin:10px 0 18px;
  color:var(--muted);
  font-size:18px;
}
.hint{
  margin:14px 0 0;
  color:var(--muted);
  font-size:14px;
}

.pill{
  display:inline-block;
  padding:2px 12px;
  border-radius:999px;
  background:#d1fae5;
  color:#065f46;
}

/* Buttons */
.btn{
  border:none;
  border-radius:999px;
  padding:14px 22px;
  font-size:18px;
  font-weight:700;
  cursor:pointer;
  box-shadow: 0 14px 28px rgba(0,0,0,.16);
  transition: transform .12s ease;
}
.btn:active{transform:scale(.96)}
.btn.primary{
  background: linear-gradient(180deg, #a7f3d0, #6ee7b7);
  color:#064e3b;
}

/* Intro */
.introWrap{
  width: 100%;
  max-width: 820px;        /* ✅ controls both cards */
  margin: 40px auto 0;

  display: flex;           /* ✅ vertical stack */
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.introCard{
  position: relative;
  padding: 16px;
  border-radius: var(--r);
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);

  display: flex;
  justify-content: center;
  align-items: center;

  max-width: 760px;     
  width: 100%;
}
.introImg {
  width: min(420px, 80%);
  max-height: 50vh;
  object-fit: contain;
  display: block;
}
/* Position AB text roughly center of circle.
   Adjust these values if your circle position differs. */
.circleText{
  position:absolute;
  left:52%;
  top:48%;
  transform:translate(-50%,-50%);
  font-size: clamp(64px, 9vw, 110px);
  font-weight:800;
  color:#6b21a8;
  text-shadow: 0 6px 0 rgba(0,0,0,.12);
  letter-spacing:2px;
  pointer-events:none;
}
.introCard,
.introText{
  width: 100%;
  max-width: 820px;
}

.introText{
  width: 100%;
  max-width: 820px;   /* ✅ SAME WIDTH */
  background: rgba(255,255,255,.95);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
}
.introText h2{
  margin:0 0 8px;
  color:var(--brand);
  font-size: clamp(22px, 4vw, 30px);
}
.introText p{
  margin:0 0 14px;
  color:var(--muted);
}

/* Animations */
.pop-in{ animation: popIn .55s ease both; }
.slide-up{ animation: slideUp .55s ease .1s both; }
@keyframes popIn{
  from{ transform:scale(.92); opacity:0 }
  to{ transform:scale(1); opacity:1 }
}
@keyframes slideUp{
  from{ transform:translateY(16px); opacity:0 }
  to{ transform:translateY(0); opacity:1 }
}

/* Game */
.gameTop{
  justify-content:space-between;
  padding: 8px 14px 0;
}
.progress{
  background: rgba(255,255,255,.85);
  border-radius:999px;
  padding:8px 14px;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
  font-weight:800;
}

.letterRow{
  width:min(600px, 96vw);
  margin: 14px auto 0;
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
  background: var(--lavender-bg);
  border: 2px solid var(--lavender-border);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 10px 26px rgba(140,120,255,0.18);
}

.letterChip {
  width: 64px;
  height: 64px;
  border-radius: 16px;

  background: linear-gradient(
    180deg,
    var(--purple-1),
    var(--purple-2)
  );

  color: #ffffff;
  font-family: "MyCustomFont", sans-serif;
  font-size: 30px;
  font-weight: 800;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: var(--tile-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.letterChip:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(128,90,213,0.45);
}

.letterChip.dragging{
  transform: scale(1.08);
  opacity:.9;
}
.letterChip[style*="opacity: 0.35"] {
  background: linear-gradient(180deg, #e5e7eb, #cbd5f5);
  color: #6b7280;
  box-shadow: none;
}

.mediaCard{
  width:min(480px, 94vw);
  margin: 18px auto 0;
  background: #ffffff;
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
  display:flex;
  justify-content:center;
}
.wordVideo, .wordImage{
  width:100%;
  max-height: 40vh;
  border-radius:18px;
  object-fit:contain;
  background: #ffffff;
}

.wordBuild{
  width:min(520px, 92vw);
  margin: 16px auto 0;
  display:flex;
  justify-content:center;
  gap:16px;
  align-items:center;
}
.dropSlot{
  width:120px;
  height:92px;
  border-radius:18px;
  background:#f8fafc;
  border:3px dashed #94a3b8;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:42px;
  font-weight:900;
  color:#64748b;
}
.dropSlot.ready{
  border-color: #8b5cf6;
  background: #f6f3ff;
  color: #6b46c1;
  box-shadow: 0 0 0 6px rgba(139,92,246,0.18);
}

.dropSlot.wrong{
  border-color: var(--danger);
  background:#fee2e2;
  color:#b91c1c;
  animation: shake .25s ease;
}
@keyframes shake{
  0%{transform:translateX(0)}
  25%{transform:translateX(-6px)}
  50%{transform:translateX(6px)}
  75%{transform:translateX(-4px)}
  100%{transform:translateX(0)}
}

.family{
  font-family: "MyCustomFont", sans-serif;
  font-size: 56px;
  letter-spacing: 2px;
  color:#6b21a8;
  text-shadow: 0 4px 0 rgba(0,0,0,.10);
}

.caption{
  width:min(720px, 92vw);
  margin: 10px auto 0;
  text-align:center;
  color: var(--muted);
  font-size:16px;
}

/* Popup */
.popup{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.38);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.popupCard{
  width:min(420px, 92vw);
  background:#fff;
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:20px;
  text-align:center;
}
/* fullscreen */
#fullscreenBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;

  background: #6ee7b7;
  color: #064e3b;
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
}


.popupCard h2{ margin:0 0 6px; color:#16a34a; }
.popupCard p{ margin:0 0 14px; color:var(--muted); }
.hidden{ display:none !important; }
/* 🔥 Bigger logo ONLY on first screen */
#screenStart .hero .logo {
  width: 280px;          /* increase size */
  max-width: 100%;
  margin-bottom: 26px;
  height: 120px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.15));
}
@media (max-width: 480px) {
  #screenStart .logo.inside-card {
    width: 240px;
  }
}
/* Pop-in animation for tiles */
@keyframes popIn {
  from { transform: translateY(10px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.letterChip {
  opacity: 0;                 /* start hidden, JS will reveal */
  animation: popIn 420ms ease both;
}
/* Correct / wrong animations */
@keyframes correctPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes wrongShake {
  0%{transform:translateX(0)}
  25%{transform:translateX(-6px)}
  50%{transform:translateX(6px)}
  75%{transform:translateX(-4px)}
  100%{transform:translateX(0)}
}

.dropSlot.correct{
  border-color:#22c55e;
  background:#ecfdf5;
  color:#065f46;
  animation: correctPulse .35s ease;
}

.dropSlot.wrong{
  border-color:#ef4444;
  background:#fee2e2;
  color:#b91c1c;
  animation: wrongShake .25s ease;
}

/* Letter tile feedback */
.letterChip.correct{
  background: linear-gradient(180deg, #86efac, #22c55e);
  box-shadow: 0 10px 22px rgba(34,197,94,0.35);
}
.letterChip.wrong{
  background: linear-gradient(180deg, #fca5a5, #ef4444);
  box-shadow: 0 10px 22px rgba(239,68,68,0.35);
}

.progressWrap{
  display:flex;
  align-items:center;
  gap:12px;
  background: rgba(255,255,255,.85);
  padding:10px 14px;
  border-radius:999px;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}

.dots{
  display:flex;
  gap:7px;
}
.dot{
  width:12px;
  height:12px;
  border-radius:999px;
  background:#e5e7eb;
}
.dot.active{
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  box-shadow: 0 6px 14px rgba(139,92,246,0.25);
}
.dot.done{
  background: linear-gradient(180deg, #86efac, #22c55e);
}
@media (max-width: 600px){
  .gameTop{
    padding: 8px 10px 0;
  }

  .letterRow{
    margin-top: 10px;
    gap:10px;
    padding: 10px 12px;
  }

  .letterChip{
    width:56px;
    height:56px;
    font-size:26px;
    border-radius:14px;
  }

  .mediaCard{
    margin-top: 12px;
    padding: 10px;
  }

  .wordVideo, .wordImage{
    max-height: 32vh;
  }

  .dropSlot{
    width:96px;
    height:76px;
    font-size:36px;
  }

  .family{
    font-size: 46px;
  }
}
/* Media transition base */
.wordImage,
.wordVideo {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}


/* Fade out */
.media-fade-out {
  opacity: 0;
  transform: scale(0.96);
}

/* Fade in */
.media-fade-in {
  opacity: 1;
  transform: scale(1);
}
.media-fade-in {
  animation: softZoomIn 0.4s ease;
}

@keyframes softZoomIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* Media visibility control (animation-safe) */
.media-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.media-visible {
  opacity: 1;
  visibility: visible;
}
#screenGame .caption {
  display: none;
}
.fullWord {
  display: inline-block;
  padding: 14px 32px;
  margin-top: 14px;

  font-family: "MyCustomFont", sans-serif;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 2px;

  color: #6b21a8;
  background: linear-gradient(180deg, #f5f3ff, #ede9fe);
  border: 3px solid #c4b5fd;
  border-radius: 20px;

  box-shadow: 0 16px 30px rgba(139, 92, 246, 0.25);
  text-align: center;

  opacity: 0;
  transform: scale(0.7);
}


/* animation */
.fullWord.show {
  animation: mergeIn 0.4s ease forwards;
  text-shadow: 0 6px 12px rgba(107,33,168,0.25);

}

@keyframes mergeIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.fullWord.show {
  animation: wordPopIn 0.55s ease forwards;
}

@keyframes wordPopIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  70% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.game-frame-wrapper iframe {
  max-width: 420px;   /* 🔹 controls width */
  width: 100%;
  height: 820px;      /* 🔹 controls height */
}
/* Control iframe size */
.wp-game-frame iframe {
  width: 420px;       /* desktop width */
  height: 820px;      /* desktop height */
  max-width: 100%;
  border: none;
  border-radius: 24px;
}
/* Prevent page scrolling caused by iframe */
.wp-game-frame {
  overflow: hidden;
}
/* ===== CENTER GAME IFRAME ===== */
.wp-game-center {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;     /* horizontal center */
  align-items: center;         /* vertical center */
  padding: 40px 16px;
  box-sizing: border-box;
}

/* Game iframe card */
.wp-game-center iframe {
  width: 420px;                /* desktop width */
  height: 820px;               /* game height */
  max-width: 100%;
  border: none;
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
  background: #000;            /* prevents white flash */
}

