/* NexGen Learning — Lesson app styles. Mobile-first; tokens from docs/UX_VISUAL_DIRECTION.md. */
:root {
  --ivory: #f9f7f1;
  --paper: #ffffff;
  --forest: #173f35;
  --forest-2: #215445;
  --forest-ink: #0f2b24;
  --ink: #22302d;
  --muted: #5b6964;
  --line: #e6e0d4;
  --line-2: #d6cfc0;
  --sage: #b9cfbd;
  --sage-soft: #e5eee6;
  --sage-ink: #2c5a49;
  --sand: #eadac0;
  --sand-soft: #f5eee1;
  --sand-ink: #77592c;
  --clay: #ecd5ca;
  --clay-ink: #7a4434;
  --error: #b34a42;
  --error-soft: #f8e9e6;
  --ok: #2d6a4e;
  --gold: #b08a3e;
  --gold-soft: #f4ecd9;
  --gold-ink: #7a5d22;
  --focus: #1f6fd1;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --sh-1: 0 1px 2px rgba(23, 63, 53, 0.05), 0 6px 18px rgba(23, 63, 53, 0.05);
  --sh-2: 0 10px 34px rgba(23, 63, 53, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --head: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --gutter: 16px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 76px;
}
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
h1,
h2,
h3 {
  font-family: var(--head);
  color: var(--forest-ink);
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
p {
  margin: 0;
}
a {
  color: var(--forest);
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--forest);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
}
.skip-link:focus {
  top: 10px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.ic {
  flex: none;
  vertical-align: -0.18em;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(249, 247, 241, 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
body:not([data-route='home']) .topbar {
  border-bottom-color: var(--line);
}
.topbar-in {
  max-width: 1120px;
  margin: 0 auto;
  height: 60px;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--forest-ink);
  min-height: 44px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-text strong {
  font: 800 17px/1.1 var(--head);
  letter-spacing: -0.01em;
}
.brand-text span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.profile {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--forest);
  display: grid;
  place-items: center;
}
.profile:hover {
  border-color: var(--forest);
}

/* ---------- Layout ---------- */
#view {
  outline: none;
}
.view-enter {
  animation: viewIn 0.22s var(--ease);
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px var(--gutter) 56px;
}
.page.narrow {
  max-width: 760px;
}
.practice .stage {
  max-width: 780px;
  margin: 0 auto;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.stage {
  /* Phones: no card frame — the activity itself is the focus. */
  padding: 4px 0 28px;
}
.boot {
  min-height: 60vh;
  display: grid;
  place-items: center;
}
.boot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sage);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  to {
    transform: scale(1.6);
    opacity: 0.4;
  }
}
.eyebrow {
  font: 700 12.5px/1.3 var(--head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage-ink);
  margin-bottom: 8px;
}
.lead {
  font-size: 17px;
  margin-top: 10px;
}
.bi-tr,
.prompt-tr,
.mission-tr,
.msg-tr,
.tray-tr,
.q-tr,
.lib-tr,
.forged-tr {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.45;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 700 15.5px/1.1 var(--head);
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 6px 18px rgba(23, 63, 53, 0.2);
}
.btn-primary:hover:not([disabled]) {
  background: var(--forest-2);
}
.btn-quiet {
  background: transparent;
  color: var(--forest);
  border-color: var(--line-2);
}
.btn-quiet:hover:not([disabled]) {
  border-color: var(--forest);
  background: rgba(23, 63, 53, 0.04);
}
.btn-danger {
  color: var(--error);
}
.btn-lg {
  min-height: 54px;
  padding: 0 24px;
  font-size: 16.5px;
}
.btn-sm {
  min-height: 44px;
  padding: 0 14px;
  font-size: 14.5px;
}
.iconbtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--forest);
  display: grid;
  place-items: center;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 6px 2px;
  min-height: 36px;
  color: var(--forest);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- Dashboard ---------- */
.dash {
  padding-top: 8px;
}
.hero {
  display: grid;
  gap: 18px;
  padding: 14px 0 6px;
}
.hero-title {
  font-size: clamp(38px, 10vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.mission {
  font-size: 18px;
  line-height: 1.5;
  margin-top: 14px;
  max-width: 36ch;
  color: var(--ink);
}
.ready-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-ink);
  font-weight: 700;
  font-size: 14.5px;
}
.meter {
  margin-top: 22px;
}
.meter-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  max-width: 420px;
}
.meter-seg {
  height: 5px;
  border-radius: 99px;
  background: var(--line);
}
.meter-seg.is-in_progress {
  background: linear-gradient(90deg, var(--sage) 50%, var(--line) 50%);
}
.meter-seg.is-completed {
  background: var(--forest);
}
.meter-label {
  margin-top: 9px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
}
.meter-label .is-ready {
  color: var(--ok);
  font-weight: 600;
}
.prompt-en {
  font-size: clamp(21px, 5.4vw, 27px);
  font-weight: 700;
}
.feedback {
  min-height: 1.4em;
  margin-top: 12px;
  font-size: 15px;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}
