/* =========================================================================
   Tillie's Phonics Star Lab — Mobile-First Styles (Pixel 9a Optimized)
   ========================================================================= */

:root {
  --bg-top: #10193a;
  --bg-mid: #161f4a;
  --bg-bot: #090e22;
  --card: rgba(24, 34, 74, 0.92);
  --card-solid: #192452;
  --card-hi: rgba(36, 51, 108, 0.96);
  --border: rgba(125, 175, 255, 0.28);
  --border-bright: rgba(251, 191, 36, 0.6);

  --gold: #fbbf24;
  --gold-bright: #fde047;
  --cyan: #38bdf8;
  --violet: #c084fc;
  --pink: #f472b6;
  --emerald: #34d399;
  --orange: #fb923c;
  --rose: #fb7185;

  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --text-dim: #94a3b8;

  --font-word: 'Fredoka', 'Nunito', system-ui, -apple-system, sans-serif;
  --font-ui: 'Nunito', system-ui, -apple-system, sans-serif;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  touch-action: manipulation;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 45% at 50% 0%, rgba(139, 92, 246, 0.24), transparent 70%),
    radial-gradient(ellipse 70% 40% at 85% 95%, rgba(56, 189, 248, 0.16), transparent 65%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bot) 100%);
  background-attachment: fixed;
  user-select: none;
  -webkit-user-select: none;
}

/* Twinkling Starfield Overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(2.5px 2.5px at 78% 12%, rgba(253, 224, 71, 0.8), transparent),
    radial-gradient(1.8px 1.8px at 36% 42%, rgba(56, 189, 248, 0.75), transparent),
    radial-gradient(2px 2px at 88% 48%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 22% 76%, rgba(244, 114, 182, 0.7), transparent),
    radial-gradient(2.5px 2.5px at 66% 84%, rgba(253, 224, 71, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 52% 24%, rgba(255, 255, 255, 0.6), transparent);
  background-size: 420px 420px;
  opacity: 0.55;
  animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.38; }
  to { opacity: 0.68; }
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 14px calc(22px + var(--safe-bot));
  display: flex;
  flex-direction: column;
}

@media (min-width: 720px) {
  .app-shell {
    max-width: 760px;
    padding: 18px 24px 36px;
  }
}

.hidden {
  display: none !important;
}

/* ---------------- TOP HUD BAR ---------------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 12px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  padding: 2px;
  min-width: 0;
}

.avatar-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  background: #fff;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

.brand-text h1 {
  font-family: var(--font-word);
  font-size: 1.08rem;
  line-height: 1.1;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}

.brand-text span {
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--cyan);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.star-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(11, 16, 38, 0.85);
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  padding: 6px 11px;
  font-family: var(--font-word);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: rgba(15, 23, 52, 0.88);
  color: var(--text);
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.2);
}

/* ---------------- HOME VIEW ---------------- */
.home-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Tonight's Quick Focus Hero Card */
.focus-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 20%, rgba(251, 191, 36, 0.24), transparent 52%),
    radial-gradient(circle at 12% 85%, rgba(192, 132, 252, 0.22), transparent 55%),
    linear-gradient(140deg, #1d285e 0%, #241b58 55%, #16214c 100%);
  border: 2px solid rgba(251, 191, 36, 0.55);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

.focus-hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.hero-franklin {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  border: 2.5px solid var(--gold);
  background: #fff;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.35);
  animation: gentleBob 3.2s ease-in-out infinite;
}

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

.focus-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1c1005;
  background: linear-gradient(135deg, var(--gold-bright), var(--orange));
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 5px;
}

.focus-hero h2 {
  font-family: var(--font-word);
  font-size: 1.32rem;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 3px;
}

.focus-hero p {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.35;
}

.hero-cta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.btn-primary {
  font-family: var(--font-word);
  font-size: 1.08rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  min-height: 54px;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  color: #1e1202;
  box-shadow: 0 5px 0 #b45309, 0 10px 22px rgba(245, 158, 11, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b45309;
}

