/* =================================================================
   Bayhaqy Kids — Lesson Kit (shared lesson-experience styles)
   v1 — Aug 2026. Loaded on every lesson/game page.
   NOTE: does NOT touch .kids-header / .kids-footer (owned by theme.css).
   Based on 2025-26 learning-design practice:
   - visible lesson arc (Learn -> Practice -> Finish) for self-direction
   - chunk-level read-aloud (pre-readers + language learners)
   - effort-praising feedback, no timers, no streak pressure
   - curriculum phase badge (Kurikulum Merdeka Fase A-D)
   ================================================================= */

/* ---------- 1. Lesson arc progress (3 steps) ---------- */
.bk-arc {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1.1rem;
  padding: 0.7rem 0.95rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg, 16px);
}
.bk-arc-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-mute);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 2px solid transparent;
  transition: color .25s var(--ease, ease), background .25s var(--ease, ease);
}
.bk-arc-step .n {
  display: inline-grid;
  place-items: center;
  width: 1.35rem; height: 1.35rem;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  transition: background .25s var(--ease, ease), color .25s var(--ease, ease);
}
.bk-arc-step.is-active { color: var(--ink); border-color: var(--line); }
.bk-arc-step.is-active .n { background: var(--red-700); color: #fff; }
.bk-arc-step.is-done { color: var(--ink-soft); }
.bk-arc-step.is-done .n { background: #16A34A; color: #fff; }
.bk-arc-link {
  width: 1.1rem;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  flex: 0 0 auto;
}
.bk-arc-spacer { flex: 1 1 auto; }
.bk-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.12em;
  font-size: 1rem;
  letter-spacing: 0.06em;
}
.bk-stars .on { filter: drop-shadow(0 1px 2px rgba(185,28,28,.35)); }
.bk-stars .off { opacity: .28; }

/* ---------- 2. Curriculum phase badge ---------- */
.bk-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--red-700) 10%, transparent);
  color: var(--red-700);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.bk-phase .info {
  cursor: help;
  font-weight: 700;
  opacity: .7;
}

/* ---------- 3. Chunk read-aloud buttons ---------- */
.bk-listen {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s var(--ease, ease), color .2s var(--ease, ease), transform .2s var(--ease, ease);
}
.bk-listen:hover { border-color: var(--red-700); color: var(--red-700); transform: translateY(-1px); }
.bk-listen.is-speaking { border-color: var(--red-700); color: var(--red-700); }
.bk-listen .ico { font-size: 0.95em; }
.bk-listen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.bk-listen-row h2, .bk-listen-row h3 { margin: 0; }

/* ---------- 4. Finish button ---------- */
.bk-finish-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin: 2rem 0 0.5rem;
  text-align: center;
}
.bk-finish {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.7rem;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 800;
  background: var(--red-700);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--red-700) 35%, transparent);
  transition: transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease), opacity .2s;
}
.bk-finish:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--red-700) 42%, transparent); }
.bk-finish:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.bk-finish-hint { font-size: var(--fs-xs); color: var(--ink-mute); max-width: 46ch; }