.feedback:empty {
  margin-top: 0;
  min-height: 0;
}
.feedback.is-wrong {
  color: var(--error);
}
.feedback.is-good {
  color: var(--ok);
}
.feedback .ic {
  margin-top: 2px;
}
.done-row {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.done-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 600;
  color: var(--forest-ink);
  flex-wrap: wrap;
}
.done-msg .ic {
  color: var(--sage-ink);
  margin-top: 2px;
}
.done-msg .bi-tr {
  flex-basis: 100%;
  font-weight: 400;
  padding-left: 26px;
}
.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.done-actions .btn {
  flex: 1 1 200px;
}
.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--sand-soft);
  color: var(--ink);
  font-size: 15px;
}
.notice .ic {
  margin-top: 3px;
}
.notice-ok {
  background: var(--sage-soft);
  color: var(--forest-ink);
}
.notice-warn {
  background: var(--sand-soft);
  color: #5d4520;
}
.notice-error {
  background: var(--error-soft);
  color: #7f2f29;
}

/* ---------- Phrase Forge ---------- */
.forge-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.forge-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fchip {
  position: relative;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line-2);
  background: var(--paper);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.fchip-left {
  font-weight: 700;
  font-family: var(--head);
  color: var(--forest-ink);
}
.fchip:hover:not(:disabled) {
  border-color: var(--forest);
}
.fchip.is-selected {
  border-color: var(--forest);
  background: var(--sage-soft);
  box-shadow: 0 0 0 3px rgba(23, 63, 53, 0.12);
  transform: translateY(-1px);
}
.fchip.is-solved {
  background: var(--ivory);
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  font-weight: 500;
}
.fchip-check {
  margin-left: auto;
  color: var(--sage-ink);
}
.fchip.is-locking {
  border-color: var(--ok);
  background: var(--sage-soft);
  animation: lock 0.22s var(--ease);
}
.fchip.is-wrong {
  border-color: var(--error);
  animation: shake 0.32s;
}
@keyframes lock {
  50% {
    transform: scale(0.97);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}
.forged-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 8px;
}
.forged {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sage-soft);
}
.forged.is-new {
  animation: forgeIn 0.28s var(--ease);
}
@keyframes forgeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}
.forged-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}
.forged-en {
  font-size: 16px;
  color: var(--forest-ink);
}

