/* ============ Course Mode styles ============ */

/* ---------- Practice Mode (v3) ---------- */
.p-dots { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0; font-size: 1.4rem; }
.p-dot { opacity: .35; filter: grayscale(1); transition: all .2s; }
.p-dot.current { opacity: 1; filter: none; transform: scale(1.35); }
.p-dot.done { opacity: 1; filter: none; }
.p-arrow { opacity: .4; font-size: .9rem; }
.p-area { background: #fff; border-radius: 18px; padding: 20px; margin: 10px 0; text-align: center; box-shadow: 0 2px 8px rgba(90,63,176,.08); }
.p-instr { font-size: 1.15rem; font-weight: 700; color: #4a3a8a; margin-bottom: 10px; }
.p-instr.small { font-size: .9rem; color: #8a80b0; font-weight: 500; }
.say-word.big { font-size: 4rem; font-weight: 900; color: #2d1b69; margin: 12px 0; font-family: 'Nunito', sans-serif; }
.learn-word .hint { color: #e63946; }
.p-claps { font-size: 1.4rem; margin: 8px 0; }
.p-pattern { color: #8a80b0; font-size: .9rem; margin-bottom: 8px; }
.say-status { color: #8a80b0; margin: 8px 0; min-height: 1.4em; }
.big-cta.mic { font-size: 1.3rem; padding: 16px 32px; }
.p-tapjudge { display: flex; gap: 12px; justify-content: center; margin-top: 10px; }
.p-marks { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
.p-mark { font-family: inherit; font-size: 1.05rem; font-weight: 800; padding: 10px 22px; border: none; border-radius: 16px; cursor: pointer; transition: all .15s; }
.p-mark.got { background: #d3ead9; color: #7a9c85; }
.p-mark.got.on { background: #2dc653; color: #fff; box-shadow: 0 3px 0 #1e9e6a; }
.p-mark.np { background: #f2d7d7; color: #b08a8a; }
.p-mark.np.on { background: #ffd60a; color: #7f5f00; box-shadow: 0 3px 0 #d4a017; }
.p-skip {
  display: block; margin: 8px auto; font-family: inherit;
  background: #fff; border: 2px solid #d9d2f0; border-radius: 12px;
  color: #6b5fa0; font-size: .9rem; font-weight: 700; padding: 7px 16px; cursor: pointer;
}
.p-skip:hover { border-color: #7c5cd6; background: #f4f0ff; }
.spell-slots { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.spell-slot { width: 52px; height: 60px; font-size: 2rem; font-weight: 900; border: 3px dashed #d9d2f0; border-radius: 12px; background: #faf9ff; color: #2d1b69; cursor: pointer; }
.spell-slots.shake { animation: pshake .4s; }
@keyframes pshake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.tile.used { opacity: .25; }
.write-canvas { background: #fff; border: 3px solid #d9d2f0; border-radius: 14px; touch-action: none; max-width: 100%; }
.p-write-btns { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.practice-complete { background: #fff; border-radius: 18px; padding: 30px; text-align: center; margin-top: 16px; box-shadow: 0 2px 8px rgba(90,63,176,.08); }
.pc-title { font-size: 1.8rem; font-weight: 900; color: #2d1b69; }
.pc-sub { color: #8a80b0; margin: 10px 0 16px; }
#courseOverlay, #rhymeOverlay, #helpOverlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 20, 60, .55);
  display: flex; align-items: center; justify-content: center;
}
#courseOverlay.hidden, #rhymeOverlay.hidden, #helpOverlay.hidden { display: none; }
.course-panel {
  background: linear-gradient(170deg, #fffdf5, #f4f0ff);
  width: min(680px, 94vw); height: min(860px, 92vh);
  border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden;
  border: 4px solid #f4b400;
}
.course-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #f4b400;
}
.course-topbar .logo { font-weight: 900; color: #5b3e00; font-size: 1.1rem; }
#courseClose, #rhymeClose, #helpClose {
  border: none; background: #fff; border-radius: 50%; width: 34px; height: 34px;
  font-size: 1rem; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
#courseContent { flex: 1; overflow-y: auto; padding: 16px 18px 28px; }

.course-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.course-head h2, .course-h2 { margin: 0; color: #4a3a8a; font-size: 1.35rem; }
.course-h2 { margin: 12px 0; }
.crumb { font-size: .85rem; color: #999; font-weight: 400; }
.course-name-btn, .ghost-btn {
  border: 2px solid #d9d2f0; background: #fff; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font-size: .9rem; color: #5b4b8a; font-weight: 700;
}
.course-total-stars { margin-left: auto; font-weight: 800; color: #b8860b; }

.grade-tabs { display: flex; gap: 8px; margin: 8px 0 16px; }
.grade-tab {
  flex: 1; padding: 12px 0; font-size: 1.05rem; font-weight: 800;
  border: none; border-radius: 14px; background: #e9e4f8; color: #6b5ba8;
  cursor: pointer; box-shadow: 0 3px 0 #cfc4ee; transition: all .15s;
}
.grade-tab.active { background: #7c5cd6; color: #fff; box-shadow: 0 3px 0 #5a3fb0; transform: translateY(1px); }

.group-list { display: flex; flex-direction: column; gap: 12px; }
.group-card {
  background: #fff; border-radius: 16px; padding: 14px 16px; cursor: pointer;
  border: 2px solid #ece6fb; box-shadow: 0 4px 10px rgba(90,63,176,.08);
  transition: transform .12s;
}
.group-card:hover { transform: translateY(-2px); border-color: #b8a5ec; }
.group-name { font-weight: 800; font-size: 1.1rem; color: #3f2f7a; }
.group-sub { color: #8a80b0; font-size: .88rem; margin: 4px 0 8px; }
.group-bar { height: 10px; border-radius: 99px; background: #eee9fb; overflow: hidden; }
.group-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4ade80, #22c55e); transition: width .3s; }

.course-back {
  border: none; background: none; color: #7c5cd6; font-weight: 800;
  cursor: pointer; font-size: .95rem; padding: 4px 0;
}

.title-box { background: #fff; border-radius: 14px; margin-bottom: 10px; border: 2px solid #ece6fb; overflow: hidden; }
.title-row { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; }
.title-row:hover { background: #faf8ff; }
.title-name { font-weight: 800; color: #3f2f7a; font-size: 1.05rem; }
.title-meta { margin-left: auto; color: #8a80b0; font-size: .85rem; }
.title-chev { color: #b8a5ec; font-size: 1.1rem; }
.title-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed #e5ddf8; }
.title-body.hidden { display: none; }

.set-btn.bonus { border-style: dashed; border-color: #e6a817; background: #fffbe9; }
.set-btn.bonus.done { border-color: #22c55e; background: #f0fdf4; }
.set-btn.bonus .set-label { color: #b8860b; }
.set-btn {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; border-radius: 12px; border: 2px solid #d9f2e3;
  background: #f2fbf5; cursor: pointer; font-size: 1rem; font-weight: 700; color: #166534;
}
.set-btn .set-info { font-size: .85rem; color: #6b7280; font-weight: 600; }
.set-btn.done { background: #ecfdf5; border-color: #4ade80; }
.set-btn.done .set-info { color: #b8860b; }
.set-btn.locked { background: #f3f4f6; border-color: #e5e7eb; color: #9ca3af; cursor: not-allowed; }
.cs-none { color: #ccc; }

.more-sets-btn, .cert-btn {
  border: 2px dashed #b8a5ec; background: #faf8ff; color: #6b5ba8;
  border-radius: 12px; padding: 9px; font-weight: 700; cursor: pointer;
}
.cert-btn { border-style: solid; border-color: #f4b400; background: #fffbeb; color: #92600a; margin-top: 4px; }

/* runner */
.dedup-note { background: #eff6ff; color: #1d4ed8; border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin-bottom: 10px; }
.autocomplete-box { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; gap: 12px; font-size: 1.2rem; color: #166534; }
.runner-progress { text-align: center; color: #8a80b0; font-size: .88rem; margin-bottom: 10px; }
.runner-card {
  background: #fff; border-radius: 20px; border: 3px solid #7c5cd6;
  padding: 34px 20px; text-align: center; cursor: pointer;
  box-shadow: 0 8px 20px rgba(90,63,176,.15); margin-bottom: 14px;
}
.runner-word { font-size: 3.2rem; font-weight: 900; color: #2d1b69; letter-spacing: 1px; }
.runner-info { color: #8a80b0; margin: 8px 0 14px; }
.say-btn {
  border: none; background: #f4b400; color: #5b3e00; font-weight: 800;
  border-radius: 999px; padding: 10px 22px; font-size: 1rem; cursor: pointer;
  box-shadow: 0 3px 0 #d4a017;
}
.say-btn.big { font-size: 1.1rem; padding: 12px 26px; margin: 8px 0; }
.runner-nav { display: flex; gap: 10px; margin-bottom: 14px; }
.runner-btn {
  flex: 1; padding: 13px 0; border-radius: 14px; border: none; font-weight: 800;
  font-size: 1rem; cursor: pointer; background: #e9e4f8; color: #6b5ba8;
}
.runner-btn.know { background: #4ade80; color: #064e3b; }
.runner-btn.dont { background: #ff8a8a; color: #7f1d1d; }
.runner-btn:disabled { opacity: .4; cursor: default; }

.big-cta {
  width: 100%; padding: 15px 0; border: none; border-radius: 16px;
  background: linear-gradient(180deg, #22c55e, #16a34a); color: #fff;
  font-size: 1.15rem; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 #15803d;
}
.big-cta:disabled { background: #d1d5db; box-shadow: 0 4px 0 #9ca3af; cursor: not-allowed; }
.testme { margin-top: 6px; }

/* test */
.test-bar { height: 12px; background: #eee9fb; border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.test-bar-fill { height: 100%; background: linear-gradient(90deg, #f4b400, #f59e0b); transition: width .3s; }
.test-count { color: #8a80b0; font-size: .85rem; text-align: center; margin-bottom: 10px; }
.test-box { background: #fff; border-radius: 18px; border: 2px solid #ece6fb; padding: 22px 16px; text-align: center; }
.test-instr { font-size: 1.15rem; font-weight: 800; color: #4a3a8a; margin-bottom: 14px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.opt-btn {
  padding: 16px 8px; font-size: 1.4rem; font-weight: 800; color: #3f2f7a;
  background: #f4f0ff; border: 3px solid #d9d2f0; border-radius: 14px; cursor: pointer;
}
.opt-btn:hover { border-color: #7c5cd6; background: #efeaff; }
.opt-btn.letter { font-size: 1.8rem; }
.build-display { font-size: 2.6rem; font-weight: 900; letter-spacing: 8px; min-height: 3.2rem; color: #2d1b69; margin: 10px 0; }
.tile-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.tile {
  width: 52px; height: 52px; font-size: 1.6rem; font-weight: 900; color: #5b3e00;
  background: #fde68a; border: none; border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 #d4a017;
}
.tile:disabled { opacity: .3; }
.say-word { font-size: 3rem; font-weight: 900; color: #2d1b69; margin: 10px 0 18px; }
.say-status { color: #8a80b0; margin: 10px 0; min-height: 1.4em; }
.parent-check { margin-top: 16px; padding-top: 12px; border-top: 1px dashed #e5ddf8; color: #8a80b0; font-size: .9rem; }
.mini-btn { border: none; border-radius: 999px; padding: 6px 14px; margin-left: 6px; font-weight: 700; cursor: pointer; }
.mini-btn.ok { background: #4ade80; color: #064e3b; }
.mini-btn.no { background: #ff8a8a; color: #7f1d1d; }
.flash-word { font-size: 3.4rem; font-weight: 900; color: #2d1b69; padding: 20px 0; }
.test-fb { margin-top: 16px; font-size: 1.3rem; font-weight: 900; }
.test-fb.ok { color: #16a34a; }
.test-fb.no { color: #dc2626; }

/* results */
.results-box { text-align: center; background: #fff; border-radius: 18px; border: 2px solid #ece6fb; padding: 30px 18px; }
.results-score { font-size: 3.4rem; font-weight: 900; color: #4a3a8a; }
.results-stars { font-size: 2.2rem; min-height: 2.6rem; }
.results-msg { color: #555; margin: 10px 0 18px; font-size: 1.05rem; }
.results-missed { background: #fff7ed; color: #9a3412; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }

@media (max-width: 520px) {
  .runner-word { font-size: 2.4rem; }
  .say-word { font-size: 2.2rem; }
  .opt-btn { font-size: 1.2rem; }
}

/* runner toast */
.runner-toast {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #2d1b69; color: #fff; font-weight: 700; font-size: .95rem;
  padding: 10px 20px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  transition: opacity .5s; z-index: 10; white-space: nowrap;
}
.runner-toast.fade { opacity: 0; }
.course-panel { position: relative; }

/* practice pile banner */
.practice-banner {
  width: 100%; margin-bottom: 14px; padding: 12px 16px; text-align: center;
  background: #fff7ed; border: 2px solid #fdba74; color: #9a3412;
  border-radius: 14px; font-weight: 800; font-size: 1rem; cursor: pointer;
}
.practice-banner:hover { background: #ffedd5; }

/* legend under Test Me */
.runner-legend {
  margin-top: 12px; text-align: center; font-size: .85rem; color: #6b6390;
  background: #f8f6ff; border: 1px solid #e5ddf8; border-radius: 12px; padding: 8px 12px; line-height: 1.6;
}

/* profile switcher */
.profile-hint { color: #8a80b0; font-size: .9rem; margin-bottom: 12px; }
.profile-card { display: flex; align-items: center; gap: 10px; }
.profile-card .group-sub { margin: 0; flex: 1; }
.profile-card.active { border-color: #4ade80; background: #f0fdf4; }
.profile-card .mini-btn { background: #e9e4f8; color: #6b5ba8; }

/* gap between "Hear it again" and "Say it now" */
.p-area .big-cta { margin-top: 16px; }

/* cycling border colors on the practice word card (matches main flashcards) */
.p-area { border: 4px solid transparent; }
.p-area.border-0 { border-color: #3a86ff; }
.p-area.border-1 { border-color: #e63946; }
.p-area.border-2 { border-color: #2dc653; }
.p-area.border-3 { border-color: #ffd60a; }

/* Write step: stacked guide + ink layers */
.write-stack { position: relative; width: min(560px, 92vw); margin: 0 auto; }
.write-stack .write-canvas { width: 100%; height: auto; display: block; }
.write-stack .write-ink { position: absolute; inset: 0; touch-action: none; background: transparent; border-color: transparent; }

/* Learn step: phoneme chips */
.phon-row { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; flex-wrap: wrap; }
.phon-chip { font-family: 'Andika', 'Fredoka', sans-serif; font-size: 1.3rem; font-weight: 700; color: #6d28d9; background: #ede9fe; border: 2px solid #c9b8f5; border-radius: 10px; padding: 4px 12px; }

/* question speaker: hear the test instruction on demand */
.instr-speaker { margin-left: 10px; font-size: 1rem; background: #ede9fe; border: 2px solid #c9b8f5; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; vertical-align: middle; }
.instr-speaker:hover { background: #ddd3fb; }
