/* ═══════════════════════════════════════════════
   Inline quiz cards (learn-mode + exercises surface)
   Shared .q-card visual vocabulary.
   ═══════════════════════════════════════════════ */

/* ── Exercises full-page container (Exercises only — not learn-mode) ── */
.exercises-scroll {
  position: fixed;
  inset: 0;
  background: var(--washi, var(--body, #F0EDE8));
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 500;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-ui);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: exFadeIn 0.25s ease;
}
/* Paper grain — same fractal-noise texture as learn-mode (#learn-mode-container::before) */
.exercises-scroll::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}
.exercises-scroll > * { position: relative; z-index: 1; }
@keyframes exFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Desktop: center the scroll column */
@media (min-width: 769px) {
  .exercises-scroll {
    padding: 0 24px;
  }
  .exercises-scroll .exercises-column {
    max-width: 640px;
    margin: 0 auto;
  }
}

/* Kill inherited button transitions (mirrors learn-mode behaviour) */
.exercises-scroll button:not(.q-choice):not(.quiz-begin-btn):not(.ex-length-btn):not(.ex-action-btn),
.exercises-scroll [role="button"] {
  transition: none !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Furigana visibility (mirrors learn-mode override of base.css opacity 0.55) */
.exercises-scroll ruby rt {
  opacity: 1 !important;
  font-family: var(--furigana-family);
  color: var(--furigana-color);
  font-weight: var(--furigana-weight);
  letter-spacing: 0.05em;
  font-size: max(0.55em, 10px);
}

/* Inline JP segments inside Inter body text (prompt, feedback, note bodies) */
.exercises-scroll .jp {
  font-family: var(--kanji-family);
  color: var(--jp-text);
  font-weight: 600;
  font-size: 1.1em;
  letter-spacing: 0.02em;
}
.exercises-scroll .romaji {
  font-family: var(--romaji-family);
  font-style: italic;
  font-weight: var(--romaji-weight);
  color: var(--romaji-color);
  font-size: 0.92em;
}

/* ── Exit button (top-right) ── */
.exercises-scroll .ex-exit-btn {
  position: fixed;
  top: calc(12px + var(--safe-top, 0px));
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(250, 250, 247, 0.85);
  border: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  color: var(--stone);
  font-size: 16px;
}
.exercises-scroll .ex-exit-btn:active {
  background: rgba(250, 250, 247, 1);
}

/* ── Start card (length picker) ── */
.exercises-scroll .exercises-start {
  padding: calc(64px + var(--safe-top, 0px)) var(--side, 20px) 40px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.exercises-scroll .ex-start-title {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  padding-bottom: 14px;
}
.exercises-scroll .ex-start-title::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 24px;
  height: 1px;
  background: var(--gold, #C9A96E);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  animation: exTitleDivider 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}
@keyframes exTitleDivider {
  to { transform: translateX(-50%) scaleX(1); }
}
.exercises-scroll .ex-start-title .jp {
  font-family: var(--kanji-family);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 6px;
  line-height: 1.2;
}
.exercises-scroll .ex-start-title .en {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone);
  opacity: 0.55;
  display: block;
}
.exercises-scroll .ex-start-sub {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
  margin: 0 0 32px;
  line-height: 1.5;
}
.exercises-scroll .ex-length-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--faint);
  text-align: center;
  margin-bottom: 12px;
}
.exercises-scroll .ex-length-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}
.exercises-scroll .ex-length-btn {
  height: 46px;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius, 8px);
  font-family: var(--kanji-family);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: border-color 0.15s, background 0.15s;
}
.exercises-scroll .ex-length-btn:active {
  background: rgba(44, 44, 44, 0.04);
}
.exercises-scroll .ex-length-btn.selected {
  border-color: var(--accent);
  background: rgba(61, 90, 128, 0.06);
  color: var(--accent);
}
.exercises-scroll .ex-resume-hint {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--faint);
  margin: -12px 0 20px;
}
.exercises-scroll .ex-start-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
  width: 100%;
}