/* ---------- Sentence Climb ---------- */
.climb-zone {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--ivory);
  border: 1.5px dashed var(--line-2);
  transition: border-color 0.15s, background 0.15s;
}
.climb-zone.is-over,
.climb-tray.is-over {
  border-color: var(--forest);
  background: var(--sage-soft);
}
.climb-zone.is-solved {
  border-style: solid;
  border-color: var(--ok);
  background: var(--sage-soft);
}
.climb-zone.is-wrong {
  border-color: var(--error);
  animation: shake 0.32s;
}
.climb-line,
.climb-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 52px;
}
.climb-tray {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
}
.zone-empty {
  color: var(--muted);
  font-size: 14.5px;
  padding: 10px 2px;
}
.tile {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--paper);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--forest-ink);
  box-shadow: 0 2px 0 var(--line);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.tile:hover {
  border-color: var(--forest);
}
.climb-line .tile {
  background: var(--paper);
}
.tile.is-selected {
  border-color: var(--forest);
  background: var(--forest);
  color: #fff;
  box-shadow: 0 6px 16px rgba(23, 63, 53, 0.25);
  transform: translateY(-2px);
}
.tile.is-dragging {
  opacity: 0.3;
}
.tile-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  pointer-events: none;
  border-color: var(--forest);
  box-shadow: var(--sh-2);
}
body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
}
.drop-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--forest);
  z-index: 55;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(23, 63, 53, 0.15);
}
.climb-zone.is-solved .tile {
  border-color: var(--sage);
  box-shadow: none;
}
.gap {
  width: 26px;
  min-height: 46px;
  margin: 0 -4px;
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
}
.gap span {
  width: 4px;
  height: 30px;
  border-radius: 4px;
  background: var(--sage);
  transition: background 0.15s, width 0.15s;
}
.gap:hover span,
.gap:focus-visible span {
  background: var(--forest);
  width: 6px;
}
.movebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--sand-soft);
}
.hint-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--sand-soft);
  color: #5d4520;
  font-size: 15px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.hint-box .ic {
  margin-top: 3px;
}
.hint-answer {
  display: block;
  background: var(--ivory);
  color: var(--ink);
  border: 1px solid var(--line);
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.actions-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.actions-row > .btn-primary {
  flex: 1 1 140px;
  max-width: 220px;
  margin-left: auto;
}

/* ---------- Conversations ---------- */
.threads {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.thread-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 600;
  font-size: 14px;
}
.thread-tab.is-active {
  border-color: var(--forest);
  box-shadow: inset 0 0 0 1px var(--forest);
}
.thread-done {
  color: var(--ok);
  display: inline-grid;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font: 800 18px var(--head);
  background: var(--sage);
  color: var(--forest-ink);
}
.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 13.5px;
}
.avatar-rahul {
  background: var(--sage);
  color: var(--forest-ink);
}
.avatar-amir {
  background: var(--sand);
  color: #4f3a17;
}
.avatar-priya {
  background: var(--clay);
  color: #5c2f22;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line);
}
.chat-id {
  flex: 1 1 180px;
  min-width: 0;
}
.chat-name {
  font-size: 19px;
}
.chat-role {
  font-family: var(--body);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
}
.chat-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--sage-ink);
}
.chat-tools {
  display: flex;
  gap: 6px;
}
.messages {
  list-style: none;
  margin: 12px 0 0;
  padding: 14px 10px;
  border-radius: var(--r-md);
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 92%;
}
.msg-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg.is-new {
  animation: msgIn 0.24s var(--ease);
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.msg-col {
  min-width: 0;
}
.msg-who {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 4px 3px;
}
.msg-me .msg-who {
  text-align: right;
}
.msg-time {
  font-weight: 400;
  opacity: 0.8;
  margin-left: 4px;
}
.bubble {
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 15.5px;
  line-height: 1.45;
}
.msg-them .bubble {
  border-bottom-left-radius: 6px;
}
.msg-me .bubble {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.msg-voice .bubble {
  padding: 8px 12px 10px;
  min-width: 230px;
}
.msg-voice .msg-text {
  margin-top: 6px;
  font-size: 14.5px;
}
.is-hidden-caption {
  display: none;
}
.caption-reveal {
  font-size: 13px;
  min-height: 28px;
  margin-top: 2px;
}
.msg-me .linkbtn {
  color: #fff;
}
.typing {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 10px 0;
}
.typing[hidden] {
  display: none;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1s infinite;
}
.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes blink {
  50% {
    opacity: 0.25;
    transform: translateY(-2px);
  }
}
.tray-wrap {
  margin-top: 14px;
}
.tray-q {
  font: 700 16.5px var(--head);
  color: var(--forest-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-done {
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--sage-soft);
}
.chat-done .bi-tr {
  margin: 4px 0 0 26px;
}

/* ---------- Options (shared) ---------- */
.options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line-2);
  background: var(--paper);
  text-align: left;
  font-size: 15.5px;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.option:hover:not([disabled]):not([aria-disabled='true']) {
  border-color: var(--forest);
}
.option:active:not([disabled]) {
  transform: scale(0.995);
}
.option-key {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ivory);
  border: 1px solid var(--line-2);
  font: 700 13px var(--head);
  color: var(--forest);
}
.option-text {
  padding-top: 3px;
}
.option.is-wrong {
  border-color: rgba(179, 74, 66, 0.5);
  background: var(--error-soft);
  color: #6f2a25;
  cursor: default;
}
.option.is-wrong .option-key {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}
.option.is-right {
  border-color: var(--ok);
  background: var(--sage-soft);
}
.option.is-right .option-key {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}
.option[disabled] {
  cursor: default;
}
.option-radio {
  cursor: pointer;
  position: relative;
}
.option-radio input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.option-radio:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.option-radio.is-selected {
  border-color: var(--forest);
  background: #f0f5f1;
  box-shadow: inset 0 0 0 1px var(--forest);
}
.option-radio.is-selected .option-key {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}

/* ---------- Audio controls ---------- */
.achip {
  display: flex;
  align-items: center;
  gap: 10px;
  --p: 0;
  flex-wrap: wrap;
}
.achip-btn,
.vp-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--forest);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.12s, background 0.15s;
}
.achip-btn:hover,
.vp-btn:hover {
  background: var(--forest-2);
}
.achip.on-dark .achip-btn {
  background: #fff;
  color: var(--forest);
}
.i-pause,
.i-retry {
  display: none;
}
[data-state='playing'] .i-play,
[data-state='loading'] .i-play {
  display: none;
}
[data-state='playing'] .i-pause,
[data-state='loading'] .i-pause {
  display: grid;
}
[data-state='error'] .i-play {
  display: none;
}
[data-state='error'] .i-retry {
  display: grid;
}
.i-play,
.i-pause,
.i-retry {
  place-items: center;
}
.i-play {
  display: grid;
}
[data-state='loading'] .achip-btn,
[data-state='loading'] .vp-btn {
  animation: pulse-soft 0.9s infinite alternate;
}
[data-state='blocked'] .achip-btn,
[data-state='blocked'] .vp-btn,
[data-state='idle'] .achip-btn.is-nudge {
  box-shadow: 0 0 0 0 rgba(23, 63, 53, 0.4);
  animation: ring 1.4s infinite;
}
@keyframes ring {
  to {
    box-shadow: 0 0 0 10px rgba(23, 63, 53, 0);
  }
}
@keyframes pulse-soft {
  to {
    opacity: 0.6;
  }
}
.wf {
  position: relative;
  flex: 1 1 auto;
  min-width: 90px;
  height: 28px;
  display: block;
}
.wf-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.wf-bars i {
  flex: 1 1 0;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 2px;
  background: var(--line-2);
}
.wf-fill {
  clip-path: inset(0 calc(100% - var(--p) * 100%) 0 0);
}
.wf-fill i {
  background: var(--forest);
}
.on-dark .wf-bars i {
  background: rgba(255, 255, 255, 0.35);
}
.on-dark .wf-fill i {
  background: #fff;
}
.achip-time {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 30px;
}
.on-dark .achip-time {
  color: rgba(255, 255, 255, 0.8);
}
.achip-err {
  display: none;
  flex-basis: 100%;
  font-size: 13.5px;
  color: var(--error);
}
.on-dark .achip-err,
.on-dark .achip-err .linkbtn {
  color: #ffd9d3;
}
[data-state='error'] .achip-err {
  display: block;
}
.vplayer {
  display: flex;
  gap: 14px;
  align-items: center;
  --p: 0;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--ivory);
  border: 1px solid var(--line);
}
.vp-btn {
  width: 56px;
  height: 56px;
}
.vp-main {
  flex: 1;
  min-width: 0;
}
.wf-lg {
  height: 40px;
  cursor: pointer;
}
.vp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vp-restart {
  font-size: 13px;
  min-height: 36px;
}

