/* =========================================================
   Caiden's Corner — learning activities
   Shares the storybook world of carlieandcaiden.com:
   cyan sky, golden gears, Fredoka One + Nunito.
   Everything is sized for small hands: huge targets,
   instant feedback, zero clutter.
   ========================================================= */

:root {
  --sky-cyan:       #3BBFCF;
  --sky-cyan-light: #5DD4E8;
  --deep-cyan:      #1A8FA0;
  --magic-white:    #EEF9FC;
  --crisp-white:    #FFFFFF;
  --gear-gold:      #F5B830;
  --gear-gold-dark: #C8881A;
  --gold-glow:      rgba(245, 184, 48, 0.35);
  --carlie-maroon:  #7B1E2E;
  --happy-green:    #44CC44;
  --happy-green-dark:#2A9B2A;
  --oops-orange:    #FF8C00;
  --text-dark:      #1A1A2E;

  --font-display: 'Fredoka One', 'Georgia', cursive;
  --font-body:    'Nunito', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--text-dark);
  background: radial-gradient(ellipse at 60% 20%, var(--sky-cyan-light) 0%, var(--sky-cyan) 55%, var(--deep-cyan) 100%);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* No accidental text selection / double-tap zoom during play */
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Top bar ---------- */
.corner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  color: var(--crisp-white);
}
.corner-home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--crisp-white);
  background: rgba(26, 143, 160, 0.55);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.35);
  min-height: 48px;
}
.corner-home svg {
  width: 22px; height: 22px;
  fill: var(--gear-gold);
  animation: gear-spin 16s linear infinite;
}
@keyframes gear-spin { to { transform: rotate(360deg); } }

/* ---------- Today's Adventure badge strip ---------- */
.quest-strip {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.25rem 1rem 0.85rem;
}
.qbadge { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.qring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 5px;
  /* The golden ring fills one segment per completed problem */
  background: conic-gradient(var(--gear-gold) var(--fill, 0%), rgba(255, 255, 255, 0.3) var(--fill, 0%));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}
.qring span {
  width: 100%;
  height: 100%;
  background: var(--crisp-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  /* Grayed out until the badge is earned */
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter 0.4s ease, opacity 0.4s ease;
}
.qbadge.done .qring {
  box-shadow: 0 0 16px var(--gold-glow), 0 0 4px var(--gear-gold);
}
.qbadge.done .qring span {
  filter: none;
  opacity: 1;
  animation: star-pop 0.5s ease;
}
.qbadge.active .qring { outline: 3px solid rgba(255, 255, 255, 0.9); outline-offset: 2px; }
.qcount {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--crisp-white);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.qbadge.done .qcount { color: var(--gear-gold); }

/* Hub start button */
.quest-start-wrap { text-align: center; position: relative; z-index: 2; margin: 0.25rem 0 0.5rem; }
.quest-start {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--crisp-white);
  background: linear-gradient(135deg, var(--carlie-maroon) 0%, #A02040 100%);
  padding: 0.9rem 2.1rem;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 0 #5A0F1C, 0 10px 28px rgba(123, 30, 46, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  min-height: 56px;
}
.quest-start:hover { transform: translateY(-2px); }
.quest-start:active { transform: translateY(3px); box-shadow: 0 2px 0 #5A0F1C; }
.quest-start.alldone {
  background: linear-gradient(135deg, var(--gear-gold) 0%, var(--gear-gold-dark) 100%);
  box-shadow: 0 6px 0 #9A6812, 0 0 30px var(--gold-glow);
  cursor: default;
}

/* Appears under the trophy once every badge is earned */
.quest-unlock {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin: 0.9rem auto 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--deep-cyan);
  background: var(--crisp-white);
  padding: 0.75rem 1.7rem;
  border-radius: 999px;
  border: 3px dashed var(--gear-gold);
  box-shadow: 0 5px 0 rgba(26, 143, 160, 0.45), 0 10px 24px rgba(15, 60, 70, 0.3);
  min-height: 52px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  animation: pop 0.5s ease backwards;
}
/* display:flex makes it block-level, so it stacks under the trophy
   and the auto margins center it */
.quest-unlock.show { display: flex; width: fit-content; }
.quest-unlock:hover { transform: translateY(-2px); }
.quest-unlock:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(26, 143, 160, 0.45); }
@keyframes pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ---------- Hub ---------- */
.corner-hero {
  text-align: center;
  padding: 1.5rem 1.25rem 0.5rem;
  color: var(--crisp-white);
  position: relative;
  z-index: 2;
}
.corner-hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4rem);
  margin: 0 0 0.4rem;
  text-shadow: 3px 4px 0 var(--deep-cyan), 6px 8px 0 rgba(26,26,46,0.3);
}
.corner-hero p {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--magic-white);
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.activity-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 2rem auto 3rem;
  padding: 0 1.25rem;
}
.activity-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: var(--crisp-white);
  border-radius: 28px;
  padding: 2rem 1.5rem 1.75rem;
  box-shadow: 0 8px 0 rgba(26, 143, 160, 0.55), 0 18px 40px rgba(15, 60, 70, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}