/* ── Progress dots (shared) ── */
.exercises-scroll .q-progress,
.learn-mode-scroll .q-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  padding-top: 8px;
}
.exercises-scroll .q-progress {
  padding-top: calc(16px + var(--safe-top, 0px));
  position: sticky;
  top: 0;
  background: var(--washi, var(--body, #F0EDE8));
  padding-bottom: 12px;
  margin-bottom: 8px;
  z-index: 4;
}
/* Hairline floor beneath the dots — they rest above a thread */
.exercises-scroll .q-progress,
.learn-mode-scroll .q-progress { position: relative; }
.exercises-scroll .q-progress::before,
.learn-mode-scroll .q-progress::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--divider);
  pointer-events: none;
}
.exercises-scroll .q-dot,
.learn-mode-scroll .q-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--divider);
  background: transparent;
  /* transition: none — same fix as .q-choice; sticky color transition would hide
     .correct/.wrong fills under the height:0→auto card reveal. */
  transition: none;
}
.exercises-scroll .q-dot.correct,
.learn-mode-scroll .q-dot.correct { background: var(--moss); border-color: var(--moss); }
.exercises-scroll .q-dot.wrong,
.learn-mode-scroll .q-dot.wrong { background: var(--terracotta); border-color: var(--terracotta); }
/* dotPulse keyframe retained for backward compat but no longer applied — hanko replaces it */

/* ── Quiz area + q-card (shared) ── */
.exercises-scroll .quiz-area,
.learn-mode-scroll .quiz-area {
  display: none;
  padding: 0 var(--side, 20px);
  padding-bottom: calc(80px + var(--safe-bottom, 0px));
}
.exercises-scroll .quiz-area.visible,
.learn-mode-scroll .quiz-area.visible { display: block; }

