/* css/components/exercise.css */
/* Main exercise layout and container styles */

.exercise-container {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 40px;
  border: 1px solid var(--border-light);
}

.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
}

.exercise-title h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.exercise-subtitle {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.exercise-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 4px 14px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
}

.exercise-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-exit {
  background: #f1f5f9;
  border: none;
  color: var(--text-medium);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.btn-exit:hover {
  background: #fee2e2;
  color: var(--incorrect);
  transform: rotate(90deg);
}

/* Cambridge Score buttons in exercise toolbar */
.btn-cambridge-score {
  background: #e30613;
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(227, 6, 19, 0.3);
}

.btn-cambridge-score:hover {
  background: #c00510;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(227, 6, 19, 0.45);
}

.btn-cambridge-overall {
  background: #b71c1c;
  box-shadow: 0 2px 8px rgba(183, 28, 28, 0.3);
}

.btn-cambridge-overall:hover {
  background: #8e0000;
  box-shadow: 0 4px 12px rgba(183, 28, 28, 0.45);
}

.exercise-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-light);
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.exercise-info-left {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 1.05rem;
  color: var(--text-medium);
  font-weight: 500;
}

.exercise-info-left i {
  margin-right: 6px;
  color: var(--primary);
}

.exercise-info-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.exercise-duration {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-medium);
}

.exercise-duration i {
  color: var(--primary);
}

.exercise-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--timer-normal);
}

.exercise-timer i {
  color: var(--primary);
}

.score-display {
  background: var(--primary);
  color: white;
  padding: 6px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 60px;
  text-align: center;
}

.exercise-description {
  background: linear-gradient(135deg, #f0f4ff, #f8fafc);
  border-left: 4px solid var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.05rem;
  color: var(--text-medium);
  line-height: 1.5;
}

.exercise-main-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 20px;
}

.reading-text-enhanced {
  font-size: 1.15rem;
  line-height: 1.9;
  color: #3c3c3c;
  background: #fff;
  padding: 28px 32px 32px;
  border-radius: 16px;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-top: 4px solid var(--ex-duo-blue, #1cb0f6);
  position: relative;
  box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Nunito', sans-serif;
}

.reading-text-enhanced p {
  margin-bottom: 18px;
}

.reading-text-enhanced p:last-child {
  margin-bottom: 0;
}

/* Duolingo-style article title inside the reading card */
.reading-text-enhanced .content-title-block {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 2px solid #f0f0f0;
  text-align: left;
}

.reading-text-enhanced .content-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  letter-spacing: -0.01em;
}

.reading-text-enhanced .content-subtitle {
  font-size: 0.98rem;
  color: #888;
  font-style: italic;
  margin-top: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.45;
}