/* ---------- Voice notes ---------- */
.note-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.note-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.note-from {
  font-weight: 700;
  color: var(--forest-ink);
}
.note-title {
  font-size: 14.5px;
  color: var(--sage-ink);
  font-weight: 600;
}
.transcript {
  margin-top: 10px;
}
.transcript-text {
  margin-top: 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--sage);
  background: var(--ivory);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 15px;
}
.question {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.q-legend {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.q-num {
  font: 700 12px var(--head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.q-en {
  font: 700 18px/1.35 var(--head);
  color: var(--forest-ink);
}

/* ---------- Test ---------- */
.test-intro h1,
.test-review h1 {
  font-size: clamp(30px, 8vw, 40px);
}
.facts {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 12px;
}
.facts li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
}
.facts .ic {
  color: var(--sage-ink);
  margin-top: 2px;
}
.audio-check {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--ivory);
  font-size: 15px;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
}
.audio-check.is-ok {
  background: var(--sage-soft);
  color: var(--forest-ink);
}
.audio-check.is-error {
  background: var(--error-soft);
  color: #7f2f29;
  align-items: flex-start;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.chip-listen {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--sand-ink);
}
.test-audio {
  margin-bottom: 4px;
}
.test-question {
  margin-top: 8px;
}
.test-question .q-en {
  font-size: clamp(19px, 5vw, 22px);
}
.test-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}
.test-nav .btn {
  flex: 1 1 0;
  max-width: 240px;
}
.qgrid-wrap {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.qgrid-wrap summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--forest);
}
.qgrid {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}
.qcell {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  font-weight: 700;
  color: var(--muted);
}
.qcell.is-answered {
  background: var(--sage-soft);
  border-color: var(--sage);
  color: var(--forest-ink);
}
.qcell.is-current {
  border-color: var(--forest);
  box-shadow: inset 0 0 0 1px var(--forest);
}
.review-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 6px;
}
.review-row {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 10px;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  min-height: 52px;
}
.review-row:hover {
  border-color: var(--forest);
}
.review-n {
  grid-row: span 2;
  font: 700 14px var(--head);
  color: var(--muted);
  padding-top: 1px;
}
.review-q {
  font-size: 14px;
  color: var(--muted);
}
.review-a {
  font-weight: 600;
  color: var(--forest-ink);
  font-size: 15px;
}
.review-row.is-missing {
  border-color: rgba(179, 74, 66, 0.4);
  background: #fffaf9;
}
.review-row.is-missing .review-a {
  color: var(--error);
}
.result-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 6px;
}
.result-hero h1 {
  font-size: clamp(24px, 6.5vw, 32px);
}
.score-ring {
  --v: 0;
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--forest) calc(var(--v) * 360deg), var(--line) 0);
  position: relative;
}
.is-notyet .score-ring {
  background: conic-gradient(var(--sand-ink) calc(var(--v) * 360deg), var(--line) 0);
}
.score-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--paper);
}
.score-ring span {
  position: relative;
  font: 600 15px var(--head);
  color: var(--muted);
}
.score-ring strong {
  font-size: 28px;
  color: var(--forest-ink);
}
.score-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 0;
}
.score-split div {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--ivory);
}
.score-split dt {
  font: 700 12px var(--head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.score-split dd {
  margin: 4px 0 0;
  font: 800 22px var(--head);
  color: var(--forest-ink);
}
.score-split dd .muted {
  font: 500 13px var(--body);
}
.suggest {
  margin-top: 16px;
}
.suggest-title {
  font-weight: 700;
  color: var(--forest-ink);
}
.suggest ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.suggest a {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-underline-offset: 3px;
}
.answers {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.answers summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--forest);
}
.answer-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 10px;
}
.answer-list > li {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.answer-list > li.is-wrong {
  background: #fffaf9;
}
.al-q {
  display: flex;
  gap: 8px;
  font-weight: 600;
  color: var(--forest-ink);
}
.al-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: #fff;
  margin-top: 1px;
}
.is-wrong .al-mark {
  background: var(--error);
}
.al-a,
.al-x {
  font-size: 14.5px;
  margin: 6px 0 0 30px;
}
.al-x {
  color: var(--muted);
}
.al-audio {
  margin: 10px 0 0 30px;
}
.prep-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}
.prep-min {
  font-weight: 700;
  color: var(--forest-ink);
}
.prep-mode {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--sand-soft);
  color: var(--sand-ink);
  font-weight: 600;
}
.prep-title {
  font-size: 18.5px;
}
.prep-title .muted {
  font-family: var(--body);
  font-weight: 500;
  font-size: 14.5px;
}
.mini-label {
  font: 700 12px var(--head);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.phrase-pills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.phrase-pills li {
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--sage-soft);
  color: var(--forest-ink);
  font-size: 14px;
  font-weight: 500;
}
.followups {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
}
.note-field {
  display: block;
  margin-top: 12px;
}
.note-field textarea {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--ivory);
  resize: vertical;
  font-size: 15px;
}
.note-field textarea:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(23, 63, 53, 0.14);
  background: #fff;
}

