/* Sight Word Clubhouse — same palette, type and chunky buttons as the other games. */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --navy: #1f5fa4;
  --crimson: #ef5b5b;
  --gold: #ffcf3f;
  --green: #4cbb6c;
  --green-dark: #2f8f4c;
  --cream: #fff8ec;
  --ink: #23324a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(#8fd4ff 0%, #bfe7ff 45%, #ffe9b8 100%);
  color: var(--ink);
  font-family: "Baloo 2", "Fredoka", "Quicksand", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 700;
  touch-action: manipulation;
  user-select: none;
}

.screen { position: fixed; inset: 0; display: none; }
.screen.show { display: flex; flex-direction: column; }

/* ------------------------------ home & sets ------------------------------ */
.home-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: calc(var(--sat) + 34px) 18px calc(var(--sab) + 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-words { min-width: 0; }
.brand-mascot { width: 132px; height: 132px; flex: 0 0 auto; filter: drop-shadow(0 5px 4px rgba(20,50,90,.22)); }
.mascot-img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-kicker { margin: 0; font-size: 17px; color: var(--navy); }
.brand-name { margin: -2px 0 0; font-size: clamp(32px,9vw,50px); line-height: .98; color: #fff; -webkit-text-stroke: 4px var(--navy); paint-order: stroke fill; text-shadow: 0 4px 0 var(--navy); }
.brand-sub { margin: 6px 0 0; font-size: 14px; color: #4b6b52; }

.card {
  background: var(--cream);
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 8px 0 rgba(31,95,164,.18), 0 14px 26px rgba(20,50,90,.16);
}
.card-title { margin: 0 0 8px; font-size: 18px; color: var(--navy); }
.card-note { margin: 0; font-size: 15px; color: #5b6b86; }

.lessons { display: flex; flex-direction: column; gap: 12px; }
.lesson-card {
  font: inherit; cursor: pointer; text-align: left;
  background: var(--cream);
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: 0 8px 0 rgba(31,95,164,.18), 0 14px 26px rgba(20,50,90,.16);
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-areas: "emoji name" "emoji blurb" "emoji stars";
  column-gap: 14px;
  align-items: center;
  color: var(--ink);
}
.lesson-card:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(31,95,164,.18); }
.lesson-emoji { grid-area: emoji; font-size: 54px; text-align: center; }
.lesson-name { grid-area: name; font-size: 24px; color: var(--navy); }
.lesson-blurb { grid-area: blurb; font-size: 14px; color: #5b6b86; font-weight: 600; }
.lesson-stars { grid-area: stars; font-size: 13px; color: #8a6400; }

.home-toggles { display: flex; gap: 8px; justify-content: center; }
.toggle {
  font: inherit; cursor: pointer; font-size: 14px;
  border-radius: 999px; padding: 8px 16px;
  border: 3px solid #d7e3f5; background: #fff; color: #8795ad;
}
.toggle[aria-pressed="true"] { border-color: var(--navy); color: var(--navy); background: #e6efff; }

.voice-pick { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 14px; }
.voice-pick select, .voice-pick button {
  font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 10px;
  border: 3px solid #d7e3f5; background: #fff; color: var(--ink);
}
.voice-pick button { cursor: pointer; }

.footer-note { margin: 0; text-align: center; font-size: 12px; color: #8795ad; }

.sets-head { display: flex; align-items: center; gap: 12px; }
.sets-title { margin: 0; font-size: clamp(26px,7vw,36px); color: #fff; -webkit-text-stroke: 3px var(--navy); paint-order: stroke fill; text-shadow: 0 3px 0 var(--navy); }
.sets-sub { text-align: center; }

.set-list { display: flex; flex-direction: column; gap: 12px; }
.set-card {
  font: inherit; cursor: pointer; text-align: left;
  background: var(--cream);
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 12px 16px;
  box-shadow: 0 6px 0 rgba(31,95,164,.18);
  display: flex; flex-direction: column; gap: 8px;
  color: var(--ink);
}
.set-card:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(31,95,164,.18); }
.set-head { display: flex; align-items: baseline; gap: 10px; }
.set-label { font-size: 19px; color: var(--navy); }
.set-name { font-size: 14px; color: #5b6b86; font-weight: 600; }
.set-stars { margin-left: auto; font-size: 15px; }
.set-words { display: flex; flex-wrap: wrap; gap: 6px; }
.set-words i {
  font-style: normal; font-size: 16px;
  background: #fff; border: 2px solid #d8e6f5; border-radius: 10px;
  padding: 3px 10px; color: var(--ink);
}

.pill-btn {
  font: inherit; cursor: pointer; font-size: 15px;
  border-radius: 999px; padding: 9px 16px;
  border: 3px solid #d7e3f5; background: #fff; color: var(--navy);
  min-height: 44px; white-space: nowrap;
}
.pill-btn.gold { border-color: #e0a90f; background: var(--gold); color: #5c4300; box-shadow: 0 3px 0 #b8860b; }

/* ------------------------------ play ------------------------------ */
.topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--sat) + 6px) 10px 6px;
  background: var(--navy); color: #fff;
}
.tb-btn {
  font: inherit; font-size: 18px; cursor: pointer; line-height: 1;
  width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: rgba(255,255,255,.16); color: #fff;
}
.tb-btn.off { opacity: .45; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.play-progress { display: flex; gap: 6px; }
.play-progress i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.play-progress i.on { background: var(--gold); box-shadow: 0 0 6px rgba(255,207,63,.8); }

.play-area { flex: 1; min-height: 0; position: relative; display: flex; }
.tip { flex: 0 0 auto; margin: 0; padding: 4px 10px calc(var(--sab) + 10px); text-align: center; font-size: 14px; color: #5b6b86; }

.wob { animation: wob .45s; }
@keyframes wob { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Frog Hop */
.pond { flex: 1; display: flex; flex-direction: column; }
.pond-bank { flex: 0 0 22%; position: relative; background: linear-gradient(#9ee37d, #6cc24a); }
.pond-bank.right { display: flex; align-items: center; justify-content: center; }
.pond-frog {
  position: absolute; top: 8%; font-size: 64px; line-height: 1;
  transition: left .5s cubic-bezier(.3,1.4,.5,1);
  filter: drop-shadow(0 4px 3px rgba(0,60,20,.3));
}
.pond-frog.hop { animation: hop .55s; }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-26px) scale(1.08); } }
.pond-picnic { font-size: 58px; }
.pond-water {
  flex: 1; position: relative;
  background: linear-gradient(#5fb8f0, #2f7fc4);
  display: flex; align-items: center; justify-content: space-evenly;
}
.stone {
  font: inherit; cursor: pointer;
  width: clamp(96px, 26%, 180px); aspect-ratio: 1.25;
  border-radius: 50%;
  border: 4px solid #2c7a3f;
  background: radial-gradient(circle at 35% 30%, #b8f59b, #79d35c 70%);
  box-shadow: 0 6px 0 #2c7a3f, 0 10px 14px rgba(0,40,80,.35);
  display: flex; align-items: center; justify-content: center;
}
.stone:active { transform: translateY(3px); box-shadow: 0 3px 0 #2c7a3f; }
.stone-word { font-size: clamp(22px, 5.5vw, 36px); color: #14401f; text-transform: uppercase; letter-spacing: .03em; }
.stone.good { border-color: var(--gold); box-shadow: 0 0 0 5px rgba(255,207,63,.5), 0 6px 0 #2c7a3f; animation: pop .45s; }

/* Balloon Pop */
.sky { flex: 1; position: relative; overflow: hidden; background: linear-gradient(#7ec8ff 0%, #bfe7ff 60%, #e8f7ff 100%); }
.sky-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--cream); border: 4px solid #fff; border-radius: 18px;
  box-shadow: 0 6px 0 rgba(31,95,164,.25);
  padding: 8px 26px; z-index: 2;
}
.sky-target { font-size: clamp(30px, 7vw, 46px); color: var(--navy); text-transform: uppercase; letter-spacing: .05em; }
.balloon {
  position: absolute; font: inherit; cursor: pointer;
  width: clamp(88px, 20vw, 132px); aspect-ratio: .82;
  border-radius: 50% 50% 48% 52% / 58% 58% 42% 42%;
  border: 0;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.85), var(--bcol) 46%);
  box-shadow: inset -6px -10px 0 rgba(0,0,0,.08), 0 8px 14px rgba(20,50,90,.2);
  display: flex; align-items: center; justify-content: center;
}
.balloon::after {
  content: ""; position: absolute; bottom: -26px; left: 50%;
  width: 2px; height: 26px; background: rgba(35,50,74,.45);
}
.balloon-word {
  background: rgba(255,255,255,.92); border-radius: 12px; padding: 4px 10px;
  font-size: clamp(18px, 4.5vw, 28px); color: var(--ink); text-transform: uppercase;
}
.balloon.pop { animation: balloonPop .4s forwards; border: 0; box-shadow: none; background: transparent; }
.balloon.pop::after { display: none; }
.balloon-burst { font-size: 64px; }
@keyframes balloonPop { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.35); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

/* Story Machine */
.story {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(10px, 3vh, 26px); padding: 12px;
}
.story-pic { font-size: clamp(72px, 16vw, 120px); line-height: 1.1; filter: drop-shadow(0 6px 5px rgba(20,50,90,.2)); }
.story-pic.bounce { animation: hop .6s; }
.story-line {
  margin: 0; text-align: center;
  font-size: clamp(26px, 6vw, 42px); color: var(--ink);
  background: var(--cream); border: 4px solid #fff; border-radius: 20px;
  padding: 12px 22px; box-shadow: 0 6px 0 rgba(31,95,164,.18);
  max-width: 640px;
}
.story-blank { color: #b9c4d6; letter-spacing: .05em; }
.story-blank.filled { color: var(--green-dark); background: #eafbe9; border-radius: 10px; padding: 0 8px; animation: pop .45s; }
.story-choices { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.story-choice {
  font: inherit; cursor: pointer; font-size: clamp(24px, 5.5vw, 34px); text-transform: uppercase;
  min-width: clamp(96px, 24vw, 150px); padding: 14px 10px; border-radius: 18px;
  border: 0; background: var(--navy); color: #fff; box-shadow: 0 6px 0 #001a45;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.story-choice:active { transform: translateY(3px); box-shadow: 0 3px 0 #001a45; }
.story-choice.good { background: var(--green); box-shadow: 0 6px 0 var(--green-dark); animation: pop .45s; }
.story-choice-hear {
  font-size: .7em; line-height: 1; cursor: pointer;
  background: rgba(255,255,255,.28); border-radius: 10px; padding: 7px 9px;
}
.story-choice-hear:active { transform: scale(1.2); }
.story-blank.glow { border-radius: 10px; padding: 0 8px; animation: blankGlow 1.1s ease-in-out infinite; }
@keyframes blankGlow { 0%, 100% { background: transparent; } 50% { background: #fff3c4; } }
.story-blank.filled { animation: pop .45s; }

/* ------------------------------ overlays ------------------------------ */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,22,46,.72); padding: 16px;
}
.overlay[hidden] { display: none; }
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.win-card {
  position: relative;
  background: #fff; border-radius: 22px; padding: 20px;
  width: min(460px, 100%); text-align: center;
  box-shadow: 0 12px 0 rgba(0,0,0,.18);
}
.win-burst { font-size: 54px; }
.win-card h2 { margin: 6px 0; color: var(--navy); font-size: 26px; }
.win-card p { margin: 4px 0; color: #5b6b86; }
.win-stars { font-size: 32px; letter-spacing: .08em; }
.win-btns { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.play-btn {
  font: inherit; font-size: 24px; cursor: pointer;
  border: 0; border-radius: 18px; padding: 14px;
  color: #fff; background: var(--navy); box-shadow: 0 6px 0 #001a45;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.play-btn.small { font-size: 18px; padding: 10px 18px; }
.ghost-btn {
  font: inherit; cursor: pointer; font-size: 16px;
  border-radius: 14px; padding: 12px 18px;
  border: 3px solid #d7e3f5; background: #fff; color: var(--navy);
  min-height: 48px;
}

/* Match the other games: use the tablet's landscape width, not browser height. */
@media (orientation: landscape) and (min-width: 820px) {
  .home-scroll { max-width: 900px; padding-top: calc(var(--sat) + 18px); padding-bottom: calc(var(--sab) + 18px); gap: 12px; }
  .brand-mascot { width: 100px; height: 100px; }
  .brand-name { font-size: 38px; }
  .lessons { display: grid; grid-template-columns: repeat(3, 1fr); }
  .lesson-card { grid-template-columns: 1fr; grid-template-areas: "emoji" "name" "blurb" "stars"; text-align: center; justify-items: center; row-gap: 4px; }
  .lesson-emoji { font-size: 46px; }
  .set-list { display: grid; grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .pond-frog, .pond-frog.hop, .story-pic.bounce, .stone.good, .story-choice.good, .story-blank.filled, .story-blank.glow { animation: none !important; transition: none !important; }
  .wob { animation: none !important; }
}
