.etopik-lms {
  max-width: 1320px;
  margin: 40px auto;
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

.etopik-lms-header h2 {
  margin: 0;
  font-size: 22px;
}

.etopik-lms-sub {
  color: #64748b;
  margin-top: 6px;
  font-size: 14px;
}

.etopik-lms-body {
  margin-top: 24px;
}

.etopik-lms-box {
  padding: 20px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}
.etopik-course-title h3 {
  margin: 0;
  font-size: 22px;
}

.etopik-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.etopik-lesson-card {
  padding: 16px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
}

.etopik-lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,.1);
}

.lesson-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.lesson-chapters {
  font-size: 14px;
  color: #475569;
  margin-bottom: 12px;
  padding-left: 16px;
}

.lesson-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.etopik-chapters{
  margin-top: 8px;
}

.etopik-chapter{
  display: inline-block;   /* 🔑 QUAN TRỌNG */
  margin-right: 10px;      /* 🔑 TÁCH CHỮ */
  margin-bottom: 6px;

  background: #eef6ff;
  color: #1d4ed8;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
/* === FORCE LMS UI === */
.etopik-scope .etopik-chapters{
  display: block !important;
}

.etopik-scope .etopik-chapter{
  display: inline-block !important;
  margin-right: 10px !important;
  margin-bottom: 6px !important;

  background: #eef6ff;
  color: #1d4ed8;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.etopik-lesson-status{
  margin-top:6px;
  font-size:13px;
  font-weight:600;
}

.status-new{
  color:#64748b;
}

.status-learning{
  color:#f59e0b;
}

.status-done{
  color:#16a34a;
}
.etopik-progress-wrap{
  margin: 16px 0 24px;
}

.etopik-progress-text{
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #0f172a;
}

.etopik-progress-bar{
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.etopik-progress-fill{
  height: 100%;
  background: linear-gradient(90deg,#3b82f6,#06b6d4);
  border-radius: 999px;
  transition: width .35s ease;
}
.etopik-resume-box{
  margin:16px 0;
}

.etopik-resume-btn{
  background:#22c55e;
  color:#fff;
  border:none;
  padding:10px 16px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
}

.resume-highlight{
  outline:2px solid #22c55e;
  border-radius:8px;
  padding:12px;
}
.etopik-my-courses-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap:20px;
  margin-top:30px;
}

.etopik-course-card{
  background:#fff;
  border-radius:18px;
  padding:22px 16px;
  text-align:center;
  text-decoration:none;
  box-shadow:0 12px 30px rgba(0,0,0,.08);
  transition:.25s;
}

.etopik-course-card:hover{
  transform:translateY(-4px);
}

.course-icon img{
  width:64px;
  height:64px;
  object-fit:contain;
  margin-bottom:12px;
}

.course-title{
  font-weight:700;
  margin-bottom:10px;
}

.course-btn{
  display:inline-block;
  padding:6px 14px;
  background:#3b82f6;
  color:#fff;
  border-radius:999px;
  font-size:13px;
}
/* ===== COURSE EXPIRE TEXT ===== */
.hub-card-expire {
  margin: 6px 0 10px;
  font-size: 10px;
  font-weight: 600;
  color: #0f172a;        /* 🔥 ĐẬM */
  opacity: 0.85;
  text-align: center;
  line-height: 1.3;
}

/* Chừa không gian cho nội dung phụ */
.hub-card {
  padding-bottom: 14px;
}

/* Trạng thái hết hạn */
.hub-card-btn.disabled {
  background: #cbd5e1;
  color: #475569;
}
.hub-card-expire {
  font-size: 13px;
  margin: 6px 0;
  font-weight: 600;
}

.expire-normal {
  color: #2563eb;
}

.expire-warning {
  color: #f59e0b;
}

.expire-danger {
  color: #ef4444;
}

.expire-life {
  color: #16a34a;
}

/* =====================================================
   VIEW 4 – LESSON DETAIL (APP STYLE)
   Match lesson-view.js
===================================================== */

/* Wrapper */
.lesson-view {
  min-height: 100vh;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== HEADER ===== */
.lesson-view-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-back-btn {
  background: #eef2ff;
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lesson-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* ===== CONTENT ===== */
.lesson-view-content {
  flex: 1;
  padding: 18px 16px 90px;
}

/* ===== VIDEO ===== */
.lesson-video .video-box {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 18px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(99,102,241,.35);
}

/* ===== QUIZ ===== */
.lesson-quiz h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

.quiz-question {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
}

.lesson-quiz label {
  display: block;
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s ease;
}

.lesson-quiz label:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

/* ===== READING ===== */
.lesson-reading h3,
.lesson-listening h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
}

.lesson-reading p {
  background: #ffffff;
  padding: 16px;
  border-radius: 14px;
  line-height: 1.7;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
}

/* ===== LISTENING ===== */
.audio-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  font-size: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
}

/* ===== ACTION BAR ===== */
.lesson-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
}

.btn-primary {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(34,197,94,.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
}
/* ================================
   VIEW 3 – LESSON TIMELINE
================================ */

/* wrapper */
.etopik-view-timeline {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== HEADER ===== */
.etopik-timeline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.etopik-timeline-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

/* back button */
.etopik-back-btn {
  border: none;
  background: #f1f5f9;
  color: #0f172a;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}

.etopik-back-btn:hover {
  background: #e2e8f0;
  transform: translateX(-2px);
}

/* ===== LIST ===== */
.etopik-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== ITEM ===== */
.timeline-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  cursor: pointer;

  transition:
    box-shadow .2s ease,
    transform .15s ease,
    border-color .2s ease;
}

/* hover desktop */
@media (hover: hover) {
  .timeline-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    border-color: #c7d2fe;
  }
}

/* ===== ICON ===== */
.timeline-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== CONTENT ===== */
.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-title {
  font-weight: 600;
  font-size: 15px;
  color: #0f172a;
}

.timeline-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* ===== ACTION ===== */
.timeline-action {
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  flex-shrink: 0;
}

/* ================================
   DONE STATE
================================ */
.timeline-item.done {
  background: #f0fdf4;
  border-color: #86efac;
}

.timeline-item.done .timeline-icon {
  background: #22c55e;
  color: #ffffff;
}

.timeline-item.done .timeline-action {
  color: #16a34a;
}

/* ================================
   ACTIVE / CURRENT (sau dùng)
================================ */
.timeline-item.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

/* ================================
   MOBILE TWEAK
================================ */
@media (max-width: 480px) {
  .etopik-view-timeline {
    padding: 16px 12px 32px;
  }

  .timeline-item {
    padding: 12px 14px;
  }

  .timeline-title {
    font-size: 14px;
  }
}
/* ================================
   VIEW 2 – LESSON DETAIL (CHAPTERS)
================================ */

.etopik-lesson-detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== CHAPTER CARD ===== */
.etopik-chapter-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  cursor: pointer;

  transition:
    transform .15s ease,
    box-shadow .2s ease,
    border-color .2s ease;
}

/* hover desktop */
@media (hover: hover) {
  .etopik-chapter-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    border-color: #c7d2fe;
  }
}

/* ĐÚNG */
.answer-correct {
  color: #166534;
  background: #dcfce7;
  border-radius: 6px;
  padding: 4px 6px;
}

/* SAI */
.answer-wrong {
  color: #991b1b;
  background: #fee2e2;
  border-radius: 6px;
  padding: 4px 6px;
}

/* text đáp án */
.answer-correct-text {
  margin-left: 8px;
  font-weight: 600;
  color: #2563eb;
}

/* box giải thích */
.explain-box {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
}

.explain-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.etopik-score-popup {
  position: fixed;
  inset: 0;
  z-index: 999999;
}

.score-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}

.score-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.score-main {
  font-size: 40px;
  font-weight: 800;
  margin: 12px 0;
}
.answer-correct {
  background: #ecfdf5;
  border-left: 4px solid #22c55e;
  padding: 6px 8px;
  border-radius: 6px;
}

.answer-wrong {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
  padding: 6px 8px;
  border-radius: 6px;
}

.answer-tag {
  margin-left: 8px;
  font-weight: 600;
  color: #16a34a;
}

.answer-tag.wrong {
  color: #dc2626;
}

.explain-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  font-size: 14px;
}

.explain-title {
  font-weight: 700;
  margin-bottom: 6px;
}
/* ===== ĐÚNG / SAI ===== */
.answer-correct {
  background: #ecfdf5;
  border-left: 4px solid #22c55e;
}

.answer-wrong {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

.answer-tag {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #16a34a;
}

.answer-tag.wrong {
  color: #dc2626;
}

/* ===== GIẢI THÍCH ===== */
.explain-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
}

.explain-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #0f172a;
}

.explain-content {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
}
/* ===== CHAPTER BLOCK ===== */
.etopik-chapter-block {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 16px 18px;
  border-radius: 14px;

  background: #ffffff;
  border: 1px solid #e5e7eb;

  transition: all .25s ease;
}

/* ===== CHƯƠNG ĐÃ HOÀN THÀNH ===== */
.etopik-chapter-block.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.etopik-chapter-block.completed h4 {
  color: #166534;
  font-weight: 700;
}

/* ===== STATUS ===== */
.chapter-status {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* chưa hoàn thành */
.chapter-status.pending {
  background: #e5e7eb;
  color: #374151;
}

/* đã hoàn thành */
.chapter-status.done {
  background: #22c55e;
  color: #ffffff;
}
.tf-question {
  margin-bottom: 16px;
}

.tf-text {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.tf-options {
  display: flex;
  gap: 12px;
}
.tf-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}


/* khi chấm */
.tf-option.answer-correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.tf-option.answer-wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}
.answer-correct {
  background: #ecfdf5;
  border-left: 4px solid #22c55e;
}

.answer-wrong {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.match-answer {
  margin-bottom: 10px;
}
.choose-text-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 12px;
}

.choose-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
}
.true-false-list {
  margin-top: 10px;
}