/* Drop cap on first paragraph for Duolingo-style reading feel */
.reading-text-enhanced .toggle-text-section p:first-of-type::first-letter {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 3em;
  font-weight: 700;
  color: var(--ex-duo-orange, #f47417);
  float: left;
  line-height: 0.8;
  margin-right: 6px;
  margin-top: 6px;
}

/* Subtle paragraph hover highlight (reading text only, not cloze/gap paragraphs) */
.reading-text-enhanced .toggle-text-section p {
  border-radius: 6px;
  transition: background 0.2s;
  text-align: justify;
  hyphens: auto;
}

.reading-text-enhanced .toggle-text-section p:hover {
  background: var(--ex-duo-blue-light, #ddf4ff);
}

/* Reading card icon badge in top-right corner */
.reading-text-enhanced::after {
  content: '\f518';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1rem;
  color: var(--ex-duo-blue, #1cb0f6);
  opacity: 0.35;
  pointer-events: none;
}

/* Legacy aliases — same purple card style as explanations-panel (B1 Reading 3/4) */
.explanations-section {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-top: 4px solid var(--ex-duo-purple, #ce82ff);
  border-radius: 16px;
  padding: 20px 22px 22px;
  margin-top: 24px;
  box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Nunito', sans-serif;
}

.explanations-section h3 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: var(--ex-duo-text, #4b4b4b);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.explanations-section h3 i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--ex-duo-purple-light, #f3e8ff);
  color: var(--ex-duo-purple-dark, #a855f7);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.explanation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 0.98rem;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.6;
  box-shadow: 0 2px 0 #e5e5e5;
}

.explanation-item:last-child {
  margin-bottom: 0;
}

.explanation-item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ex-duo-purple, #ce82ff);
  color: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  min-width: 30px;
  height: 30px;
  border-radius: 10px;
  flex-shrink: 0;
  padding: 0 4px;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.explanation-item-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--ex-duo-text, #4b4b4b);
}

/* Toggle view for text/questions (Parts 5, 6, 8) */
.toggle-view-header {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 30px;
  background: #f8fafc;
  color: var(--text-medium);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-view-btn:hover {
  border-color: var(--primary-light);
  background: #f0f4ff;
  color: var(--primary);
}

.toggle-view-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.toggle-view-btn.active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

/* Part-level progress pill */
.part-score-display {
  background: var(--secondary);
  color: white;
  padding: 4px 14px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 50px;
  text-align: center;
}

/* Content section header with title/subtitle and toggle buttons */
.content-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-radius: 16px;
  padding: 14px 20px;
  margin-bottom: 16px;
  margin-top: 16px;
  gap: 12px;
}

.content-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.content-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-section-header .toggle-view-header {
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Exercise header right section */
.exercise-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Part navigation row */
.part-nav-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.part-nav-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: var(--text-medium);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
}

.part-nav-cell:hover {
  border-color: var(--primary-light);
  background: #f0f4ff;
  color: var(--primary);
}

.part-nav-cell.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.part-nav-cell.completed {
  background: #dcfce7;
  border-color: #86efac;
  color: #16a34a;
}

.part-nav-cell.completed.active {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}

.part-nav-check {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.55rem;
  background: #16a34a;
  color: white;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   EXERCISE ERROR CARD
   ============================================ */
.exercise-error-card {
  background: linear-gradient(135deg, #fff1f2 0%, #ffffff 100%);
  border: 1.5px solid #fecaca;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  max-width: 520px;
  margin: 40px auto;
  box-shadow: 0 4px 24px rgba(239, 68, 68, 0.08);
  animation: fadeInUp 0.4s ease;
}

.exercise-error-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.exercise-error-icon i {
  font-size: 2rem;
  color: white;
}

.exercise-error-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 10px;
}

.exercise-error-desc {
  color: #6b7280;
  font-size: 1rem;
  margin-bottom: 16px;
}

.exercise-error-detail {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 24px;
}

.exercise-error-detail code {
  font-size: 0.85rem;
  color: #b91c1c;
  word-break: break-word;
}

.exercise-error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.exercise-error-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.exercise-error-btn-primary {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.exercise-error-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.exercise-error-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.exercise-error-btn-secondary:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

/* ====== Explanation mode styles ====== */

/* Explanation button in toggle-view-header */
.toggle-view-btn.btn-explanation-mode {
  border-color: var(--ex-duo-purple, #ce82ff);
  color: var(--ex-duo-purple-dark, #a855f7);
}

.toggle-view-btn.btn-explanation-mode:hover {
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-color: var(--ex-duo-purple, #ce82ff);
  color: var(--ex-duo-purple-dark, #a855f7);
}

.toggle-view-btn.btn-explanation-mode.explanation-active {
  background: var(--ex-duo-purple, #ce82ff);
  border-color: var(--ex-duo-purple-dark, #a855f7);
  color: #fff;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.toggle-view-btn.btn-explanation-mode.explanation-active:hover {
  background: #d9a0ff;
  border-color: var(--ex-duo-purple-dark, #a855f7);
  color: #fff;
}

/* Active question display above text */
.explanation-question-display {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ex-duo-purple-light, #f3e8ff);
  border: 2px solid var(--ex-duo-purple, #ce82ff);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 14px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ex-duo-text, #4b4b4b);
  position: static;
  z-index: 10;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 35%, #e5e5e5);
  font-family: 'Nunito', sans-serif;
}

.explanation-question-display.sticky-mode {
  position: sticky;
  top: 0;
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-color: var(--ex-duo-purple, #ce82ff);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 35%, #e5e5e5);
}

.explanation-question-display.sticky-mode .eq-number {
  background: var(--ex-duo-purple, #ce82ff);
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.eq-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ex-duo-purple, #ce82ff);
  color: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  min-width: 32px;
  min-height: 32px;
  aspect-ratio: 1;
  border-radius: 10px;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.eq-text {
  font-weight: 600;
  color: var(--ex-duo-text, #4b4b4b);
}

.eq-question-text {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Options layout: rows for Part 5 */
.eq-options.eq-options-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.eq-options.eq-options-rows .eq-option {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  background: #fff;
  box-shadow: 0 2px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ex-duo-text, #4b4b4b);
}

.eq-options.eq-options-rows .eq-option.eq-option-correct {
  border-color: var(--ex-duo-purple, #ce82ff);
  background: var(--ex-feedback-bg, #fff);
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
  color: var(--ex-duo-purple-text, #5b21b6);
}

/* Options layout: columns for Parts 6, 8 */
.eq-options.eq-options-columns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.eq-options.eq-options-columns .eq-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 12px;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  background: #fff;
  box-shadow: 0 2px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ex-duo-text, #4b4b4b);
}

.eq-options.eq-options-columns .eq-option.eq-option-correct {
  border-color: var(--ex-duo-purple, #ce82ff);
  background: var(--ex-feedback-bg, #fff);
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
  color: var(--ex-duo-purple-text, #5b21b6);
}

/* Evidence [n]...[/n]: explanation styling only under .explanation-mode-text */
.evidence-explanation-mode {
  display: none;
}

/* Only the active explanation question shows passage highlighting; others stay plain text.
   (Part 7 adds .evidence-active-q to all wraps so every gap stays highlighted there.) */
.explanation-mode-text .evidence-wrap:not(.evidence-active-q) > .evidence-normal {
  display: inline;
}

.explanation-mode-text .evidence-wrap:not(.evidence-active-q) > .evidence-explanation-mode {
  display: none;
}

.explanation-mode-text .evidence-wrap.evidence-active-q > .evidence-normal {
  display: none;
}

.explanation-mode-text .evidence-wrap.evidence-active-q > .evidence-explanation-mode {
  display: inline;
}

.explanation-mode-text .evidence-explanation-mode {
  color: var(--ex-duo-purple-text, #5b21b6);
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-radius: 4px;
  padding: 0 2px;
  text-decoration: underline;
  text-decoration-color: var(--ex-duo-purple, #ce82ff);
  text-underline-offset: 2px;
}

/* Active question only: inner .evidence-core carries the purple highlight and a darker
   double underline; avoid stacking .evidence-explanation-mode underline/background with
   .evidence-marker.evidence-active border. */
.explanation-mode-text .evidence-wrap.evidence-active-q > .evidence-explanation-mode.evidence-marker.evidence-active {
  color: inherit;
  background: transparent;
  border-bottom: none;
  text-decoration: none;
  padding: 0;
  border-radius: 0;
}

/* Inner phrase: matches parent until this wrap is the active explanation question (.evidence-active-q). */
.explanation-mode-text .evidence-explanation-mode .evidence-core {
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 0;
  font-weight: inherit;
  text-decoration: inherit;
  text-underline-offset: inherit;
}

/* Inactive markers within the active question stay plain until .evidence-active is applied. */
.explanation-mode-text .evidence-explanation-mode.evidence-marker:not(.evidence-active) {
  color: inherit;
  background: transparent;
  border-radius: 0;
  padding: 0;
  text-decoration: none;
}

.explanation-mode-text .evidence-wrap.evidence-active-q .evidence-explanation-mode .evidence-core {
  background: var(--ex-duo-purple-light, #f3e8ff);
  color: var(--ex-duo-purple-text, #5b21b6);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 700;
  text-decoration: underline wavy;
  text-decoration-color: var(--ex-duo-purple, #ce82ff);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  box-decoration-break: clone;
}

/* Evidence markers in text (rendered from [n]...[/n]) */
.evidence-marker {
  transition: background 0.2s, border-bottom 0.2s;
}

.evidence-marker.evidence-active {
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-bottom: 2px solid var(--ex-duo-purple, #ce82ff);
  border-radius: 4px;
  padding: 0 1px;
}

/* C1 Reading Part 7: hover explanation on evidence markers in gapped text */
.c1-reading7 .evidence-marker.evidence-active {
  position: relative;
  cursor: help;
}

.c1-reading7 .evidence-marker.evidence-active[data-explanation]::after {
  content: attr(data-explanation);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: var(--ex-duo-text, #4b4b4b);
  border: 2px solid var(--ex-duo-purple, #ce82ff);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  white-space: normal;
  max-width: 300px;
  min-width: 150px;
  display: none;
  z-index: 30;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 35%, #e5e5e5);
  font-weight: 600;
  line-height: 1.45;
  pointer-events: none;
  font-family: 'Nunito', sans-serif;
}

.c1-reading7 .evidence-marker.evidence-active[data-explanation]:hover::after {
  display: block;
}

/* Options display in explanation-question-display */
.eq-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.eq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.eq-option {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  background: #f1f5f9;
  color: var(--text-medium);
  border: 1px solid #e2e8f0;
}

.eq-option.eq-option-correct {
  background: var(--ex-duo-purple-light, #f3e8ff);
  color: var(--ex-duo-purple-text, #5b21b6);
  border-color: var(--ex-duo-purple, #ce82ff);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

/* Explanations panel below exercise (Parts 5-8) */
.explanations-panel {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-top: 4px solid var(--ex-duo-purple, #ce82ff);
  border-radius: 16px;
  padding: 20px 22px 22px;
  margin-top: 24px;
  box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Nunito', sans-serif;
}

.explanations-panel h3 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: var(--ex-duo-text, #4b4b4b);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.explanations-panel h3 i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--ex-duo-purple-light, #f3e8ff);
  color: var(--ex-duo-purple-dark, #a855f7);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.explanation-card {
  padding: 14px 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  box-shadow: 0 2px 0 #e5e5e5;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.explanation-card:last-child {
  margin-bottom: 0;
}

.explanation-card:hover {
  border-color: var(--ex-duo-purple, #ce82ff);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 30%, #e5e5e5);
}

.explanation-card.explanation-active {
  border-color: var(--ex-duo-purple, #ce82ff);
  background: var(--ex-duo-purple-light, #f3e8ff);
  box-shadow: 0 3px 0 var(--ex-duo-purple-dark, #a855f7);
}

.explanation-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.explanation-card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ex-duo-purple, #ce82ff);
  color: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  min-width: 30px;
  height: 30px;
  border-radius: 10px;
  flex-shrink: 0;
  padding: 0 4px;
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.explanation-card.explanation-active .explanation-card-number {
  background: var(--ex-duo-purple-dark, #a855f7);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 80%, #000);
}

.explanation-card-text {
  font-size: 0.98rem;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.6;
  flex: 1;
  font-weight: 600;
}

.explanation-card-text .explanation-term {
  display: inline;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 8px;
  font-weight: 800;
  color: var(--ex-duo-purple-dark, #7c3aed);
  background: var(--ex-duo-purple-light, #f3e8ff);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.explanation-card.explanation-active .explanation-card-text .explanation-term {
  color: #5b21b6;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ex-duo-purple, #ce82ff) 55%, #fff);
}

/* Word-formation explanations: grammar rule + transform chip */
.explanation-card-header:has(.explanation-wf-chip) {
  align-items: center;
}

.explanation-card-text:has(.explanation-wf-chip) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.explanation-card-rule {
  flex: 1;
  min-width: 0;
}

.explanation-wf-chip {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #f8fafc;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  box-shadow: 0 2px 0 #e5e5e5;
}

.explanation-wf-root,
.explanation-wf-result {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 8px;
  line-height: 1.45;
}

.explanation-wf-root {
  color: #fff;
  background: var(--ex-duo-blue, #1cb0f6);
  border: 2px solid var(--ex-duo-blue-dark, #1899d6);
}

.explanation-wf-arrow {
  font-size: 1rem;
  font-weight: 800;
  color: #94a3b8;
  line-height: 1;
  user-select: none;
}

.explanation-wf-result {
  color: #fff;
  background: var(--ex-duo-practice, #58cc02);
  border: 2px solid var(--ex-duo-practice-dark, #58a700);
}

.explanation-card.explanation-active .explanation-wf-chip {
  background: #fff;
  border-color: color-mix(in srgb, var(--ex-duo-purple, #ce82ff) 40%, #e5e5e5);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 25%, #e5e5e5);
}

/* Listening transcript in main content area */
.listening-transcript-main {
  padding: 0;
}

.listening-transcript-main .transcript-extract {
  margin-bottom: 16px;
}

.listening-transcript-main .transcript-text {
  font-size: 1rem;
  line-height: 1.8;
  text-align: justify;
  hyphens: auto;
}

.listening-transcript-context {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%);
  border: 1px solid #a7f3d0;
}

.listening-transcript-context-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #047857;
  margin-bottom: 8px;
}

.listening-transcript-context-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text-dark);
  text-align: justify;
  hyphens: auto;
}

.listening-transcript-main .transcript-extract-interview {
  border-radius: 12px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #e5e5e5;
}

.listening-transcript-main .transcript-turn-interviewer {
  border-left: 4px solid #0284c7;
  background: #f0f9ff;
}

.listening-transcript-main .transcript-turn-guest {
  border-left: 4px solid #0d9488;
  background: #f0fdfa;
}

.listening-transcript-main .transcript-turn-other {
  border-left: 4px solid #94a3b8;
}

.listening-transcript-main .transcript-speaker-card {
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #2D2E5F;
  box-shadow: 0 2px 10px rgba(45, 46, 95, 0.06);
}

.listening-transcript-main .transcript-speaker-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}

.listening-transcript-main .transcript-turn-interviewer .transcript-speaker-label {
  color: #0369a1;
}

.listening-transcript-main .transcript-turn-guest .transcript-speaker-label {
  color: #0f766e;
}

.listening-transcript-main .transcript-extract-interview .transcript-text {
  text-align: justify;
  hyphens: auto;
}

/* B1 Listening — Duolingo transcript styling */
.dashboard-layout--exercise .b1-listening .listening-transcript-context {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f0f9ff 0%, var(--ex-duo-blue-light, #ddf4ff) 100%);
  border: 2px solid var(--ex-duo-blue, #1cb0f6);
  box-shadow: 0 4px 0 var(--ex-duo-blue-dark, #1899d6);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-context-label {
  display: inline-flex;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ex-duo-blue, #1cb0f6);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-context-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  color: var(--ex-duo-text, #4b4b4b);
  text-align: justify;
  hyphens: auto;
}

.dashboard-layout--exercise .b1-listening .toggle-text-section .listening-transcript-context-text::first-letter {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  float: none;
  line-height: inherit;
  margin: 0;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-extract-interview {
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  box-shadow: 0 3px 0 var(--ex-duo-border, #e5e5e5);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-interviewer {
  border-left: 4px solid var(--ex-duo-blue, #1cb0f6);
  background: var(--ex-duo-blue-light, #ddf4ff);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-guest {
  border-left: 4px solid var(--ex-duo-orange, #f47417);
  background: var(--ex-duo-orange-light, #fff0e6);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-interviewer .transcript-speaker-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: var(--ex-duo-blue-dark, #1899d6);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-guest .transcript-speaker-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: var(--ex-duo-orange-dark, #d45f0a);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.7;
  text-align: justify;
  hyphens: auto;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-speaker-card {
  padding: 14px 16px;
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 12px;
  box-shadow: 0 2px 0 var(--ex-duo-border, #e5e5e5);
  margin-bottom: 10px;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-speaker-card.transcript-turn-interviewer {
  border-left: 4px solid var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-speaker-card.transcript-turn-guest {
  border-left: 4px solid var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-speaker-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  color: var(--ex-duo-blue-dark, #1899d6);
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-extract-header-only {
  margin-bottom: 12px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-extract-header-only .transcript-extract-header {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--ex-duo-blue-light, #ddf4ff);
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  box-shadow: 0 3px 0 var(--ex-duo-border, #e5e5e5);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.5;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-other {
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
}

.dashboard-layout--exercise .b1-listening .listening-transcript-main .transcript-turn-other .transcript-speaker-label {
  color: #64748b;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .exercise-container {
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 24px;
  }

  .exercise-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .exercise-title h2 {
    font-size: 1.28rem;
    overflow-wrap: anywhere;
  }

  .exercise-toolbar,
  .exercise-header-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .exercise-info,
  .exercise-info-left,
  .exercise-info-right {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .dashboard-layout--exercise .exercise-info--single-row {
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-left {
    width: 100%;
    flex: 0 0 auto;
    padding-bottom: 0;
    padding-left: 8px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right .exercise-timer {
    margin-left: auto;
  }

  .exercise-info {
    padding: 12px 14px;
  }

  .score-display,
  .part-score-display {
    align-self: flex-start;
  }

  .reading-text-enhanced .toggle-text-section p,
  .listening-transcript-main .transcript-text {
    text-align: justify;
    hyphens: auto;
  }

  .reading-text-enhanced {
    padding: 18px 20px 22px;
    font-size: 1.02rem;
    line-height: 1.75;
  }

  .reading-text-enhanced .content-title {
    font-size: 1.25rem;
  }

  .content-section-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
  }

  .content-title,
  .content-subtitle {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .content-section-header .toggle-view-header,
  .toggle-view-header {
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .toggle-view-btn {
    flex: 0 0 auto;
  }

  .part-nav-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  }

  .part-nav-cell {
    width: auto;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .exercise-container {
    padding: 14px;
    border-radius: 16px;
  }

  .exercise-description,
  .explanations-section {
    padding: 14px;
  }

  .reading-text-enhanced {
    padding: 14px 16px 18px;
  }
}

@media (max-width: 360px) {
  .exercise-container {
    padding: 10px;
  }

  .reading-text-enhanced {
    padding: 12px 12px 14px;
    font-size: 0.93rem;
  }

  .exercise-description {
    padding: 7px 9px;
    font-size: 0.82rem;
  }
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .exercise-container {
    position: relative;
    padding: 14px;
  }

  .exercise-header {
    margin-bottom: 10px;
    padding-right: 46px;
  }

  .exercise-title h2 {
    margin-bottom: 2px;
    font-size: 1.08rem;
    line-height: 1.15;
  }

  .exercise-subtitle,
  .exercise-badge,
  .mixed-mode-badge,
  .exam-mode-badge,
  .practice-mode-badge {
    font-size: 0.72rem;
  }

  .exercise-header-right {
    gap: 8px;
  }

  .btn-exit {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    min-height: 36px !important;
    z-index: 3;
  }

  .btn-cambridge-score {
    width: 34px;
    height: 34px;
    min-height: 34px !important;
  }

  .score-display {
    min-width: 48px;
    padding: 5px 10px;
    font-size: 0.86rem;
  }

  .exercise-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px 10px;
    margin-bottom: 10px;
    border-radius: 14px;
  }

  .dashboard-layout--exercise .exercise-info--single-row {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    overflow: hidden;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-left {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
    padding-left: 8px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right {
    width: 100%;
    flex-shrink: 0;
    justify-content: space-between;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right .exercise-timer {
    margin-left: auto;
  }

  .exercise-info-left,
  .exercise-info-right {
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
  }

  .exercise-info-left {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-left: 8px;
  }

  .exercise-info-right {
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .toggle-view-btn {
    width: auto;
    min-width: 42px;
    height: 42px;
    min-height: 42px !important;
    padding: 0 10px;
    border-radius: 14px;
    gap: 6px;
    justify-content: center;
    align-items: center;
  }

  .toggle-view-btn span {
    display: inline;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  .toggle-view-btn i {
    margin: 0;
    font-size: 1rem;
    line-height: 1;
  }

  .part-nav-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .part-nav-cell {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-height: 40px !important;
    border-radius: 11px;
    font-size: 0.9rem;
  }

  .exercise-timer,
  .part-score-display {
    font-size: 0.84rem;
  }

  .part-score-display {
    min-width: 44px;
    padding: 4px 9px;
  }

  .exercise-description {
    margin-top: 0;
    margin-bottom: 8px;
    padding: 6px 10px;
    font-size: 0.86rem;
    line-height: 1.45;
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
  }

  .exercise-description p {
    margin: 0;
  }

  .exercise-main-layout {
    gap: 12px;
    margin-top: 10px;
  }

  .reading-text-enhanced {
    padding: 14px 16px 18px;
    border-radius: 14px;
    font-size: 0.96rem;
    line-height: 1.65;
  }

  .reading-text-enhanced .content-title {
    font-size: 1.15rem;
  }

  .reading-text-enhanced .toggle-text-section p:first-of-type::first-letter {
    font-size: 2.4em;
  }

  .content-section-header {
    gap: 8px;
    margin: 10px 0;
  }

  .explanations-section,
  .explanations-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .explanation-wf-chip {
    display: none !important;
  }

  .explanation-card-text:has(.explanation-wf-chip) {
    display: block;
  }
}

/* ── Test exercise layout: full-width content, no white card ─────────── */

:root {
  --ex-duo-blue: #1cb0f6;
  --ex-duo-blue-dark: #1899d6;
  --ex-duo-blue-hover: #2eb8f7;
  --ex-duo-blue-light: #ddf4ff;
  --ex-duo-orange: #f47417;
  --ex-duo-orange-dark: #d45f0a;
  --ex-duo-orange-hover: #f6802a;
  --ex-duo-orange-light: #fff0e6;
  --ex-duo-purple: #ce82ff;
  --ex-duo-purple-dark: #a855f7;
  --ex-duo-purple-light: #f3e8ff;
  --ex-duo-purple-text: #5b21b6;
  --ex-duo-practice: #58cc02;
  --ex-duo-practice-dark: #58a700;
  --ex-duo-practice-light: #d7ffb8;
  --ex-duo-border: #e5e5e5;
  --ex-duo-text: #4b4b4b;
  --ex-duo-text-muted: #afafaf;
  --ex-duo-canvas: #f7f7f7;
  --ex-duo-info-bg: #ddf4ff;
  --ex-duo-info-border: #1cb0f6;
  --ex-feedback-bg: #fff;
}

body:has(.dashboard-layout--exercise) {
  background: var(--ex-duo-canvas);
}

body:has(.dashboard-layout--exercise) .app-container,
body:has(.dashboard-layout--exercise) #main-content {
  background: var(--ex-duo-canvas);
}

.dashboard-layout--exercise {
  background: var(--ex-duo-canvas);
}

.dashboard-layout--exercise .dashboard-center--exercise {
  background: var(--ex-duo-canvas);
}

.dashboard-layout--exercise .exercise-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  border: none;
  margin-bottom: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.dashboard-layout--exercise .exercise-page-wrapper {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.dashboard-layout--exercise .exercise-main-layout {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 0;
}

.dashboard-layout--exercise .exercise-main-layout > .exercise-header,
.dashboard-layout--exercise .exercise-main-layout > .exercise-info,
.dashboard-layout--exercise .exercise-main-layout > .exercise-description,
.dashboard-layout--exercise .exercise-main-layout > .reading-text-enhanced,
.dashboard-layout--exercise .exercise-main-layout > .content-section-header {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Section report — full-width exam-style summary after completing a section */
.dashboard-layout--exercise .section-report {
  width: 100%;
  animation: fadeInUp 0.35s ease;
}

.dashboard-layout--exercise .section-report--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.dashboard-layout--exercise .section-report-loading {
  text-align: center;
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-top: 4px solid var(--ex-duo-blue, #1cb0f6);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
  max-width: 420px;
  width: 100%;
}

.dashboard-layout--exercise .section-report-loading-icon {
  font-size: 2.5rem;
  color: var(--ex-duo-blue, #1cb0f6);
  margin-bottom: 12px;
}

.dashboard-layout--exercise .section-report-loading h2 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ex-duo-text, #4b4b4b);
  margin: 0 0 8px;
}

.dashboard-layout--exercise .section-report-loading p {
  margin: 0;
  color: var(--ex-duo-text-muted, #777);
  font-weight: 600;
}

.dashboard-layout--exercise .section-report-info .part-nav-cell {
  pointer-events: none;
  cursor: default;
}

.dashboard-layout--exercise .section-report-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--ex-duo-green, #58cc02);
  font-size: 0.9rem;
  white-space: nowrap;
}

.dashboard-layout--exercise .section-report-banner p {
  margin: 0;
}

.dashboard-layout--exercise .section-report-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.dashboard-layout--exercise .section-report-summary-card {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
}

.dashboard-layout--exercise .section-report-cambridge-card {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.dashboard-layout--exercise .section-report-cambridge-tile {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 3px 0 var(--ex-duo-border, #e5e5e5);
}

.dashboard-layout--exercise .section-report-cambridge-tile--stat {
  flex: 0 0 64px;
}

.dashboard-layout--exercise .section-report-cambridge-tile-label {
  display: block;
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #afafaf;
  line-height: 1.1;
}

.dashboard-layout--exercise .section-report-cambridge-tile-value {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.1;
  word-break: break-word;
}

.dashboard-layout--exercise .section-report-cambridge-tile-value--score span {
  font-size: 0.72rem;
  color: #afafaf;
}

.dashboard-layout--exercise .section-report-cambridge-tile--raw {
  flex: 1.4 1 0;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
}

.dashboard-layout--exercise .section-report-cambridge-tile-raw-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.dashboard-layout--exercise .section-report-cambridge-tile--raw .section-report-cambridge-tile-label,
.dashboard-layout--exercise .section-report-cambridge-tile--raw .section-report-cambridge-tile-value {
  text-align: left;
}

.dashboard-layout--exercise .section-report-cambridge-tile--raw .section-report-cambridge-tile-value {
  flex-shrink: 0;
}

.dashboard-layout--exercise .section-report-summary-bar-wrap--inline {
  width: 100%;
  max-width: none;
  height: 6px;
  margin-top: 0;
}

.dashboard-layout--exercise .section-report-cambridge-raw {
  display: none;
}

.dashboard-layout--exercise .section-report-cambridge-tile--charts {
  flex: 0 0 64px;
  background: #fff;
  color: var(--ex-duo-blue-dark, #1899d6);
  border-color: var(--ex-duo-blue, #1cb0f6);
  box-shadow: 0 3px 0 var(--ex-duo-blue-dark, #1899d6);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.dashboard-layout--exercise .section-report-cambridge-tile--charts i {
  font-size: 0.85rem;
  color: var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .section-report-cambridge-tile--charts:hover {
  background: var(--ex-duo-blue-light, #ddf4ff);
}

.dashboard-layout--exercise .section-report-cambridge-tile--charts:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ex-duo-blue-dark, #1899d6);
}

.dashboard-layout--exercise .section-report-summary-card--final {
  border-top: 4px solid var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .section-report-summary-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-layout--exercise .section-report-summary-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #777;
}

.dashboard-layout--exercise .section-report-summary-value {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1;
}

.dashboard-layout--exercise .section-report-summary-value span {
  font-size: 1.1rem;
  color: #afafaf;
  font-weight: 700;
}

.dashboard-layout--exercise .section-report-summary-bar-wrap {
  height: 12px;
  background: #f0f0f0;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
}

.dashboard-layout--exercise .section-report-summary-bar-wrap--inline {
  height: 8px;
  margin-top: 10px;
}

.dashboard-layout--exercise .section-report-summary-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ex-duo-green, #58cc02), #7ae02f);
  border-radius: 999px;
  transition: width 0.5s ease;
  min-width: 0;
}

.dashboard-layout--exercise .section-report-summary-bar--final {
  background: linear-gradient(90deg, var(--ex-duo-orange, #f47417), #ff9a4d);
}

.dashboard-layout--exercise .section-report-summary-pct {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #777;
  text-align: right;
}

.dashboard-layout--exercise .section-report-grade {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--ex-duo-text, #4b4b4b);
  line-height: 1.15;
  margin-bottom: 10px;
}

.dashboard-layout--exercise .section-report-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-layout--exercise .section-report-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f7f7f7;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.dashboard-layout--exercise .section-report-pill-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #afafaf;
}

.dashboard-layout--exercise .section-report-pill strong {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  color: var(--ex-duo-blue-dark, #1899d6);
}

.dashboard-layout--exercise .section-report-parts-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ex-duo-text, #4b4b4b);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-layout--exercise .section-report-parts-title i {
  color: var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .section-report-parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.dashboard-layout--exercise .section-report-part-card {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 3px 0 var(--ex-duo-border, #e5e5e5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-layout--exercise .section-report-part-card--section {
  padding-bottom: 14px;
}

.dashboard-layout--exercise .section-report-part-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-layout--exercise .section-report-part-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ex-duo-text, #4b4b4b);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-layout--exercise .section-report-part-score {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .section-report-part-score-sep {
  color: #cfcfcf;
  margin: 0 1px;
}

.dashboard-layout--exercise .sc-question-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dashboard-layout--exercise .sc-q-cell {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #d4d4d4;
  background: #ececec;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease;
}

.dashboard-layout--exercise .sc-q-cell:hover {
  transform: scale(1.08);
}

.dashboard-layout--exercise .sc-q-cell.sc-q-correct {
  background: var(--ex-duo-green, #58cc02);
  border-color: #46a302;
  box-shadow: 0 2px 0 #46a302;
}

.dashboard-layout--exercise .sc-q-cell.sc-q-incorrect {
  background: #ff4b4b;
  border-color: #ea2b2b;
  box-shadow: 0 2px 0 #c81e1e;
}

.dashboard-layout--exercise .sc-q-cell.sc-q-empty {
  background: #ececec;
  border-color: #d4d4d4;
}

.dashboard-layout--exercise .section-report-part-card .btn-review-part--icon {
  padding: 4px 7px;
  border: 2px solid var(--ex-duo-blue, #1cb0f6);
  border-radius: 8px;
  background: #fff;
  color: var(--ex-duo-blue, #1cb0f6);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}

.dashboard-layout--exercise .section-report-part-card .btn-review-part--icon:hover {
  background: var(--ex-duo-blue, #1cb0f6);
  color: #fff;
}

.dashboard-layout--exercise .section-report-actions {
  margin-top: 20px;
}

/* Legacy section-complete (fallback outside exercise layout) */
.dashboard-layout--exercise .section-complete-screen {
  max-width: none;
  margin: 0;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.dashboard-layout--exercise .section-complete-icon {
  font-size: 3.5rem;
  color: var(--ex-duo-green, #58cc02);
  margin-bottom: 12px;
}

.dashboard-layout--exercise .section-complete-icon.final {
  color: var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .section-complete-screen h2 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ex-duo-text, #4b4b4b);
  margin-bottom: 8px;
}

.dashboard-layout--exercise .section-complete-screen p {
  color: var(--ex-duo-text-muted, #777);
  margin-bottom: 20px;
}

.dashboard-layout--exercise .section-complete-score {
  background: color-mix(in srgb, var(--ex-duo-green, #58cc02) 12%, #fff);
  border: 2px solid color-mix(in srgb, var(--ex-duo-green, #58cc02) 35%, #e5e5e5);
  border-radius: 12px;
}

.dashboard-layout--exercise .section-complete-score.final-total {
  background: color-mix(in srgb, var(--ex-duo-orange, #f47417) 12%, #fff);
  border-color: color-mix(in srgb, var(--ex-duo-orange, #f47417) 35%, #e5e5e5);
}

.dashboard-layout--exercise .section-complete-value {
  color: var(--ex-duo-green, #58cc02);
}

.dashboard-layout--exercise .final-total .section-complete-value {
  color: var(--ex-duo-orange, #f47417);
}

.dashboard-layout--exercise .section-complete-part-row,
.dashboard-layout--exercise .final-results-section-row {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 10px;
}

.dashboard-layout--exercise .btn-next-section,
.dashboard-layout--exercise .btn-final-results {
  background: var(--ex-duo-green, #58cc02);
  border: 2px solid var(--ex-duo-green-dark, #46a302);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--ex-duo-green-dark, #46a302);
}

.dashboard-layout--exercise .btn-next-section:hover,
.dashboard-layout--exercise .btn-final-results:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.dashboard-layout--exercise .btn-back-dashboard {
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  border-radius: 12px;
  color: var(--ex-duo-text, #4b4b4b);
}

.dashboard-layout--exercise .btn-back-dashboard:hover {
  border-color: var(--ex-duo-blue, #1cb0f6);
  color: var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .btn-review-part {
  border-color: var(--ex-duo-blue, #1cb0f6);
  color: var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .btn-review-part:hover {
  background: var(--ex-duo-blue, #1cb0f6);
  color: #fff;
}

/* Header & meta — Duolingo-inspired */
.dashboard-layout--exercise .exercise-header {
  margin-bottom: 12px;
}

.dashboard-layout--exercise .exercise-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
}

.dashboard-layout--exercise .exercise-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fff;
  color: var(--ex-duo-text);
  border: 2px solid var(--ex-duo-border);
  box-shadow: 0 2px 0 #e5e5e5;
  font-weight: 800;
  border-radius: 12px;
  min-height: 42px;
}

.dashboard-layout--exercise .exercise-chip--level {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.95rem;
  padding: 0 14px;
  letter-spacing: -0.01em;
}

.dashboard-layout--exercise .exercise-chip--mode {
  width: 42px;
  padding: 0;
}

.dashboard-layout--exercise .exercise-chip--mode .material-symbols-outlined {
  font-size: 1.15rem;
}

.dashboard-layout--exercise .exercise-chip--practice {
  background: #d7ffb8;
  color: #166534;
  border-color: #58cc02;
  box-shadow: 0 2px 0 #58a700;
}

.dashboard-layout--exercise .exercise-chip--simulation {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #ce82ff;
  box-shadow: 0 2px 0 #a855f7;
}

.dashboard-layout--exercise .exercise-chip--random {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #60a5fa;
  box-shadow: 0 2px 0 #3b82f6;
}

.dashboard-layout--exercise .exercise-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-layout--exercise .exercise-heading {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ex-duo-text);
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.dashboard-layout--exercise .exercise-header-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-layout--exercise .exercise-title h2 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ex-duo-text);
  letter-spacing: -0.01em;
}

.dashboard-layout--exercise .exercise-badge {
  background: var(--ex-duo-orange);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--ex-duo-orange-dark);
}

.dashboard-layout--exercise .score-display {
  background: #fff;
  color: var(--ex-duo-text);
  border: 2px solid var(--ex-duo-border);
  box-shadow: 0 2px 0 #e5e5e5;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0 14px;
  border-radius: 12px;
  min-width: auto;
}

.dashboard-layout--exercise .exercise-chips-row .score-display {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.dashboard-layout--exercise .exercise-chips-row .exercise-toolbar {
  flex-shrink: 0;
}

.dashboard-layout--exercise .exercise-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dashboard-layout--exercise .exercise-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-layout--exercise .btn-cambridge-score {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  color: #e30613;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 2px 0 #e5e5e5;
  font-size: 0.95rem;
}

.dashboard-layout--exercise .btn-cambridge-score:hover {
  background: #fff5f5;
  border-color: #fca5a5;
  color: #c00510;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-cambridge-overall {
  background: #fff;
  color: #b71c1c;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-cambridge-overall:hover {
  background: #fff5f5;
  box-shadow: 0 3px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-exit {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  color: #afafaf;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-exit:hover {
  background: #fff5f5;
  border-color: #fca5a5;
  color: var(--incorrect);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #e5e5e5;
}

.dashboard-layout--exercise .part-score-display {
  background: var(--ex-duo-orange);
  color: #fff;
  border: 2px solid var(--ex-duo-orange-dark);
  box-shadow: 0 2px 0 var(--ex-duo-orange-dark);
  font-weight: 800;
  font-size: 0.82rem;
}

.dashboard-layout--exercise .exercise-info {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  border-radius: 16px;
  box-shadow: none;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.dashboard-layout--exercise .exercise-info--single-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.dashboard-layout--exercise .exercise-info--single-row .exercise-info-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  padding-bottom: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-layout--exercise .exercise-info--single-row .exercise-info-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dashboard-layout--exercise .exercise-info--single-row .part-nav-row {
  display: inline-flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 6px;
}

.dashboard-layout--exercise .exercise-info--single-row .exercise-chip--duration,
.dashboard-layout--exercise .exercise-info--single-row .exercise-timer,
.dashboard-layout--exercise .exercise-info--single-row .part-score-display {
  flex-shrink: 0;
  white-space: nowrap;
}

.dashboard-layout--exercise .exercise-chip--duration {
  gap: 5px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ex-duo-text);
}

.dashboard-layout--exercise .exercise-chip--duration i {
  color: var(--ex-duo-orange);
  font-size: 0.78rem;
}

.dashboard-layout--exercise .exercise-chip--part-score {
  font-size: 0.82rem;
  padding: 0 12px;
  min-height: 38px;
  min-width: auto;
  border-radius: 12px;
}

.dashboard-layout--exercise .exercise-info-left {
  font-weight: 700;
  color: #777;
}

.dashboard-layout--exercise .exercise-container[data-section] .exercise-info--single-row .exercise-info-left {
  padding-bottom: 5px;
}

/* Desktop: push score-display and toolbar to the far right */
@media (min-width: 769px) {
  .dashboard-layout--exercise .exercise-chips-row {
    width: 100%;
  }

  .dashboard-layout--exercise .exercise-chips-row .score-display {
    margin-left: auto;
  }
}

/* Duolingo-style explanations blocks */
.dashboard-layout--exercise .explanations-section,
.dashboard-layout--exercise .explanations-panel {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  border-top: 4px solid var(--ex-duo-purple);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ex-duo-border);
}

.dashboard-layout--exercise .explanation-question-display {
  background: var(--ex-duo-purple-light, #f3e8ff);
  border-color: var(--ex-duo-purple, #ce82ff);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ex-duo-purple-dark, #a855f7) 35%, #e5e5e5);
}

.dashboard-layout--exercise .explanation-question-display .eq-number {
  background: var(--ex-duo-purple, #ce82ff);
  box-shadow: 0 2px 0 var(--ex-duo-purple-dark, #a855f7);
}

.dashboard-layout--exercise .explanation-card.explanation-active {
  border-color: var(--ex-duo-purple);
  background: var(--ex-feedback-bg, #fff);
  box-shadow: 0 3px 0 var(--ex-duo-purple-dark);
}

.dashboard-layout--exercise .explanation-item {
  background: #fff;
  border-color: var(--ex-duo-border);
}

.dashboard-layout--exercise .exercise-duration,
.dashboard-layout--exercise .exercise-timer {
  font-weight: 800;
  color: var(--ex-duo-text);
  font-size: 0.95rem;
}

.dashboard-layout--exercise .exercise-duration i,
.dashboard-layout--exercise .exercise-timer i {
  color: var(--ex-duo-orange);
}

.dashboard-layout--exercise .part-nav-cell {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 12px;
  border: 2px solid var(--ex-duo-border);
  background: #fff;
  color: #afafaf;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .part-nav-cell:hover {
  border-color: #cfcfcf;
  background: #fafafa;
  color: #777;
}

.dashboard-layout--exercise .part-nav-cell.active {
  background: var(--ex-duo-orange);
  color: #fff;
  border-color: var(--ex-duo-orange-dark);
  box-shadow: 0 3px 0 var(--ex-duo-orange-dark);
}

.dashboard-layout--exercise .part-nav-cell.completed {
  background: var(--ex-duo-orange-light);
  border-color: #ffc78a;
  color: var(--ex-duo-orange-dark);
}

.dashboard-layout--exercise .part-nav-cell.completed.active {
  background: var(--ex-duo-orange);
  color: #fff;
  border-color: var(--ex-duo-orange-dark);
}

.dashboard-layout--exercise .part-nav-check {
  background: var(--ex-duo-orange);
}

.dashboard-layout--exercise .exercise-description {
  background: var(--ex-duo-info-bg);
  border-left: 3px solid var(--ex-duo-info-border);
  border-radius: 14px;
  color: #3c3c3c;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 0;
  margin-bottom: 10px;
  padding: 6px 12px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.dashboard-layout--exercise .reading-text-enhanced {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  border-top: 4px solid var(--ex-duo-blue);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ex-duo-border);
  padding: 28px 32px 32px;
}

.dashboard-layout--exercise .reading-text-enhanced::after {
  display: none;
}

/* B1 Reading Part 1 — notice cards + MC options inside the reading card */
.dashboard-layout--exercise .reading-text-enhanced:has(.reading-type5-with-notice) {
  padding: 20px 22px 24px;
  border-top-color: var(--ex-duo-blue);
}

/* B1 Reading Part 2 / C1 Reading Part 8 — matching exercise inside the reading card */
.dashboard-layout--exercise .reading-text-enhanced--b1r2,
.dashboard-layout--exercise .reading-text-enhanced:has(.b1-reading2-people),
.dashboard-layout--exercise .reading-text-enhanced.duo-reading-matching {
  padding: 20px 22px 24px;
  border-top-color: var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .reading-text-enhanced--b1r2 .content-title-block,
.dashboard-layout--exercise .reading-text-enhanced:has(.b1-reading2-people) .content-title-block,
.dashboard-layout--exercise .reading-text-enhanced.duo-reading-matching .content-title-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ex-duo-border, #e5e5e5);
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .dashboard-layout--exercise .reading-text-enhanced--b1r2,
  .dashboard-layout--exercise .reading-text-enhanced:has(.b1-reading2-people),
  .dashboard-layout--exercise .reading-text-enhanced.duo-reading-matching {
    padding: 16px 18px 20px;
  }

  .dashboard-layout--exercise .reading-text-enhanced--b1r2 .b1-reading2-chip,
  .dashboard-layout--exercise .reading-text-enhanced:has(.b1-reading2-people) .b1-reading2-chip,
  .dashboard-layout--exercise .reading-text-enhanced.duo-reading-matching .b1-reading2-chip,
  .dashboard-layout--exercise .reading-text-enhanced--b1r2 .b1-reading2-preview-letter,
  .dashboard-layout--exercise .reading-text-enhanced:has(.b1-reading2-people) .b1-reading2-preview-letter,
  .dashboard-layout--exercise .reading-text-enhanced.duo-reading-matching .b1-reading2-preview-letter {
    min-width: 38px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 0.95rem;
  }
}

/* B1 Reading Parts 3–6 — normal body text (no drop cap, no paragraph hover) */
.reading-text-enhanced--b1r-plain .toggle-text-section p:first-of-type::first-letter {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  float: none;
  line-height: inherit;
  margin: 0;
}

.reading-text-enhanced--b1r-plain .toggle-text-section p {
  border-radius: 0;
  transition: none;
}

.reading-text-enhanced--b1r-plain .toggle-text-section p:hover {
  background: transparent;
}

.dashboard-layout--exercise .reading-text-enhanced--b1r-plain {
  padding: 20px 22px 24px;
  border-top-color: var(--ex-duo-blue, #1cb0f6);
}

.dashboard-layout--exercise .reading-text-enhanced--b1r-plain .content-title-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ex-duo-border, #e5e5e5);
}

/* B1 Reading Part 4 — header layout (toggle uses standard .toggle-view-header) */
.b1-reading4-header,
.b1-reading4 .content-section-header,
.c1-reading7-header,
.c1-reading7 .content-section-header {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
}

.b1-reading4-header .question-nav-row,
.b1-reading4 .question-nav-row,
.c1-reading7-header .question-nav-row,
.c1-reading7 .question-nav-row {
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0;
}

.b1-reading4-header .question-nav-cell,
.b1-reading4 .question-nav-cell,
.c1-reading7-header .question-nav-cell,
.c1-reading7 .question-nav-cell {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 0.88rem;
  border-radius: 12px;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .dashboard-layout--exercise .reading-text-enhanced--b1r-plain {
    padding: 16px 18px 20px;
  }

  .reading-text-enhanced--b1r-plain .toggle-text-section p:first-of-type::first-letter {
    font-size: inherit;
  }
}

.dashboard-layout--exercise .content-section-header {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  border-radius: 16px;
  box-shadow: none;
}

.dashboard-layout--exercise .toggle-view-btn.active {
  background: var(--ex-duo-orange);
  border-color: var(--ex-duo-orange-dark);
  box-shadow: 0 2px 0 var(--ex-duo-orange-dark);
}

/* ── Duolingo-style exercise footer ─────────────────────────────────────
   Structure: [feedback banner (after checking)] + [3-zone action bar]
   States (set by ExerciseHandlers.syncFooterState):
   --ready (≥1 answer given → Check lights up green)
   --correct / --partial / --incorrect (result tint after checking)        */

.dashboard-layout--exercise .exercise-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-top: 28px;
  padding: 14px clamp(20px, 4vw, 40px) max(14px, env(safe-area-inset-bottom));
  border-top: 2px solid var(--ex-duo-border, #e5e5e5);
  position: sticky;
  bottom: 0;
  z-index: 120;
  background: var(--ex-duo-canvas, #f7f7f7);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.dashboard-layout--exercise .exercise-footer.exercise-footer--correct {
  background: var(--ex-duo-practice-light, #d7ffb8);
  border-top-color: color-mix(in srgb, var(--ex-duo-practice, #58cc02) 45%, #fff);
}

.dashboard-layout--exercise .exercise-footer.exercise-footer--partial {
  background: var(--ex-duo-orange-light, #fff0e6);
  border-top-color: color-mix(in srgb, var(--ex-duo-orange, #f47417) 40%, #fff);
}

.dashboard-layout--exercise .exercise-footer.exercise-footer--incorrect {
  background: #ffdfe0;
  border-top-color: #ffb2b2;
}

/* Action bar: secondary (left) / contextual toggles (mid) / primary (right) */
.dashboard-layout--exercise .exercise-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.dashboard-layout--exercise .exercise-footer-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.dashboard-layout--exercise .exercise-footer-group:empty {
  display: none;
}

.dashboard-layout--exercise .exercise-footer-group--mid {
  flex: 1 1 auto;
  justify-content: center;
}

.dashboard-layout--exercise .exercise-footer-group--right {
  margin-left: auto;
  justify-content: flex-end;
}

/* Feedback banner (injected after Check, Duolingo result sheet style) */
.dashboard-layout--exercise .exercise-footer-feedback {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 14px;
  animation: exFooterFeedbackIn 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.18);
}

.dashboard-layout--exercise .exercise-footer-feedback[hidden] {
  display: none;
}

@keyframes exFooterFeedbackIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dashboard-layout--exercise .exercise-footer-feedback-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.dashboard-layout--exercise .exercise-footer-feedback-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dashboard-layout--exercise .exercise-footer-feedback-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.2;
}

.dashboard-layout--exercise .exercise-footer-feedback-sub {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.85;
}

.dashboard-layout--exercise .exercise-footer-feedback-score {
  margin-left: auto;
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.dashboard-layout--exercise .exercise-footer--correct .exercise-footer-feedback-icon,
.dashboard-layout--exercise .exercise-footer--correct .exercise-footer-feedback-title,
.dashboard-layout--exercise .exercise-footer--correct .exercise-footer-feedback-sub,
.dashboard-layout--exercise .exercise-footer--correct .exercise-footer-feedback-score {
  color: var(--ex-duo-practice-dark, #58a700);
}

.dashboard-layout--exercise .exercise-footer--partial .exercise-footer-feedback-icon,
.dashboard-layout--exercise .exercise-footer--partial .exercise-footer-feedback-title,
.dashboard-layout--exercise .exercise-footer--partial .exercise-footer-feedback-sub,
.dashboard-layout--exercise .exercise-footer--partial .exercise-footer-feedback-score {
  color: var(--ex-duo-orange-dark, #d45f0a);
}

.dashboard-layout--exercise .exercise-footer--incorrect .exercise-footer-feedback-icon,
.dashboard-layout--exercise .exercise-footer--incorrect .exercise-footer-feedback-title,
.dashboard-layout--exercise .exercise-footer--incorrect .exercise-footer-feedback-sub,
.dashboard-layout--exercise .exercise-footer--incorrect .exercise-footer-feedback-score {
  color: #ea2b2b;
}

/* Buttons: chunky 3D Duolingo style */
.dashboard-layout--exercise .exercise-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, color 0.15s, border-color 0.15s;
  min-height: 46px;
  min-width: 120px;
}

.dashboard-layout--exercise .exercise-footer button i,
.dashboard-layout--exercise .exercise-footer button .material-symbols-outlined,
.dashboard-layout--exercise .exercise-footer button .btn-toggle-answer-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Check: always active green — user can check even without answering */
.dashboard-layout--exercise .btn-check {
  background: var(--ex-duo-practice, #58cc02);
  color: #fff;
  border: none;
  box-shadow: 0 4px 0 var(--ex-duo-practice-dark, #58a700);
}

.dashboard-layout--exercise .exercise-footer--ready .btn-check:not(:disabled) {
  animation: exCheckReadyPop 0.25s ease;
}

@keyframes exCheckReadyPop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.dashboard-layout--exercise .btn-check:hover:not(:disabled) {
  filter: brightness(1.05);
}

.dashboard-layout--exercise .btn-check:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ex-duo-practice-dark, #58a700);
}

.dashboard-layout--exercise .btn-check:disabled {
  background: #e5e7eb;
  color: var(--ex-duo-text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Once answers are checked the Check button gives way to Continue */
body.answers-checked-app .dashboard-layout--exercise .exercise-footer:not(.section-report-actions) .btn-check {
  display: none;
}

/* Next: quiet skip-style before checking… */
.dashboard-layout--exercise .btn-next {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  color: #777;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-next:hover {
  color: #555;
  border-color: #cfcfcf;
  background: #fafafa;
}

.dashboard-layout--exercise .btn-next:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #e5e5e5;
}

/* …and a neutral Continue after checking (or in exam mode, where there is no Check) */
body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next:not(.btn-finish-section),
.dashboard-layout--exercise .exercise-footer-bar:not(:has(.btn-check)) .btn-next:not(.btn-finish-section) {
  background: #fff;
  color: var(--ex-duo-text, #4b4b4b);
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  box-shadow: 0 4px 0 #d1d5db;
}

body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next:not(.btn-finish-section):hover,
.dashboard-layout--exercise .exercise-footer-bar:not(:has(.btn-check)) .btn-next:not(.btn-finish-section):hover {
  color: #333;
  border-color: #cfcfcf;
  background: #fafafa;
  filter: none;
}

body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next:not(.btn-finish-section):active,
.dashboard-layout--exercise .exercise-footer-bar:not(:has(.btn-check)) .btn-next:not(.btn-finish-section):active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d1d5db;
}

/* Finish Section / Finish Test: orange milestone button (always primary) */
body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section,
.dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section,
.dashboard-layout--exercise .exercise-footer .btn-finish-section {
  background: var(--ex-duo-orange, #f47417);
  color: #fff;
  border: none;
  box-shadow: 0 4px 0 var(--ex-duo-orange-dark, #d45f0a);
}

body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section:hover,
.dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section:hover,
.dashboard-layout--exercise .exercise-footer .btn-finish-section:hover {
  background: var(--ex-duo-orange-hover, #f6802a);
  filter: none;
}

body.answers-checked-app .dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section:active,
.dashboard-layout--exercise .exercise-footer .btn-next.btn-finish-section:active,
.dashboard-layout--exercise .exercise-footer .btn-finish-section:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ex-duo-orange-dark, #d45f0a);
}

.dashboard-layout--exercise .btn-prev,
.dashboard-layout--exercise .btn-reset {
  background: #fff;
  border: 2px solid var(--ex-duo-border);
  color: #777;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-toggle-answer,
.dashboard-layout--exercise .btn-explanations {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  color: #6b6b6b;
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-prev:hover,
.dashboard-layout--exercise .btn-reset:hover {
  color: #555;
  border-color: #cfcfcf;
  background: #fafafa;
}

.dashboard-layout--exercise .btn-toggle-answer:hover,
.dashboard-layout--exercise .btn-explanations:hover {
  color: #555;
  border-color: #cfcfcf;
  background: #fafafa;
}

.dashboard-layout--exercise .btn-prev:active,
.dashboard-layout--exercise .btn-reset:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-toggle-answer:active,
.dashboard-layout--exercise .btn-explanations:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-tools-toggle {
  background: #fff;
  border: 2px solid var(--ex-duo-border, #e5e5e5);
  color: var(--tool-duo-orange, #f47417);
  box-shadow: 0 2px 0 #e5e5e5;
}

.dashboard-layout--exercise .btn-tools-toggle:hover,
.dashboard-layout--exercise .btn-tools-toggle.active {
  color: #fff;
  background: var(--tool-duo-orange, #f47417);
  border-color: var(--tool-duo-orange-dark, #d46110);
  box-shadow: 0 3px 0 var(--tool-duo-orange-dark, #d46110);
}

.dashboard-layout--exercise .btn-tools-toggle:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--tool-duo-orange-dark, #d46110);
}

@media (min-width: 769px) {
  .dashboard-layout--exercise .exercise-footer .btn-tools-toggle {
    display: none;
  }
}

/* Section report footers keep a simple centered row (no zones/feedback) */
.dashboard-layout--exercise .exercise-footer.section-report-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Desktop: Duo card-style footer container (fixed stack keeps it always visible) */
@media (min-width: 769px) {
  .dashboard-layout--exercise .exercise-bottom-stack .exercise-footer {
    position: static;
    bottom: auto;
    margin-top: 0;
    z-index: auto;
  }

  .dashboard-layout--exercise .exercise-footer:not(.section-report-actions) {
    margin-inline: 0;
    margin-bottom: 0;
    padding: 16px clamp(20px, 3vw, 28px) 18px;
    background: #fff;
    border: 2px solid var(--ex-duo-border, #e5e5e5);
    border-radius: 20px;
    box-shadow: 0 4px 0 var(--ex-duo-border, #e5e5e5);
    transition:
      background 0.25s ease,
      border-color 0.25s ease,
      box-shadow 0.25s ease,
      border-top-color 0.25s ease,
      opacity 0.25s ease;
  }

  @media (hover: hover) {
    .dashboard-layout--exercise .exercise-footer:not(.section-report-actions) {
      opacity: 0.42;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }

    .dashboard-layout--exercise .exercise-footer:not(.section-report-actions):is(
      :hover,
      :focus-within,
      :has(.exercise-footer-feedback:not([hidden]))
    ) {
      opacity: 1;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
  }

  .dashboard-layout--exercise .exercise-container {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  body.answers-checked-app .dashboard-layout--exercise .exercise-container {
    padding-bottom: calc(168px + env(safe-area-inset-bottom));
  }

  .dashboard-layout--exercise .exercise-footer.exercise-footer--correct {
    background: var(--ex-duo-practice-light, #d7ffb8);
    border-color: color-mix(in srgb, var(--ex-duo-practice, #58cc02) 30%, var(--ex-duo-border, #e5e5e5));
    border-top: 4px solid var(--ex-duo-practice, #58cc02);
    box-shadow: 0 4px 0 color-mix(in srgb, var(--ex-duo-practice-dark, #58a700) 35%, var(--ex-duo-border, #e5e5e5));
  }

  .dashboard-layout--exercise .exercise-footer.exercise-footer--partial {
    background: var(--ex-duo-orange-light, #fff0e6);
    border-color: color-mix(in srgb, var(--ex-duo-orange, #f47417) 28%, var(--ex-duo-border, #e5e5e5));
    border-top: 4px solid var(--ex-duo-orange, #f47417);
    box-shadow: 0 4px 0 color-mix(in srgb, var(--ex-duo-orange-dark, #d45f0a) 30%, var(--ex-duo-border, #e5e5e5));
  }

  .dashboard-layout--exercise .exercise-footer.exercise-footer--incorrect {
    background: #ffdfe0;
    border-color: color-mix(in srgb, #ea2b2b 22%, var(--ex-duo-border, #e5e5e5));
    border-top: 4px solid #ea2b2b;
    box-shadow: 0 4px 0 color-mix(in srgb, #ea2b2b 28%, var(--ex-duo-border, #e5e5e5));
  }

  .dashboard-layout--exercise .exercise-footer-feedback {
    padding: 2px 4px 16px;
  }

  .dashboard-layout--exercise .exercise-footer-feedback-icon {
    border: 2px solid color-mix(in srgb, currentColor 18%, #fff);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
  }

  .dashboard-layout--exercise .exercise-footer-feedback-score {
    border: 2px solid color-mix(in srgb, currentColor 14%, #fff);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
  }
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  /* Fixed bottom stack: tools sheet grows upward + exercise footer (full viewport width) */
  .dashboard-layout--exercise .exercise-footer {
    position: static;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: 1;
    margin-top: 0;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 2px solid var(--ex-duo-border, #e5e5e5);
    border-radius: 0;
    box-shadow: none;
  }

  .dashboard-layout--exercise .exercise-bottom-stack:not(:has(.exercise-tools-sidebar-wrap--mobile.is-open)) .exercise-footer {
    border-radius: 20px 20px 0 0;
    border-top: none;
  }

  .dashboard-layout--exercise .exercise-bottom-stack:has(.exercise-tools-sidebar-wrap--mobile.is-open) .exercise-footer {
    border-top: none;
  }

  .dashboard-layout--exercise .exercise-footer.exercise-footer--correct,
  .dashboard-layout--exercise .exercise-footer.exercise-footer--partial,
  .dashboard-layout--exercise .exercise-footer.exercise-footer--incorrect {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .dashboard-layout--exercise .exercise-container {
    /* Spacer element tracks the real fixed stack height (tools + footer + keyboard). */
    padding-bottom: 0;
  }

  body.answers-checked-app .dashboard-layout--exercise .exercise-container {
    padding-bottom: 0;
  }

  .dashboard-layout--exercise .exercise-bottom-stack {
    bottom: var(--exercise-kb-inset, 0px);
  }

  .dashboard-layout--exercise .exercise-page-wrapper {
    padding-bottom: 0;
  }

  .dashboard-layout--exercise .exercise-footer-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .dashboard-layout--exercise .exercise-footer-group {
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
  }

  .dashboard-layout--exercise .exercise-footer-group--left {
    justify-content: flex-start;
  }

  .dashboard-layout--exercise .exercise-footer-group--mid {
    flex: none;
    justify-content: center;
  }

  .dashboard-layout--exercise .exercise-footer-group--right {
    margin-left: 0;
    justify-content: flex-end;
  }

  /* Compact feedback banner */
  .dashboard-layout--exercise .exercise-footer-feedback {
    gap: 10px;
    padding: 0 0 10px;
  }

  .dashboard-layout--exercise .exercise-footer-feedback-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .dashboard-layout--exercise .exercise-footer-feedback-title {
    font-size: 1rem;
  }

  .dashboard-layout--exercise .exercise-footer-feedback-sub {
    font-size: 0.72rem;
  }

  .dashboard-layout--exercise .exercise-footer-feedback-score {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  /* Icon-only square buttons by default */
  .dashboard-layout--exercise .exercise-footer button {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    padding: 0;
    border-radius: 14px;
    gap: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide text labels on secondary actions — primary CTA keeps a short label.
     IMPORTANT: the hide rule uses :not(.class) twice, which adds specificity.
     The show rule must beat `.footer button > span:not(...):not(...)` (0,4,2). */
  .dashboard-layout--exercise .exercise-footer button > span:not(.material-symbols-outlined):not(.btn-toggle-answer-icon),
  .dashboard-layout--exercise .exercise-footer button > [data-i18n],
  .dashboard-layout--exercise .exercise-footer .btn-toggle-answer-label,
  .dashboard-layout--exercise .exercise-footer .btn-tools-toggle-label {
    display: none !important;
  }

  .dashboard-layout--exercise .exercise-footer .btn-check,
  .dashboard-layout--exercise .exercise-footer .btn-next,
  .dashboard-layout--exercise .exercise-footer .btn-finish-section {
    width: auto;
    min-width: 50px;
    padding: 0 14px;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-footer button.btn-check > span:not(.material-symbols-outlined):not(.btn-toggle-answer-icon),
  .dashboard-layout--exercise .exercise-footer button.btn-check > [data-i18n],
  .dashboard-layout--exercise .exercise-footer button.btn-next > span:not(.material-symbols-outlined):not(.btn-toggle-answer-icon),
  .dashboard-layout--exercise .exercise-footer button.btn-next > [data-i18n],
  .dashboard-layout--exercise .exercise-footer button.btn-finish-section > span:not(.material-symbols-outlined):not(.btn-toggle-answer-icon),
  .dashboard-layout--exercise .exercise-footer button.btn-finish-section > [data-i18n] {
    display: inline !important;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  .dashboard-layout--exercise .exercise-footer button i,
  .dashboard-layout--exercise .exercise-footer button .material-symbols-outlined,
  .dashboard-layout--exercise .exercise-footer button .btn-toggle-answer-icon {
    font-size: 1.2rem;
    margin: 0;
  }
}

/* ── Mobile-specific overrides for the Duolingo-style exercise layout ── */
@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  /* Reduce exercise container top padding (no white card frame) */
  .dashboard-layout--exercise .exercise-container {
    padding-top: 12px;
    padding-inline: 14px;
  }

  /* Compact header on mobile */
  .dashboard-layout--exercise .exercise-header {
    margin-bottom: 10px;
  }

  .dashboard-layout--exercise .exercise-chips-row {
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-chip,
  .dashboard-layout--exercise .exercise-chips-row .score-display {
    min-height: 36px;
    border-radius: 10px;
  }

  .dashboard-layout--exercise .exercise-chip--level {
    font-size: 0.85rem;
    padding: 0 10px;
  }

  .dashboard-layout--exercise .exercise-chip--mode {
    width: 36px;
  }

  .dashboard-layout--exercise .exercise-chip--mode .material-symbols-outlined {
    font-size: 1rem;
  }

  .dashboard-layout--exercise .exercise-header-top {
    gap: 10px;
  }

  .dashboard-layout--exercise .exercise-heading {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .dashboard-layout--exercise .exercise-badge {
    font-size: 0.68rem;
    padding: 4px 9px;
  }

  /* Score and toolbar buttons tighter */
  .dashboard-layout--exercise .score-display {
    font-size: 0.78rem;
    padding: 0 10px;
  }

  .dashboard-layout--exercise .btn-exit,
  .dashboard-layout--exercise .btn-cambridge-score {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  /* Exercise info: two-row layout on mobile (parts / time+score) */
  .dashboard-layout--exercise .exercise-info {
    padding: 6px 10px;
    margin-bottom: 6px;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info:not(.exercise-info--single-row) {
    flex-wrap: nowrap !important;
    flex-direction: row !important;
  }

  .dashboard-layout--exercise .exercise-info--single-row {
    flex-direction: column !important;
    align-items: stretch !important;
    overflow: hidden;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-chip--duration,
  .dashboard-layout--exercise .exercise-info--single-row .part-score-display {
    min-height: 34px;
    font-size: 0.78rem;
    padding: 0 10px;
    border-radius: 10px;
  }

  .dashboard-layout--exercise .exercise-info-left,
  .dashboard-layout--exercise .exercise-info-right {
    flex-shrink: 0;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-left {
    width: 100%;
    flex: 0 0 auto;
    flex-shrink: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
    padding-left: 8px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right {
    width: 100%;
    flex-shrink: 0;
    justify-content: space-between;
    gap: 6px;
  }

  .dashboard-layout--exercise .exercise-info--single-row .exercise-info-right .exercise-timer {
    margin-left: auto;
  }

  /* Part nav cells — keep near 44px for comfortable thumbs */
  .dashboard-layout--exercise .part-nav-cell {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 11px;
    font-size: 0.9rem;
  }

  /* Compact exercise description */
  .dashboard-layout--exercise .exercise-description {
    padding: 5px 10px;
    font-size: 0.86rem;
    margin-top: 0;
    margin-bottom: 6px;
    border-radius: 12px;
  }

  /* Reading text */
  .dashboard-layout--exercise .reading-text-enhanced {
    padding: 14px 16px 18px;
    border-radius: 14px;
    font-size: 0.96rem;
    line-height: 1.65;
  }

  /* Content section header: compact */
  .dashboard-layout--exercise .content-section-header {
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 14px;
    gap: 8px;
  }

  /* Main layout gap */
  .dashboard-layout--exercise .exercise-main-layout {
    gap: 10px;
    margin-top: 0;
  }

  .dashboard-layout--exercise .section-report-parts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout--exercise .section-report-summary-value {
    font-size: 1.6rem;
  }

  .dashboard-layout--exercise .section-report-cambridge-card {
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-layout--exercise .section-report-cambridge-tile {
    flex: 0 0 72px;
    padding: 8px 6px;
  }

  .dashboard-layout--exercise .section-report-cambridge-tile--stat {
    flex: 0 0 56px;
  }

  .dashboard-layout--exercise .section-report-cambridge-tile--charts {
    flex: 0 0 56px;
  }

  .dashboard-layout--exercise .section-report-cambridge-tile--raw {
    flex: 1 0 110px;
  }

  .dashboard-layout--exercise .section-report-cambridge-tile-value {
    font-size: 0.78rem;
  }

  .dashboard-layout--exercise .section-report-info .exercise-info-right {
    flex-wrap: wrap;
  }
}

@media (max-width: 360px) {
  .dashboard-layout--exercise .exercise-container {
    padding-top: 10px;
    padding-inline: 10px;
  }

  .dashboard-layout--exercise .exercise-footer {
    gap: 7px;
  }

  .dashboard-layout--exercise .exercise-footer button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .dashboard-layout--exercise .exercise-heading {
    font-size: 0.95rem;
  }
}

/* ── Duolingo-style hover hints (correct answer on incorrect gaps) ───── */
.dashboard-layout--exercise .gap-box.incorrect::after,
.dashboard-layout--exercise .reading-type1-incorrect[data-correct]::after,
.dashboard-layout--exercise .reading-type2-gap.incorrect::after,
.dashboard-layout--exercise .reading-type3-gap-inline.incorrect::after,
.dashboard-layout--exercise .reading-type4-inline-wrap.incorrect::after,
.dashboard-layout--exercise .listening-type2-gap.incorrect::after,
.dashboard-layout--exercise .reading-type5-gap-wrap[data-correct]::after {
  background: var(--ex-duo-purple-light, #f3e8ff) !important;
  color: var(--ex-duo-purple-dark, #7c3aed) !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 2px 8px !important;
  font-family: 'Nunito', sans-serif !important;
  font-weight: 800 !important;
  font-size: 0.82rem !important;
  line-height: 1.35 !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

/* Show-correct answer mode: unified purple across exercise types */
.dashboard-layout--exercise .reading-type1-show-correct,
.dashboard-layout--exercise .reading-type2-show-correct,
.dashboard-layout--exercise .reading-type3-show-correct,
.dashboard-layout--exercise .reading-type4-show-correct,
.dashboard-layout--exercise .reading-type4-inline-input.cu-input-show-correct,
.dashboard-layout--exercise .listening-type2-input.cu-input-show-correct,
.dashboard-layout--exercise .listening-type4-select.listening-type4-select-expl-show,
.dashboard-layout--exercise .reading-type5-gap-trigger-show-correct,
.dashboard-layout--exercise .reading-type5-option-key,
.dashboard-layout--exercise .b1-reading2-chip-key,
.dashboard-layout--exercise .b1-reading2-chip-answer-toggle-correct,
.dashboard-layout--exercise .b1-reading2-chip-expl-show,
.dashboard-layout--exercise .c1-reading6-chip-expl-show,
.dashboard-layout--exercise .b1-reading2-select-answer-toggle-correct {
  border-color: var(--ex-duo-purple, #ce82ff) !important;
  background: var(--ex-feedback-bg, #fff) !important;
  color: var(--ex-duo-purple-text, #5b21b6) !important;
}

.dashboard-layout--exercise .listening-type2-questions-wrapper.listening-type2-explanation-mode .listening-type2-gap.incorrect::after,
.dashboard-layout--exercise .listening-type2-questions-wrapper.listening-type2-explanation-mode .listening-type2-gap.incorrect:hover::after,
.dashboard-layout--exercise .listening-type2-questions-wrapper.listening-type2-explanation-mode .listening-type2-gap.incorrect:focus-within::after {
  display: none !important;
}

.dashboard-layout--exercise .listening-type4-container.listening-type4-explanation-mode .listening-type4-correct-tooltip,
.dashboard-layout--exercise .listening-type4-container.listening-type4-explanation-mode .listening-type4-answer-wrapper:hover .listening-type4-correct-tooltip {
  display: none !important;
}

/* Universal mobile spacer under exercise content (height synced in JS) */
.exercise-mobile-stack-spacer {
  display: none;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .dashboard-layout--exercise .exercise-mobile-stack-spacer {
    display: block;
    width: 100%;
    flex-shrink: 0;
    min-height: 88px;
    pointer-events: none;
  }

  /* Touch devices: always show correct-answer hints (hover tooltips don't work) */
  .dashboard-layout--exercise .gap-box.incorrect::after,
  .dashboard-layout--exercise .reading-type1-incorrect[data-correct]::after,
  .dashboard-layout--exercise .reading-type2-gap.incorrect::after,
  .dashboard-layout--exercise .reading-type3-gap-inline.incorrect::after,
  .dashboard-layout--exercise .reading-type4-inline-wrap.incorrect::after,
  .dashboard-layout--exercise .listening-type2-gap.incorrect::after,
  .dashboard-layout--exercise .reading-type5-gap-wrap[data-correct]::after {
    display: block !important;
    position: static !important;
    transform: none !important;
    margin: 6px 0 0 !important;
    white-space: normal !important;
    max-width: 100% !important;
    width: max-content;
    pointer-events: none;
  }

  .dashboard-layout--exercise .gap-box.incorrect,
  .dashboard-layout--exercise .reading-type2-gap.incorrect,
  .dashboard-layout--exercise .reading-type3-gap-inline.incorrect,
  .dashboard-layout--exercise .reading-type4-inline-wrap.incorrect,
  .dashboard-layout--exercise .listening-type2-gap.incorrect,
  .dashboard-layout--exercise .reading-type5-gap-wrap[data-correct] {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}