.btn-secondary {
  font-family: var(--font-word);
  font-size: 0.94rem;
  font-weight: 600;
  border: 2px solid rgba(56, 189, 248, 0.55);
  border-radius: 16px;
  padding: 12px 14px;
  min-height: 54px;
  background: rgba(15, 26, 62, 0.85);
  color: #e0f2fe;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, background 0.15s;
}

.btn-secondary:active {
  transform: scale(0.96);
}

/* Tricky Words Quick Banner (shown when she has missed words to review) */
.tricky-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(251, 146, 60, 0.18));
  border: 1.5px solid rgba(251, 113, 133, 0.5);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
}

.tricky-banner-info strong {
  display: block;
  font-family: var(--font-word);
  font-size: 0.96rem;
  color: #fecdd3;
}

.tricky-banner-info span {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.btn-tricky {
  font-family: var(--font-word);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 0 #9f1239;
}

.btn-tricky:active {
  transform: translateY(2px);
}

/* Section Heading */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.section-head h3 {
  font-family: var(--font-word);
  font-size: 1.05rem;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}

.mode-pill-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: rgba(15, 23, 52, 0.85);
  color: var(--cyan);
  cursor: pointer;
}

.mode-pill-toggle.book-mode {
  border-color: var(--emerald);
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.16);
}

/* Phonics World Cards Grid */
.worlds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .worlds-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

.world-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 10px 12px;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 6px 0 rgba(7, 11, 28, 0.65), 0 10px 22px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease, border-color 0.2s, box-shadow 0.12s ease;
}

.world-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(7, 11, 28, 0.65);
}

.world-card.is-focus {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(180deg, rgba(35, 45, 96, 0.96), rgba(22, 30, 68, 0.96));
}

.world-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
}

.world-badge.focus {
  background: rgba(251, 191, 36, 0.22);
  color: var(--gold-bright);
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.world-badge.skill {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.world-badge.recommended {
  background: rgba(251, 146, 60, 0.24);
  color: #fed7aa;
  border: 1px solid rgba(251, 146, 60, 0.55);
}

.world-badge.bonus {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.world-planet {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 6px;
  box-shadow: 0 0 18px rgba(125, 175, 255, 0.3);
}

.world-card h4 {
  font-family: var(--font-word);
  font-size: 1rem;
  line-height: 1.15;
  color: #fff;
}

.world-sample {
  font-family: var(--font-word);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(10, 15, 36, 0.72);
  color: var(--text-soft);
}

.world-stars-row {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Collectible Pet Clubhouse Strip */
.pet-clubhouse {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 12px 14px;
}

.pet-clubhouse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pet-clubhouse-head h3 {
  font-family: var(--font-word);
  font-size: 0.98rem;
  color: var(--cyan);
}

.pet-clubhouse-head span {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold-bright);
}

.pets-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (min-width: 720px) {
  .pets-rail {
    grid-template-columns: repeat(6, 1fr);
  }
}

.pet-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(10, 16, 40, 0.78);
  border: 1.5px solid rgba(125, 175, 255, 0.22);
  border-radius: 16px;
  padding: 8px 4px 6px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s;
}

.pet-tile.unlocked {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(28, 40, 88, 0.85);
}

.pet-tile.unlocked:active {
  transform: scale(1.08) translateY(-4px);
}

.pet-tile.bounce {
  animation: petBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes petBounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.16) translateY(-8px); }
  100% { transform: scale(1); }
}