.tf-row {
  margin-bottom: 14px;
}

.tf-text {
  margin-bottom: 6px;
  line-height: 1.4;
}

.tf-row label {
  margin-right: 18px;
  font-weight: 600;
}
/* ===============================
   EXAM RESULT POPUP
================================ */
.exam-result-popup {
  position: fixed;
  inset: 0;
  z-index: 999999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}

.exam-result-popup .popup-box {
  width: 92%;
  max-width: 420px;

  background: #ffffff;
  border-radius: 16px;
  padding: 24px 22px;

  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);

  animation: popupIn .25s ease;
}

@keyframes popupIn {
  from {
    transform: translateY(20px) scale(.96);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.popup-score {
  font-size: 40px;
  font-weight: 800;
  margin: 8px 0;
  color: #f59e0b;
}

.popup-message {
  margin: 12px 0 18px;
  font-size: 15px;
  line-height: 1.5;
}

.popup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.popup-actions button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.popup-actions .btn-review {
  background: #0ea5e9;
  color: #fff;
}

.popup-actions .btn-close {
  background: #e5e7eb;
}
/* ===== POPUP RESULT – TINH CHỈNH ===== */
.exam-result-popup h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.exam-result-popup .popup-score {
  font-size: 48px;       /* 🔥 TO HƠN */
  font-weight: 900;
  color: #f59e0b;
  margin: 6px 0 10px;
}

.exam-result-popup p {
  font-size: 14px;
}
/* ===============================
   LISTENING QUESTIONS – TYPO
================================ */
.listen-question {
  font-size: 16px;
  line-height: 1.6;
}

.listen-question h4 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.true-false-list,
.choose-text-grid,
.match-question,
.mcq,
.image-choice-question {
  font-size: 16px;
}

.true-false-list label,
.choose-option,
.mcq li {
  font-size: 16px;
}

/* ===============================
   SUBMIT EXAM BUTTON
================================ */
.submit-exam-btn {
  margin: 24px auto 0;
  display: block;

  padding: 12px 20px;
  border-radius: 999px;

  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #ffffff;

  border: none;
  font-size: 15px;
  font-weight: 800;

  cursor: pointer;
  box-shadow: 0 10px 25px rgba(245,158,11,.35);

  transition: transform .15s ease, box-shadow .15s ease;
}

.submit-exam-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(245,158,11,.45);
}

/* ===============================
   OPTIONS BASE STYLE
================================ */
.choose-option,
.tf-option,
.mcq-option,
.image-choice-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 10px 16px;
  margin: 6px 8px 6px 0;

  border-radius: 999px;
  border: 2px solid #e5e7eb;
  background: #ffffff;

  font-size: 16px;
  font-weight: 500;

  cursor: pointer;
  transition: all .2s ease;
}

/* ===============================
   ANSWER REVIEW STATE
================================ */

/* ✅ Đáp án đúng */
.correct-answer {
  background: #ecfdf5 !important;
  border-color: #22c55e !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
}

/* ❌ Học viên chọn sai */
.user-wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #7f1d1d !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.25);
}

/* icon */
.correct-answer::after {
  content: " ✓";
  font-weight: 800;
}

.user-wrong::after {
  content: " ✕";
  font-weight: 800;
}
.match-correct-text {
  margin-left: 10px;
  color: #16a34a;
  font-weight: 700;
  font-size: 14px;
}
/* ===============================
   MATCH – MOBILE ONE LINE
================================ */
@media (max-width: 768px) {

  .match-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .match-mobile-item {
    display: grid;
    grid-template-columns: 32px 70px 1fr;
    align-items: center;
    gap: 10px;

    padding: 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
  }

  .match-num {
    font-weight: 700;
    text-align: center;
  }

  .match-mobile-item select {
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 14px;
  }

  .match-text {
    font-size: 15px;
    line-height: 1.4;
  }
}

/* ===============================
   CHOOSE TEXT – MOBILE COMPACT
================================ */
@media (max-width: 768px) {

  /* grid 2 cột gọn */
  .choose-text-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* mỗi câu = card nhỏ */
  .choose-text-row {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
  }

  /* số câu sát option */
  .choose-question {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
  }

  /* option gọn – 1 dòng */
  .choose-option {
    width: 100%;
    padding: 8px 12px;
    margin: 4px 0;
    font-size: 15px;

    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
  }

  /* radio nhỏ hơn */
  .choose-option input[type="radio"] {
    transform: scale(1);
  }

  /* bỏ icon thừa cho gọn */
  .choose-option::after {
    margin-left: auto;
    font-size: 16px;
  }
}
.ordering-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ordering-item {
  display: grid;
  grid-template-columns: 28px 64px 1fr;
  align-items: center;
  gap: 8px;

  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
}

.ordering-index {
  font-weight: 700;
  text-align: center;
}

.ordering-item select {
  height: 36px;
  border-radius: 8px;
  padding: 0 8px;
}

.ordering-text {
  font-size: 15px;
  line-height: 1.4;
}

.ordering-correct {
  grid-column: 2 / -1;
  font-size: 13px;
  margin-top: 4px;
  color: #16a34a;
}

/* trạng thái */
.ordering-item.correct-answer {
  background: #ecfdf5;
  border-color: #22c55e;
}

.ordering-item.user-wrong {
  background: #fef2f2;
  border-color: #ef4444;
}
.quiz-section-title {
  margin: 16px 0 8px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-left: 4px solid #6366f1;
  font-weight: 600;
}

/* ===== FILL BLANK BASE ===== */
.fill-blank-content p {
  margin: 12px 0;
  line-height: 1.9;
  font-size: 16px;
}

/* select (ô trống) */
.fill-blank-content select {
  margin: 0 6px;
  padding: 4px 10px;
  min-width: 90px;

  border-radius: 6px;
  border: 1px solid #cbd5f5;

  font-size: 15px;
  vertical-align: middle;
}

/* khi review */
select.correct-answer {
  border-color: #22c55e;
  background: #f0fdf4;
}

select.user-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

/* feedback dưới ô trống */
.fill-feedback {
  margin-top: 6px;
  font-size: 14px;
}

.fill-explain {
  margin-top: 4px;
  color: #475569;
}

/* ===== SECTION TITLE (① ②) ===== */
.quiz-section-title {
  margin: 20px 0 10px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-left: 4px solid #6366f1;
  font-weight: 600;
}

/* ===== DIALOGUE ===== */
.dialogue-line {
  margin: 10px 0;
  line-height: 1.8;
}

.dialogue-speaker {
  font-weight: 600;
  margin-right: 6px;
}
.sentence-line {
  margin-bottom: 12px;
}

.sentence-index {
  font-weight: 600;
  margin-right: 6px;
}

.dialogue-block {
  margin: 16px 0;
  padding-left: 12px;
  border-left: 3px solid #e5e7eb;
}

.dialogue-line {
  margin: 6px 0;
}

.dialogue-speaker {
  font-weight: 700;
  margin-right: 6px;
}
.dialogue-separator {
  margin: 18px 0;
  border-top: 1px dashed #d1d5db;
}
/* vùng chọn O / X */
.tf-choice {
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}

/* đúng */
.tf-choice.correct-answer {
  background: #ecfdf5;
  border: 1px solid #34d399;
}

/* sai */
.tf-choice.user-wrong {
  background: #fef2f2;
  border: 1px solid #f87171;
}

/* phần giải thích */
.tf-explain {
  background: #f8fafc;
  border-left: 4px solid #38bdf8;
  padding: 10px 12px;
  margin: 6px 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: #0f172a;
}

/* dòng hiển thị đáp án */
.tf-correct-line {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}
.video-wrapper {
    width: 100% !important;
    max-width: 100% !important; /* Đảm bảo không bị giới hạn ví dụ 800px */
    position: relative;
}

.video-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 400px; /* Chỉnh độ cao tối thiểu cho tablet */
}

/* ===== OVERLAY ===== */
.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;

  display: none; /* mặc định ẩn */

  align-items: center;
  justify-content: center;
  flex-direction: column;

  text-align: center;
  font-weight: 600;
  color: #fff;

  background: rgba(0,0,0,0.45);
  pointer-events: none;
}

/* ✅ HIỆN TRÊN TẤT CẢ PWA (ANDROID + IOS) */
body.pwa-mode .video-overlay {
  display: flex;
}
.submit-exam-btn {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.lesson-view-content,
.reading-skill,
.listening-skill,
.quiz-skill {
  position: relative;
  z-index: 1;
}
/* ================================
   VIEW 2 – CHAPTER LIST
================================ */

/* Container */
.etopik-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

/* Card chương */
.etopik-chapter-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  cursor: pointer;
  transition: all 0.2s ease;
}

/* Hover */
.etopik-chapter-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

/* Tiêu đề chương */
.etopik-chapter-card h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

/* Status */
.etopik-chapter-card .chapter-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Chưa xong */
.etopik-chapter-card .chapter-status {
  background: #f1f5f9;
  color: #475569;
}

/* Đã xong (sau này gắn class done) */
.etopik-chapter-card.done {
  border-color: #86efac;
  background: #f0fdf4;
}

.etopik-chapter-card.done h4 {
  color: #166534;
}

