/* ═══════════════════════════════════════════════════════════════════════
   ae4u-exercise.css — Interactive Exercise Engine v2.1
   Site:    allenglish4u.com
   Prefix:  ae4u-ex-  (all custom classes must use this prefix)
   Layout:  Mobile-first
   New in v2.1:
     • Resume Banner  (Section 0)
     • Meta Bar       (Section 0.5)
     • Question Navigator  (Section 16)
     • Modal improvements: improvement indicator, Done button
     • Progress bar: moved score inline with progress text
     • Stagger animations on question load
   ═══════════════════════════════════════════════════════════════════════ */


/* ─────────────────────────────────────────────────────────────────────
   [1] SECTION ACCENT SYSTEM
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-card {
  --ex-accent:       var(--c-blue-600, #1565C0);
  --ex-accent-light: #E3F2FD;
  --ex-accent-rgb:   21, 101, 192;
}

.ae4u-ex-card[data-section="toefl"] {
  --ex-accent:       var(--c-green-500, #2E7D32);
  --ex-accent-light: #E8F5E9;
  --ex-accent-rgb:   46, 125, 50;
}

.ae4u-ex-card[data-section="ielts"] {
  --ex-accent:       var(--c-orange-500, #E64A19);
  --ex-accent-light: #FBE9E7;
  --ex-accent-rgb:   230, 74, 25;
}

.ae4u-ex-card[data-section="grammar"] {
  --ex-accent:       var(--c-blue-600, #1565C0);
  --ex-accent-light: #E3F2FD;
  --ex-accent-rgb:   21, 101, 192;
}

.ae4u-ex-card[data-section="dictation"] {
  --ex-accent:       var(--c-purple-500, #6A1B9A);
  --ex-accent-light: #F3E5F5;
  --ex-accent-rgb:   106, 27, 154;
}


/* ─────────────────────────────────────────────────────────────────────
   [0] RESUME BANNER — "Last attempt" friendly banner
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-resume-banner {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: linear-gradient(
    135deg,
    rgba(var(--ex-accent-rgb, 21, 101, 192), 0.08) 0%,
    rgba(var(--ex-accent-rgb, 21, 101, 192), 0.04) 100%
  );
  border-bottom: 1px solid rgba(var(--ex-accent-rgb, 21, 101, 192), 0.12);
  padding: 10px 16px;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.82rem;
  color: var(--c-text, #1A2B4A);
  animation: ae4u-ex-slide-down 0.3s ease;
}

.ae4u-ex-resume-banner--show {
  display: flex;
}

@media (min-width: 768px) {
  .ae4u-ex-resume-banner {
    padding: 11px 40px;
  }
}

.ae4u-ex-resume-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ae4u-ex-resume-body {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ae4u-ex-resume-label {
  color: var(--c-muted, #4E6280);
}

.ae4u-ex-resume-score {
  color: var(--ex-accent);
  font-weight: 800;
  font-size: 0.9rem;
}

.ae4u-ex-resume-cta {
  margin-left: auto;
  font-weight: 600;
  color: var(--ex-accent);
  font-size: 0.8rem;
}

@media (max-width: 500px) {
  .ae4u-ex-resume-cta {
    width: 100%;
    margin-left: 28px;
  }
}


/* ─────────────────────────────────────────────────────────────────────
   [2] CARD SHELL
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-card {
  position: relative;
  background: #ffffff;
  border-radius: var(--r-xl, 24px);
  box-shadow:
    0 1px 3px rgba(7, 17, 43, 0.06),
    0 4px 20px rgba(7, 17, 43, 0.08);
  overflow: hidden;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  color: var(--c-text, #1A2B4A);
  margin: 0 auto;
  max-width: 820px;
  transition: box-shadow 0.2s;
}

.ae4u-ex-card:focus-within {
  box-shadow:
    0 1px 3px rgba(7, 17, 43, 0.06),
    0 6px 28px rgba(var(--ex-accent-rgb, 21, 101, 192), 0.12);
}

/* Top accent stripe */
.ae4u-ex-card::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--ex-accent);
  width: 100%;
  flex-shrink: 0;
}

.ae4u-ex-card-inner {
  padding: 20px 16px 28px;
}