.exercises-scroll .q-card,
.learn-mode-scroll .q-card {
  margin-top: 32px;
  scroll-margin-top: 64px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.exercises-scroll .q-card.active,
.learn-mode-scroll .q-card.active {
  height: auto;
  overflow: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* Staggered child reveal — mirrors learn-mode lmSectionReveal cascade.
   Children start invisible/down and animate in with deliberate rhythm.
   .q-feedback and .q-next opt out — they have their own .visible toggle. */
.exercises-scroll .q-card.active > *:not(.q-feedback):not(.q-next),
.learn-mode-scroll .q-card.active > *:not(.q-feedback):not(.q-next) {
  animation: qChildReveal 0.42s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.exercises-scroll .q-card.active > .q-counter,
.learn-mode-scroll .q-card.active > .q-counter   { animation-delay: 0ms; }
.exercises-scroll .q-card.active > .q-audio-prompt,
.learn-mode-scroll .q-card.active > .q-audio-prompt { animation-delay: 40ms; }
.exercises-scroll .q-card.active > .q-prompt,
.learn-mode-scroll .q-card.active > .q-prompt    { animation-delay: 60ms; }
.exercises-scroll .q-card.active > .q-hint-bar,
.learn-mode-scroll .q-card.active > .q-hint-bar  { animation-delay: 100ms; }
.exercises-scroll .q-card.active > .q-hint-content,
.learn-mode-scroll .q-card.active > .q-hint-content { animation-delay: 120ms; }
.exercises-scroll .q-card.active > .q-choices,
.learn-mode-scroll .q-card.active > .q-choices   { animation-delay: 140ms; }
/* Choice-level cascade within the choices grid */
.exercises-scroll .q-card.active > .q-choices .q-choice,
.learn-mode-scroll .q-card.active > .q-choices .q-choice {
  animation: qChildReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.exercises-scroll .q-card.active > .q-choices .q-choice:nth-child(1),
.learn-mode-scroll .q-card.active > .q-choices .q-choice:nth-child(1) { animation-delay: 160ms; }
.exercises-scroll .q-card.active > .q-choices .q-choice:nth-child(2),
.learn-mode-scroll .q-card.active > .q-choices .q-choice:nth-child(2) { animation-delay: 195ms; }
.exercises-scroll .q-card.active > .q-choices .q-choice:nth-child(3),
.learn-mode-scroll .q-card.active > .q-choices .q-choice:nth-child(3) { animation-delay: 230ms; }
.exercises-scroll .q-card.active > .q-choices .q-choice:nth-child(4),
.learn-mode-scroll .q-card.active > .q-choices .q-choice:nth-child(4) { animation-delay: 265ms; }
@keyframes qChildReveal {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.exercises-scroll .q-counter,
.learn-mode-scroll .q-counter {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
/* Pedagogy tags — surface what the adaptive system is doing */
.exercises-scroll .q-counter-tag,
.learn-mode-scroll .q-counter-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.exercises-scroll .q-counter-tag .jp,
.learn-mode-scroll .q-counter-tag .jp {
  font-family: var(--kanji-family);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.exercises-scroll .q-counter-tag .en,
.learn-mode-scroll .q-counter-tag .en {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.7;
}
.exercises-scroll .q-tag-echo,
.learn-mode-scroll .q-tag-echo {
  background: rgba(163, 90, 74, 0.08);
  color: var(--terracotta);
  border: 1px solid rgba(163, 90, 74, 0.25);
}
.exercises-scroll .q-tag-new,
.learn-mode-scroll .q-tag-new {
  background: rgba(201, 169, 110, 0.1);
  color: var(--color-amber-deep);
  border: 1px solid rgba(201, 169, 110, 0.4);
}
.exercises-scroll .q-type,
.learn-mode-scroll .q-type {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta);
  margin-bottom: 8px;
  opacity: 0.8;
}
.exercises-scroll .q-prompt,
.learn-mode-scroll .q-prompt {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}
.exercises-scroll .q-prompt .quiz-blank,
.learn-mode-scroll .q-prompt .quiz-blank,
.exercises-scroll .q-hint-text .quiz-blank,
.learn-mode-scroll .q-hint-text .quiz-blank {
  display: inline-block;
  width: 3em;
  border-bottom: 1.5px solid var(--stone);
  vertical-align: baseline;
}
.exercises-scroll .q-hint-text .quiz-blank,
.learn-mode-scroll .q-hint-text .quiz-blank {
  width: 2.4em;
  border-bottom-color: var(--faint);
}
.exercises-scroll .q-fb-note .jp,
.learn-mode-scroll .q-fb-note .jp { font-style: normal; }

/* ── Audio prompt ── */
.exercises-scroll .q-audio-prompt,
.learn-mode-scroll .q-audio-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: var(--radius, 8px);
  cursor: pointer;
}
.exercises-scroll .q-audio-icon,
.learn-mode-scroll .q-audio-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--divider);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exercises-scroll .q-audio-icon svg,
.learn-mode-scroll .q-audio-icon svg {
  width: 14px; height: 14px; stroke: var(--stone); fill: none; stroke-width: 1.5;
}
.exercises-scroll .q-audio-label,
.learn-mode-scroll .q-audio-label {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.02em;
}

/* ── Choice buttons ── */
.exercises-scroll .q-choices,
.learn-mode-scroll .q-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exercises-scroll .q-choice,
.learn-mode-scroll .q-choice {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius, 8px);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  /* transition: none — overrides the global `select, button` transition (components.css:481).
     The card's height:0→auto reveal pins child transitions at currentTime:0, hiding
     .correct/.wrong color states entirely. lmCorrectPulse provides the temporal feedback. */
  transition: none;
  box-shadow: none !important;
}
.exercises-scroll .q-choice:active:not(.answered),
.learn-mode-scroll .q-choice:active:not(.answered) {
  background: rgba(44, 44, 44, 0.04);
}
/* Kill inherited hover transforms (lift / shadow) — keeps choices resting, not floating */
.exercises-scroll .q-choice:hover,
.learn-mode-scroll .q-choice:hover {
  transform: none !important;
  box-shadow: none !important;
}
.exercises-scroll .q-choice.correct,
.learn-mode-scroll .q-choice.correct {
  border-color: var(--moss);
  background: rgba(107, 127, 92, 0.08);
  animation: lmCorrectPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes lmCorrectPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.exercises-scroll .q-choice.wrong,
.learn-mode-scroll .q-choice.wrong {
  border-color: var(--terracotta);
  background: rgba(163, 90, 74, 0.06);
  opacity: 0.7;
}
.exercises-scroll .q-choice.answered:not(.correct):not(.wrong),
.learn-mode-scroll .q-choice.answered:not(.correct):not(.wrong) {
  opacity: 0.35;
}
.exercises-scroll .q-choice.answered,
.learn-mode-scroll .q-choice.answered { cursor: default; }

.exercises-scroll .q-choice:has(ruby),
.learn-mode-scroll .q-choice:has(ruby) {
  font-family: var(--kanji-family);
  font-size: 20px;
  line-height: 1.9;
  color: var(--jp-text);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: block;
}
/* ── Hint bar (reading aids) ── */
.exercises-scroll .q-hint-bar,
.learn-mode-scroll .q-hint-bar {
  display: flex;
  gap: 16px;
  margin: -6px 0 8px;
}
.exercises-scroll .q-hint-btn,
.learn-mode-scroll .q-hint-btn {
  padding: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--stone);
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.exercises-scroll .q-hint-btn:active,
.learn-mode-scroll .q-hint-btn:active {
  opacity: 1;
  background: none;
  box-shadow: none;
  transform: none;
}
.exercises-scroll .q-hint-btn.active,
.learn-mode-scroll .q-hint-btn.active { opacity: 1; }

.exercises-scroll .q-hint-content,
.learn-mode-scroll .q-hint-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.exercises-scroll .q-hint-text,
.learn-mode-scroll .q-hint-text {
  display: none;
  padding: 0;
  line-height: 1.5;
  animation: hintFadeIn 0.15s ease-out;
}
.exercises-scroll .q-hint-text.visible,
.learn-mode-scroll .q-hint-text.visible { display: block; }
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
.exercises-scroll .q-reading-text,
.learn-mode-scroll .q-reading-text {
  font-family: var(--romaji-family);
  font-size: 14px;
  font-style: italic;
  font-weight: var(--romaji-weight);
  color: var(--romaji-color);
  letter-spacing: 0.01em;
}
.exercises-scroll .q-kana-text,
.learn-mode-scroll .q-kana-text {
  font-family: var(--kanji-family);
  font-size: 15px;
  font-weight: var(--kanji-weight);
  color: var(--kanji-color);
  letter-spacing: 0.02em;
}
.exercises-scroll .q-english-text,
.learn-mode-scroll .q-english-text {
  font-family: var(--english-family);
  font-size: 14px;
  font-weight: var(--english-weight);
  color: var(--english-color);
}

/* ── Option romaji subtitle (sibling row beneath kana) ── */
.exercises-scroll .q-choice-romaji,
.learn-mode-scroll .q-choice-romaji {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-style: italic;
  color: var(--color-romaji);
  margin-top: 6px;
  letter-spacing: 0.04em;
  font-weight: 400;
}
.exercises-scroll .q-choice-romaji::before,
.learn-mode-scroll .q-choice-romaji::before {
  content: '';
  display: block;
  width: 18px;
  height: 1px;
  background: var(--divider);
  margin-bottom: 5px;
}
/* Choices that contain Japanese (signaled by the romaji subtitle) — upgrade typography */
.exercises-scroll .q-choice:has(.q-choice-romaji),
.learn-mode-scroll .q-choice:has(.q-choice-romaji) {
  display: block;
  padding: 12px 16px;
  font-family: var(--kanji-family);
  font-size: 18px;
  font-weight: 600;
  color: var(--jp-text);
  line-height: 1.45;
  letter-spacing: 0.02em;
}

/* ── Ruby group styling (span-based) ── */
.exercises-scroll .q-choice .ruby-group,
.learn-mode-scroll .q-choice .ruby-group {
  display: inline;
  position: relative;
  font-family: var(--kanji-family);
  color: var(--jp-text);
  letter-spacing: 0.03em;
}
.exercises-scroll .q-choice .ruby-rt,
.learn-mode-scroll .q-choice .ruby-rt {
  display: block;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 100%;
  width: max-content;
  white-space: nowrap;
  font-size: 0.6em;
  font-weight: 400;
  line-height: 1;
  color: var(--stone);
  text-align: center;
  text-align-last: justify;
  text-justify: inter-character;
  padding-bottom: 0.05em;
}
.exercises-scroll .q-choice:has(.ruby-group),
.learn-mode-scroll .q-choice:has(.ruby-group) {
  overflow: visible;
  padding-top: 16px;
}
.exercises-scroll .q-choice .quiz-blank,
.learn-mode-scroll .q-choice .quiz-blank {
  display: inline-block;
  width: 3em;
  border-bottom: 1.5px solid var(--stone);
  vertical-align: baseline;
}

/* ── Feedback layers ── */
.exercises-scroll .q-feedback,
.learn-mode-scroll .q-feedback {
  margin-top: 16px;
  opacity: 0;
  transform: translateY(6px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}
.exercises-scroll .q-feedback.visible,
.learn-mode-scroll .q-feedback.visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 500px;
  overflow: visible;
}
.exercises-scroll .q-fb-why,
.learn-mode-scroll .q-fb-why {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  padding: 12px 16px;
  background: rgba(107, 127, 92, 0.06);
  border-left: 2px solid var(--moss);
  border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
  margin-bottom: 8px;
}
.exercises-scroll .q-fb-why.wrong-fb,
.learn-mode-scroll .q-fb-why.wrong-fb {
  border-left-color: var(--terracotta);
  background: rgba(163, 90, 74, 0.05);
}
.exercises-scroll .q-fb-note,
.learn-mode-scroll .q-fb-note {
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--faint);
  padding: 0 2px;
  margin-top: 16px;
}
.exercises-scroll .q-fb-note::before,
.learn-mode-scroll .q-fb-note::before {
  content: 'tip';
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 4px;
}

/* ── Next / end buttons ── */
.exercises-scroll .q-next,
.learn-mode-scroll .q-next {
  margin-top: 16px;
  width: 100%;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(44, 44, 44, 0.2);
  border-radius: var(--radius, 8px);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--stone);
  cursor: pointer;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.25s ease 0.15s, transform 0.25s ease 0.15s, border-color 0.15s ease, color 0.15s ease;
}
.exercises-scroll .q-next:active,
.learn-mode-scroll .q-next:active { border-color: var(--ink); color: var(--ink); }
.exercises-scroll .q-next.visible,
.learn-mode-scroll .q-next.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.exercises-scroll .q-end-practice,
.learn-mode-scroll .q-end-practice {
  display: block;
  margin-top: 12px;
  width: 100%;
  height: 40px;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--stone);
  cursor: pointer;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-decoration-color: rgba(87, 83, 78, 0.3);
  text-underline-offset: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease 0.3s;
}
.exercises-scroll .q-end-practice.visible,
.learn-mode-scroll .q-end-practice.visible {
  opacity: 0.6;
  pointer-events: auto;
}
.exercises-scroll .q-end-practice:active,
.learn-mode-scroll .q-end-practice:active { color: var(--ink); }

/* ── Begin/start button (shared with learn-mode intro) ── */
.exercises-scroll .quiz-begin-btn,
.learn-mode-scroll .quiz-begin-btn,
.exercises-scroll .ex-action-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  height: 46px;
  background: transparent;
  border: 1px solid rgba(61, 90, 128, 0.3);
  border-radius: var(--radius, 8px);
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.exercises-scroll .quiz-begin-btn:active,
.learn-mode-scroll .quiz-begin-btn:active,
.exercises-scroll .ex-action-btn:active {
  background: rgba(61, 90, 128, 0.06);
  border-color: rgba(61, 90, 128, 0.5);
}
.exercises-scroll .ex-action-btn.secondary {
  color: var(--stone);
  border-color: rgba(44, 44, 44, 0.2);
}
.exercises-scroll .ex-action-btn.secondary:active {
  background: rgba(44, 44, 44, 0.04);
  border-color: var(--ink);
  color: var(--ink);
}

/* Bilingual begin button — paired hierarchy (mirrors learn-mode section labels) */
.exercises-scroll .ex-begin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 64px;
  border-color: rgba(61, 90, 128, 0.5);
  background: rgba(61, 90, 128, 0.07);
  padding: 10px 16px 12px;
  line-height: 1.1;
  position: relative;
}
.exercises-scroll .ex-begin-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 1px;
  background: var(--gold, #C9A96E);
  opacity: 0.6;
  transform: translate(-50%, 11px);
}
.exercises-scroll .ex-begin-btn:active {
  background: rgba(61, 90, 128, 0.12);
  border-color: rgba(61, 90, 128, 0.7);
}
.exercises-scroll .ex-begin-jp {
  font-family: var(--kanji-family);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  line-height: 1;
}
.exercises-scroll .ex-begin-en {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.55;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 6px;
}