/* ---------- Library ---------- */
.phrases-page h1 {
  font-size: clamp(30px, 8vw, 40px);
}
.library {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 8px;
}
.lib-item {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--ivory);
}
.lib-en {
  font: 700 16.5px var(--head);
  color: var(--forest-ink);
}
.lib-ex {
  font-size: 14px;
  font-style: italic;
  color: var(--sage-ink);
  margin-top: 3px;
}

/* ---------- Dialog ---------- */
.dialog {
  border: 0;
  padding: 0;
  border-radius: var(--r-lg);
  max-width: min(460px, calc(100vw - 32px));
  box-shadow: var(--sh-2);
  color: var(--ink);
  background: var(--paper);
}
.dialog::backdrop {
  background: rgba(15, 43, 36, 0.35);
  backdrop-filter: blur(2px);
}
.dialog-body {
  padding: 22px;
}
.dialog-body h2 {
  font-size: 21px;
  margin-bottom: 10px;
}
.dialog-body p + p {
  margin-top: 8px;
}
.dialog-list {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 14.5px;
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* ---------- Shell: slim activity header + sections sheet ---------- */
.tr {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
}
.storage-warning {
  max-width: 1120px;
  margin: 8px auto 0;
  padding: 8px var(--gutter);
  color: var(--sand-ink);
  font-size: 14px;
}
body:not([data-route='home']) .topbar {
  display: none;
}
.apphead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(249, 247, 241, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  padding: 4px var(--gutter) 8px;
}
.ah-row {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ah-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--forest);
  display: grid;
  place-items: center;
  text-decoration: none;
}
.ah-btn:hover {
  background: rgba(23, 63, 53, 0.07);
}
.ah-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font: 700 15.5px/1.2 var(--head);
  color: var(--forest-ink);
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
}
.ah-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ah-step {
  font: 600 13px var(--body);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ah-bar,
.ah-segs {
  max-width: 780px;
  margin: 4px auto 0;
}
.ah-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.ah-bar span {
  display: block;
  height: 100%;
  background: var(--forest);
  border-radius: 99px;
  transition: width 0.3s var(--ease);
}
.ah-segs {
  display: flex;
  gap: 3px;
}
.ah-seg {
  /* 28px tall hit area (WCAG 2.2 AA target size) around a 4px bar */
  flex: 1;
  height: 28px;
  margin: -12px 0;
  padding: 12px 0;
  border: 0;
  background: none;
  display: block;
}
.ah-seg span {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.2s;
}
.ah-seg.is-done span {
  background: var(--sage);
}
.ah-seg.is-current span {
  background: var(--forest);
}
.ah-seg:hover span {
  background: var(--sage-ink);
}
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  border-radius: 22px 22px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--sh-2);
}
.sheet[open] {
  animation: sheetUp 0.22s var(--ease);
}
@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
.sheet::backdrop {
  background: rgba(15, 43, 36, 0.35);
}
.sheet-body {
  padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 6px 8px;
}
.sheet-head h2 {
  font-size: 16px;
}
.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sheet-extra {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.sheet-row:hover,
.sheet-row.is-active {
  background: var(--sage-soft);
}
.sheet-ic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--sage-ink);
  background: var(--ivory);
}
.sheet-row.is-done .sheet-ic {
  background: var(--forest);
  color: #fff;
}
.sheet-name {
  flex: 1;
}
.sheet-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- Dashboard ---------- */
.dash-grid {
  display: grid;
  gap: 36px;
  padding-top: 20px;
}
.btn-xl {
  width: 100%;
  min-height: 60px;
  margin-top: 26px;
  padding: 0 24px;
  justify-content: space-between;
  font-size: 17px;
}
.btn-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.btn-stack small {
  font: 500 13px var(--body);
  opacity: 0.8;
  margin-top: 2px;
}
.path-title {
  font-size: 15px;
  margin-bottom: 8px;
}
.path-title .tr {
  display: inline;
  font-size: 13px;
}
.path-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.path-extra {
  margin-top: 14px;
}
.path-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 15.5px;
}
.path-row:hover .path-name {
  color: var(--forest);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.path-dot {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 13px var(--head);
  color: var(--forest);
  border: 1px solid var(--line-2);
  background: var(--paper);
}
.path-row.is-completed .path-dot {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}
.path-row.is-in_progress .path-dot {
  border-color: var(--forest);
  box-shadow: inset 0 0 0 1px var(--forest);
}
.path-name {
  flex: 1;
}
.path-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.path-row.is-completed .path-status {
  color: var(--ok);
}
.path-row .chev {
  color: var(--line-2);
}
.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 10px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--forest);
}
.meter {
  max-width: 420px;
}
.hero .tr {
  max-width: 46ch;
  margin-top: 8px;
}