@media (min-width: 768px) {
  .ae4u-ex-card-inner {
    padding: 28px 40px 36px;
  }
}


/* ─────────────────────────────────────────────────────────────────────
   [0.5] META BAR
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.ae4u-ex-meta-bar:empty {
  display: none;
}

.ae4u-ex-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--c-muted, #4E6280);
  background: var(--c-border, #E2EAF4);
  border-radius: 99px;
  padding: 3px 10px;
  line-height: 1.4;
}

.ae4u-ex-meta-tag svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.ae4u-ex-meta-tag--count {
  background: var(--ex-accent-light);
  color: var(--ex-accent);
}

.ae4u-ex-meta-tag--diff.ae4u-ex-meta-tag--green  { background: #E8F5E9; color: #2E7D32; }
.ae4u-ex-meta-tag--diff.ae4u-ex-meta-tag--orange { background: #FFF3E0; color: #E65100; }
.ae4u-ex-meta-tag--diff.ae4u-ex-meta-tag--red    { background: #FFEBEE; color: #B71C1C; }

.ae4u-ex-meta-tag--skill {
  background: transparent;
  border: 1.5px solid var(--c-border, #E2EAF4);
  text-transform: none;
  letter-spacing: 0;
}


/* ─────────────────────────────────────────────────────────────────────
   [3] HEADER
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-header {
  margin-bottom: 16px;
}

.ae4u-ex-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-dark, #07112B);
  margin: 0 0 8px;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .ae4u-ex-title {
    font-size: 1.2rem;
  }
}

.ae4u-ex-instructions {
  font-size: 0.875rem;
  color: var(--c-muted, #4E6280);
  margin: 0;
  line-height: 1.6;
}


/* ─────────────────────────────────────────────────────────────────────
   [4] PROGRESS BAR
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-progress {
  margin-bottom: 20px;
}

.ae4u-ex-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  gap: 8px;
}

.ae4u-ex-progress-text {
  font-size: 0.72rem;
  color: var(--c-muted, #4E6280);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ae4u-ex-progress-track {
  height: 6px;
  background: var(--c-border, #E2EAF4);
  border-radius: 99px;
  overflow: hidden;
}

.ae4u-ex-progress-fill {
  height: 100%;
  background: var(--ex-accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ─────────────────────────────────────────────────────────────────────
   [16] QUESTION NAVIGATOR
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-nav-bar {
  margin-bottom: 22px;
}

.ae4u-ex-nav-bar:empty {
  display: none;
}

.ae4u-ex-nav-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Individual pill */
.ae4u-ex-nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--c-border, #E2EAF4);
  background: #F8FAFF;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-muted, #4E6280);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.ae4u-ex-nav-pill:hover {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  color: var(--ex-accent);
  transform: scale(1.1);
}

.ae4u-ex-nav-pill:focus-visible {
  outline: 2px solid var(--ex-accent);
  outline-offset: 2px;
}

/* Answered — accent color */
.ae4u-ex-nav-pill[data-state="answered"] {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  color: var(--ex-accent);
}

/* Correct — green */
.ae4u-ex-nav-pill[data-state="correct"] {
  border-color: #2E7D32;
  background: #E8F5E9;
  color: #2E7D32;
}

/* Incorrect — red */
.ae4u-ex-nav-pill[data-state="incorrect"] {
  border-color: #C62828;
  background: #FFEBEE;
  color: #C62828;
}

/* Skipped (graded but not answered) */
.ae4u-ex-nav-pill[data-state="skipped"] {
  border-color: #9E9E9E;
  background: #F5F5F5;
  color: #9E9E9E;
}

@media (max-width: 400px) {
  .ae4u-ex-nav-pill {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }
}


/* ─────────────────────────────────────────────────────────────────────
   [5] EXERCISE BODY
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-body {
  min-height: 100px;
}


/* ─────────────────────────────────────────────────────────────────────
   [6] CONTROLS BAR
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border, #E2EAF4);
}

@media (min-width: 768px) {
  .ae4u-ex-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.ae4u-ex-controls-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ae4u-ex-controls-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

@media (min-width: 768px) {
  .ae4u-ex-controls-right {
    align-items: flex-end;
  }
}

/* Score moved to progress row — keep this for backward compat */
.ae4u-ex-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ex-accent);
  min-height: 18px;
  text-align: right;
  white-space: nowrap;
}