.etopik-chapter-card.done .chapter-status {
  background: #22c55e;
  color: #ffffff;
}
/* MULTI CHOICE GROUP – mỗi đáp án 1 dòng */
.mcg-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mcg-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;

  line-height: 1.5;
  cursor: pointer;
}
/* ===== MOBILE READING PASSAGE ===== */
@media (max-width: 768px) {
  .reading-passage {
    font-size: 15px;
    line-height: 1.75;
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
  }

  .reading-passage p {
    margin-bottom: 12px;
  }
}
/* ===== READING GROUP CARD ===== */
@media (max-width: 768px) {
  .reading-group {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  }

  .reading-group-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
  }
}
/* ===== READING OPTIONS MOBILE ===== */
@media (max-width: 768px) {
  .choose-option,
  .tf-option,
  .mcg-option {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 12px 14px;
    margin-bottom: 10px;

    border-radius: 10px;
    background: #f8fafc;
  }

  input[type="radio"],
  input[type="checkbox"] {
    transform: scale(1.15);
  }
}
@media (max-width: 768px) {
  .lesson-back-btn {
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 999px;
  }
}
/* ===== FIX CHỮ BỊ NHỐT KHUNG – MOBILE ===== */
@media (max-width: 768px) {

  .choose-option,
  .tf-option,
  .mcg-option {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    box-sizing: border-box;
  }

  .choose-option span,
  .tf-option span,
  .mcg-option {
    white-space: normal;
    word-break: break-word;
  }
}
@media (max-width: 768px) {

  .choose-text-row,
  .mcg-options,
  .true-false-list {
    width: 100%;
  }
}
@media (max-width: 768px) {
  .choose-text-grid {
    display: block !important;
  }
}
.quiz-example {
  padding: 14px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.example-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.example-image img {
  width: 100%;
  max-width: 420px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.example-text {
  line-height: 1.6;
}
.quiz-section {
  margin: 24px 0 12px;
}

.quiz-section-title {
  font-weight: 700;
  font-size: 16px;
  color: #0f172a;
}

.quiz-section-divider {
  height: 2px;
  background: #e5e7eb;
  margin-top: 8px;
}
/* ===============================
   🔁 RETRY BUTTON – BEAUTIFUL UI
=============================== */
.exam-review-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 12px 18px;
  min-height: 44px;

  font-size: 14px;
  font-weight: 600;

  color: #0f172a;
  background: #f8fafc;

  border: 1.5px solid #cbd5e1;
  border-radius: 999px;

  cursor: pointer;
  user-select: none;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

/* hover (desktop) */
.btn-retry:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* active (mobile tap) */
.btn-retry:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* focus (accessibility) */
.btn-retry:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

/* disabled (nếu sau này cần) */
.btn-retry[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.listening-skill {
  display: flex;
  flex-direction: column;
}

.exam-review-actions {
  margin-top: 24px;
}
.video-complete-box {
  margin-top: 16px;
  text-align: center;
}

.btn-video-complete {
  background: #22c55e;
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-video-complete:hover {
  background: #16a34a;
}

.btn-video-complete.done {
  background: #e5e7eb;
  color: #374151;
  cursor: default;
}
.etopik-view-timeline.v2 .timeline-item.done {
  opacity: 0.6;
}

.etopik-view-timeline.v2 .timeline-action {
  font-weight: 600;
}

.chapter-complete-box {
  margin-top: 16px;
  padding: 12px;
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  color: #166534;
}
/* ===== TIMELINE DONE SKILL ===== */
.timeline-item.done {
  background: #f0fdf4;
  border: 1px solid #22c55e;
}

.timeline-item.done .timeline-icon {
  opacity: 0.85;
}

.timeline-item.done .timeline-title {
  color: #166534;
  font-weight: 600;
}

.timeline-item.done .timeline-action {
  color: #22c55e;
  font-weight: 600;
}
.etopik-course-progress {
  margin: 16px 0 24px;
}

.progress-label {
  font-size: 14px;
  margin-bottom: 6px;
  color: #334155;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.multi-choice-group {
  margin: 16px 0;
}

.mcg-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mcg-item {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;

  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mcg-item:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.mcg-item.selected {
  border-color: #2563eb;
  background: #eff6ff;
}

.mcg-num {
  font-weight: 700;
  color: #2563eb;
  min-width: 24px;
}

.mcg-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
}
.image-block .example-image img {
  width: 100%;
  max-width: none;   /* 🔥 bỏ giới hạn */
}
.quiz-options {
  background: #f8f9fb;
  border: 1px dashed #cfd3dc;
  padding: 10px;
  margin: 10px 0;
  border-radius: 8px;
}

.quiz-options-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.quiz-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-option-item {
  background: #fff;
  border: 1px solid #dcdfe6;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
}
.fill-review-wrap {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.fill-correct-answer {
  color: #0969da;
  font-weight: 600;
  white-space: nowrap;
}

.fill-input.user-wrong {
  border-color: #d1242f;
  background: #fff5f5;
}

.fill-input.correct-answer {
  border-color: #1a7f37;
  background: #e6ffec;
}

.fill-input.partial-answer {
  border-color: #bf8700;
  background: #fff8e1;
}
.exam-review-actions .btn-close,
.popup-actions .btn-close {
  appearance: none;
  border: 1px solid #d0d7de;
  background: #f6f8fa;
  color: #24292f;

  padding: 8px 14px;
  border-radius: 8px;

  font-size: 14px;
  font-weight: 500;

  cursor: pointer;
  transition: all 0.15s ease;
}

/* hover */
.exam-review-actions .btn-close:hover,
.popup-actions .btn-close:hover {
  background: #eaeef2;
  border-color: #afb8c1;
}

/* active */
.exam-review-actions .btn-close:active,
.popup-actions .btn-close:active {
  background: #d0d7de;
}
.match-person-block {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: #fafafa;
}

.match-person-name {
  font-size: 15px;
  margin-bottom: 8px;
}

.match-checkbox {
  display: block;
  margin: 6px 0;
}
.listening-main-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.listening-group-body {
  background: #f5f7fa;
  padding: 14px;
  border-radius: 14px;
}

.listening-sub-question {
  display: flex;
  gap: 10px;
  background: #fff;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 10px;
}

.sub-question-index {
  font-weight: 700;
  width: 22px;
}

.sub-question-content {
  flex: 1;
}
/* ===============================
   📱 MOBILE – READING Q/A PREMIUM
================================ */
@media (max-width: 480px) {

  /* 📖 Đoạn văn thường */
  .reading-qna p {
    font-size: 13px;
    line-height: 1.6;
    letter-spacing: -0.2px;
    color: #222;
    margin-bottom: 10px;
  }

  /* 🟦 KHUNG Q / A */
  .reading-qna .qa-box {
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.55;
  }

  /* ❓ QUESTION */
  .reading-qna .qa-box.question {
    background: #f2f7ff;
    border-left: 4px solid #3b82f6;
  }

  .reading-qna .qa-box.question .qa-label {
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 4px;
  }

  /* 💬 ANSWER */
  .reading-qna .qa-box.answer {
    background: #f8fafc;
    border-left: 4px solid #10b981;
  }

  /* 👤 TÊN NHÂN VẬT (선배1 / 선배2) */
  .reading-qna .qa-avatar {
    font-weight: 600;
    font-size: 12px;
    color: #047857;
    margin-bottom: 4px;
  }

  /* 📄 NỘI DUNG A */
  .reading-qna .qa-content {
    font-size: 13px;
    color: #111;
  }

}
@media (max-width: 768px) {

  .match-checkbox,
  .choose-option {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 8px 10px;
    margin-bottom: 6px;

    border-radius: 8px;
    background: #f8f9fb;
    font-size: 14px;
  }

  .match-checkbox b,
  .choose-option b {
    min-width: 20px;
    text-align: center;
  }

  .match-checkbox input,
  .choose-option input {
    transform: scale(0.9);
  }
}
.correct-answer {
  background: #e8f7ee !important;
  border-left: 4px solid #2ecc71;
}

.user-wrong {
  background: #fdeeee !important;
  border-left: 4px solid #e74c3c;
}
/* FIX chữ Hàn bị bẻ dọc */
.choose-option span,
.match-checkbox,
.match-text,
.mcg-text {
  word-break: keep-all !important;
  line-break: normal !important;
  white-space: normal !important;
}
.match-person-block.all-correct {
  border: 2px solid #2ecc71;
  background: rgba(46, 204, 113, 0.08);
}
.match-checkbox.missed-correct {
  border: 2px dashed #ff9800;
  background: #fff3e0;
}
.missed-question {
  border: 2px dashed #f59e0b;
  background: #fff7ed;
}

.missed-note {
  margin-top: 6px;
  font-size: 13px;
  color: #d97706;
}
/* =========================
   MATCH – MOBILE UI FIX
========================= */
@media (max-width: 768px) {

  .match-mobile-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  }

  .match-mobile-item select {
    width: 100%;
    font-size: 15px;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .match-mobile-item span {
    font-size: 15px;
    line-height: 1.6;
    word-break: keep-all;
  }

  .match-correct-hint {
    display: inline-block;
    margin-top: 6px;
    font-weight: 600;
    color: #2e7d32;
  }

  .match-explain {
    margin-top: 8px;
    padding: 10px;
    background: #f9fafb;
    border-left: 4px solid #ff9800;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
  }

  .missed-question {
    border: 2px dashed #ff9800;
    background: #fff8ee;
  }
}
/* ===== Fill blank hint ===== */
.fill-blank-wrap {
  display: inline-block;
  margin: 4px 0;
}

.fill-hint {
  margin-top: 4px;
  font-size: 13px;
  color: #666;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fill-hint .hint-text {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
}

.fill-hint .grammar-tag {
  background: #fff3cd;
  color: #7a5200;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 500;
}
/* =========================
   GRAMMAR BOX (TRÊN SECTION)
========================= */
.quiz-section-grammar {
  margin: 10px 0 16px;
  padding: 12px 14px;
  background: #f6f8ff;
  border-left: 4px solid #5b6dff;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.quiz-section-grammar b {
  color: #2c3e50;
}
.quiz-grammar-box {
  margin: 12px 0 18px;
  padding: 12px;
  background: #f6f8ff;
  border-radius: 10px;
}

.quiz-grammar-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.quiz-grammar-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grammar-chip {
  background: #e3e9ff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
}
.reading-explain {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border-left: 4px solid #4f46e5;
  border-radius: 8px;
  font-size: 15px;          /* 🔥 tăng size tổng thể */
  line-height: 1.65;        /* 🔥 dễ đọc cho tiếng Hàn */
  color: #111827;
}

.reading-explain-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 15px;
}

/* Ý chính */
.explain-main {
  margin: 6px 0;
  padding-left: 6px;
}

/* 🔵 DẪN CHỨNG – KHÔNG NGHIÊNG */
.explain-evidence {
  margin: 6px 0 10px 20px;
  padding-left: 10px;
  font-size: 14px;
  color: #1f2937;
  font-style: normal;          /* ❌ bỏ italic */
  border-left: 3px solid #93c5fd;
  background: #f1f5ff;
  border-radius: 4px;
}

/* icon dẫn chứng */
.explain-evidence::before {
  content: "📌 ";
  margin-right: 4px;
}

/* 🔴 KẾT LUẬN */
.explain-conclusion {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #c7d2fe;
  font-weight: 700;
  font-size: 15px;
  color: #1e3a8a;
}
.ordering-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ordering-item select {
  flex-shrink: 0;
}

.ordering-item {
  white-space: nowrap;
}
.reading-explain {
  background: #f8fbff;
  border-left: 4px solid #4c6fff;
  padding: 14px 16px;
  margin-top: 16px;
  border-radius: 10px;
  font-size: 14px;
}

.explain-block-title {
  font-weight: 700;
  margin: 10px 0 6px;
  color: #2c3e50;
}

.explain-answer.correct {
  color: #1e8e3e;
  font-weight: 600;
  margin-top: 8px;
}

.explain-answer.wrong {
  color: #d93025;
  font-weight: 600;
  margin-top: 8px;
}

.explain-evidence {
  margin-left: 16px;
  color: #555;
  font-style: italic;
}

.explain-text {
  margin-left: 8px;
  color: #333;
}
/* ===============================
   MATCH TAP – 2 CỘT (IMPROVED)
================================ */
.match-tap-question {
  margin: 20px 0;
}

.match-title {
  margin-bottom: 6px;
}

.match-tap-hint {
  font-size: 13px;
  color: #ff9800;
  background: #fff7e6;
  padding: 6px 10px;
  border-radius: 8px;
  margin: 8px 0 14px;
}

/* ===== GRID ===== */
.match-tap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.match-tap-left,
.match-tap-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===============================
   ITEM CHUNG
================================ */
.tap-left-item,
.tap-right-item {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* ===============================
   CỘT TRÁI
================================ */
.tap-left-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8faff;
  border: 1px solid #dbe3ff;
}

.tap-left-item .tap-num {
  font-weight: 600;
  color: #4f6cff;
}

.tap-left-item.active {
  background: #e8eeff;
  border-color: #4f6cff;
  box-shadow: 0 0 0 2px rgba(79,108,255,0.25);
}

/* đã nối */
.tap-left-item.linked {
  background: #f0f4ff;
}

/* review đúng / sai */
.tap-left-item.correct {
  border-color: #4caf50;
  background: #e8f5e9;
}

.tap-left-item.wrong {
  border-color: #f44336;
  background: #fdecea;
}

/* mũi tên hiển thị */
.tap-linked {
  margin-left: auto;
  font-size: 12px;
  color: #ff9800;
  white-space: nowrap;
}

/* ===============================
   CỘT PHẢI
================================ */
.tap-right-item {
  background: #fff;
  border: 1px solid #ffd9a0;
}

.tap-right-item .tap-num {
  font-weight: 600;
  color: #ff9800;
  margin-right: 4px;
}

.tap-right-item:hover {
  background: #fff7ec;
}

/* option đã được dùng */
.tap-right-item.used {
  pointer-events: auto;   /* 🔥 BẮT BUỘC */
  opacity: 0.6;
}

/* ===============================
   MOBILE
================================ */
@media (max-width: 640px) {
  .match-tap-grid {
    grid-template-columns: 1fr;
  }

  .match-tap-left {
    margin-bottom: 8px;
  }
}

/* ===============================
   IMAGE CHOICE – TAP TO CHOOSE
================================ */

.image-choice-question ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.image-choice-question label {
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 18px 12px;
  border-radius: 14px;

  /* 👇 RÕ TRƯỚC KHI CHỌN */
  background: #ffffff;
  border: 2px solid #dfe5f2;

  font-size: 18px;
  font-weight: 600;

  cursor: pointer;
  user-select: none;
  touch-action: manipulation;

  transition:
    transform 0.1s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}


/* ẨN RADIO GỐC */
.image-choice-question input[type="radio"] {
  display: none;
}

.image-choice-question label:hover {
  background: #f0fbf5;
}


/* 👉 TAP ACTIVE */
.image-choice-question label:active {
  transform: scale(0.97);
}

/* 👉 ĐÃ CHỌN */
.image-choice-question input[type="radio"]:checked + span,
.image-choice-question label.correct-answer,
.image-choice-question label.user-wrong {
  background: #e8f8ef;
  border-color: #2ecc71;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25);
}


/* 👉 ĐÁP ÁN ĐÚNG (REVIEW) */
.image-choice-question label.correct-answer {
  background: #e8f8ef;
  border-color: #2ecc71;
}

/* 👉 ĐÁP ÁN SAI (REVIEW) */
.image-choice-question label.user-wrong {
  background: #ffecec;
  border-color: #ff5c5c;
}

/* MOBILE TỐI ƯU */
@media (max-width: 640px) {
  .image-choice-question label {
    font-size: 20px;
    padding: 20px 12px;
  }
}
/* ===============================
   MATCH DROPDOWN – MOBILE FRIENDLY
================================ */

.match-row {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 12px;
  border-radius: 14px;
  background: #f8faff;

  margin-bottom: 10px;
  transition: background 0.2s ease;
}

/* SỐ THỨ TỰ BÊN TRÁI */
.match-left-number {
  font-weight: 700;
  font-size: 16px;
  min-width: 24px;
}

/* SELECT TO HƠN – DỄ TAP */
.match-row select {
  flex: 1;

  min-height: 48px;
  padding: 10px 14px;

  font-size: 16px;
  font-weight: 600;

  border-radius: 12px;
  border: 2px solid #dde3ff;
  background: #fff;

  appearance: none;
  -webkit-appearance: none;

  background-image:
    linear-gradient(45deg, transparent 50%, #4f6cff 50%),
    linear-gradient(135deg, #4f6cff 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 4px),
    calc(100% - 14px) calc(50% - 4px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

/* TAP FEEDBACK */
.match-row select:focus {
  outline: none;
  border-color: #4f6cff;
  box-shadow: 0 0 0 3px rgba(79,108,255,0.2);
}

/* ĐÃ CHỌN */
.match-row select:not([value=""]) {
  background-color: #eef2ff;
}

/* REVIEW – ĐÚNG */
.match-row .match-correct-hint {
  font-size: 13px;
  color: #2ecc71;
  margin-top: 6px;
}

/* MOBILE TỐI ƯU */
@media (max-width: 640px) {
  .match-row {
    padding: 14px;
  }

  .match-row select {
    font-size: 17px;
    min-height: 52px;
  }
}
.image-choice-options {
  display: flex;
  gap: 14px;
}

.image-choice-option {
  flex: 1;
  justify-content: center;

  padding: 14px 0;
  border-radius: 16px;

  background: #f6f7fb;
  border: 2px solid transparent;

  font-size: 20px;
  font-weight: 600;
  color: #555;

  cursor: pointer;
  transition: all 0.15s ease;
}

/* hover */
.image-choice-option:hover {
  background: #eef2ff;
}

/* chọn */
.image-choice-option:has(input:checked) {
  background: #4f6cff;
  color: #fff;
  border-color: #4f6cff;
  box-shadow: 0 6px 14px rgba(79,108,255,0.25);
}

/* ẩn radio */
.image-choice-option input {
  display: none;
}
.paragraph-explain {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-left: 4px solid #4f46e5;
  border-radius: 8px;
  font-size: 14px;
}

.paragraph-explain .explain-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.paragraph-explain .explain-item {
  margin-bottom: 6px;
  line-height: 1.6;
}

.paragraph-explain .explain-index {
  font-weight: 600;
  color: #2563eb;
  margin-right: 4px;
}

.paragraph-explain .explain-answer {
  font-weight: 600;
  color: #059669;
  margin-right: 4px;
}

.paragraph-explain .explain-text {
  color: #374151;
}
.submit-exam-btn {
  pointer-events: auto !important;
}
/* ===============================
   WRAPPER
================================ */
.etopik-theory-embed {
  position: relative;
}

/* ===============================
   CTA NỔI – DESKTOP
================================ */
.etopik-theory-cta {
  position: sticky;
  top: 12px;                     /* 👈 luôn thấy khi scroll */
  z-index: 30;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

/* ===============================
   NÚT CTA – DESKTOP
================================ */
.etopik-flashcard-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;

  box-shadow: 0 10px 26px rgba(34, 197, 94, 0.35);
  transition: all 0.25s ease;
}

.etopik-flashcard-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(34, 197, 94, 0.45);
}

/* ===============================
   IFRAME (GIỮ CẢM GIÁC BAN ĐẦU)
================================ */
.etopik-theory-embed iframe {
  width: 100%;
  height: 80vh;
  border: none;
  border-radius: 12px;
}

/* ===============================
   MOBILE – NHỎ GỌN, KHÔNG CHIẾM CHỖ
================================ */
/* ===============================
   MOBILE – CTA NHỎ GỌN (2/3)
================================ */
@media (max-width: 768px) {

  .etopik-theory-cta {
    top: 6px;
    margin-bottom: 6px;
  }

  .etopik-flashcard-btn {
    padding: 7px 12px;          /* 👈 nhỏ hơn rõ rệt */
    font-size: 12px;            /* 👈 2/3 desktop */
    font-weight: 600;
    border-radius: 14px;

    max-width: 90%;             /* 👈 không tràn viền */
    text-align: center;

    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  }
}
/* ===== FLASHCARD ===== */
.flashcard-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard {
  width: 100%;
  max-width: 340px;
  height: 200px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transition: transform 0.6s;
  transform-style: preserve-3d;
  position: relative;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* FLASHCARD BACK – ĐỎ ĐÔ */
.flashcard-back {
  background: linear-gradient(135deg, #5a0f14, #7a1c24);
  color: #ffffff;              /* 🔥 CHỮ TRẮNG */
}


/* ===== CENTER TEXT ===== */
.flash-center {
  text-align: center;
}

.flash-center h2 {
  font-size: 28px;
  margin: 0;
}

.flash-meaning {
  font-size: 17px;
  font-weight: 500;
  color: #ffffff;   /* 🔥 TRẮNG TUYỆT ĐỐI */
}
/* ===== SHAKE EFFECT ===== */
.flash-shake {
  animation: shake 0.35s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* ===== SRS ===== */
.flash-srs {
  margin-top: 8px;
  font-size: 14px;
  color: #555;
}
/* ===== FLASHCARD LAYOUT ===== */
.flashcard-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
}

.flashcard {
  width: 100%;
  max-width: 620px;
  height: 320px;
  perspective: 1200px;
}

/* CARD */
.flashcard-inner {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
  position: relative;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}
.flashcard-hint {
  margin-top: 14px;
  font-size: 14px;
  color: #94a3b8;
  font-style: italic;
  transition: opacity 0.3s ease;
}

/* khi đã lật thì ẩn hint */
.flashcard-inner.flipped + .flashcard-hint {
  opacity: 0;
}
@media (max-width: 768px) {
  .flashcard {
    height: 220px;
  }

  .flashcard-front {
    font-size: 32px;
  }

  .flashcard-back {
    font-size: 16px;
  }
}

/* 2 MẶT */
.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #f7f9ff, #eef2ff);
}

/* TEXT */
.flash-center h2 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
}

.flash-meaning {
  font-size: 18px;
  line-height: 1.7;
  text-align: center;
  color: #333;
}

/* EXAMPLES */
.flash-examples {
  width: 100%;
  max-width: 520px;
  background: #f9fafb;
  border-radius: 14px;
  padding: 16px;
}

.example-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #ddd;
}

.example-row:last-child {
  border-bottom: none;
}

/* ACTIONS */
.flash-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.flash-actions button {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.flash-actions button:nth-child(2) {
  background: #22c55e;
  color: white;
}

.flash-actions button:nth-child(3) {
  background: #f97316;
  color: white;
}

/* PROGRESS */
.flash-progress,
.flash-srs {
  font-size: 14px;
  color: #555;
}

/* SHAKE */
.flash-shake {
  animation: shake 0.35s;
}
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.flash-remind {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 14px;
  color: #334155;
  text-align: center;
}

.flash-actions button {
  min-width: 220px;
}

.flash-actions:last-of-type button {
  background: #16a34a;
  color: #fff;
  font-weight: 600;
}

.flash-actions:last-of-type button:hover {
  background: #15803d;
}
/* =========================
   FLASHCARD – COLOR THEME
========================= */

/* Toàn bộ thẻ */
/* FLASHCARD – TONE TRẦM, DỄ CHỊU */
/* FLASHCARD – GREEN PINE (XANH CÂY THÔNG NOEL) */
.flashcard-inner {
  background: linear-gradient(135deg, #0f3d2e, #1f5e46);
  color: #ecfdf5;
  border-radius: 20px;
  box-shadow: 0 10px 26px rgba(6, 95, 70, 0.35);
}

/* Mặt trước */
.flashcard-front {
  background: transparent;
}

/* Chữ ngữ pháp */
.flash-center h2 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
}

/* Mặt sau */
.flashcard-back {
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  color: #1f2937;
}

/* Nghĩa */
.flash-meaning {
  font-size: 18px;
  font-weight: 500;
  color: #1e293b;
}
/* =========================
   FLASH EXAMPLES
========================= */

.flash-examples {
  background: #f1f5f9;
  border-radius: 16px;
  padding: 18px;
  box-shadow: inset 0 0 0 1px #e5e7eb;
}

.example-row {
  padding: 10px 0;
  border-bottom: 1px dashed #c7d2fe;
}

.example-row:last-child {
  border-bottom: none;
}

.example-row b {
  color: #1e3a8a;
  font-size: 15px;
}

.example-row span {
  color: #334155;
  font-size: 14px;
}

/* Nút audio */
.example-row button {
  background: #e0e7ff;
  border-radius: 8px;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.example-row button:hover {
  background: #6366f1;
  color: #fff;
}
/* =========================
   REMINDER + CTA GUIDE
========================= */

.flash-remind {
  background: linear-gradient(135deg, #ecfeff, #f0fdf4);
  border: 1px dashed #67e8f9;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  font-size: 14px;
  color: #0f172a;
}

.flash-remind .remind-line {
  color: #155e75;
  margin-bottom: 6px;
}

.flash-remind .remind-cta {
  color: #166534;
  font-size: 14px;
}

/* CTA BUTTON – COMPLETE */
.flash-actions button[onclick*="commitDailyFlashcard"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  font-weight: 700;
  border-radius: 14px;
  padding: 10px 20px;
  box-shadow: 0 10px 24px rgba(34,197,94,0.35);
}

.flash-actions button[onclick*="commitDailyFlashcard"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(34,197,94,0.45);
}
.etopik-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.etopik-result-box {
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  width: 90%;
  max-width: 360px;
  text-align: center;
}
.etopik-result-actions button {
  margin: 8px;
}
.listening-explain-line {
  margin: 6px 0;
  line-height: 1.6;
}
/* =========================
   FIX EXAMPLE AUDIO ALIGN RIGHT (FORCE)
========================= */

.example-panel{
  position: relative !important;
  padding-right: 52px;   /* 🔥 chừa chỗ cho nút audio bên phải */
}

#example-audio{
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;

  width: 36px;
  height: 36px;
  border-radius: 50%;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  background: #e0e7ff !important;
  border: none !important;

  box-shadow: 0 4px 10px rgba(0,0,0,.12) !important;
  cursor: pointer;
}
.sequence-pair {
  margin: 12px 0;
}

.sequence-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seq-arrow {
  font-weight: bold;
  font-size: 18px;
}
.explain-step {
  padding-left: 12px;
  margin: 6px 0;
  border-left: 3px solid #4da3ff;
  background: #f6faff;
  border-radius: 6px;
}
/* =========================
   LISTENING – WORD OPTIONS
========================= */

.listening-options {
  margin: 12px 0 16px;
  padding: 12px;
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: 12px;
}

.listening-options-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #d48806;
}

.listening-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;              /* 🔥 GIÃN CÁCH */
}

.listening-option-item {
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #d9d9d9;
  border-radius: 999px;  /* pill shape */
  font-size: 14px;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}
/* =========================
WRITING 54 APP STYLE
========================= */

.w54-app{
max-width:420px;
margin:auto;
padding:18px 16px 40px;
font-family:Inter,system-ui;
}

/* HEADER */

.w54-header{
display:flex;
align-items:center;
gap:10px;
margin-bottom:20px;
}

.w54-back{
border:none;
background:#f1f3f7;
width:36px;
height:36px;
border-radius:12px;
font-size:18px;
cursor:pointer;
transition:.2s;
}
.w54-back:hover{
background:#e3e7ef;
}

.w54-title{
font-size:20px;
font-weight:700;
color:#222;
}

/* TOPIC GRID */


.w54-topic-btn{
border:none;
background:white;
padding:10px 16px;
border-radius:14px;
font-size:14px;
font-weight:600;
cursor:pointer;
box-shadow:0 2px 8px rgba(0,0,0,.08);
transition:.25s;
}

.w54-topic-btn:hover{
transform:translateY(-2px);
box-shadow:0 4px 12px rgba(0,0,0,.12);
}

/* ===== LESSON PAGE ===== */

.w54-tabs{
display:flex;
gap:8px;
margin:15px 0;
flex-wrap:wrap;
}

.w54-tabs button{
border:none;
background:#eef2ff;
color:#4f46e5;
padding:8px 14px;
border-radius:10px;
font-weight:600;
cursor:pointer;
transition:.2s;
}

.w54-tabs button:hover{
background:#4f46e5;
color:white;
}

/* CONTENT BOX */

#w54-tab-content{
background:white;
padding:18px;
border-radius:16px;
box-shadow:0 3px 12px rgba(0,0,0,.08);
margin-top:10px;
}

/* THEORY */

.w54-theory{
line-height:1.6;
font-size:15px;
}

.w54-theory ul{
margin-top:10px;
padding-left:18px;
}

/* BUTTON PRIMARY */

.w54-btn-main{
border:none;
background:linear-gradient(45deg,#6366f1,#a855f7);
color:white;
padding:12px 18px;
border-radius:12px;
font-weight:700;
cursor:pointer;
margin-top:12px;
width:100%;
}

.w54-btn-main:hover{
opacity:.9;
}

/* TEXTAREA */

.w54-textarea{
width:100%;
min-height:140px;
border-radius:12px;
border:1px solid #e5e7eb;
padding:12px;
margin-top:10px;
font-size:14px;
resize:none;
}

/* MOBILE POLISH */

@media(max-width:420px){
.w54-topic-btn{
flex:1 1 48%;
text-align:center;
}
}
.w54-topic-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:20px;
}

.w54-topic-btn{
  width:100%;
  padding:14px 16px;
  border:none;
  border-radius:14px;
  background:#ffffff;
  font-size:15px;
  font-weight:500;
  text-align:left;
  box-shadow:0 4px 12px rgba(0,0,0,0.05);
  transition:all .2s ease;
}

.w54-topic-btn:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,0.08);
}

.w54-topic-btn:active{
  transform:scale(0.98);
}
.w54-app{
  padding:16px;
}

.w54-topic-btn::after{
  content:"›";
  float:right;
  opacity:.4;
}
/* mặc định = mobile */
.w54-tabs{
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* button style */
.w54-tabs button{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:none;
  background:#eef3ff;
  font-weight:600;
  text-align:left;
  font-size:15px;
  transition:.2s;
}

.w54-tabs button:hover{
  background:#dfe7ff;
}

/* desktop */
@media (min-width:768px){
  .w54-tabs{
    flex-direction:row;
  }
  
  .w54-tabs button{
    width:auto;
    text-align:center;
    flex:1;
  }
}
/* ===== DESKTOP FIX LMS WIDTH ===== */
@media (min-width:1024px){

  .etopik-lms-course{
    max-width:100%;
    width:100%;
    padding:40px 120px;
  }

  .w54-app{
    max-width:1200px;
    width:100%;
  }

}
/* back button inline ngang tab */
.w54-back-inline{
  margin:16px auto 0; /* ⭐ căn giữa */

  padding:10px 16px;
  border-radius:10px;

  background:#eef2ff;
color:#4f46e5;        /* cùng tone với tab */

  font-weight:600;
  font-size:14px;

  cursor:pointer;
  transition:.2s;
  display:inline-block;
}

.w54-back-inline:hover{
  background:#e5e7eb;
}
/* hover */
.w54-back-inline:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 24px rgba(99,102,241,.35);
}

/* active */
.w54-back-inline:active{
  transform:scale(.97);
}

.w54-topic-detail{
  text-align:center;
}
.w54-tab-btn.active{
  background:#4f46e5;
  color:white;
  box-shadow:0 4px 12px rgba(79,70,229,.35);
}

.w54-tab-btn.active{
  background:#4f46e5;
  color:white;
  box-shadow:0 4px 12px rgba(79,70,229,.35);
}
#w54-tab-content{
  border:1px solid #eceef5;
}
.w54-tab-btn.active{
  background:#4f46e5;
  color:white;
  box-shadow:0 4px 12px rgba(79,70,229,.35);
}
.w54-topic-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:20px;
}

.w54-topic-tab{
  border:none;
  padding:10px 16px;
  border-radius:999px;
  background:#f1f5ff;
  color:#4f46e5;
  font-weight:600;
  cursor:pointer;
  transition:.25s;
}

.w54-topic-tab:hover{
  background:#e0e7ff;
}

.w54-topic-tab.active{
  background:linear-gradient(45deg,#6366f1,#8b5cf6);
  color:white;
  box-shadow:0 6px 18px rgba(99,102,241,.35);
}
.w54-tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.w54-tab-btn{
  flex:1;
  padding:12px;
  border:none;
  border-radius:12px;
  background:#eef2ff;
  font-weight:600;
  cursor:pointer;
  transition:.2s;
}

.w54-tab-btn.active{
  background:#4f46e5;
  color:white;
}
@media (max-width:768px){

  .w54-tab-btn{
    flex:100%;
  }

  .w54-topic-tab{
    flex:1 1 45%;
    text-align:center;
  }

}
.lesson-card{
  background:white;
  border-radius:16px;
  padding:18px;
  box-shadow:0 4px 14px rgba(0,0,0,.08);
  margin-top:14px;
}
.needTabs{
  display:flex;
  gap:8px;
  margin-bottom:15px;
}

.needTabBtn{
  padding:8px 16px;
  border:none;
  border-radius:20px;
  background:#eee;
  cursor:pointer;
}

.needTabBtn.active{
  background:linear-gradient(45deg,#6366f1,#8b5cf6);
  color:white;
}

.quizItem{
  margin-bottom:20px;
}

.explainBox{
  display:none;
  margin-top:8px;
  padding:8px;
  background:#f5f7ff;
  border-left:4px solid #6366f1;
}

.levelItem{
  padding:12px;
  margin-bottom:10px;
  background:#f8f9ff;
  border-radius:12px;
}
const style=document.createElement("style");
style.innerHTML=`

.lessonWrap{
padding:20px;
background:#f8fafc;
border-radius:16px;
animation:fadeIn .3s ease;
}

.lessonHeader h1{
font-size:24px;
font-weight:700;
line-height:1.3;
margin-bottom:8px;
}

.lessonHeader p{
font-size:14px;
color:#64748b;
margin-bottom:18px;
}

.jumpBtns{
display:flex;
gap:10px;
margin-bottom:18px;
}

.jumpBtns button{
flex:1;
padding:10px 14px;
border:none;
border-radius:12px;
font-size:14px;
font-weight:600;
cursor:pointer;
transition:.2s ease;
}

.jumpBtns button:first-child{
background:linear-gradient(135deg,#6366f1,#7c3aed);
color:white;
}

.jumpBtns button:last-child{
background:#e2e8f0;
}

.lessonStep{
background:white;
padding:18px;
border-radius:16px;
box-shadow:0 4px 20px rgba(0,0,0,.05);
margin-bottom:16px;
}

.stepTitle{
font-weight:600;
margin-bottom:10px;
font-size:15px;
}

.quizItem{
background:#f1f5f9;
padding:14px;
border-radius:12px;
margin-bottom:12px;
}

.quizBtns button{
padding:6px 12px;
border-radius:8px;
border:none;
font-size:13px;
cursor:pointer;
}

.correctBtn{
background:#16a34a!important;
color:white;
}

.wrongBtn{
background:#dc2626!important;
color:white;
}

@keyframes fadeIn{
from{opacity:0;transform:translateY(6px)}
to{opacity:1;transform:translateY(0)}
}

`;
document.head.appendChild(style);
.w54-header{
  margin-bottom:16px;
}

.w54-back-btn{
  border:none;
  background:#eef1f6;
  padding:8px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
}

.w54-back-btn:hover{
  background:#dde3ec;
}
/* container */
.lessonWrap{
  max-width:900px;
  margin:0 auto;
  padding:20px;
}

/* title */
.lessonWrap h1{
  font-size:42px;
  font-weight:900;
  margin-bottom:30px;
  line-height:1.2;
}

/* tabs */
.practiceTabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:20px;
}

.pBtn{
  border:none;
  background:#e5e7eb;
  padding:8px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
}

.pBtn.active{
  background:linear-gradient(135deg,#6366f1,#7c3aed);
  color:white;
}

/* card */
.quizCard{
  display:flex;
  flex-direction:column;
  gap:16px;
}

/* item */
.quizItem{
  background:white;
  border-radius:18px;
  padding:18px 20px;
  box-shadow:0 6px 18px rgba(0,0,0,.08);
  transition:.2s;
}

.quizItem:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 24px rgba(0,0,0,.12);
}

/* text */
.quizText{
  font-size:18px;
  font-weight:600;
}

/* buttons */
.quizBtns{
  display:flex;
  gap:10px;
  margin-top:10px;
}

.quizBtns button{
  border:none;
  padding:8px 18px;
  border-radius:10px;
  font-weight:600;
  cursor:pointer;
  background:#f1f5f9;
  transition:.15s;
}

.quizBtns button:hover{
  background:#6366f1;
  color:white;
}

/* explain */
.explainBox{
  margin-top:12px;
  font-size:14px;
  color:#475569;
}
.w54-app{
  animation:fadeIn .3s ease;
}

@keyframes fadeIn{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:none}
}
/* =========================
   GRAMMAR TOOL BOX
========================= */

.grammarToolBox{
  background: linear-gradient(135deg,#f3f4ff,#eef2ff);
  padding: 22px 24px;
  border-radius: 18px;
  margin: 25px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.gTitle{
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4338ca;
}

/* grid 2 cột */
.gGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* từng cột */
.gCol{
  font-size: 15px;
  line-height: 1.7;
  background: white;
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

/* bullet đẹp hơn */
.gCol br{
  margin-bottom: 6px;
}

/* responsive mobile */
@media(max-width:768px){
  .gGrid{
    grid-template-columns: 1fr;
  }
}
/* =========================
   ORDER INPUT - TO HƠN
========================= */

.orderInput{
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 14px;
  border: 1px solid #dcdfea;
  background: #f8fafc;
  margin: 12px 0 16px;
  transition: .2s;
}

.orderInput:focus{
  outline: none;
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
/* =========================
   COMPLETE INPUT – WRITING
========================= */

.completeInput{
  display:inline-block;
  min-width:220px;
  max-width:100%;
  padding:12px 14px;
  margin:0 6px;
  
  font-size:16px;
  font-weight:500;
  color:#0f172a;

  border-radius:12px;
  border:2px solid #e2e8f0;
  background:#f8fafc;

  transition:.2s;
}

/* focus effect */
.completeInput:focus{
  outline:none;
  background:white;
  border-color:#6366f1;
  box-shadow:0 0 0 3px rgba(99,102,241,.15);
}

/* mobile to hơn */
@media(max-width:768px){
  .completeInput{
    display:block;
    width:100%;
    margin:8px 0;
    font-size:17px;
    padding:14px;
  }
  .completeInput{
  width: clamp(180px, 40%, 420px);
}
}
.completeInput{
  border:0;
  background:#eef2ff;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.05);
}
.quizItem input,
.quizItem textarea{
  width:100%;
  min-height:70px;
  padding:14px;
  font-size:16px;

  border-radius:14px;
  border:2px solid #e2e8f0;
  background:#f8fafc;

  transition:.2s;
}

.quizItem input:focus,
.quizItem textarea:focus{
  outline:none;
  border-color:#6366f1;
  background:white;
  box-shadow:0 0 0 3px rgba(99,102,241,.15);
}
.rewriteLine .rw1,
.rewriteLine .rw2{
  width: 150px !important;
  height: 38px !important;
}
style.innerHTML = `

/* ===== BASE ===== */

.lessonWrap{
  max-width:920px;
  margin:auto;
  padding:10px 0 40px;
  font-family: 'Inter', system-ui, sans-serif;
}

.lessonHeader{
  margin-bottom:40px;
}

.lessonHeader span{
  background:#ede9fe;
  color:#6d28d9;
  padding:6px 14px;
  border-radius:20px;
  font-size:12px;
  font-weight:600;
}

.lessonHeader h1{
  font-size:30px;
  font-weight:800;
  margin:16px 0 10px;
  color:#111827;
  letter-spacing:-0.5px;
}

.lessonHeader p{
  color:#6b7280;
  font-size:15px;
}

/* ===== STEP ===== */

.lessonStep{
  margin-bottom:44px;
}

.stepTitle{
  font-size:20px;
  font-weight:700;
  margin-bottom:18px;
  color:#5b21b6;
}

/* ===== CARD ===== */

.card{
  background:#ffffff;
  border-radius:20px;
  padding:28px;
  box-shadow:0 8px 32px rgba(124,58,237,0.08);
  border:1px solid #f3f0ff;
  line-height:1.9;
  font-size:16px;
}

/* Khoảng cách giữa các đoạn */
.card p{
  margin-bottom:18px;
}

/* Highlight câu quan trọng */
.highlight{
  background:#f5f3ff;
  padding:14px 16px;
  border-radius:12px;
  margin:18px 0;
  border-left:4px solid #7c3aed;
}

/* List đẹp */
.klist{
  padding-left:20px;
}

.klist li{
  margin-bottom:12px;
}

/* ===== FORMULA BOX ===== */

.formulaBox{
  display:flex;
  flex-direction:column;
  gap:26px;
}

.formulaItem{
  background:#faf7ff;
  padding:22px;
  border-radius:18px;
  border:1px solid #ede9fe;
}

.formulaMain{
  font-size:18px;
  font-weight:700;
  color:#6d28d9;
  margin-bottom:8px;
}

.formulaVi{
  color:#6b7280;
  margin-bottom:12px;
}

.formulaEx{
  font-weight:600;
  margin-bottom:6px;
}

.formulaExVi{
  color:#374151;
  margin-bottom:12px;
}

/* ===== AUDIO BUTTON ===== */

.audioBtn{
  background:linear-gradient(135deg,#7c3aed,#a855f7);
  color:white;
  border:none;
  padding:8px 18px;
  border-radius:14px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:0.2s;
}

.audioBtn:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 20px rgba(124,58,237,0.35);
}

/* ===== LEVEL ===== */

.levelBoxSmall{
  background:#ffffff;
  padding:22px;
  border-radius:18px;
  margin-bottom:18px;
  border:1px solid #ede9fe;
}

.levelLabel{
  font-weight:700;
  color:#7c3aed;
  margin-bottom:8px;
}

.kText{
  font-size:16px;
  font-weight:600;
  margin-bottom:6px;
}

.vText{
  color:#6b7280;
  margin-bottom:12px;
}

`;
/* ===== CARD CHỦ ĐỀ ===== */

.lessonStep .card{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:14px;
  padding:28px;
}

/* ===== CHIP STYLE ===== */

.tag{
  display:inline-block;
  background:#f5f3ff;
  color:#5b21b6;
  padding:10px 18px;
  border-radius:18px;
  font-size:14px;
  font-weight:600;
  border:1px solid #ede9fe;
  transition:0.25s ease;
  cursor:default;
}

/* Hover nổi nhẹ kiểu app */

.tag:hover{
  background:#7c3aed;
  color:#ffffff;
  transform:translateY(-3px);
  box-shadow:0 10px 25px rgba(124,58,237,0.25);
}
.upgradeWrap{
max-width:1100px;
margin:auto;
}

.levelTabs button{
padding:8px 16px;
border:none;
border-radius:20px;
margin-right:10px;
background:#eee;
cursor:pointer;
}

.levelTabs .active{
background:#7c3aed;
color:white;
}

.upgradeLayout{
display:flex;
gap:30px;
margin-top:20px;
}

.upgradeMain{
flex:2;
background:white;
padding:30px;
border-radius:20px;
box-shadow:0 10px 30px rgba(0,0,0,0.05);
}

.upgradeSide{
flex:1;
background:#faf7ff;
padding:20px;
border-radius:20px;
}

.upgradeControls{
margin-bottom:20px;
display:flex;
gap:10px;
}

.upgradeControls button{
border:none;
padding:6px 14px;
border-radius:14px;
cursor:pointer;
}

.hl{
background:#e9d5ff;
padding:2px 6px;
border-radius:6px;
}

.upgradeTrans{
margin-top:20px;
color:#6b7280;
}
.expItem{
  margin-bottom:14px;
  list-style:none;
}

.expK{
  font-weight:600;
  color:#4b2aad;
}

.expV{
  font-size:13px;
  color:#666;
  margin-top:4px;
}
.vocab{
  position:relative;
  background:#e9ddff;
  padding:2px 6px;
  border-radius:6px;
  cursor:pointer;
  transition:0.2s;
}

.vocab:hover{
  background:#d2bfff;
}

.vocab::after{
  content: attr(data-meaning);
  position:absolute;
  bottom:140%;
  left:50%;
  transform:translateX(-50%);
  background:#2d1b5e;
  color:#fff;
  font-size:13px;
  padding:8px 12px;
  border-radius:8px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:0.2s;
  box-shadow:0 10px 25px rgba(0,0,0,0.15);
  z-index:20;
}

.vocab:hover::after{
  opacity:1;
}
/* Tối ưu hiển thị cho Điện thoại (Mobile) */
@media (max-width: 768px) {
    .upgradeLayout {
        display: flex !important;
        flex-direction: column !important; /* Chuyển thành 1 hàng dọc */
        gap: 15px !important;
    }

    .upgradeMain, .upgradeSide {
        width: 100% !important; /* Chiếm hết chiều ngang màn hình */
    }

    .upgradeText {
        font-size: 16px !important; /* Chữ nhỏ lại một chút cho dễ đọc */
        line-height: 1.6 !important;
    }

    .levelTabs {
        flex-wrap: wrap; /* Tự động xuống dòng nếu nút quá dài */
    }

    .levelTabs button {
        padding: 10px 5px !important;
        font-size: 14px !important;
    }

    .upgradeControls {
        display: flex;
        justify-content: space-between;
        gap: 5px;
    }

    .upgradeControls button {
        flex: 1;
        padding: 8px 2px !important;
        font-size: 13px !important;
    }
}
/* Ép khung chứa video to hết cỡ trên màn hình Tablet */
.lesson-view-content, 
.lesson-video, 
.video-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Đảm bảo iframe chiếm trọn không gian */
.video-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
/* ==========================================
   PROB PRACTICE – DẠNG VẤN ĐỀ
   ========================================== */

.prob-wrap {
  padding: 4px 0 24px;
}

.prob-title {
  font-size: 17px;
  font-weight: 700;
  color: #3b1fa8;
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid #ede9fe;
}

.prob-guide {
  font-size: 13px;
  color: #6d28d9;
  background: #f5f3ff;
  padding: 8px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

/* ---- Item ---- */
.prob-item {
  background: #ffffff;
  border: 1px solid #ede9fe;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(124,58,237,.06);
  transition: box-shadow .2s;
}
.prob-item:hover {
  box-shadow: 0 8px 24px rgba(124,58,237,.12);
}

.prob-text {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 10px;
  color: #1e1b4b;
}

/* ---- Buttons ---- */
.prob-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}
.prob-btns button {
  border: none;
  padding: 8px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #f1f5f9;
  transition: .15s;
}
.prob-btns button:hover {
  background: #7c3aed;
  color: white;
  transform: translateY(-1px);
}

.prob-check-btn {
  border: none;
  padding: 9px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #ede9fe;
  color: #5b21b6;
  margin-top: 8px;
  transition: .15s;
}
.prob-check-btn:hover {
  background: #7c3aed;
  color: white;
}
.prob-check-btn.ai {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
}
.prob-check-btn.ai:hover {
  box-shadow: 0 6px 18px rgba(124,58,237,.35);
  transform: translateY(-1px);
}

/* ---- Explain box ---- */
.prob-explain {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  border-left: 4px solid #6366f1;
  background: #f0f7ff;
}
.prob-explain.correct {
  background: #f0fdf4;
  border-left-color: #22c55e;
}
.prob-explain.wrong {
  background: #fff7ed;
  border-left-color: #f97316;
}

/* ---- Hint ---- */
.prob-hint {
  font-size: 13px;
  color: #7c3aed;
  background: #f5f3ff;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  line-height: 1.6;
}
.prob-hint-small {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

/* ---- Textarea ---- */
.prob-textarea {
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  font-size: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  resize: vertical;
  transition: .2s;
  margin-top: 6px;
  box-sizing: border-box;
}
.prob-textarea:focus {
  outline: none;
  border-color: #7c3aed;
  background: white;
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.prob-textarea.big {
  min-height: 130px;
}

/* ---- Word chips (order) ---- */
.prob-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.prob-word {
  background: #ede9fe;
  color: #5b21b6;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: default;
}

/* ---- Word bank ---- */
.prob-wordbank {
  background: #faf7ff;
  border: 1px dashed #c4b5fd;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.9;
}
.prob-chip {
  display: inline-block;
  background: #ede9fe;
  color: #5b21b6;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin: 3px 3px;
}
.prob-chip.purple { background: #7c3aed; color: white; }
.prob-chip.grey   { background: #e5e7eb; color: #374151; }
.prob-blank {
  display: inline-block;
  border-bottom: 2px solid #7c3aed;
  min-width: 80px;
  color: #7c3aed;
  font-style: italic;
}

/* ---- Expand row ---- */
.prob-expand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.prob-ending {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  background: #f1f5f9;
  padding: 5px 14px;
  border-radius: 10px;
}

/* ---- Essay block ---- */
.prob-essay-block {
  background: #faf7ff;
  border: 1px solid #ede9fe;
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.prob-essay-q {
  font-size: 15px;
  font-weight: 700;
  color: #3b1fa8;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ede9fe;
}
.prob-hints {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.prob-starter {
  font-size: 14px;
  color: #374151;
  background: #fff;
  border-left: 3px solid #a855f7;
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  margin-bottom: 10px;
  line-height: 1.7;
}
.prob-ai-result {
  background: #f0f7ff;
  border-left: 4px solid #6366f1;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.7;
}
.prob-model {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.8;
}

/* ---- Level content box in lesson ---- */
.levelSentence {
  font-size: 16px;
  font-weight: 600;
  color: #1e1b4b;
  margin-bottom: 8px;
  line-height: 1.7;
}
.levelVi {
  color: #555;
  font-size: 14px;
  margin-bottom: 10px;
}

/* ---- flowBox trong lesson ---- */
.flowBox {
  background: #f5f3ff;
  border: 1px dashed #c4b5fd;
  padding: 12px 18px;
  border-radius: 12px;
  margin-top: 10px;
  font-weight: 600;
  color: #5b21b6;
  text-align: center;
  font-size: 14px;
}

/* miniTitle */
.miniTitle {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: #374151;
}

/* responsive */
@media(max-width:600px){
  .prob-btns { flex-direction: column; }
  .prob-expand-row { flex-direction: column; align-items: flex-start; }
}
}
/* ============================================================
   WRITING 54 – ANALYSIS MODULE: Tab + Bài mẫu + Luyện tập
   ============================================================ */

/* --- Tab cấp 3 (Nâng cấp / Bài mẫu / Luyện tập) --- */
.w54-analysis-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 0 0 16px 0; padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}
.w54-atab {
  padding: 8px 16px; border-radius: 20px; border: 2px solid #c7d2fe;
  background: #fff; color: #4f46e5; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.w54-atab.active, .w54-atab:hover {
  background: #4f46e5; color: #fff; border-color: #4f46e5;
}

/* --- Bài mẫu phân tích --- */
.sample-wrap { padding: 4px 0; }
.sample-topic-box {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.sample-topik-label { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.sample-prompt { font-size: 14px; line-height: 1.7; color: #1e293b; }
.sample-qlist { margin: 10px 0 0 0; padding: 0; list-style: none; }
.sample-qlist li { font-size: 13px; color: #475569; padding: 2px 0; }

.sample-para-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.sample-ptab {
  padding: 7px 14px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; font-size: 13px; cursor: pointer; color: #475569;
  transition: all .15s;
}
.sample-ptab.active {
  background: #0f172a; color: #fff; border-color: #0f172a;
}

.sample-content-layout {
  display: grid; grid-template-columns: 1fr 260px; gap: 16px;
}
@media(max-width:640px){ .sample-content-layout { grid-template-columns: 1fr; } }

.sample-text-col { min-width: 0; }
.sample-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.sample-controls button {
  padding: 6px 14px; border-radius: 8px; border: 1px solid #e2e8f0;
  background: #f8fafc; font-size: 13px; cursor: pointer;
}
.sample-ko-text {
  font-size: 15px; line-height: 1.9; color: #1e293b;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 16px;
}
.sample-hl {
  background: #fef08a; border-radius: 3px; padding: 0 2px;
  font-weight: 600;
}
.sample-trans {
  margin-top: 12px; padding: 14px; background: #f0fdf4;
  border-radius: 10px; border-left: 4px solid #22c55e;
  font-size: 14px; line-height: 1.8; color: #15803d;
}

/* Mission sidebar */
.sample-mission-col {
  background: #faf5ff; border: 1px solid #e9d5ff;
  border-radius: 12px; padding: 14px; height: fit-content;
}
.mission-header {
  font-weight: 700; font-size: 13px; color: #7c3aed;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid #e9d5ff;
}
.mission-item {
  display: flex; gap: 8px; align-items: flex-start;
  margin-bottom: 12px; font-size: 13px; line-height: 1.6;
}
.mission-icon {
  background: #7c3aed; color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700;
  flex-shrink: 0; margin-top: 2px;
}
.mission-tag {
  background: #ede9fe; color: #5b21b6;
  padding: 1px 7px; border-radius: 4px; font-weight: 600;
  font-size: 12px;
}

/* --- Luyện tập --- */
.practice-wrap { padding: 4px 0; }
.practice-section-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.practice-stab {
  padding: 7px 16px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; font-size: 13px; cursor: pointer; color: #475569;
  transition: all .15s;
}
.practice-stab.active {
  background: #0f172a; color: #fff; border-color: #0f172a;
}

/* Quiz điền từ nối */
.quiz-wrap { padding: 4px 0; }
.quiz-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: #1e293b; }
.quiz-hint { font-size: 13px; color: #64748b; margin-bottom: 16px; }
.quiz-item {
  background: #f8fafc; border-radius: 12px;
  padding: 16px; margin-bottom: 16px; border: 1px solid #e2e8f0;
}
.quiz-sentence {
  font-size: 15px; line-height: 1.8; color: #1e293b; margin-bottom: 12px;
}
.quiz-blank {
  display: inline-block; min-width: 80px; border-bottom: 2px solid #4f46e5;
  color: #4f46e5; font-weight: 700; text-align: center;
}
.quiz-options { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.quiz-opt {
  padding: 6px 14px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; font-size: 13px; cursor: pointer; transition: all .15s;
}
.quiz-opt:hover { background: #f1f5f9; }
.quiz-opt.correct { background: #dcfce7; border-color: #22c55e; color: #15803d; font-weight: 700; }
.quiz-opt.wrong   { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.quiz-explain {
  margin-top: 8px; padding: 10px 14px; border-radius: 8px;
  background: #f0f9ff; font-size: 13px; color: #0369a1; line-height: 1.6;
}

/* Rewrite */
.rewrite-wrap { padding: 4px 0; }
.rewrite-item {
  background: #f8fafc; border-radius: 12px;
  padding: 16px; margin-bottom: 16px; border: 1px solid #e2e8f0;
}
.rewrite-basic { font-size: 14px; color: #475569; margin-bottom: 8px; }
.rewrite-basic span { font-weight: 600; color: #1e293b; }
.rewrite-hint { font-size: 13px; color: #7c3aed; margin-bottom: 10px; }
.rewrite-input {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 10px; font-size: 14px; resize: vertical; font-family: inherit;
  box-sizing: border-box;
}
.quiz-submit-btn {
  margin-top: 8px; padding: 7px 16px; border-radius: 8px;
  background: #4f46e5; color: #fff; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.rewrite-sample {
  margin-top: 12px; padding: 14px; background: #ecfdf5;
  border-radius: 10px; border-left: 4px solid #10b981;
}
.sample-label { font-size: 12px; color: #065f46; font-weight: 700; margin-bottom: 6px; }
.sample-ko { font-size: 14px; color: #1e293b; line-height: 1.7; font-weight: 600; }
.sample-tip { font-size: 12px; color: #047857; margin-top: 6px; }

/* AI chấm bài */
.aiwrite-wrap { padding: 4px 0; }
.aiwrite-prompt {
  background: #f0f9ff; border-left: 4px solid #3b82f6;
  padding: 14px 16px; border-radius: 10px; margin-bottom: 12px;
  font-size: 14px; line-height: 1.8; color: #1e293b;
}
.aiwrite-criteria {
  font-size: 13px; color: #64748b; margin-bottom: 12px;
}
.aiwrite-textarea {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 10px;
  padding: 12px; font-size: 15px; line-height: 1.8; resize: vertical;
  font-family: inherit; box-sizing: border-box;
}
.aiwrite-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.char-count { font-size: 13px; color: #64748b; }
.aiwrite-btn {
  padding: 10px 24px; background: linear-gradient(135deg,#4f46e5,#7c3aed);
  color: #fff; border: none; border-radius: 10px; font-size: 14px;
  font-weight: 700; cursor: pointer; transition: opacity .2s;
}
.aiwrite-btn:hover { opacity: .9; }
.aiwrite-result {
  margin-top: 16px; padding: 16px; border-radius: 12px;
  border: 1px solid #e2e8f0; background: #fafafa;
}
.aiwrite-loading { color: #64748b; font-size: 14px; text-align: center; padding: 20px; }
.aiwrite-error { color: #b91c1c; font-size: 14px; }
.aiwrite-feedback { font-size: 14px; line-height: 1.8; color: #1e293b; }
.aiwrite-feedback h3 { font-size: 16px; font-weight: 700; margin: 16px 0 6px; color: #0f172a; }
.aiwrite-feedback h4 { font-size: 14px; font-weight: 700; margin: 12px 0 4px; color: #334155; }

/* ============================================================
   WRITING 54 NÂNG CAO – App layout
   ============================================================ */
.w54adv-app { padding: 8px 0; }

.w54adv-header {
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}
.w54adv-title {
  font-size: 20px; font-weight: 800; color: #0f172a; margin-bottom: 4px;
}
.w54adv-subtitle {
  font-size: 14px; color: #64748b;
}

.w54adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
@media(max-width:480px){ .w54adv-grid { grid-template-columns: repeat(2, 1fr); } }

.w54adv-topic-card {
  background: #fff; border: 2px solid #e2e8f0;
  border-radius: 14px; padding: 16px 12px;
  text-align: center; cursor: pointer;
  transition: all .18s; display: flex;
  flex-direction: column; gap: 6px; align-items: center;
}
.w54adv-topic-card:hover {
  border-color: #4f46e5; background: #eef2ff;
  transform: translateY(-2px);
}
.w54adv-topic-card.active {
  border-color: #4f46e5; background: #4f46e5;
}
.w54adv-topic-card.active .w54adv-topic-label,
.w54adv-topic-card.active .w54adv-topic-sub { color: #fff; }

.w54adv-topic-label {
  font-size: 14px; font-weight: 700; color: #1e293b;
}
.w54adv-topic-sub {
  font-size: 11px; color: #64748b;
}

.w54adv-back-btn {
  padding: 8px 18px; border-radius: 10px;
  border: 1px solid #cbd5e1; background: #f8fafc;
  color: #475569; font-size: 13px; cursor: pointer;
  margin-bottom: 16px; display: inline-block;
}
.w54adv-back-btn:hover { background: #e2e8f0; }

.w54adv-coming-soon {
  text-align: center; padding: 60px 20px;
  color: #64748b; font-size: 15px;
}