/* ---------- Activity content ---------- */
.instr h1 {
  font: 600 16px/1.4 var(--body);
  color: var(--ink);
  letter-spacing: 0;
}
.prompt .tr,
.instr .tr {
  margin-top: 4px;
}
.tip {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.tip .tr {
  display: inline;
  font-size: 13px;
  opacity: 0.85;
}
.climb-zone {
  margin-top: 18px;
}
.movebar {
  justify-content: center;
}
.actions-row {
  justify-content: flex-start;
  gap: 8px;
}
.actions-row > .btn-primary {
  margin-left: auto;
}
.iconbtn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.done-msg .tr {
  margin-top: 2px;
}
.chat-head {
  border-bottom: 0;
  padding: 14px 0 0;
}
.chat-name {
  flex: 1;
  font-size: 17px;
}
.chat-role {
  font: 500 14px var(--body);
  color: var(--muted);
}
.toggle-ic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--muted);
  display: grid;
  place-items: center;
}
.toggle-ic[aria-pressed='true'] {
  background: var(--sage-soft);
  border-color: var(--sage);
  color: var(--sage-ink);
}
.scene {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink);
  padding: 4px 8px 6px;
}
.scene .tr {
  font-size: 12.5px;
}
.scene-note {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--sage-ink);
}
.note-from {
  font: 700 16px/1.3 var(--head);
  color: var(--forest-ink);
}
.q-done {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sage-soft);
}
.q-done-mark {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: #fff;
}
.q-done-q {
  font-size: 13.5px;
  color: var(--muted);
}
.q-done-a {
  font-weight: 700;
  color: var(--forest-ink);
}
.q-done-x {
  font-size: 13.5px;
  color: var(--sage-ink);
  margin-top: 2px;
}
.pass-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 18px;
  font-size: 15.5px;
}
.pass-line .ic {
  color: var(--sage-ink);
  margin-top: 3px;
}
.more {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}
.more summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--forest);
  list-style: none;
}
.more summary::-webkit-details-marker {
  display: none;
}
.more summary::after {
  content: '+';
  margin-left: auto;
  font: 500 20px var(--body);
  color: var(--muted);
}
.more[open] summary::after {
  content: '–';
}
.more .facts {
  margin: 0 0 12px;
  padding-left: 18px;
  display: block;
  font-size: 14.5px;
  color: var(--muted);
}
.more .facts li {
  display: list-item;
  margin: 4px 0;
}
.more .phrase-pills,
.more .followups {
  margin-bottom: 14px;
}
.center {
  text-align: center;
}
.test-intro .btn-xl,
.test-intro .audio-check {
  margin-top: 18px;
}
.chip-listen {
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 14px;
}
.prep-card {
  margin-top: 6px;
}
.prep-intro {
  margin: 0 0 14px;
}
.prep-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.prep-title {
  font-size: clamp(24px, 6.5vw, 30px);
  margin-top: 10px;
  outline: none;
}
.prep-prompt {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.5;
}
.prep-prompt + .tr {
  margin-top: 6px;
}
.add-note {
  margin-top: 10px;
  min-height: 44px;
}
.prep-tools {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}
.prep-print {
  display: none;
}