/* ---------- 5. Celebration overlay ---------- */
.bk-celebrate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease, ease);
}
.bk-celebrate.show { opacity: 1; pointer-events: auto; }
.bk-celebrate-card {
  width: min(430px, 100%);
  background: var(--paper);
  border-radius: 22px;
  border: 2px solid var(--line);
  padding: 1.9rem 1.5rem 1.5rem;
  text-align: center;
  transform: translateY(14px) scale(.97);
  transition: transform .35s var(--ease, ease);
  position: relative;
  overflow: hidden;
}
.bk-celebrate.show .bk-celebrate-card { transform: translateY(0) scale(1); }
.bk-celebrate-card::before {
  content: '';
  position: absolute;
  top: -70px; left: 50%;
  width: 240px; height: 140px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--red-700) 16%, transparent), transparent);
  pointer-events: none;
}
.bk-cel-emoji { font-size: 3rem; line-height: 1; }
.bk-cel-title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--ink);
  margin: 0.5rem 0 0.35rem;
}
.bk-cel-msg { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: 0.8rem; }
.bk-cel-stars { font-size: 2rem; letter-spacing: 0.12em; margin-bottom: 1rem; }
.bk-cel-stars .off { opacity: .25; }
.bk-cel-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.bk-btn-next {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--red-700);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s var(--ease, ease);
}
.bk-btn-next:hover { transform: translateY(-2px); color: #fff; }
.bk-btn-ghost2 {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.68rem 1.15rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  text-decoration: none;
}
.bk-btn-ghost2:hover { border-color: var(--red-700); color: var(--red-700); }

/* confetti (pure CSS, respects reduced motion) */
.bk-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bk-confetti i {
  position: absolute;
  top: -12px;
  width: 8px; height: 13px;
  border-radius: 2px;
  opacity: 0;
  animation: bkFall 1.6s ease-in forwards;
}
.bk-confetti i:nth-child(3n) { background: #B91C1C; }
.bk-confetti i:nth-child(3n+1) { background: #F59E0B; }
.bk-confetti i:nth-child(3n+2) { background: #2563EB; }
.bk-confetti i:nth-child(1) { left: 12%; animation-delay: .05s; }
.bk-confetti i:nth-child(2) { left: 26%; animation-delay: .22s; }
.bk-confetti i:nth-child(3) { left: 41%; animation-delay: .1s; }
.bk-confetti i:nth-child(4) { left: 55%; animation-delay: .3s; }
.bk-confetti i:nth-child(5) { left: 68%; animation-delay: .16s; }
.bk-confetti i:nth-child(6) { left: 82%; animation-delay: .26s; }
.bk-confetti i:nth-child(7) { left: 90%; animation-delay: .38s; }
.bk-confetti i:nth-child(8) { left: 33%; animation-delay: .44s; }
@keyframes bkFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(330px) rotate(240deg); opacity: 0; }
}

/* ---------- 6. Prev / Next lesson nav ---------- */
.bk-pn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 2.2rem 0 0;
}
@media (max-width: 640px) { .bk-pn { grid-template-columns: 1fr; } }
.bk-pn a {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg, 16px);
  text-decoration: none;
  transition: border-color .2s var(--ease, ease), transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease);
}
.bk-pn a:hover {
  border-color: var(--red-700);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.08);
}
.bk-pn .dir {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.bk-pn .t {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-sm);
  color: var(--ink);
  line-height: 1.35;
}
.bk-pn a.next { text-align: right; align-items: flex-end; }
.bk-pn .all {
  grid-column: 1 / -1;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--red-700);
  text-decoration: none;
  padding-top: 0.2rem;
}
.bk-pn .all:hover { text-decoration: underline; }

/* ---------- 7. Continue card (landing) ---------- */
.bk-continue {
  display: none;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-left: 6px solid var(--red-700);
  border-radius: var(--radius-lg, 16px);
  text-decoration: none;
  margin-bottom: 1.75rem;
  transition: transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease), border-color .2s;
}
.bk-continue.has { display: flex; }
.bk-continue:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(2,6,23,.10); border-color: var(--red-700); }
.bk-continue .emoji { font-size: 2rem; line-height: 1; }
.bk-continue .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.bk-continue .label {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--red-700);
  margin-bottom: 0.15rem;
}
.bk-continue .title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-md);
  color: var(--ink);
  line-height: 1.3;
}
.bk-continue .sub { font-size: var(--fs-xs); color: var(--ink-mute); }
.bk-continue .go {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--red-700);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

/* ---------- 8. Lesson list star chips (category pages) ---------- */
.lesson-card { position: relative; }
.lesson-card .bk-done {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}
.lesson-card .bk-order {
  display: inline-grid;
  place-items: center;
  width: 1.5rem; height: 1.5rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  flex: 0 0 auto;
}
.lesson-card .level { display: inline-flex; align-items: center; }

/* ---------- 9. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bk-confetti i { animation: none; opacity: 0; }
  .bk-celebrate, .bk-celebrate-card, .bk-finish, .bk-pn a, .bk-continue { transition: none; }
  .bk-listen:hover { transform: none; }
}

/* ---------- 10. Small screens ---------- */
@media (max-width: 640px) {
  .bk-arc { gap: 0.35rem; padding: 0.6rem 0.7rem; }
  .bk-arc-step { padding: 0.22rem 0.5rem; }
  .bk-arc-step .txt { display: none; }
  .bk-arc-step.is-active .txt { display: inline; }
  .bk-phase { margin-left: 0.35rem; }
}