.exercises-scroll .learn-mode-scroll .quiz-intro,
.learn-mode-scroll .quiz-intro {
  margin-top: 16px;
  text-align: center;
}
.learn-mode-scroll .quiz-intro-count {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
  margin-bottom: 16px;
}

/* ── Results card ── */
.exercises-scroll .exercises-results {
  display: none;
  padding: 48px var(--side, 20px) 80px;
  text-align: center;
  animation: exFadeIn 0.3s ease;
}
.exercises-scroll .exercises-results.visible { display: block; }
.exercises-scroll .ex-results-score {
  font-family: var(--kanji-family);
  font-size: 56px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  line-height: 1.1;
}
.exercises-scroll .ex-results-score .total {
  color: var(--faint);
  font-weight: 400;
}
/* Surfaced when echoes fired — keeps the score honest about first-pass mastery */
.exercises-scroll .ex-results-firsttry {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  opacity: 0.6;
  margin-top: -4px;
  margin-bottom: 12px;
  text-align: center;
}
.exercises-scroll .ex-results-firsttry span {
  font-family: var(--kanji-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.85;
  margin-left: 6px;
  letter-spacing: 0.04em;
  text-transform: none;
}
.exercises-scroll .ex-results-msg {
  font-family: var(--kanji-family);
  font-size: 16px;
  color: var(--stone);
  margin-bottom: 32px;
  letter-spacing: 0.04em;
}

/* Hanko stamp — earned moment between score and message */
.exercises-scroll .ex-results-hanko {
  position: relative;
  width: 38px;
  height: 38px;
  margin: 16px auto;
  transform: rotate(-3deg);
  opacity: 0;
  animation: hankoSet 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
/* Ink bleed — irregular pigment under the stamp, mirrors learn-mode hanko (learn-mode.css:678) */
.exercises-scroll .ex-results-hanko::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
  animation: hankoInkBleed 0.6s ease 0.18s forwards;
}
@keyframes hankoInkBleed {
  0%   { opacity: 0; transform: scale(0.6); }
  60%  { opacity: 0.9; transform: scale(1.15); }
  100% { opacity: 0.65; transform: scale(1); }
}
.exercises-scroll .ex-results-hanko .hanko-frame {
  position: absolute;
  inset: 0;
  background: var(--terracotta);
  border-radius: 5px;
  -webkit-mask-image: radial-gradient(circle at center, transparent 11px, #000 11.5px);
          mask-image: radial-gradient(circle at center, transparent 11px, #000 11.5px);
  box-shadow: 0 1px 2px rgba(163, 90, 74, 0.25);
}
.exercises-scroll .ex-results-hanko .hanko-kanji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--kanji-family);
  font-size: 14px;
  font-weight: 700;
  color: var(--terracotta);
  letter-spacing: 0;
}
.exercises-scroll .ex-results-hanko.gold .hanko-frame {
  background: var(--gold);
  box-shadow: 0 1px 2px rgba(201, 169, 110, 0.3);
}
.exercises-scroll .ex-results-hanko.gold .hanko-kanji {
  color: var(--gold);
}
@keyframes hankoSet {
  0%   { opacity: 0; transform: scale(0.6) rotate(-3deg); }
  60%  { opacity: 1; transform: scale(1.1) rotate(-3deg); }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}
.exercises-scroll .ex-review-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 24px 0 10px;
  text-align: left;
}
.exercises-scroll .ex-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}
.exercises-scroll .ex-review-item {
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--divider);
  border-left: 2px solid var(--terracotta);
  border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.45;
}
.exercises-scroll .ex-review-item:active {
  background: rgba(163, 90, 74, 0.04);
}
.exercises-scroll .ex-review-item .word {
  font-family: var(--kanji-family);
  font-weight: 600;
  font-size: 15px;
  color: var(--jp-text);
  margin-right: 8px;
}
.exercises-scroll .ex-review-item .gloss {
  color: var(--faint);
  font-size: 12px;
}
.exercises-scroll .ex-details {
  margin: 16px 0 24px;
  text-align: left;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}
