/* Lesson runner — the 5-phase learning journey + activities. */

.lesson { max-width: 50rem; margin-inline: auto; padding-block: var(--sp-5) var(--sp-8); }

/* Journey map — orientation, not a competitive progress bar */
.journey {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
.journey__step { flex: 1; text-align: center; position: relative; }
.journey__dot {
  width: 30px; height: 30px; margin: 0 auto var(--sp-2);
  border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line-2);
  font-size: .8rem; font-weight: 700; color: var(--ink-3);
  position: relative; z-index: 1;
}
.journey__step.is-done .journey__dot { background: var(--good); border-color: var(--good); color: #fff; }
.journey__step.is-current .journey__dot { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.12); }
.journey__step::after {
  content: ""; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px;
  background: var(--line-2); z-index: 0;
}
.journey__step:last-child::after { display: none; }
.journey__step.is-done::after { background: var(--good); }
.journey__label { font-size: .68rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.journey__step.is-current .journey__label { color: var(--accent); }

/* Phase panel */
.phase {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--sp-6);
  box-shadow: var(--shadow);
}
.phase__kicker {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--step--1); font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--sp-2);
}
.phase__kicker .glyph { font-size: 1.1rem; }
.phase h2 { font-size: var(--step-2); margin-bottom: var(--sp-3); }
.phase__body > * + * { margin-top: var(--sp-4); }
.phase__body p { max-width: none; }

.phase-foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-6); gap: var(--sp-3); }

/* Teaching prose blocks */
.teach-block { }
.teach-block h3 { font-size: var(--step-1); margin-bottom: var(--sp-2); }
.read-aloud {
  background: var(--surface-2); border-radius: var(--radius);
  padding: var(--sp-5); border: 1px solid var(--line);
}
.read-aloud p + p { margin-top: var(--sp-3); }

/* Worked example */
.worked { background: var(--think-soft); border-radius: var(--radius); padding: var(--sp-5); }
.worked__q { font-weight: 600; margin-bottom: var(--sp-3); }
.worked__steps { list-style: none; padding: 0; counter-reset: ws; }
.worked__steps li {
  counter-increment: ws; position: relative;
  padding: var(--sp-3) 0 var(--sp-3) var(--sp-6);
  border-top: 1px solid color-mix(in srgb, var(--think) 20%, transparent);
}
.worked__steps li::before {
  content: counter(ws); position: absolute; left: 0; top: var(--sp-3);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--think); color: #fff; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
}

/* ---- Activity card ---- */
.activity {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: var(--sp-5);
}
.activity + .activity { margin-top: var(--sp-4); }
.activity__q { font-size: var(--step-1); font-weight: 500; font-family: var(--font-display); margin-bottom: var(--sp-4); }
.activity__count { font-size: var(--step--1); color: var(--ink-3); margin-bottom: var(--sp-2); }

/* Options (multiple choice / true-false) */
.options { display: grid; gap: var(--sp-3); }
.option {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  text-align: left; width: 100%;
  padding: var(--sp-4); border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--surface);
  cursor: pointer; font: inherit; color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.option__key {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.option.is-correct { border-color: var(--good); background: var(--good-soft); }
.option.is-correct .option__key { background: var(--good); color: #fff; border-color: var(--good); }
.option.is-chosen-wrong { border-color: var(--think); background: var(--think-soft); }
.option.is-chosen-wrong .option__key { background: var(--think); color: #fff; border-color: var(--think); }
.option:disabled { cursor: default; }

/* Feedback — warm, specific, never "wrong" */
.feedback {
  margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-sm); font-size: var(--step-0);
  border-left: 4px solid var(--good); background: var(--good-soft);
}
.feedback--retry { border-color: var(--think); background: var(--think-soft); }
.feedback__head { font-weight: 600; font-family: var(--font-display); margin-bottom: 4px; }
.feedback p { max-width: none; }

/* Text answer */
.answer-box {
  width: 100%; font: inherit; padding: var(--sp-4);
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); resize: vertical; min-height: 6rem;
}
.answer-box:focus-visible { border-color: var(--accent); }
.model-answer { margin-top: var(--sp-3); }

/* Matching / categorise — drag-free, tap based for reliability */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.match-col h4 { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: var(--sp-2); }
.tile {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--surface);
  cursor: pointer; font: inherit; text-align: left; width: 100%; color: var(--ink);
}
.tile + .tile { margin-top: var(--sp-2); }
.tile:hover:not(:disabled) { border-color: var(--accent); }
.tile.is-selected { border-color: var(--accent); background: var(--surface-2); box-shadow: var(--ring); }
.tile.is-matched { border-color: var(--good); background: var(--good-soft); cursor: default; }
.tile.is-wrong { border-color: var(--think); background: var(--think-soft); }
.tile:disabled { opacity: .55; }