.activity-card:hover, .activity-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 12px 0 rgba(26, 143, 160, 0.55), 0 24px 50px rgba(15, 60, 70, 0.35);
}
.activity-card:active { transform: translateY(3px); box-shadow: 0 4px 0 rgba(26,143,160,0.55), 0 10px 24px rgba(15,60,70,0.3); }
.activity-emoji { font-size: 4.5rem; line-height: 1; }
.activity-card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.75rem;
  margin: 0.25rem 0 0;
  color: var(--deep-cyan);
}
.activity-card p { margin: 0; font-size: 1rem; color: #4A5568; }
.activity-card.soon {
  opacity: 0.55;
  filter: saturate(0.6);
  pointer-events: none;
}
.activity-card.soon .badge {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gear-gold-dark);
  background: rgba(245, 184, 48, 0.2);
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
}

/* ---------- Game shell ---------- */
.game-wrap {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 0 auto;
  padding: 0.5rem 1rem 3rem;
}
.game-card {
  background: var(--crisp-white);
  border-radius: 32px;
  padding: 1.75rem 1.5rem 2rem;
  box-shadow: 0 10px 0 rgba(26, 143, 160, 0.55), 0 24px 60px rgba(15, 60, 70, 0.35);
  text-align: center;
}
.game-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--deep-cyan);
  margin: 0 0 0.25rem;
}

/* Streak stars */
.streak {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  font-size: 1.6rem;
  min-height: 2rem;
  margin-bottom: 0.75rem;
}
.streak span { opacity: 0.25; transition: opacity 0.2s, transform 0.2s; }
.streak span.lit { opacity: 1; animation: star-pop 0.35s ease; }
@keyframes star-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Prompt area */
.prompt-zone {
  min-height: 150px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1.15;
  margin: 0.5rem 0 1rem;
}
.prompt-zone .op {
  font-family: var(--font-display);
  color: var(--deep-cyan);
  font-size: clamp(2rem, 7vw, 3rem);
  margin: 0 0.35rem;
}
.prompt-zone .obj { animation: obj-in 0.4s ease backwards; }
.prompt-zone .obj:nth-child(2n) { animation-delay: 0.05s; }
.prompt-zone .obj:nth-child(3n) { animation-delay: 0.1s; }
@keyframes obj-in {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.prompt-question {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0 0 1.25rem;
}

/* Answer buttons — huge, bouncy */
.answers {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.answer-btn {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--crisp-white);
  background: linear-gradient(135deg, var(--sky-cyan) 0%, var(--deep-cyan) 100%);
  min-width: 96px;
  min-height: 96px;
  padding: 0.5rem 1.5rem;
  border-radius: 24px;
  box-shadow: 0 6px 0 #12707E, 0 10px 24px rgba(15, 60, 70, 0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s;
}
.answer-btn:hover { transform: translateY(-3px); }
.answer-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #12707E, 0 4px 12px rgba(15,60,70,0.3); }
.answer-btn.right {
  background: linear-gradient(135deg, var(--happy-green) 0%, var(--happy-green-dark) 100%);
  box-shadow: 0 6px 0 #1C7A1C, 0 10px 24px rgba(26, 155, 42, 0.4);
  animation: bounce-yay 0.5s ease;
}
.answer-btn.wrong {
  background: linear-gradient(135deg, var(--oops-orange) 0%, #D97706 100%);
  box-shadow: 0 6px 0 #A85A00, 0 10px 24px rgba(217, 119, 6, 0.35);
  animation: wiggle-no 0.4s ease;
}
@keyframes bounce-yay {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-16px) scale(1.08); }
  70% { transform: translateY(2px); }
}
@keyframes wiggle-no {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* ---------- Spelling ---------- */
.word-picture { font-size: 6rem; line-height: 1; margin: 0.25rem 0 0.5rem; }
.hear-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--crisp-white);
  background: linear-gradient(135deg, var(--gear-gold) 0%, var(--gear-gold-dark) 100%);
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  box-shadow: 0 5px 0 #9A6812, 0 8px 20px var(--gold-glow);
  margin-bottom: 1.25rem;
  min-height: 56px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.hear-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #9A6812; }