.exercises-scroll .ex-details summary {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  opacity: 0.7;
}
.exercises-scroll .ex-details summary::-webkit-details-marker { display: none; }
.exercises-scroll .ex-details summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.2s;
}
.exercises-scroll .ex-details[open] summary::before { transform: rotate(90deg); }
.exercises-scroll .ex-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.exercises-scroll .ex-details-stat {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: var(--radius, 8px);
  text-align: left;
}
.exercises-scroll .ex-details-stat .label {
  font-family: var(--font-ui);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone);
  margin-bottom: 4px;
}
.exercises-scroll .ex-details-stat .value {
  font-family: var(--kanji-family);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.exercises-scroll .ex-results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

/* ── Empty / error state ── */
.exercises-scroll .ex-empty {
  padding: 80px var(--side, 20px);
  text-align: center;
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
}
.exercises-scroll .ex-empty .jp {
  font-family: var(--kanji-family);
  font-size: 18px;
  color: var(--stone);
  display: block;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════
   ELEVATION PASS — exercises-only refinements.
   Scoped to .exercises-scroll; learn-mode untouched.
   ═══════════════════════════════════════════════ */

/* 1. Close button — unframe, shrink, quiet. No filled circle, no blur. */
.exercises-scroll .ex-exit-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--faint);
  font-size: 15px;
  top: calc(16px + var(--safe-top, 0px));
  right: 16px;
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.exercises-scroll .ex-exit-btn:hover { opacity: 1; color: var(--stone); }
.exercises-scroll .ex-exit-btn:active { background: transparent; color: var(--ink); }

/* 2. Collapse the stacked hidden-card margin-top so the first question
      rides close to the progress rail. margin-top is shared with learn-mode
      (line 280), so we override only on .exercises-scroll. */
.exercises-scroll .q-card { margin-top: 0; }
.exercises-scroll .quiz-area { padding-top: 20px; }

/* 3. Tokonoma (床の間) — the active card gets a resting surface.
      Paper under, gentle shadow, single radius. Non-active cards stay
      transparent (no competing stacked surfaces). */
.exercises-scroll .q-card.active {
  background: var(--card);
  border-radius: 14px;
  padding: 28px 28px 30px;
  box-shadow: var(--shadow-rest);
  border: 1px solid rgba(44, 44, 44, 0.04);
}

/* Card already has margin between cards; with tokonoma padding, no extra needed */
.exercises-scroll .q-card.active + .q-card.active { margin-top: 16px; }

/* Counter sits as small cap label, not a body line */
.exercises-scroll .q-card.active .q-counter {
  margin-bottom: 18px;
  opacity: 0.85;
}

/* 4. Typography rhythm — prompt and choices find their weight.
      Prompt: 17px with 1.65 line-height; body stories read as "the thing
      you're answering." Choices: 15px, 54px tap target. */
.exercises-scroll .q-card.active .q-prompt {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 22px;
}
.exercises-scroll .q-card.active .q-choice {
  min-height: 54px;
  padding: 14px 18px;
  font-size: 15px;
  border-width: 1.5px;
  border-color: var(--divider);
  background: var(--paper);
  transition: border-color 0.18s ease;
}
.exercises-scroll .q-card.active .q-choice:hover:not(.answered) {
  border-color: rgba(61, 90, 128, 0.35);
}
.exercises-scroll .q-card.active .q-choice.correct {
  background: rgba(107, 127, 92, 0.08);
  border-color: var(--moss);
}
.exercises-scroll .q-card.active .q-choice.wrong {
  background: rgba(163, 90, 74, 0.05);
  border-color: var(--terracotta);
}

/* Choices that carry Japanese — scale kanji up for legibility */
.exercises-scroll .q-card.active .q-choice:has(ruby),
.exercises-scroll .q-card.active .q-choice:has(.ruby-group),
.exercises-scroll .q-card.active .q-choice:has(.q-choice-romaji) {
  font-size: 20px;
}

/* Audio prompt blends into the card surface */
.exercises-scroll .q-card.active .q-audio-prompt {
  background: var(--paper);
  border-color: var(--divider);
  padding: 14px 16px;
  margin-bottom: 20px;
}

/* Hairline between prompt group and choices — like a scroll's folding line */
.exercises-scroll .q-card.active .q-choices {
  position: relative;
  padding-top: 20px;
}
.exercises-scroll .q-card.active .q-choices::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(to right,
    transparent,
    rgba(44, 44, 44, 0.08) 20%,
    rgba(44, 44, 44, 0.08) 80%,
    transparent);
  pointer-events: none;
}
.exercises-scroll .q-card.active .q-audio-prompt + .q-choices::before {
  display: none;
}