/* Categorise bins */
.bins { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(11rem,1fr)); }
.bin { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: var(--sp-4); min-height: 6rem; }
.bin h4 { font-size: var(--step-0); margin-bottom: var(--sp-2); }
.bin.is-target { border-color: var(--accent); background: var(--surface-2); }
.token-pool { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.token {
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--surface); cursor: pointer; font: inherit; color: var(--ink);
}
.token.is-selected { border-color: var(--accent); box-shadow: var(--ring); }
.token.is-placed-correct { border-color: var(--good); background: var(--good-soft); }
.token.is-placed-wrong { border-color: var(--think); background: var(--think-soft); }

/* Ordering */
.order-list { list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.order-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--surface);
}
.order-item__num { font-weight: 700; color: var(--ink-3); width: 1.5rem; }
.order-item__move { display: flex; flex-direction: column; gap: 2px; margin-left: auto; }
.order-item__move button {
  border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: 6px; cursor: pointer; width: 26px; height: 20px; line-height: 1; color: var(--ink-2);
}
.order-item.is-right { border-color: var(--good); background: var(--good-soft); }
.order-item.is-wrong { border-color: var(--think); background: var(--think-soft); }

/* Vocabulary glossary inline */
.glossary { display: grid; gap: var(--sp-2); }
.glossary dt { font-weight: 600; color: var(--accent); }
.glossary dd { margin: 0 0 var(--sp-2); font-size: var(--step--1); color: var(--ink-2); }

/* Lesson complete */
.lesson-done { text-align: center; padding: var(--sp-7) var(--sp-5); }
.lesson-done__seal {
  width: 84px; height: 84px; margin: 0 auto var(--sp-4);
  border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 2.4rem;
}
.recap { text-align: left; max-width: 34rem; margin: var(--sp-5) auto; }
.recap li { margin-top: var(--sp-2); }

/* TTS / read-aloud button */
.tts-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font: inherit; font-size: var(--step--1); color: var(--ink-2);
}
.tts-btn:hover { border-color: var(--accent); color: var(--accent); }
.tts-btn.is-playing { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Maths puzzle pad */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); max-width: 15rem; }
.numpad button {
  font: inherit; font-size: var(--step-1); font-weight: 600;
  padding: var(--sp-3); border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; color: var(--ink);
}
.numpad button:hover { border-color: var(--accent); }
.numpad button.wide { grid-column: span 2; }
.puzzle-answer {
  font-family: var(--font-display); font-size: var(--step-3); font-weight: 600;
  min-height: 2.4rem; padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-sm);
  border: 2px solid var(--line-2); background: var(--surface-2); text-align: center;
  min-width: 8rem; display: inline-block;
}
.puzzle-answer.is-right { border-color: var(--good); background: var(--good-soft); }
.puzzle-answer.is-wrong { border-color: var(--think); background: var(--think-soft); }

@media (max-width: 560px) {
  .phase { padding: var(--sp-4); }
  .journey__label { font-size: .6rem; }
  .match-grid { grid-template-columns: 1fr; }
}

/* ---- Tiered hint box (gentle help, never penalised) ---- */
.hintbox { margin: var(--sp-3) 0 var(--sp-1); }
.hint-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
  font: inherit; font-size: var(--step--1); font-weight: 600; color: var(--ink-2);
}
.hint-toggle:hover { border-color: var(--warn); color: var(--warn); }
.hint-toggle[aria-expanded="true"] { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.hint-panel {
  margin-top: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  background: var(--warn-soft); border-radius: var(--radius-sm);
  border-left: 3px solid var(--warn);
}
.hint-list { margin: 0; padding-left: var(--sp-4); }
.hint-list li { font-size: var(--step--1); color: var(--ink); }
.hint-list li + li { margin-top: var(--sp-2); }
.hint-panel .btn { margin-top: var(--sp-3); }

/* ---- Unified read-aloud control (one per section) ---- */
.tts-control {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1.5px solid var(--line-2); background: var(--surface);
  border-radius: 999px; padding: 6px 13px; cursor: pointer;
  font: inherit; font-size: var(--step--1); font-weight: 600; color: var(--ink-2);
}
.tts-control:hover { border-color: var(--accent); color: var(--accent); }
.tts-control .tts-label::after { content: "Listen"; }
.tts-control.is-playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.tts-control.is-playing .tts-label::after { content: "Stop"; }
.phase__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-3);
}
.phase__head h2 { margin-bottom: 0; }

/* word lit up as it is spoken */
.tts-w--on {
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--accent);
}