.pet-img-wrap {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.pet-tile:not(.unlocked) .pet-img-wrap {
  background: rgba(30, 41, 82, 0.8);
}

.pet-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pet-tile:not(.unlocked) img {
  filter: brightness(0) invert(0.38);
  opacity: 0.45;
}

.pet-tile span {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pet-cheer-toast {
  margin-top: 8px;
  text-align: center;
  font-family: var(--font-word);
  font-size: 0.9rem;
  color: var(--gold-bright);
  min-height: 22px;
}

/* ---------------- EXERCISE / SPRINT VIEW ---------------- */
.sprint-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sprint-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-back {
  font-family: var(--font-word);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.progress-track {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.prog-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.25);
  border: 1.5px solid rgba(148, 163, 184, 0.4);
  transition: all 0.25s ease;
}

.prog-dot.current {
  width: 24px;
  border-radius: 999px;
  background: var(--cyan);
  border-color: #bae6fd;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.65);
}

.prog-dot.done-gold {
  background: var(--gold-bright);
  border-color: #fff;
  box-shadow: 0 0 8px rgba(253, 224, 71, 0.65);
}

.prog-dot.done-ok {
  background: var(--emerald);
  border-color: #a7f3d0;
}

.btn-rule-peek {
  font-family: var(--font-word);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(251, 191, 36, 0.14);
  color: var(--gold-bright);
  cursor: pointer;
}

/* Exercise Prompt Card */
.prompt-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
}

.exercise-kicker-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exercise-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}

.streak-chip {
  font-family: var(--font-word);
  font-size: 0.82rem;
  color: var(--gold-bright);
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 3px 10px;
  border-radius: 999px;
}

.prompt-instruction {
  font-family: var(--font-word);
  font-size: 1.16rem;
  line-height: 1.25;
  color: #fff;
}

/* Main Visual Stage inside Prompt Card */
.visual-stage {
  width: 100%;
  min-height: 112px;
  background: rgba(10, 15, 38, 0.76);
  border: 1.5px solid rgba(125, 175, 255, 0.22);
  border-radius: 20px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.clue-emoji-big {
  font-size: 2.85rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clue-emoji-big.pop {
  transform: scale(1.22);
}

.audio-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-hear {
  font-family: var(--font-word);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  min-height: 48px;
  background: linear-gradient(135deg, #38bdf8, #3b82f6);
  color: #fff;
  box-shadow: 0 4px 0 #1d4ed8, 0 8px 18px rgba(59, 130, 246, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.1s;
}

.btn-hear:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1d4ed8;
}

.btn-blend {
  font-family: var(--font-word);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1.5px solid rgba(192, 132, 252, 0.55);
  border-radius: 999px;
  padding: 10px 15px;
  min-height: 48px;
  background: rgba(192, 132, 252, 0.16);
  color: #e9d5ff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-blend:active {
  transform: scale(0.96);
}

/* Word Display + Phonics Visual Markup */
.big-word-display {
  font-family: var(--font-word);
  font-size: clamp(2.4rem, 10vw, 3.3rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #fff;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
}

/* Night Light -igh highlight */
.ph-igh {
  display: inline-flex;
  align-items: baseline;
  position: relative;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.2);
  border-bottom: 3.5px solid var(--gold-bright);
}

.ph-igh-i {
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(253, 224, 71, 0.85);
}

.ph-igh-gh {
  color: rgba(226, 232, 240, 0.45);
  position: relative;
}

.ph-igh-gh::after {
  content: 'zZz';
  position: absolute;
  top: -0.68em;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.28em;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

/* Magic E highlight + Rainbow Arc */
.ph-vce {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  padding-top: 0.14em;
}

.ph-vce::before {
  content: '';
  position: absolute;
  top: -0.06em;
  left: 0.16em;
  right: 0.16em;
  height: 0.42em;
  border-top: 3px solid var(--violet);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.8));
}

.ph-vce-v {
  color: #fde047;
  text-shadow: 0 0 12px rgba(253, 224, 71, 0.65);
}

.ph-vce-c {
  color: #f8fafc;
}

.ph-vce-e {
  color: #e879f9;
  opacity: 0.82;
  text-shadow: 0 0 12px rgba(232, 121, 249, 0.75);
}

/* Digraph highlight */
.ph-digraph {
  display: inline-block;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  border-bottom: 3.5px solid var(--cyan);
}

/* Vowel Team highlight */
.ph-team {
  display: inline-block;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 10px;
  background: rgba(244, 114, 182, 0.22);
  color: #f9a8d4;
  border-bottom: 3.5px solid var(--pink);
}

/* Bossy R highlight */
.ph-bossyr {
  display: inline-block;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 10px;
  background: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
  border-bottom: 3.5px solid var(--emerald);
}

/* Real Book Mode strips rule highlights until answered */
.plain-mode .ph-igh,
.plain-mode .ph-digraph,
.plain-mode .ph-team,
.plain-mode .ph-bossyr {
  background: transparent;
  border-bottom: none;
  padding: 0;
  margin: 0;
  color: inherit;
}

.plain-mode .ph-igh-i,
.plain-mode .ph-igh-gh,
.plain-mode .ph-vce-v,
.plain-mode .ph-vce-c,
.plain-mode .ph-vce-e {
  color: inherit;
  text-shadow: none;
  opacity: 1;
}

.plain-mode .ph-igh-gh::after,
.plain-mode .ph-vce::before {
  display: none;
}

.plain-mode .ph-vce {
  padding-top: 0;
}

/* Missing Slot inside Chunk Builder */
.chunk-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1ch;
  padding: 0 8px;
  margin: 0 4px;
  border-radius: 14px;
  border: 2.5px dashed var(--gold);
  background: rgba(251, 191, 36, 0.12);
  color: var(--gold-bright);
  transition: all 0.2s ease;
}