/* Feedback body — lives inside the card, inherits the surface */
.exercises-scroll .q-card.active .q-feedback {
  margin-top: 20px;
}

/* 5. Kintsugi breadcrumb — wrong choice grows a gold hairline from its
      bottom edge. The crack healed with gold. Persists for the card's life. */
.exercises-scroll .q-card.active .q-choice.wrong {
  position: relative;
  overflow: visible;
}
.exercises-scroll .q-card.active .q-choice.wrong::after {
  content: '';
  position: absolute;
  left: 12%; right: 12%;
  bottom: -1.5px;
  height: 1.5px;
  background: var(--gold);
  opacity: 0;
  transform-origin: left center;
  transform: scaleX(0);
  animation: qKintsugiReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
  pointer-events: none;
}
@keyframes qKintsugiReveal {
  from { opacity: 0; transform: scaleX(0); }
  60%  { opacity: 0.75; transform: scaleX(1.02); }
  to   { opacity: 0.6; transform: scaleX(1); }
}

/* Review items on results screen — carry the same gold hairline signal */
.exercises-scroll .ex-review-item {
  border-left-color: var(--gold);
  background: var(--card);
}

/* 6. Hanko at scale — the moment that closes the session.
      120px desktop, 96px mobile. Kanji uses Klee One (was Inter!). */