/* ---------- Course journey (dashboard) ---------- */
.journey {
  padding-top: 18px;
}
.journey-grid {
  display: grid;
  gap: 34px;
}
.journey-title {
  font: 600 clamp(34px, 9.4vw, 54px) / 1.05 var(--serif);
  letter-spacing: -0.02em;
  color: var(--forest-ink);
  font-variation-settings: 'opsz' 96;
}
.journey-sub {
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
}
.journey-tr {
  margin-top: 4px;
}
.journey-progress {
  margin-top: 24px;
  padding: 16px 18px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sh-1);
}
.jp-label {
  font-size: 15px;
  color: var(--muted);
}
.jp-label strong {
  color: var(--forest-ink);
  font: 700 15.5px var(--head);
}
.jp-track {
  position: relative;
  height: 8px;
  margin: 12px 0 8px;
  border-radius: 99px;
  background: var(--sage-soft);
  overflow: hidden;
}
.jp-track span {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--forest) 0%, var(--forest-2) 92%, var(--gold) 100%);
  transition: width 0.6s var(--ease);
}
.jp-done {
  font-size: 13.5px;
  color: var(--muted);
}
.journey-cta {
  margin-top: 18px;
}
.device-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13.5px var(--body);
  cursor: pointer;
}
.device-note:hover {
  color: var(--forest);
}
.path-h {
  font-size: 15px;
  margin-bottom: 12px;
}
.path-h .tr {
  display: inline;
  font-size: 13px;
  font-family: var(--body);
}
.modules {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
/* The thread that ties the modules into one path */
.modules::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 30px;
  bottom: 30px;
  width: 2px;
  background: repeating-linear-gradient(var(--line-2) 0 6px, transparent 6px 11px);
}
.module {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.mnode {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  margin-top: 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ivory);
  border: 1.5px solid var(--line-2);
  color: var(--muted);
}
.module.is-active .mnode {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
  box-shadow: 0 0 0 5px var(--sage-soft);
}
.module.is-completed .mnode {
  background: var(--forest);
  border-color: var(--gold);
  color: var(--gold-soft);
}
.mcard {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s;
}
.module.is-active .mcard {
  border-color: var(--sage);
  box-shadow: var(--sh-1);
}
.module.is-locked .mcard {
  background: rgba(255, 255, 255, 0.55);
}
.mhead {
  font: inherit;
  margin: 0;
}
.mtoggle {
  width: 100%;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  border-radius: 18px;
  cursor: pointer;
}
.mtext {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.meyebrow {
  font: 700 11.5px/1.3 var(--head);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sage-ink);
}
.module.is-active .meyebrow {
  color: var(--gold-ink);
}
.mtitle {
  margin-top: 2px;
  font: 700 16.5px/1.25 var(--head);
  color: var(--forest-ink);
  letter-spacing: -0.01em;
}
.module.is-locked .mtitle {
  color: var(--ink);
}
.msub {
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--muted);
}
.mmeta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.mcount {
  min-width: 40px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--sage-soft);
  color: var(--sage-ink);
  font: 500 13px var(--body);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mcount strong {
  font-weight: 700;
}
.mcount.is-locked {
  background: transparent;
  color: var(--muted);
}
.mchev {
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}
.mtoggle[aria-expanded='true'] .mchev {
  transform: rotate(90deg);
}
.mbody {
  padding: 0 8px 8px;
  animation: viewIn 0.2s var(--ease);
}
.mdots {
  display: flex;
  gap: 4px;
  margin: 0 8px 6px;
}
.mdots span {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
}
.mdots .is-done {
  background: var(--forest);
}
.mdots .is-current {
  background: var(--gold);
}
.lessons {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lessons li + li {
  border-top: 1px solid var(--line);
}
.lrow {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
a.lrow:hover .ltitle {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lnum {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 13px var(--head);
  color: var(--forest);
  border: 1.5px solid var(--line-2);
  background: var(--paper);
}
.lname {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.ltitle {
  font: 600 15px/1.3 var(--body);
  color: var(--forest-ink);
}
.lsub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.lpill {
  flex: none;
  font: 700 12.5px var(--head);
  padding: 5px 11px;
  border-radius: 99px;
  color: var(--sage-ink);
  background: var(--sage-soft);
}
.lpill:empty {
  display: none;
}
.lpill-go {
  background: var(--forest);
  color: #fff;
}
.lpill-soft {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.lrow.is-completed .lnum {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}
.lrow.is-current {
  background: linear-gradient(90deg, var(--sage-soft), rgba(229, 238, 230, 0.35));
}
.lessons li:has(.is-current) + li,
.lessons li:has(+ li .is-current) {
  border-top-color: transparent;
}
.lrow.is-current .lnum {
  border: 2px solid var(--forest);
  color: var(--forest);
}
.lrow.is-locked {
  cursor: default;
}
.lrow.is-locked .ltitle {
  color: var(--muted);
  font-weight: 500;
}
.lrow.is-locked .lnum {
  border-style: dashed;
  color: var(--muted);
  background: var(--ivory);
}
.lrow.is-nudged .lnum {
  animation: nudge 0.38s var(--ease);
}
@keyframes nudge {
  25% {
    transform: rotate(-12deg);
  }
  60% {
    transform: rotate(9deg);
  }
}
.lrow.is-new {
  animation: glow 1.6s var(--ease) 0.2s 2;
}
.lrow.is-new .lock-open {
  display: grid;
  animation: lockAway 1s var(--ease) 0.5s both;
}
@keyframes lockAway {
  40% {
    transform: translateY(-2px) rotate(-14deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-6px) rotate(-14deg) scale(0.6);
    opacity: 0;
  }
}
@keyframes glow {
  0% {
    box-shadow: 0 0 0 0 rgba(176, 138, 62, 0.35);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(176, 138, 62, 0);
  }
}
.lock-toast {
  display: none;
  align-items: flex-start;
  gap: 8px;
  margin: 0 8px 8px 50px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold-ink);
  font-size: 13.5px;
  line-height: 1.4;
}
.lock-toast.is-on {
  display: flex;
  animation: viewIn 0.2s var(--ease);
}
.lock-toast .tr {
  display: block;
  font-size: 12.5px;
  color: var(--gold-ink);
  opacity: 0.85;
}
.lock-toast .ic {
  margin-top: 2px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  font: 600 14px var(--body);
  text-decoration: none;
}
.back-link:hover {
  color: var(--forest);
}

/* ---------- Lesson passed: celebration ---------- */
.celebrate {
  text-align: center;
  padding-top: 18px;
}
.cel-mark svg {
  display: block;
  margin: 0 auto 12px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cel-mark circle {
  stroke: var(--sage);
  stroke-width: 2.5;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw 0.7s var(--ease) 0.1s forwards;
}
.cel-mark path {
  stroke: var(--forest);
  stroke-width: 3.5;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.45s var(--ease) 0.6s forwards;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
.cel-eyebrow {
  font: 700 12px/1.3 var(--head);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.cel-title {
  margin-top: 6px;
  font: 600 clamp(30px, 8vw, 40px) / 1.1 var(--serif);
  letter-spacing: -0.015em;
}
.celebrate .tr {
  margin-top: 6px;
}
.cel-score {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
}
.cel-score strong {
  color: var(--forest-ink);
}
.cel-module {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.cel-module span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: dotIn 0.3s var(--ease) both;
}
.cel-module span:nth-child(1) { animation-delay: 0.7s; }
.cel-module span:nth-child(2) { animation-delay: 0.82s; }
.cel-module span:nth-child(3) { animation-delay: 0.94s; }
.cel-module span:nth-child(4) { animation-delay: 1.06s; }
.cel-module span:nth-child(5) { animation-delay: 1.18s; }
@keyframes dotIn {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.celebrate.is-module .cel-mark circle {
  stroke: var(--gold);
}
.unlock {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 360px;
  margin: 24px auto 0;
  padding: 12px 16px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh-1);
}
.unlock-lock {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--forest);
}
.unlock-lock svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  overflow: visible;
}
.unlock.is-open .shackle {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  animation: shackle 0.6s var(--ease) 1.1s both;
}
@keyframes shackle {
  to {
    transform: translateY(-2.5px) rotate(28deg);
  }
}
.unlock.is-open .unlock-lock {
  animation: unlockBg 0.4s var(--ease) 1.4s both;
}
@keyframes unlockBg {
  to {
    background: var(--forest);
    color: #fff;
  }
}
.unlock.is-soon .unlock-lock {
  background: var(--ivory);
  color: var(--muted);
}
.unlock-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.unlock-k {
  font-size: 13px;
  color: var(--muted);
}
.unlock-text strong {
  font: 700 16px var(--head);
  color: var(--forest-ink);
}
.cel-progress {
  max-width: 320px;
  margin: 22px auto 0;
}
.cel-progress p {
  font-size: 13.5px;
  color: var(--muted);
}
.cel-progress .jp-track span {
  width: var(--to);
  animation: grow 0.9s var(--ease) 1.2s both;
}
@keyframes grow {
  from {
    width: var(--from);
  }
  to {
    width: var(--to);
  }
}
.cel-cta {
  margin-top: 26px;
}
.cel-links {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}
@media (min-width: 600px) {
  .celebrate .cel-cta {
    width: auto;
    min-width: 300px;
  }
}
@media (min-width: 960px) {
  .journey {
    padding-top: 40px;
  }
  .journey-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 72px;
    align-items: start;
  }
  .journey-hero {
    position: sticky;
    top: 100px;
  }
  .journey-sub {
    font-size: 19px;
  }
  .journey-cta {
    width: 100%;
  }
  .path-h {
    margin-top: 6px;
  }
}

/* ---------- Larger screens ---------- */
@media (min-width: 600px) {
  :root {
    --gutter: 24px;
  }
  .stage {
    padding: 26px 28px 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
  }
  .forge-cols {
    gap: 16px;
  }
  .fchip {
    font-size: 16px;
    padding: 12px 16px;
  }
  .messages {
    padding: 18px 16px;
  }
  .sheet {
    margin: auto;
    border-radius: 22px;
  }
  .apphead {
    padding-top: 10px;
  }
  .page.practice {
    padding-top: 18px;
  }
  .msg {
    max-width: 80%;
  }
}
@media (min-width: 900px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 56px;
    align-items: start;
    padding-top: 48px;
  }
  .hero .btn-xl {
    width: auto;
    min-width: 300px;
  }
  .mission {
    font-size: 20px;
  }
  .page {
    padding-top: 24px;
  }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .topbar,
  .apphead,
  .stage,
  .no-print,
  .skip-link,
  .storage-warning {
    display: none !important;
  }
  body {
    background: #fff;
    font-size: 12pt;
  }
  .page {
    padding: 0;
    max-width: none;
  }
  .prep-print {
    display: block !important;
  }
  .prep-print-item {
    break-inside: avoid;
    border-top: 1px solid #ccc;
    padding-top: 8px;
    margin-bottom: 12px;
  }
  .print-lines {
    height: 48px;
    border-bottom: 1px solid #bbb;
  }
  .note-field textarea {
    border: 1px solid #bbb;
    background: #fff;
    min-height: 60px;
  }
}

/* Headings receive focus on route change for screen readers; no ring for that programmatic focus. */
h1[tabindex='-1']:focus {
  outline: none;
}