.chunk-slot.filled {
  border-style: solid;
  border-color: var(--emerald);
  background: rgba(52, 211, 153, 0.24);
  color: #a7f3d0;
  animation: popIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.75); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Magic E Interactive Switcher Stage */
.magic-e-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.magic-e-pair-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.magic-e-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 54px;
  border-radius: 14px;
  border: 2.5px dashed rgba(232, 121, 249, 0.65);
  color: rgba(232, 121, 249, 0.55);
  font-size: 2.1rem;
  margin-left: 4px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.magic-e-ghost.zapped {
  border-style: solid;
  border-color: #e879f9;
  background: rgba(232, 121, 249, 0.24);
  color: #f5d0fe;
  box-shadow: 0 0 22px rgba(232, 121, 249, 0.7);
  transform: scale(1.12);
}

.magic-e-caption {
  font-size: 0.88rem;
  font-weight: 800;
  color: #e9d5ff;
}

/* Book Sentence Stage */
.sentence-box {
  font-family: var(--font-word);
  font-size: clamp(1.26rem, 4.8vw, 1.58rem);
  line-height: 1.55;
  color: #f8fafc;
  padding: 6px 4px;
}

.sentence-word {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 1px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.sentence-word:active {
  background: rgba(56, 189, 248, 0.25);
  transform: scale(0.95);
}

.sentence-word.detective-word {
  background: rgba(30, 46, 98, 0.9);
  border: 1.5px solid rgba(125, 175, 255, 0.38);
  padding: 5px 11px;
  margin: 4px 3px;
  box-shadow: 0 3px 0 rgba(9, 14, 34, 0.7);
}

.sentence-word.detective-word.correct {
  background: rgba(16, 185, 129, 0.28);
  border-color: var(--emerald);
  color: #a7f3d0;
}

.sentence-word.detective-word.wrong {
  animation: gentleShake 0.35s ease;
  border-color: var(--rose);
}

.sentence-blank {
  display: inline-block;
  min-width: 92px;
  padding: 0 10px;
  border-bottom: 3.5px dashed var(--gold-bright);
  color: var(--gold-bright);
  text-align: center;
}

.sentence-blank.filled {
  border-bottom-style: solid;
  border-bottom-color: var(--emerald);
  color: #a7f3d0;
}

/* Interactive Continuous Blending Slider (Slide slow left-to-right!) */
.blender-strip {
  width: 100%;
  margin-top: 2px;
}

.blend-slider-box {
  background: rgba(9, 14, 36, 0.85);
  border: 1.5px solid rgba(125, 175, 255, 0.34);
  border-radius: 16px;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blend-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.blend-slider-hint {
  font-family: var(--font-word);
  font-size: 0.82rem;
  color: #7dd3fc;
}

.btn-say-word-mini {
  font-family: var(--font-word);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid rgba(52, 211, 153, 0.6);
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-say-word-mini:active {
  transform: scale(0.95);
}

.blend-track {
  position: relative;
  width: 100%;
  padding: 4px 14px 20px;
  border-radius: 14px;
  background: rgba(20, 31, 70, 0.68);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.blend-track.dragging {
  cursor: grabbing;
  background: rgba(26, 40, 88, 0.88);
}

.blend-track.completed {
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.7), 0 0 20px rgba(52, 211, 153, 0.3);
}

.blend-letters-row {
  display: flex;
  align-items: baseline;
  justify-content: space-around;
  gap: 2px;
  margin-bottom: 14px;
  pointer-events: none;
}

.blend-seg {
  font-family: var(--font-word);
  font-size: 1.7rem;
  font-weight: 700;
  color: rgba(248, 250, 252, 0.72);
  padding: 2px 8px;
  border-radius: 12px;
  border-bottom: 3px solid transparent;
  transition: transform 0.12s ease, color 0.12s ease, background 0.12s ease, text-shadow 0.12s ease;
  position: relative;
}

.blend-seg.is-rule {
  color: #fde68a;
  border-bottom-color: rgba(251, 191, 36, 0.55);
}

.blend-seg.is-silent-e {
  color: rgba(232, 121, 249, 0.62);
  font-size: 1.5rem;
}

.blend-seg.is-silent-e::after {
  content: 'silent';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: rgba(232, 121, 249, 0.78);
  white-space: nowrap;
}

.blend-seg.passed {
  color: #a7f3d0;
}

.blend-seg.active {
  color: #fde047;
  background: rgba(251, 191, 36, 0.24);
  border-bottom-color: var(--gold-bright);
  transform: translateY(-4px) scale(1.18);
  text-shadow: 0 0 14px rgba(253, 224, 71, 0.85);
}

.blend-seg.linked-e {
  color: #f5d0fe;
  transform: translateY(-3px) scale(1.1);
  text-shadow: 0 0 12px rgba(232, 121, 249, 0.85);
}

.blend-seg.all-done {
  color: #fde047;
  transform: scale(1.06);
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.75);
}

.blend-rail {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
  border: 1px solid rgba(148, 163, 184, 0.35);
  pointer-events: none;
}

.blend-rail-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8 0%, #fde047 55%, #34d399 100%);
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.65);
}