.exercises-scroll .ex-results-hanko {
  width: 120px;
  height: 120px;
  margin: 24px auto 20px;
}
.exercises-scroll .ex-results-hanko .hanko-frame {
  background: var(--terracotta);
  border-radius: 14px;
  -webkit-mask-image: radial-gradient(circle at center,
    transparent calc(50% - 22px),
    #000 calc(50% - 20px));
          mask-image: radial-gradient(circle at center,
    transparent calc(50% - 22px),
    #000 calc(50% - 20px));
  box-shadow: 0 2px 8px rgba(163, 90, 74, 0.2);
}
.exercises-scroll .ex-results-hanko .hanko-kanji {
  font-family: var(--kanji-family);
  font-size: 48px;
  font-weight: 500;
  color: var(--terracotta);
  letter-spacing: 0;
}
.exercises-scroll .ex-results-hanko.gold .hanko-frame {
  box-shadow: 0 2px 6px rgba(201, 169, 110, 0.25);
}
.exercises-scroll .ex-results-hanko::before {
  inset: -6px;
  border-radius: 14px;
}

/* Score becomes caption under seal, not the hero */
.exercises-scroll .ex-results-score {
  font-size: 42px;
  margin-top: 12px;
  margin-bottom: 6px;
  opacity: 0.9;
  font-weight: 500;
}
.exercises-scroll .ex-results-msg {
  font-size: 18px;
  margin-bottom: 40px;
  color: var(--stone);
  letter-spacing: 0.08em;
}
.exercises-scroll .ex-results-firsttry {
  margin-top: 0;
  margin-bottom: 20px;
}

/* 7. Start card — 練習 becomes the moment. JP hero, EN caption. */
.exercises-scroll .ex-start-title .jp {
  font-size: 38px;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  line-height: 1.1;
}
.exercises-scroll .ex-start-title .en {
  font-size: 10px;
  letter-spacing: 0.22em;
  opacity: 0.5;
}
.exercises-scroll .ex-start-title { margin-bottom: 40px; padding-bottom: 18px; }
.exercises-scroll .ex-start-title::after { width: 32px; }

.exercises-scroll .ex-length-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 16px;
}
.exercises-scroll .ex-length-btn { height: 52px; }
.exercises-scroll .ex-length-picker { max-width: 360px; margin: 0 auto 32px; gap: 10px; }

/* 8. Next button — mild indigo pull, not a CTA. */
.exercises-scroll .q-card.active .q-next {
  border-color: rgba(61, 90, 128, 0.35);
  color: var(--accent);
  font-weight: 500;
  height: 48px;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.exercises-scroll .q-card.active .q-next:hover {
  border-color: rgba(61, 90, 128, 0.6);
  background: rgba(61, 90, 128, 0.04);
}
.exercises-scroll .q-card.active .q-next:active {
  border-color: var(--accent);
  background: rgba(61, 90, 128, 0.08);
  color: var(--accent);
}

/* 9. Hint bar — sits as small meta row; pull closer to prompt */
.exercises-scroll .q-card.active .q-hint-bar {
  margin: -4px 0 12px;
  gap: 18px;
}

/* 10. Mobile — tokonoma breathes less; hanko smaller. */
@media (max-width: 600px) {
  .exercises-scroll .q-card.active {
    padding: 22px 20px 24px;
    border-radius: 12px;
  }
  .exercises-scroll .q-card.active .q-prompt {
    font-size: 16px;
    margin-bottom: 18px;
  }
  .exercises-scroll .q-card.active .q-choice { min-height: 52px; padding: 13px 16px; }
  .exercises-scroll .q-card.active .q-choice:has(ruby),
  .exercises-scroll .q-card.active .q-choice:has(.ruby-group),
  .exercises-scroll .q-card.active .q-choice:has(.q-choice-romaji) {
    font-size: 18px;
  }
  .exercises-scroll .ex-start-title .jp { font-size: 32px; }
  .exercises-scroll .ex-results-hanko { width: 96px; height: 96px; }
  .exercises-scroll .ex-results-hanko .hanko-kanji { font-size: 40px; }
  .exercises-scroll .ex-results-score { font-size: 36px; }
  .exercises-scroll .ex-results-msg { font-size: 16px; }
  .exercises-scroll .quiz-area { padding-top: 16px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .exercises-scroll { animation: none; }
  .exercises-scroll .q-card {
    transition: opacity 0.15s ease;
    transform: none;
  }
  .exercises-scroll .q-choice.correct { animation: none; }
  .exercises-scroll .q-choice.wrong::after {
    animation: none;
    opacity: 0.6;
    transform: scaleX(1);
  }
  .exercises-scroll .ex-results-hanko {
    animation: none;
    opacity: 1;
    transform: rotate(-2deg);
  }
  .exercises-scroll .ex-results-hanko::before { animation: none; opacity: 0.5; }
}