/* ─────────────────────────────────────────────────────────────────────
   [7] BUTTONS
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--r-md, 10px);
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
  padding: 10px 20px;
  line-height: 1;
}

.ae4u-ex-btn:focus-visible {
  outline: 3px solid var(--ex-accent);
  outline-offset: 2px;
}

.ae4u-ex-btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* Check — filled accent */
.ae4u-ex-btn--check {
  background: var(--ex-accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.ae4u-ex-btn--check:hover:not(:disabled) {
  opacity: 0.88;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ae4u-ex-btn--check:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Hint — outlined */
.ae4u-ex-btn--hint {
  background: transparent;
  color: var(--ex-accent);
  border: 2px solid var(--ex-accent);
}

.ae4u-ex-btn--hint:hover:not(:disabled) {
  background: var(--ex-accent-light);
}

.ae4u-ex-btn--hint:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Try Again — ghost */
.ae4u-ex-btn--retry {
  background: transparent;
  color: var(--c-muted, #4E6280);
  border: 2px solid var(--c-border, #E2EAF4);
}

.ae4u-ex-btn--retry:hover:not(:disabled) {
  background: var(--c-border, #E2EAF4);
  color: var(--c-text, #1A2B4A);
}

.ae4u-ex-btn--retry:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Done — accent outline */
.ae4u-ex-btn--done {
  background: var(--ex-accent-light);
  color: var(--ex-accent);
  border: 2px solid var(--ex-accent);
}

.ae4u-ex-btn--done:hover:not(:disabled) {
  background: var(--ex-accent);
  color: #ffffff;
}


/* ─────────────────────────────────────────────────────────────────────
   [8] SCORE POPUP MODAL v2.1
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 43, 0.60);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  animation: ae4u-ex-fade-in 0.2s ease;
  backdrop-filter: blur(2px);
}

.ae4u-ex-modal {
  background: #ffffff;
  border-radius: var(--r-xl, 24px);
  box-shadow: 0 16px 48px rgba(7, 17, 43, 0.18);
  padding: 32px 24px 28px;
  text-align: center;
  width: 100%;
  max-width: 400px;
  animation: ae4u-ex-pop-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  --ex-accent: var(--ex-accent, #1565C0);
  --ex-accent-light: var(--ex-accent-light, #E3F2FD);
}

.ae4u-ex-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--ex-accent-light, #E3F2FD);
  margin: 0 auto 14px;
  color: var(--ex-accent);
}

.ae4u-ex-modal-msg {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-dark, #07112B);
  margin: 0 0 18px;
  line-height: 1.3;
}

.ae4u-ex-modal-score-box {
  background: var(--ex-accent-light, #E3F2FD);
  border-radius: var(--r-lg, 16px);
  padding: 18px 20px 14px;
  margin-bottom: 12px;
}

.ae4u-ex-modal-fraction {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ex-accent);
  line-height: 1;
  margin-bottom: 4px;
}

.ae4u-ex-modal-frac-sep {
  font-size: 1.5rem;
  font-weight: 400;
  opacity: 0.6;
  margin: 0 2px;
}

.ae4u-ex-modal-percent {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-muted, #4E6280);
}

.ae4u-ex-modal-bar-track {
  height: 8px;
  background: var(--c-border, #E2EAF4);
  border-radius: 99px;
  overflow: hidden;
  margin: 0 0 12px;
}

.ae4u-ex-modal-bar-fill {
  height: 100%;
  background: var(--ex-accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.15s;
}

/* Improvement indicator (v2.1) */
.ae4u-ex-modal-improvement {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 16px;
  background: #F0F4FF;
  color: var(--c-muted, #4E6280);
}

.ae4u-ex-modal-improvement--up {
  background: #E8F5E9;
  color: #2E7D32;
}

.ae4u-ex-modal-improvement--dn {
  background: #FFEBEE;
  color: #C62828;
}

.ae4u-ex-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 360px) {
  .ae4u-ex-modal-actions {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .ae4u-ex-modal-actions .ae4u-ex-btn {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
  }
}

.ae4u-ex-modal-next {
  text-decoration: none;
}


/* ─────────────────────────────────────────────────────────────────────
   [9] FEEDBACK STATE CLASSES
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-correct {
  border-color: #2E7D32 !important;
  background-color: #E8F5E9 !important;
  color: #1B5E20 !important;
}

.ae4u-ex-incorrect {
  border-color: #C62828 !important;
  background-color: #FFEBEE !important;
  color: #B71C1C !important;
  animation: ae4u-ex-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.ae4u-ex-reveal-correct {
  border-color: #2E7D32 !important;
  background-color: #C8E6C9 !important;
  color: #1B5E20 !important;
}

.ae4u-ex-hint-eliminate {
  opacity: 0.28;
  text-decoration: line-through;
  pointer-events: none;
  cursor: default;
}

.ae4u-ex-hint-pulse {
  animation: ae4u-ex-pulse-hint 1.1s ease-in-out 3;
}


/* ─────────────────────────────────────────────────────────────────────
   [10] EX-1: FILL IN THE BLANKS
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-fill-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Stagger animation on load */
.ae4u-ex-fill-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: ae4u-ex-fade-up 0.35s ease both;
}

.ae4u-ex-fill-item:nth-child(1)  { animation-delay: 0.00s; }
.ae4u-ex-fill-item:nth-child(2)  { animation-delay: 0.04s; }
.ae4u-ex-fill-item:nth-child(3)  { animation-delay: 0.08s; }
.ae4u-ex-fill-item:nth-child(4)  { animation-delay: 0.12s; }
.ae4u-ex-fill-item:nth-child(5)  { animation-delay: 0.16s; }
.ae4u-ex-fill-item:nth-child(6)  { animation-delay: 0.20s; }
.ae4u-ex-fill-item:nth-child(7)  { animation-delay: 0.24s; }
.ae4u-ex-fill-item:nth-child(8)  { animation-delay: 0.28s; }
.ae4u-ex-fill-item:nth-child(9)  { animation-delay: 0.32s; }
.ae4u-ex-fill-item:nth-child(n+10) { animation-delay: 0.36s; }

.ae4u-ex-fill-num {
  font-weight: 700;
  color: var(--ex-accent);
  min-width: 24px;
  padding-top: 4px;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.ae4u-ex-fill-sentence {
  flex: 1;
  font-size: 0.975rem;
  line-height: 2.1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 2px;
}

.ae4u-ex-fill-sentence .ae4u-ex-word {
  display: inline;
}

.ae4u-ex-input {
  display: inline-block;
  vertical-align: middle;
  border: 2px solid var(--c-border, #E2EAF4);
  border-radius: var(--r-md, 10px);
  padding: 4px 10px;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.9rem;
  color: var(--c-text, #1A2B4A);
  background: #F8FAFF;
  min-width: 80px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  margin: 0 2px;
}

.ae4u-ex-input:focus {
  border-color: var(--ex-accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(var(--ex-accent-rgb, 21, 101, 192), 0.12);
}

.ae4u-ex-input.ae4u-ex-correct {
  border-color: #2E7D32;
  background: #E8F5E9;
  color: #1B5E20;
  pointer-events: none;
}

.ae4u-ex-input.ae4u-ex-incorrect {
  border-color: #C62828;
  background: #FFEBEE;
  color: #B71C1C;
  animation: ae4u-ex-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.ae4u-ex-input:disabled { cursor: default; }

.ae4u-ex-answer-reveal {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.78rem;
  color: #2E7D32;
  font-weight: 700;
  vertical-align: middle;
  background: #C8E6C9;
  border-radius: 4px;
  padding: 1px 7px;
}

.ae4u-ex-item-hint-btn {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--c-muted, #4E6280);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--r-md, 10px);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  margin-top: 2px;
  align-self: flex-start;
}

.ae4u-ex-item-hint-btn:hover {
  background: var(--ex-accent-light);
  color: var(--ex-accent);
}


/* ─────────────────────────────────────────────────────────────────────
   [11] EX-2: MULTIPLE CHOICE
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-mcq-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.ae4u-ex-mcq-block {
  animation: ae4u-ex-fade-up 0.35s ease both;
}

.ae4u-ex-mcq-block:nth-child(1)  { animation-delay: 0.00s; }
.ae4u-ex-mcq-block:nth-child(2)  { animation-delay: 0.05s; }
.ae4u-ex-mcq-block:nth-child(3)  { animation-delay: 0.10s; }
.ae4u-ex-mcq-block:nth-child(4)  { animation-delay: 0.15s; }
.ae4u-ex-mcq-block:nth-child(5)  { animation-delay: 0.20s; }
.ae4u-ex-mcq-block:nth-child(6)  { animation-delay: 0.25s; }
.ae4u-ex-mcq-block:nth-child(n+7) { animation-delay: 0.30s; }

.ae4u-ex-mcq-question {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--c-dark, #07112B);
  margin: 0 0 12px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ae4u-ex-mcq-qnum {
  font-weight: 800;
  color: var(--ex-accent);
  min-width: 24px;
  flex-shrink: 0;
}

.ae4u-ex-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ae4u-ex-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 2px solid var(--c-border, #E2EAF4);
  border-radius: var(--r-md, 10px);
  background: #F8FAFF;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.9rem;
  color: var(--c-text, #1A2B4A);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  line-height: 1.45;
}

.ae4u-ex-option-btn:hover:not(:disabled):not(.ae4u-ex-correct):not(.ae4u-ex-incorrect):not(.ae4u-ex-reveal-correct) {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  transform: translateX(2px);
}

.ae4u-ex-option-btn:focus-visible {
  outline: 3px solid var(--ex-accent);
  outline-offset: 1px;
}

.ae4u-ex-option-btn.ae4u-ex-selected {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(var(--ex-accent-rgb, 21, 101, 192), 0.14);
}

.ae4u-ex-option-btn:disabled { cursor: default; }

.ae4u-ex-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-border, #E2EAF4);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--c-muted, #4E6280);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.ae4u-ex-option-btn.ae4u-ex-selected .ae4u-ex-option-letter { background: var(--ex-accent); color: #ffffff; }
.ae4u-ex-option-btn.ae4u-ex-correct  .ae4u-ex-option-letter { background: #2E7D32; color: #ffffff; }
.ae4u-ex-option-btn.ae4u-ex-incorrect .ae4u-ex-option-letter { background: #C62828; color: #ffffff; }
.ae4u-ex-option-btn.ae4u-ex-reveal-correct { border-color: #2E7D32; background: #E8F5E9; }
.ae4u-ex-option-btn.ae4u-ex-reveal-correct .ae4u-ex-option-letter { background: #2E7D32; color: #ffffff; }

.ae4u-ex-mcq-explanation {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md, 10px);
  background: #F0F4FF;
  font-size: 0.845rem;
  color: var(--c-muted, #4E6280);
  line-height: 1.58;
  border-left: 3px solid var(--ex-accent);
}

.ae4u-ex-mcq-explanation.ae4u-ex-visible {
  display: block;
  animation: ae4u-ex-fade-up 0.22s ease;
}


/* ─────────────────────────────────────────────────────────────────────
   [12] EX-3: DRAG & DROP
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-word-bank {
  background: #F8FAFF;
  border: 1.5px solid var(--c-border, #E2EAF4);
  border-radius: var(--r-lg, 16px);
  padding: 14px 16px 12px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
}

.ae4u-ex-word-bank-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--c-muted, #4E6280);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 100%;
  margin-bottom: 2px;
}

.ae4u-ex-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 99px;
  background: #ffffff;
  border: 2px solid var(--c-border, #E2EAF4);
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text, #1A2B4A);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s, opacity 0.15s;
  box-shadow: 0 1px 4px rgba(7, 17, 43, 0.07);
}

.ae4u-ex-chip:hover {
  border-color: var(--ex-accent);
  box-shadow: 0 3px 10px rgba(7, 17, 43, 0.12);
  transform: translateY(-1px);
}

.ae4u-ex-chip:focus-visible {
  outline: 3px solid var(--ex-accent);
  outline-offset: 2px;
}

.ae4u-ex-chip.ae4u-ex-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.ae4u-ex-chip.ae4u-ex-selected {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.ae4u-ex-touch-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.88;
  transform: scale(1.06);
  border: 2px solid var(--ex-accent);
}

.ae4u-ex-zone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  min-width: 90px;
  min-height: 36px;
  border: 2px dashed var(--c-border, #E2EAF4);
  border-radius: var(--r-md, 10px);
  padding: 2px 10px;
  background: #F8FAFF;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  cursor: pointer;
  margin: 0 3px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text, #1A2B4A);
}

.ae4u-ex-zone.ae4u-ex-dragover {
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  border-style: solid;
}

.ae4u-ex-zone.ae4u-ex-filled {
  border-style: solid;
  border-color: var(--ex-accent);
  background: var(--ex-accent-light);
  cursor: pointer;
}

.ae4u-ex-zone.ae4u-ex-correct {
  border-color: #2E7D32;
  background: #E8F5E9;
  color: #1B5E20;
  cursor: default;
}

.ae4u-ex-zone.ae4u-ex-incorrect {
  border-color: #C62828;
  background: #FFEBEE;
  color: #B71C1C;
  animation: ae4u-ex-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  cursor: default;
}

.ae4u-ex-drag-sentence {
  font-size: 0.975rem;
  line-height: 2.5;
  margin-bottom: 6px;
}

.ae4u-ex-drag-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.ae4u-ex-drag-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: ae4u-ex-fade-up 0.35s ease both;
}

.ae4u-ex-drag-item:nth-child(1)  { animation-delay: 0.00s; }
.ae4u-ex-drag-item:nth-child(2)  { animation-delay: 0.04s; }
.ae4u-ex-drag-item:nth-child(3)  { animation-delay: 0.08s; }
.ae4u-ex-drag-item:nth-child(4)  { animation-delay: 0.12s; }
.ae4u-ex-drag-item:nth-child(5)  { animation-delay: 0.16s; }
.ae4u-ex-drag-item:nth-child(n+6) { animation-delay: 0.20s; }

.ae4u-ex-drag-num {
  font-weight: 700;
  color: var(--ex-accent);
  min-width: 24px;
  padding-top: 6px;
  font-size: 0.875rem;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────────────────────
   [13] EX-4: JOIN / MATCH LINES
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-match-wrapper {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.ae4u-ex-match-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.ae4u-ex-match-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.ae4u-ex-match-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md, 10px);
  border: 2px solid var(--c-border, #E2EAF4);
  background: #F8FAFF;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: 44px;
  animation: ae4u-ex-fade-up 0.35s ease both;
}

.ae4u-ex-match-item:nth-child(1) { animation-delay: 0.00s; }
.ae4u-ex-match-item:nth-child(2) { animation-delay: 0.06s; }
.ae4u-ex-match-item:nth-child(3) { animation-delay: 0.12s; }
.ae4u-ex-match-item:nth-child(4) { animation-delay: 0.18s; }
.ae4u-ex-match-item:nth-child(5) { animation-delay: 0.24s; }
.ae4u-ex-match-item:nth-child(n+6) { animation-delay: 0.30s; }

.ae4u-ex-match-col-left .ae4u-ex-match-item  { justify-content: space-between; cursor: default; }
.ae4u-ex-match-col-right .ae4u-ex-match-item { justify-content: flex-start; cursor: default; }

.ae4u-ex-match-item.ae4u-ex-active-item { border-color: var(--ex-accent); background: var(--ex-accent-light); }
.ae4u-ex-match-item.ae4u-ex-connected   { border-color: var(--ex-accent); }
.ae4u-ex-match-item.ae4u-ex-correct     { border-color: #2E7D32; background: #E8F5E9; }
.ae4u-ex-match-item.ae4u-ex-incorrect   {
  border-color: #C62828;
  background: #FFEBEE;
  animation: ae4u-ex-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.ae4u-ex-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--ex-accent);
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
  position: relative;
  z-index: 3;
}

.ae4u-ex-dot:hover         { background: var(--ex-accent-light); transform: scale(1.25); }
.ae4u-ex-dot:focus-visible { outline: 2px solid var(--ex-accent); outline-offset: 2px; }
.ae4u-ex-dot.ae4u-ex-active    { background: var(--ex-accent); transform: scale(1.3); }
.ae4u-ex-dot.ae4u-ex-connected { background: var(--ex-accent); }
.ae4u-ex-dot.ae4u-ex-correct   { border-color: #2E7D32; background: #2E7D32; }
.ae4u-ex-dot.ae4u-ex-incorrect { border-color: #C62828; background: #C62828; }

.ae4u-ex-match-line {
  stroke: var(--ex-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.7;
  fill: none;
  transition: stroke 0.25s, opacity 0.2s;
}

.ae4u-ex-match-line.ae4u-ex-correct  { stroke: #2E7D32; stroke-width: 3; opacity: 1; }
.ae4u-ex-match-line.ae4u-ex-incorrect { stroke: #C62828; stroke-width: 3; opacity: 1; }

@media (max-width: 767px) {
  .ae4u-ex-match-wrapper {
    gap: 12px;
  }

  .ae4u-ex-match-svg-layer { display: none; }
  .ae4u-ex-dot { display: none; }

  .ae4u-ex-match-item {
    cursor: pointer;
    font-size: 0.82rem;
    padding: 9px 10px;
  }

  .ae4u-ex-match-col-left .ae4u-ex-match-item { justify-content: flex-start; }

  .ae4u-ex-match-item:hover:not(.ae4u-ex-correct):not(.ae4u-ex-incorrect):not(.ae4u-ex-connected) {
    border-color: var(--ex-accent);
    background: var(--ex-accent-light);
  }
}


/* ─────────────────────────────────────────────────────────────────────
   [14] UTILITY STATES
   ───────────────────────────────────────────────────────────────────── */

.ae4u-ex-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--c-muted, #4E6280);
  font-size: 0.9rem;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
}

.ae4u-ex-error {
  padding: 14px 18px;
  background: #FFEBEE;
  border: 1px solid #EF9A9A;
  border-radius: var(--r-md, 10px);
  color: #B71C1C;
  font-size: 0.875rem;
  font-family: var(--f-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
}

.ae4u-ex-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ─────────────────────────────────────────────────────────────────────
   [15] ANIMATIONS
   ───────────────────────────────────────────────────────────────────── */

@keyframes ae4u-ex-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-7px); }
  30%      { transform: translateX(7px); }
  45%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

@keyframes ae4u-ex-pop-in {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes ae4u-ex-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ae4u-ex-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ae4u-ex-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ae4u-ex-pulse-hint {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(var(--ex-accent-rgb, 21, 101, 192), 0.45);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(var(--ex-accent-rgb, 21, 101, 192), 0);
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .ae4u-ex-fill-item,
  .ae4u-ex-mcq-block,
  .ae4u-ex-drag-item,
  .ae4u-ex-match-item {
    animation: none;
  }

  .ae4u-ex-progress-fill,
  .ae4u-ex-modal-bar-fill {
    transition: none;
  }
}


/* ═══════════════════════════════════════════════════════════════════
   LISTENING EXERCISE — Audio Player
   ═══════════════════════════════════════════════════════════════════ */

.ae4u-listen-player {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 10px;
  align-items: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2540 100%);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
}

.ae4u-listen-player__icon {
  grid-row: 1;
  grid-column: 1;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.ae4u-listen-player__info {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ae4u-listen-player__label {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ae4u-listen-player__hint {
  font-size: 11px;
  color: rgba(255,255,255,.55);
}

.ae4u-listen-player__controls {
  grid-row: 1;
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ae4u-listen-btn {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s, transform .1s;
  color: #fff;
}

.ae4u-listen-btn--rewind {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.1);
}

.ae4u-listen-btn--rewind:hover { background: rgba(255,255,255,.2); }

.ae4u-listen-btn--play {
  width: 48px;
  height: 48px;
  background: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,.5);
}

.ae4u-listen-btn--play:hover  { background: #2563eb; transform: scale(1.05); }
.ae4u-listen-player--playing .ae4u-listen-btn--play { background: #8b5cf6; }

.ae4u-listen-progress {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ae4u-listen-progress__track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 99px;
  cursor: pointer;
  overflow: hidden;
  transition: height .15s;
}

.ae4u-listen-progress__track:hover { height: 6px; }

.ae4u-listen-progress__fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 99px;
  transition: width .1s linear;
}

.ae4u-listen-player--playing .ae4u-listen-progress__fill { background: #8b5cf6; }

.ae4u-listen-progress__time {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  text-align: right;
}

.ae4u-listen-part-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 12px;
}

.ae4u-listen-part-header:first-child { margin-top: 0; }

.ae4u-listen-part-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--part-color, #3b82f6);
  background: color-mix(in srgb, var(--part-color, #3b82f6) 12%, transparent);
  padding: 4px 12px;
  border-radius: 99px;
}
/* ---------------------------------------------------------------------
   [18] EX-10: IMAGE OVERLAY (LIVEWORKSHEETS STYLE)
   --------------------------------------------------------------------- */

.ae4u-ex-overlay-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
  overflow: hidden; /* Prevent scrollbars when dragging outside */
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--c-border, #E2EAF4);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.ae4u-ex-overlay-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.ae4u-ex-overlay-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.ae4u-ex-overlay-fields {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
}

.ae4u-ex-overlay-item {
  position: absolute;
  box-sizing: border-box;
}

/* Input & Dropdown */
.ae4u-ex-overlay-input,
.ae4u-ex-overlay-select {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #1565C0;
  color: #1A2B4A;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: border-color 0.15s, background 0.15s;
}

.ae4u-ex-overlay-input:focus,
.ae4u-ex-overlay-select:focus {
  outline: none;
  border-color: #E64A19;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(230, 74, 25, 0.2);
}

.ae4u-ex-overlay-input.ae4u-ex-correct,
.ae4u-ex-overlay-select.ae4u-ex-correct {
  border: 2px solid #2E7D32 !important;
  background-color: #E8F5E9 !important;
  color: #1B5E20 !important;
}

.ae4u-ex-overlay-input.ae4u-ex-incorrect,
.ae4u-ex-overlay-select.ae4u-ex-incorrect {
  border: 2px solid #C62828 !important;
  background-color: #FFEBEE !important;
  color: #B71C1C !important;
}

/* Checkbox */
.ae4u-ex-overlay-checkbox {
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s, border-color 0.1s;
}

.ae4u-ex-overlay-checkbox:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: #1565C0;
}

.ae4u-ex-overlay-checked {
  background: rgba(21, 101, 192, 0.3);
  border-color: #1565C0;
}

.ae4u-ex-overlay-checkbox.ae4u-ex-correct {
  background: rgba(46, 125, 50, 0.3) !important;
  border-color: #2E7D32 !important;
}

.ae4u-ex-overlay-checkbox.ae4u-ex-incorrect {
  background: rgba(198, 40, 40, 0.3) !important;
  border-color: #C62828 !important;
}

/* Join Points */
.ae4u-ex-overlay-join {
  background: rgba(21, 101, 192, 0.1);
  border: 2px dashed #1565C0;
  border-radius: 50%;
  cursor: crosshair;
  transition: background 0.15s, transform 0.15s;
}

.ae4u-ex-overlay-join:hover {
  background: rgba(21, 101, 192, 0.3);
  transform: scale(1.1);
}

.ae4u-ex-overlay-join-active {
  background: #1565C0 !important;
  box-shadow: 0 0 8px rgba(21, 101, 192, 0.6);
}

/* Drag & Drop */
.ae4u-ex-overlay-dragitem {
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid #E64A19;
  border-radius: 6px;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ae4u-ex-overlay-dragitem:active {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: scale(1.02);
}

.ae4u-ex-overlay-dropzone {
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed #999;
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.ae4u-ex-overlay-dropzone.ae4u-ex-correct {
  border-color: #2E7D32 !important;
  background: rgba(46, 125, 50, 0.1) !important;
}

.ae4u-ex-overlay-dropzone.ae4u-ex-incorrect {
  border-color: #C62828 !important;
  background: rgba(198, 40, 40, 0.1) !important;
}