.word-slots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.slot {
  width: 62px; height: 72px;
  border-radius: 16px;
  border: 3px dashed rgba(26, 143, 160, 0.4);
  background: var(--magic-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--deep-cyan);
  text-transform: uppercase;
}
.slot.filled {
  border-style: solid;
  border-color: var(--happy-green);
  background: #EAF9EA;
  animation: star-pop 0.3s ease;
}
.letter-bank {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.letter-btn {
  width: 78px; height: 78px;
  font-family: var(--font-display);
  font-size: 2.1rem;
  text-transform: uppercase;
  color: var(--crisp-white);
  background: linear-gradient(135deg, var(--sky-cyan) 0%, var(--deep-cyan) 100%);
  border-radius: 20px;
  box-shadow: 0 6px 0 #12707E, 0 10px 24px rgba(15, 60, 70, 0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s;
}
.letter-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #12707E; }
.letter-btn.used { opacity: 0.25; pointer-events: none; }
.letter-btn.wrong { animation: wiggle-no 0.4s ease; }

/* ---------- Celebration overlay ---------- */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 143, 160, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.celebrate.show { opacity: 1; pointer-events: auto; }
.celebrate-text {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  color: var(--crisp-white);
  text-shadow: 3px 4px 0 var(--deep-cyan), 0 0 40px var(--gold-glow);
  animation: bounce-yay 0.8s ease infinite;
  text-align: center;
  padding: 0 1rem;
}
.celebrate-sub {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gear-gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  margin-top: 0.5rem;
}
.confetti {
  position: absolute;
  top: -10%;
  font-size: 2rem;
  animation: confetti-fall linear forwards;
  pointer-events: none;
}
@keyframes confetti-fall {
  to { transform: translateY(120vh) rotate(720deg); }
}

/* Level-up banner */
.level-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  z-index: 60;
  background: linear-gradient(135deg, var(--gear-gold) 0%, var(--gear-gold-dark) 100%);
  color: var(--crisp-white);
  font-family: var(--font-display);
  font-size: 1.3rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  box-shadow: 0 8px 30px var(--gold-glow), 0 4px 0 #9A6812;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.level-banner.show { transform: translateX(-50%) translateY(0); }

/* Decorative background gear */
.gear-bg {
  position: fixed;
  width: 340px; height: 340px;
  top: -80px; right: -100px;
  fill: var(--gear-gold);
  opacity: 0.12;
  animation: gear-spin 26s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Picture-choice games (hearing, location, story) ---------- */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
}
.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--magic-white);
  border: 3px solid rgba(26, 143, 160, 0.25);
  border-radius: 24px;
  padding: 1.1rem 0.75rem;
  min-height: 128px;
  box-shadow: 0 5px 0 rgba(26, 143, 160, 0.35), 0 8px 20px rgba(15, 60, 70, 0.15);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--deep-cyan);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.choice-btn:hover { transform: translateY(-3px); }
.choice-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(26,143,160,0.35); }
.choice-btn .big { font-size: 3.2rem; line-height: 1; }
.choice-btn.right {
  border-color: var(--happy-green);
  background: #EAF9EA;
  animation: bounce-yay 0.5s ease;
}
.choice-btn.wrong {
  border-color: var(--oops-orange);
  animation: wiggle-no 0.4s ease;
}

/* Story text */
.story-text {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--magic-white);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  margin: 0.5rem 0 1rem;
  text-align: left;
}
.story-scene { font-size: 3.5rem; line-height: 1; margin-bottom: 0.5rem; }

/* ---------- Talking Time (speech) ---------- */
.mic-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  font-size: 4rem;
  color: var(--crisp-white);
  background: linear-gradient(135deg, var(--carlie-maroon) 0%, #A02040 100%);
  box-shadow: 0 8px 0 var(--carlie-maroon-dark, #5A0F1C), 0 14px 34px rgba(123, 30, 46, 0.4);
  margin: 0.75rem 0;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.mic-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #5A0F1C; }
.mic-btn.listening {
  background: linear-gradient(135deg, var(--happy-green) 0%, var(--happy-green-dark) 100%);
  box-shadow: 0 8px 0 #1C7A1C;
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { outline: 0px solid rgba(68, 204, 68, 0.5); outline-offset: 0; }
  50% { outline: 18px solid rgba(68, 204, 68, 0); outline-offset: 18px; }
}
.mic-hint { font-size: 1.15rem; font-weight: 800; color: #4A5568; min-height: 1.6rem; margin: 0.25rem 0 0; }
.transcript {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--deep-cyan);
  min-height: 2rem;
  margin: 0.5rem 0 0;
}
.no-speech {
  background: #FFF6E5;
  border: 3px solid var(--gear-gold);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: #7A5A10;
}

@media (max-width: 480px) {
  .slot { width: 50px; height: 60px; font-size: 1.8rem; }
  .letter-btn { width: 64px; height: 64px; font-size: 1.8rem; }
  .answer-btn { font-size: 2rem; min-width: 84px; min-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .confetti { display: none; }
}