.blend-rail-end {
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.8;
}

.blend-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  border: 2.5px solid #fff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  pointer-events: none;
  transition: transform 0.1s ease;
}

.blend-track.dragging .blend-thumb {
  transform: translate(-50%, -50%) scale(1.16);
}

/* ---------------- ANSWER OPTIONS AREA (Thumb-Friendly) ---------------- */
.options-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.rule-tip-pill {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 999px;
  padding: 4px 12px;
}

.options-area.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.options-area.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.option-btn {
  font-family: var(--font-word);
  font-size: clamp(1.42rem, 5.8vw, 1.85rem);
  font-weight: 700;
  min-height: 56px;
  padding: 9px 14px;
  border-radius: 18px;
  border: 2px solid rgba(125, 175, 255, 0.42);
  background: linear-gradient(180deg, #253470 0%, #192452 100%);
  color: #fff;
  box-shadow: 0 5px 0 #0d1330, 0 10px 20px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.2s, background 0.2s;
}

.option-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #0d1330;
}

.option-btn.magic-wand-btn {
  background: linear-gradient(135deg, #c084fc 0%, #ec4899 100%);
  border-color: #f5d0fe;
  box-shadow: 0 5px 0 #86198f, 0 10px 24px rgba(236, 72, 153, 0.4);
  font-size: 1.25rem;
}

.option-btn.magic-wand-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #86198f;
}

.option-btn.correct {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-color: #a7f3d0;
  box-shadow: 0 5px 0 #065f46, 0 0 22px rgba(52, 211, 153, 0.55);
  color: #fff;
}

.option-btn.wrong {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.35), rgba(159, 18, 57, 0.35));
  border-color: rgba(251, 113, 133, 0.65);
  opacity: 0.65;
  animation: gentleShake 0.35s ease;
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.option-sub-emoji {
  font-size: 1.35rem;
}

/* Coach Feedback Drawer */
.feedback-bar {
  background: linear-gradient(135deg, rgba(20, 32, 74, 0.98), rgba(29, 25, 74, 0.98));
  border: 2px solid var(--emerald);
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: slideUp 0.22s ease;
}

.feedback-bar.is-hint {
  border-color: var(--gold);
}

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

.feedback-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}

.feedback-copy {
  flex: 1;
  min-width: 0;
}

.feedback-copy > strong {
  display: block;
  font-family: var(--font-word);
  font-size: 1.05rem;
  color: var(--gold-bright);
  margin-bottom: 2px;
}

.feedback-copy p strong {
  color: var(--gold-bright);
}

.feedback-copy p {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.35;
}

.btn-next {
  width: 100%;
  font-family: var(--font-word);
  font-size: 1.12rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  min-height: 54px;
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #052e1f;
  box-shadow: 0 5px 0 #047857;
  cursor: pointer;
}

.btn-next:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #047857;
}

/* ---------------- MODALS (Result, Rule Card, Parent Panel) ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 8, 22, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 88dvh;
  overflow-y: auto;
  background: linear-gradient(165deg, #1b275c 0%, #121a3e 100%);
  border: 2px solid var(--border-bright);
  border-radius: 26px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-reward-img {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  border: 3px solid var(--gold-bright);
  background: #fff;
  object-fit: contain;
  padding: 6px;
  margin: 0 auto 10px;
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.5);
}

.modal-card h2 {
  font-family: var(--font-word);
  font-size: 1.55rem;
  color: var(--gold-bright);
  margin-bottom: 6px;
}

.modal-score-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 1.8rem;
}

.modal-card p {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.45;
  margin-bottom: 14px;
}

.modal-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Rule Card Modal */
.rule-demo-box {
  background: rgba(10, 15, 38, 0.85);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 14px 12px;
  margin: 12px 0;
}

.rule-demo-note {
  font-family: var(--font-word);
  font-size: 0.96rem;
  color: var(--cyan);
  margin-top: 6px;
}

/* Parent Modal */
.parent-modal {
  text-align: left;
}

.parent-modal h2 {
  text-align: center;
  font-size: 1.35rem;
}

.parent-group {
  background: rgba(10, 15, 38, 0.68);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.parent-group label {
  display: block;
  font-family: var(--font-word);
  font-size: 0.92rem;
  color: var(--gold-bright);
  margin-bottom: 8px;
}

.segmented-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.segmented-row.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.seg-btn {
  font-family: var(--font-word);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: rgba(20, 31, 70, 0.85);
  color: var(--text-soft);
  cursor: pointer;
}

.seg-btn.active {
  border-color: var(--gold-bright);
  background: rgba(251, 191, 36, 0.22);
  color: #fff;
}

.mastery-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mastery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(25, 36, 82, 0.65);
}

.mastery-row strong {
  color: #fff;
}

.tricky-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tricky-chip {
  font-family: var(--font-word);
  font-size: 0.88rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.site-footer-link {
  text-align: center;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.site-footer-link a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 700;
}
