/* ================= LEARNING CAMPUS - MINNA NO NIHONGO N5 CSS ================= */

/* 1. Header Mode Switcher */
.header-mode-switch-wrap {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-right: 12px;
}
.mode-switcher-pill {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  padding: 3px;
  gap: 3px;
}
.mode-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.mode-switch-btn i {
  font-size: 15px;
}
.mode-switch-btn:hover {
  color: #1e293b;
}
.mode-switch-btn.active {
  background: #ffffff;
  color: var(--primary-color, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* 2. Mode Selection Modal */
.mode-select-modal-dialog {
  max-width: 680px;
}
.mode-select-body {
  padding: 16px 24px 24px 24px;
}
.mode-select-intro {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.5;
}
.mode-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .mode-cards-grid {
    grid-template-columns: 1fr;
  }
}
.mode-option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mode-option-card:hover {
  border-color: #6366f1;
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}
.mode-option-card.highlight {
  border-color: #818cf8;
  background: linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
}
.mode-card-badge {
  position: absolute;
  top: -10px;
  right: 14px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mode-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}
.chat-icon {
  background: #e0f2fe;
  color: #0284c7;
}
.learn-icon {
  background: #ede9fe;
  color: #7c3aed;
}
.mode-card-info h4 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #1e293b;
}
.mode-card-info p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex: 1;
}
.mode-select-action-btn {
  width: 100%;
  margin-top: auto;
}

/* 3. Standalone Fullscreen Learning Campus (Zero Chat Room Impact) */
.learning-campus-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #f8fafc;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.learning-campus-fullscreen.hidden {
  display: none !important;
}

.learning-top-header {
  border-radius: 0;
  padding: 10px 20px;
  height: auto;
  min-height: 56px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.learning-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.learning-brand-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.learning-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.learning-brand-title {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learning-brand-sub {
  font-size: 11px;
  color: #6366f1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-learning-exit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-learning-exit:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

.learning-campus-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #f8fafc;
  height: 100%;
}

/* Quick Mode Switcher in Chat Sidebar */
.sidebar-mode-switcher-card {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  margin: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.sidebar-mode-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.sidebar-mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.sidebar-mode-btn.active {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}
.sidebar-mode-btn.highlight {
  position: relative;
}
.sidebar-mode-btn .mode-badge-n5 {
  font-size: 10px;
  padding: 1px 5px;
  background: #10b981;
  color: #ffffff;
  border-radius: 8px;
  font-weight: 700;
}

/* 4. Roadmap Screen */
.learning-roadmap-screen {
  padding: 24px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.roadmap-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  padding: 28px 32px;
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
  margin-bottom: 28px;
}
@media (max-width: 768px) {
  .learning-roadmap-screen {
    padding: 14px 10px;
  }
  .roadmap-hero-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 14px;
    gap: 14px;
    margin-bottom: 16px;
    border-radius: 14px;
  }
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hero-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: #ffffff;
}
.hero-subtitle {
  font-size: 13.5px;
  opacity: 0.9;
  line-height: 1.5;
  margin: 0;
  max-width: 600px;
}
.roadmap-stats-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  min-width: 200px;
}
.stats-label {
  font-size: 11.5px;
  opacity: 0.85;
  text-transform: uppercase;
  font-weight: 700;
}
.stats-num {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0 8px 0;
}
.stats-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  overflow: hidden;
}
.stats-bar-fill {
  height: 100%;
  background: #34d399;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Roadmap Grid */
.roadmap-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}
.lesson-node-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}
.lesson-node-card:hover:not(.locked) {
  border-color: #6366f1;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.lesson-node-card.active-current {
  border: 2px solid #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.lesson-node-card.completed {
  border-color: #10b981;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
}
.lesson-node-card.locked {
  opacity: 0.65;
  background: #f8fafc;
  cursor: not-allowed;
}

.lesson-node-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.lesson-number-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lesson-node-card.completed .lesson-number-circle {
  background: #d1fae5;
  color: #059669;
}
.lesson-meta-wrap {
  flex: 1;
}
.lesson-ja-subtitle {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 2px;
}
.lesson-vi-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.35;
}
.lesson-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lesson-status-badge.completed {
  background: #dcfce7;
  color: #15803d;
}
.lesson-status-badge.active {
  background: #e0e7ff;
  color: #4338ca;
}
.lesson-status-badge.locked {
  background: #f1f5f9;
  color: #64748b;
}

.lesson-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
  margin: 0 0 16px 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lesson-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.lesson-subprogress-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}
.lesson-subprogress-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 9999px;
  transition: width 0.3s ease;
}
.lesson-node-card.completed .lesson-subprogress-fill {
  background: #10b981;
}
.lesson-pct-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  min-width: 32px;
  text-align: right;
}
.lesson-node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lesson-modules-pill, .lesson-score-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}
.lesson-score-pill {
  color: #059669;
}
.lesson-enter-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
}

/* 5. Lesson Workspace Screen */
.learning-lesson-screen {
  padding: 20px 24px 40px 24px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.lesson-top-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.lesson-top-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.btn-back-roadmap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 6px 14px;
}
.lesson-header-ja-badge {
  font-size: 12px;
  font-weight: 800;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 4px 12px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.lesson-header-titles {
  width: 100%;
  text-align: left;
}
.lesson-header-vi {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
}

/* 7 Module Tabs Navigation */
.module-tabs-nav {
  display: flex;
  gap: 6px;
  background: #ffffff;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  margin-bottom: 24px;
  scrollbar-width: thin;
}
.module-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}
.module-tab-btn i {
  font-size: 16px;
}
.module-tab-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.module-tab-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}
.module-tab-btn.test-tab {
  color: #b45309;
}
.module-tab-btn.test-tab.active {
  background: #d97706;
  color: #ffffff;
}
.module-tab-check {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}
.module-tab-check.completed {
  background: #10b981;
  box-shadow: 0 0 0 2px #d1fae5;
}
.module-tab-btn.active .module-tab-check.completed {
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* Section Header inside modules */
.module-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.module-section-header.vocab-header-compact {
  padding: 6px 12px;
  margin-bottom: 8px;
}
.module-sec-info h3 {
  font-size: 13.5px;
  font-weight: 800;
  margin: 0;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.module-sec-info p {
  display: none; /* Hide large paragraph to eliminate scrolling */
}
.complete-module-btn.mini-btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 6. Module 1: Quizlet Vocab Suite (Flashcard, Test, Match, List) */

/* Vocab Mode Toolbar */
.vocab-mode-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.vmode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.vmode-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.vmode-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}

/* ================= QUIZLET MODE 1: FLASHCARD CAROUSEL ================= */
.quizlet-carousel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}
.quizlet-card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}
.quizlet-progress-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quizlet-pill {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.quizlet-pill.pill-mastered {
  background: #dcfce7;
  color: #15803d;
}
.quizlet-pill.pill-learning {
  background: #fee2e2;
  color: #b91c1c;
}
.quizlet-card-stage {
  width: 100%;
  perspective: 1200px;
  margin-bottom: 20px;
}
.quizlet-flashcard {
  width: 100%;
  min-height: 290px;
  position: relative;
  border-radius: 20px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}
.quizlet-flashcard.flipped {
  transform: rotateY(180deg);
}
.quizlet-card-face {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 24px 28px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.quizlet-card-face.face-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #f8faff 0%, #ffffff 100%);
  border-color: #c7d2fe;
}
.quizlet-face-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.quizlet-main-word {
  font-size: 38px;
  font-weight: 800;
  color: #0f172a;
  margin: 18px 0 6px 0;
  line-height: 1.25;
}
.quizlet-romaji {
  font-size: 16px;
  color: #6366f1;
  font-weight: 600;
}
.quizlet-flip-prompt {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}
.quizlet-meaning-vi {
  font-size: 26px;
  font-weight: 800;
  color: #1e1b4b;
  margin: 14px 0 8px 0;
}
.quizlet-example-box {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
  text-align: left;
  margin: 10px 0;
}
.quizlet-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.btn-quizlet-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-quizlet-learning {
  background: #fef2f2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
}
.btn-quizlet-learning:hover {
  background: #fee2e2;
  transform: translateY(-2px);
}
.btn-quizlet-mastered {
  background: #ecfdf5;
  color: #059669;
  border: 1.5px solid #a7f3d0;
}
.btn-quizlet-mastered:hover {
  background: #d1fae5;
  transform: translateY(-2px);
}
.btn-quizlet-nav {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-quizlet-nav:hover {
  background: #f8fafc;
  color: #0f172a;
}

/* ================= QUIZLET MODE 2: TRẮC NGHIỆM TEST ================= */
.quizlet-test-wrap {
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}
.quizlet-test-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.quizlet-test-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.quizlet-test-progress-num {
  font-size: 12px;
  font-weight: 800;
  color: #6366f1;
}
.quizlet-test-score-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 2px 8px;
  border-radius: 9999px;
}
.quizlet-test-prompt-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  margin-bottom: 8px;
}
.quizlet-prompt-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: 0.3px;
}
.quizlet-prompt-word {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 2px 0;
  line-height: 1.3;
}
.quizlet-prompt-sub {
  font-size: 12px;
  color: #6366f1;
  font-weight: 600;
}
.quizlet-test-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.quizlet-opt-btn {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  min-height: 40px;
}
.quizlet-opt-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #f5f3ff;
}
.quizlet-opt-btn .opt-key {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quizlet-opt-btn .opt-label {
  flex: 1;
  line-height: 1.35;
}
.quizlet-opt-btn .opt-label ruby {
  font-size: 13.5px;
}
.quizlet-opt-btn .opt-label rt {
  font-size: 9px;
}
.quizlet-opt-btn.correct {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}
.quizlet-opt-btn.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}
.quizlet-test-feedback {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}
.quizlet-test-feedback.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.quizlet-test-feedback.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.btn-quizlet-next-q {
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: 9999px;
  border: none;
  background: #4f46e5;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Kết quả Test Quizlet */
.quizlet-result-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}
.quizlet-score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  margin: 0 auto 16px auto;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}
.quizlet-missed-list {
  text-align: left;
  margin: 20px 0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
}
.quizlet-missed-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #b91c1c;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.quizlet-missed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 13.5px;
}
.quizlet-missed-item:last-child {
  border-bottom: none;
}
.quizlet-res-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ================= QUIZLET MODE 3: GHÉP THẺ MATCH ================= */
.quizlet-match-wrap {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.quizlet-match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.quizlet-match-timer {
  font-size: 16px;
  font-weight: 800;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.quizlet-match-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 600px) {
  .quizlet-match-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.match-tile {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 12px;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14.5px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.match-tile:hover {
  border-color: #818cf8;
  transform: translateY(-2px);
}
.match-tile.selected {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  transform: scale(1.03);
}
.match-tile.matched {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.match-tile.wrong-shake {
  border-color: #ef4444;
  background: #fef2f2;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ================= QUIZLET MODE 4: FULL LIST ================= */
.vocab-list-table-wrap {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.vocab-list-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
  transition: background 0.15s ease;
}
.vocab-list-item-row:last-child {
  border-bottom: none;
}
.vocab-list-item-row:hover {
  background: #f8fafc;
}
.vocab-list-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vocab-list-word-ja {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}
.vocab-list-romaji {
  font-size: 12px;
  color: #94a3b8;
}
.vocab-list-right {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}
.vocab-list-meaning {
  font-size: 14.5px;
  font-weight: 700;
  color: #334155;
  transition: opacity 0.2s;
}
.vocab-list-meaning.hidden-meaning {
  filter: blur(5px);
  user-select: none;
}

/* Shared Flashcard styles */
.vocab-type-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #64748b;
}
.btn-card-audio, .btn-inline-tts, .btn-kaiwa-tts {
  background: #eef2ff;
  color: #4f46e5;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-card-audio:hover, .btn-inline-tts:hover, .btn-kaiwa-tts:hover {
  background: #4f46e5;
  color: #ffffff;
  transform: scale(1.08);
}

/* 7. Module 2: Kanji Cards */
.kanji-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.kanji-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}
.kanji-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.kanji-character-big {
  font-size: 40px;
  font-weight: 900;
  color: #4338ca;
  line-height: 1;
}
.kanji-meta-box {
  display: flex;
  flex-direction: column;
}
.kanji-han-viet {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
}
.kanji-meaning {
  font-size: 12.5px;
  color: #64748b;
}
.kanji-readings-row {
  display: flex;
  gap: 12px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}
.reading-label {
  font-weight: 700;
  color: #94a3b8;
  margin-right: 4px;
}
.reading-val {
  font-weight: 600;
  color: #1e293b;
}
.kanji-compounds-list {
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
  font-size: 11.5px;
}
.compounds-title {
  font-weight: 700;
  color: #64748b;
  margin-bottom: 4px;
}
.compound-item {
  margin-bottom: 3px;
  line-height: 1.4;
}
.compound-word {
  font-weight: 700;
  color: #0f172a;
}
.compound-reading {
  color: #4f46e5;
}
.compound-meaning {
  color: #475569;
}

/* 8. Module 3: Grammar Points */
.grammar-points-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.grammar-point-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.grammar-point-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px 0;
}
.grammar-formula-box {
  background: #f1f5f9;
  border-left: 3px solid #6366f1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.formula-label {
  font-weight: 700;
  color: #475569;
}
.grammar-formula-box code {
  font-family: inherit;
  font-weight: 700;
  color: #4338ca;
}
.grammar-explanation {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.6;
  margin-bottom: 14px;
}
.grammar-examples-box {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}
.examples-header {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.grammar-example-item {
  margin-bottom: 10px;
  padding-left: 6px;
}
.ex-ja-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}
.ex-vi-line {
  font-size: 12.5px;
  color: #64748b;
  margin-left: 40px;
}

/* 9. Module 4: Listening */
.listening-questions-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.listening-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.listening-audio-player {
  margin-bottom: 14px;
}
.btn-play-audio-big {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
  transition: all 0.15s ease;
}
.btn-play-audio-big:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
}
.listening-question-text {
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 14px;
  line-height: 1.4;
}
.listening-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .listening-options-grid {
    grid-template-columns: 1fr;
  }
}
.listening-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  font-size: 13.5px;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.listening-opt-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #f8faff;
}
.opt-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.listening-opt-btn.correct {
  border-color: #10b981;
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
}
.listening-opt-btn.wrong {
  border-color: #ef4444;
  background: #fee2e2;
  color: #b91c1c;
}
.listening-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.listening-feedback.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.listening-feedback.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* 10. Module 5: Speaking */
.speaking-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.speaking-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.speaking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.speaking-idx-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: #eef2ff;
  color: #4f46e5;
  padding: 2px 8px;
  border-radius: 9999px;
}
.btn-speaking-listen {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
}
.speaking-target-box {
  background: #f8fafc;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.speaking-furigana-line {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}
.speaking-meaning-line {
  font-size: 13px;
  color: #64748b;
}
.speaking-hint {
  font-size: 12px;
  color: #d97706;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.speaking-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn-speaking-mic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #4f46e5;
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-speaking-mic.recording {
  background: #ef4444;
  animation: pulse-red 1.2s infinite;
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.speaking-mic-status {
  font-size: 12.5px;
  font-weight: 600;
  color: #4f46e5;
}
.speaking-result-box {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}
.speaking-result-box.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.speaking-result-box.needs-work {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.result-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.score-badge {
  font-size: 12px;
  font-weight: 800;
  background: #10b981;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 9999px;
}
.speaking-result-box.needs-work .score-badge {
  background: #f59e0b;
}

/* 11. Module 6: Kaiwa */
.kaiwa-scenario-banner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 13px;
  color: #475569;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kaiwa-chat-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;
}
.kaiwa-messages-feed {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kaiwa-msg-item {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}
.kaiwa-msg-item.ai-bubble {
  align-self: flex-start;
}
.kaiwa-msg-item.user-bubble {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.kaiwa-bubble-content {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.ai-bubble .kaiwa-bubble-content {
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}
.user-bubble .kaiwa-bubble-content {
  background: #4f46e5;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.kaiwa-ja-line {
  font-weight: 700;
  margin-bottom: 2px;
}
.kaiwa-vi-line {
  font-size: 11.5px;
  opacity: 0.85;
}
.kaiwa-suggestions-wrap {
  padding: 8px 14px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}
.sugg-header {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sugg-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kaiwa-sugg-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kaiwa-sugg-chip:hover {
  border-color: #6366f1;
  background: #eef2ff;
}
.kaiwa-input-bar {
  display: flex;
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  gap: 8px;
  background: #ffffff;
}
.kaiwa-input-bar input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
}
.kaiwa-input-bar input:focus {
  border-color: #6366f1;
}

/* 12. Module 7: Test Vượt Ải */
.test-module-header {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.test-header-meta h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: #0f172a;
}
.test-header-meta p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}
.test-passed-badge-banner {
  background: #dcfce7;
  color: #15803d;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.test-questions-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.test-question-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  transition: all 0.2s ease;
}
.test-question-card.is-correct {
  border-color: #10b981;
  background: #f0fdf4;
}
.test-question-card.is-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}
.test-q-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.test-q-num {
  font-size: 12px;
  background: #eef2ff;
  color: #4f46e5;
  padding: 2px 7px;
  border-radius: 4px;
}
.test-q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.test-header-side {
  display: flex;
  align-items: center;
  gap: 12px;
}
.test-answered-counter {
  font-size: 13px;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 6px 14px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.test-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  font-size: 13.5px;
  transition: all 0.15s ease;
}
.test-option-label:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.test-option-label.active-selected {
  border-color: #6366f1;
  background: #f5f3ff;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}
.test-option-label input[type="radio"] {
  accent-color: #4f46e5;
  width: 16px;
  height: 16px;
}
.test-q-explanation {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12.5px;
  line-height: 1.4;
}
.test-submit-bar {
  margin-top: 10px;
  text-align: center;
}
.btn-submit-test {
  padding: 12px 28px;
  font-size: 14.5px;
  font-weight: 800;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.test-final-result-card {
  margin-top: 24px;
  padding: 24px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
}
@media (max-width: 640px) {
  .test-final-result-card {
    flex-direction: column;
    text-align: center;
  }
}
.test-final-result-card.passed {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff;
}
.test-final-result-card.failed {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #ffffff;
}
.result-score-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  flex-shrink: 0;
}
.result-main-info {
  flex: 1;
}
.result-main-info h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: #ffffff;
}
.result-main-info p {
  font-size: 14px;
  margin: 0;
  opacity: 0.95;
}
.unlocked-next-alert {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Common State */
.learning-loading-state, .learning-error-state, .empty-module-msg {
  padding: 40px 20px;
  text-align: center;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 14px;
}
.learning-loading-state i, .learning-error-state i {
  font-size: 28px;
  color: #4f46e5;
}
.learning-error-state i {
  color: #ef4444;
}

/* ==========================================================================
   ADVENTURE JOURNEY MAP (BẢN ĐỒ PHIÊU LƯU MINNA N5)
   ========================================================================== */

/* Switcher Chế độ xem */
.roadmap-view-switcher {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px;
  border-radius: 9999px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.view-switch-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.view-switch-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.view-switch-btn.active {
  background: #ffffff;
  color: #4338ca;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.stats-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.stats-badge-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.stats-badge-pill.highlight {
  background: #f59e0b;
  color: #1e1b4b;
}

/* Adventure Map Main Container */
.roadmap-main-viewport {
  width: 100%;
  position: relative;
}
.adventure-map-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 30px 16px 80px 16px;
  position: relative;
}

/* Winding Trail Timeline */
.adventure-trail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

/* SVG Winding Road Path Connector */
.adventure-trail::before {
  content: "";
  position: absolute;
  top: 40px;
  bottom: 80px;
  left: 50%;
  width: 8px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #818cf8 0%, #a78bfa 50%, #f59e0b 100%);
  border-radius: 9999px;
  opacity: 0.35;
  z-index: 1;
}

/* Milestone Node Wrapper (Alternating S-curve layout) */
.trail-milestone-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease;
}
.trail-milestone-row.pos-left {
  justify-content: flex-start;
  padding-left: 8%;
}
.trail-milestone-row.pos-right {
  justify-content: flex-end;
  padding-right: 8%;
}
.trail-milestone-row.pos-center {
  justify-content: center;
}

/* Start Milestone Banner */
.trail-start-banner {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  margin-bottom: 10px;
  z-index: 3;
}

/* Node Item Card & Disc */
.trail-node-combo {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  position: relative;
}
.trail-milestone-row.pos-right .trail-node-combo {
  flex-direction: row-reverse;
}

/* 3D Round Disc Node */
.trail-disc {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12), inset 0 -4px 0 rgba(0, 0, 0, 0.15);
  border: 4px solid #ffffff;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  flex-shrink: 0;
}
.trail-node-combo:hover .trail-disc {
  transform: translateY(-4px) scale(1.06);
}

/* Trạng thái: Completed */
.trail-disc.status-completed {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff;
  border-color: #a7f3d0;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}
.trail-disc.status-completed .disc-stars {
  position: absolute;
  top: -12px;
  font-size: 12px;
  color: #f59e0b;
  display: flex;
  gap: 1px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Trạng thái: Current (Đang học) */
.trail-disc.status-current {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #ffffff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.25), 0 8px 24px rgba(79, 70, 229, 0.4), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  animation: radar-pulse 2s infinite ease-out;
}
@keyframes radar-pulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6), 0 8px 24px rgba(79, 70, 229, 0.4); }
  70% { box-shadow: 0 0 0 14px rgba(99, 102, 241, 0), 0 8px 24px rgba(79, 70, 229, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0), 0 8px 24px rgba(79, 70, 229, 0.4); }
}

/* Avatar "Bạn ở đây" */
.player-location-pin {
  position: absolute;
  top: -38px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 9999px;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.4);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: bounce-pin 1.6s infinite ease-in-out;
}
.player-location-pin::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0 4px;
  border-style: solid;
  border-color: #ef4444 transparent transparent transparent;
}
@keyframes bounce-pin {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Trạng thái: Locked */
.trail-disc.status-locked {
  background: #cbd5e1;
  color: #64748b;
  border-color: #e2e8f0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06), inset 0 -3px 0 rgba(0, 0, 0, 0.1);
  cursor: not-allowed;
}

.disc-number {
  font-size: 22px;
  line-height: 1;
}

/* Thông tin thẻ cạnh Node */
.trail-card-preview {
  background: #ffffff;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 280px;
  transition: all 0.2s ease;
}
.trail-node-combo:hover .trail-card-preview {
  border-color: #818cf8;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
}
.trail-card-header {
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.trail-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 6px 0;
  line-height: 1.3;
}
.trail-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

/* ==========================================================================
   OBSTACLE CHECKPOINT GATE (CỬA ẢI CHƯỚNG NGẠI VẬT)
   ========================================================================== */
.trail-checkpoint-row {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 3;
  margin: 10px 0;
}
.checkpoint-gate-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 18px 24px;
  box-shadow: 0 10px 25px rgba(49, 46, 129, 0.35);
  border: 2px solid #818cf8;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 540px;
  width: 100%;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.checkpoint-gate-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  pointer-events: none;
}
.checkpoint-gate-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: #f59e0b;
  box-shadow: 0 14px 30px rgba(245, 158, 11, 0.25);
}

/* Cửa ải đã hoàn thành */
.checkpoint-gate-card.status-completed {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  border-color: #34d399;
  box-shadow: 0 10px 25px rgba(5, 150, 105, 0.3);
}

/* Cửa ải bị khóa */
.checkpoint-gate-card.status-locked {
  background: #334155;
  border-color: #475569;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.75;
}
.checkpoint-gate-card.status-locked:hover {
  transform: none;
}

.checkpoint-gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1e1b4b;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
}
.checkpoint-gate-card.status-completed .checkpoint-gate-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}
.checkpoint-gate-card.status-locked .checkpoint-gate-icon {
  background: #475569;
  color: #94a3b8;
}

.checkpoint-gate-info {
  flex: 1;
}
.checkpoint-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}
.checkpoint-gate-card.status-completed .checkpoint-tag {
  color: #6ee7b7;
}
.checkpoint-gate-card.status-locked .checkpoint-tag {
  color: #94a3b8;
}

.checkpoint-title {
  font-size: 15.5px;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: #ffffff;
}
.checkpoint-desc {
  font-size: 12.5px;
  margin: 0;
  color: #cbd5e1;
  line-height: 1.4;
}

.btn-enter-gate {
  background: #f59e0b;
  color: #1e1b4b;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 9999px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
  cursor: pointer;
  transition: all 0.2s;
}
.checkpoint-gate-card.status-completed .btn-enter-gate {
  background: #10b981;
  color: #ffffff;
}
.checkpoint-gate-card.status-locked .btn-enter-gate {
  background: #475569;
  color: #cbd5e1;
  cursor: not-allowed;
}

/* Đích Đến: Đỉnh Núi Phú Sĩ (Mt. Fuji Pinnacle) */
.trail-finish-goal {
  text-align: center;
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 3px solid #f59e0b;
  border-radius: 24px;
  padding: 24px 30px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.25);
  margin-top: 20px;
  position: relative;
  z-index: 3;
}
.finish-icon-wrap {
  font-size: 48px;
  margin-bottom: 6px;
}
.finish-goal-title {
  font-size: 20px;
  font-weight: 900;
  color: #78350f;
  margin: 0 0 6px 0;
}
.finish-goal-desc {
  font-size: 13.5px;
  color: #92400e;
  margin: 0;
}

/* ==========================================================================
   OBSTACLE ARENA SCREEN (ĐẤU TRƯỜNG VƯỢT CHƯỚNG NGẠI VẬT)
   ========================================================================== */
.obstacle-arena-screen {
  background: #f8fafc;
  min-height: 100vh;
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
}

/* Top bar đấu trường */
.arena-top-bar {
  background: #1e1b4b;
  color: #ffffff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #312e81;
}
.btn-arena-exit {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-arena-exit:hover {
  background: rgba(255, 255, 255, 0.2);
}
.arena-header-titles {
  text-align: center;
}
.arena-zone-badge {
  font-size: 11px;
  font-weight: 800;
  color: #f59e0b;
  text-transform: uppercase;
}
.arena-title {
  font-size: 18px;
  font-weight: 800;
  margin: 2px 0 0 0;
}

/* Sinh mệnh (Hearts) */
.arena-hearts-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hearts-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}
.hearts-list {
  display: flex;
  gap: 6px;
}
.heart-item {
  font-size: 24px;
  color: #ef4444;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.heart-item.lost {
  color: #475569;
  transform: scale(0.7);
  opacity: 0.5;
}

/* Đường chạy chướng ngại vật */
.arena-track-wrap {
  background: #ffffff;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
}
.arena-runner-bar {
  height: 12px;
  background: #e2e8f0;
  border-radius: 9999px;
  position: relative;
  overflow: visible;
  margin-top: 14px;
}
.arena-runner-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}
.arena-runner-avatar {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  font-size: 26px;
  transition: left 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.arena-track-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-top: 10px;
}
.arena-streak-badge {
  background: #fef3c7;
  color: #b45309;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Màn chơi chướng ngại vật */
.arena-playfield-wrap {
  max-width: 760px;
  width: 100%;
  margin: 30px auto;
  padding: 0 16px;
}
.obstacle-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  padding: 28px;
  position: relative;
}
.obstacle-card.shake {
  animation: arena-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes arena-shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.obstacle-card-header {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}
.obstacle-badge-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #fee2e2;
  color: #ef4444;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.obstacle-category {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #6366f1;
}
.obstacle-question {
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
  margin: 4px 0 0 0;
  line-height: 1.4;
}

/* 4 Phương án */
.obstacle-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .obstacle-options-grid {
    grid-template-columns: 1fr;
  }
}
.obstacle-opt-btn {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
  position: relative;
}
.obstacle-opt-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #f5f3ff;
  transform: translateY(-2px);
}
.obstacle-opt-btn .opt-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.obstacle-opt-btn.correct {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}
.obstacle-opt-btn.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

/* Feedback Banner */
.obstacle-feedback-banner {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fade-in 0.25s ease;
}
.obstacle-feedback-banner.success {
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
}
.obstacle-feedback-banner.error {
  background: #fef2f2;
  border: 2px solid #fecaca;
}
.obstacle-feedback-banner .feedback-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.obstacle-feedback-banner.success .feedback-icon { color: #10b981; }
.obstacle-feedback-banner.error .feedback-icon { color: #ef4444; }
.feedback-info {
  flex: 1;
}
.feedback-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 4px 0;
}
.obstacle-feedback-banner.success .feedback-title { color: #065f46; }
.obstacle-feedback-banner.error .feedback-title { color: #991b1b; }
.feedback-desc {
  font-size: 13px;
  margin: 0;
  color: #475569;
}
.btn-next-obstacle {
  flex-shrink: 0;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 800;
}

/* Kết quả Vượt ải */
.arena-result-wrap {
  max-width: 600px;
  width: 100%;
  margin: 30px auto;
  padding: 0 16px;
}
.arena-result-card {
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1);
  padding: 36px 24px;
  text-align: center;
}
.result-trophy-icon {
  font-size: 64px;
  margin-bottom: 12px;
}
.result-big-title {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 8px 0;
}
.result-big-subtitle {
  font-size: 15px;
  color: #475569;
  margin: 0 0 20px 0;
}
.result-badge-showcase {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px dashed #f59e0b;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 800;
  color: #78350f;
}
.result-badge-showcase i {
  font-size: 32px;
  color: #d97706;
}
.result-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* ==========================================================================
   MOBILE & SMARTPHONE OPTIMIZATIONS (RESPONSIVE MASTER)
   ========================================================================== */

@media (max-width: 768px) {
  /* 1. Header & Brand */
  .learning-top-header {
    padding: 8px 14px !important;
    min-height: 52px !important;
  }
  .learning-brand-block {
    gap: 8px;
  }
  .learning-brand-icon {
    font-size: 22px;
  }
  .learning-brand-title {
    font-size: 13.5px;
  }
  .learning-brand-sub {
    font-size: 10.5px;
  }
  .btn-learning-exit {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* 2. Roadmap Screen & Hero Banner */
  .learning-roadmap-screen {
    padding: 12px 10px;
  }
  .roadmap-hero-banner {
    padding: 16px 14px;
    gap: 12px;
    margin-bottom: 14px;
    border-radius: 14px;
  }
  .hero-badge {
    font-size: 10px;
    padding: 3px 8px;
    margin-bottom: 4px;
  }
  .hero-title {
    font-size: 18px;
    margin-bottom: 4px;
  }
  .hero-subtitle {
    font-size: 12px;
    line-height: 1.4;
  }
  .roadmap-view-switcher {
    display: flex;
    width: 100%;
    margin-top: 10px;
    padding: 3px;
  }
  .view-switch-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 11.5px;
  }
  .roadmap-stats-card {
    min-width: unset;
    width: 100%;
    padding: 12px 14px;
  }
  .stats-num {
    font-size: 20px;
  }
  .stats-badge-pill {
    font-size: 10.5px;
    padding: 3px 8px;
  }

  /* 3. Lesson Workspace & Tabs */
  .learning-lesson-screen {
    padding: 12px 10px 40px 10px;
  }
  .lesson-top-bar {
    padding: 10px 14px;
    gap: 8px;
  }
  .btn-back-roadmap {
    font-size: 12px;
    padding: 5px 11px;
  }
  .lesson-header-ja-badge {
    font-size: 11px;
    padding: 3px 9px;
  }
  .lesson-header-vi {
    font-size: 14.5px;
  }
  .module-tabs-nav {
    padding: 4px;
    gap: 4px;
    margin-bottom: 14px;
    border-radius: 10px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .module-tab-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
    gap: 6px;
    scroll-snap-align: start;
  }
  .module-tab-btn i {
    font-size: 14px;
  }
  .btn-card-audio, .btn-inline-tts, .btn-kaiwa-tts {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  /* Header mode buttons compact */
  .mode-switch-btn {
    padding: 4px 8px;
    font-size: 11.5px;
    gap: 4px;
  }
  .mode-switch-btn i {
    font-size: 13px;
  }

  /* Adventure Map: S-Curve without overflow */
  .adventure-map-container {
    padding: 16px 4px 60px 4px;
  }
  .adventure-trail {
    gap: 20px;
  }
  .adventure-trail::before {
    width: 5px;
    opacity: 0.25;
  }
  .trail-start-banner {
    font-size: 11.5px;
    padding: 6px 14px;
    margin-bottom: 4px;
  }
  .trail-milestone-row {
    padding-left: 0 !important;
    padding-right: 0 !important;
    justify-content: center !important;
    width: 100%;
  }
  /* Offset nodes smoothly while staying within mobile viewport */
  .trail-milestone-row.pos-left {
    transform: translateX(-12px);
  }
  .trail-milestone-row.pos-right {
    transform: translateX(12px);
  }
  .trail-milestone-row.pos-center {
    transform: translateX(0);
  }
  .trail-node-combo {
    gap: 10px;
    max-width: 320px;
    width: 100%;
    justify-content: center;
  }
  .trail-disc {
    width: 54px;
    height: 54px;
    border-width: 3px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
  }
  .disc-number {
    font-size: 17px;
  }
  .trail-disc.status-completed .disc-stars {
    font-size: 9px;
    top: -10px;
  }
  .player-location-pin {
    font-size: 9.5px;
    padding: 2px 6px;
    top: -30px;
  }
  .trail-card-preview {
    padding: 8px 12px;
    max-width: 220px;
    flex: 1;
    min-width: 0;
    border-radius: 12px;
  }
  .trail-card-header {
    font-size: 10px;
    margin-bottom: 1px;
  }
  .trail-card-title {
    font-size: 12.5px;
    line-height: 1.25;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .trail-card-meta {
    font-size: 10.5px;
  }
  .trail-card-meta span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
  }

  /* Checkpoint gate card */
  .trail-checkpoint-row {
    margin: 6px 0;
    padding: 0 4px;
  }
  .checkpoint-gate-card {
    padding: 14px 12px;
    gap: 12px;
    flex-wrap: wrap;
    border-radius: 16px;
  }
  .checkpoint-gate-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
    border-radius: 12px;
  }
  .checkpoint-gate-info {
    min-width: 0;
    flex: 1;
  }
  .checkpoint-tag {
    font-size: 9.5px;
  }
  .checkpoint-title {
    font-size: 13.5px;
    line-height: 1.25;
    margin-bottom: 2px;
  }
  .checkpoint-desc {
    font-size: 11px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .btn-enter-gate {
    width: 100%;
    justify-content: center;
    padding: 9px 14px;
    font-size: 12.5px;
    margin-top: 2px;
  }

  /* Finish Mount Fuji Goal */
  .trail-finish-goal {
    padding: 18px 14px;
    border-radius: 16px;
    margin-top: 6px;
  }
  .finish-icon-wrap {
    font-size: 38px;
    margin-bottom: 6px;
  }
  .finish-goal-title {
    font-size: 15px;
  }
  .finish-goal-desc {
    font-size: 11.5px;
  }

  /* Obstacle Arena on Mobile */
  .obstacle-arena-screen {
    padding-bottom: 40px;
  }
  .arena-top-bar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-arena-exit {
    padding: 6px 10px;
    font-size: 11.5px;
    gap: 4px;
  }
  .arena-hearts-wrap {
    gap: 4px;
  }
  .hearts-label {
    display: none;
  }
  .heart-item {
    font-size: 18px;
  }
  .arena-header-titles {
    order: 3;
    width: 100%;
    text-align: left;
    margin-top: 2px;
  }
  .arena-zone-badge {
    font-size: 10px;
  }
  .arena-title {
    font-size: 14.5px;
  }
  .arena-track-wrap {
    padding: 10px 12px;
  }
  .arena-runner-bar {
    height: 10px;
    margin-top: 10px;
  }
  .arena-runner-avatar {
    font-size: 20px;
    top: -13px;
  }
  .arena-track-meta {
    font-size: 11.5px;
  }
  .arena-streak-badge {
    font-size: 10.5px;
    padding: 2px 7px;
  }
  .arena-playfield-wrap {
    margin: 14px auto;
    padding: 0 10px;
  }
  .obstacle-card {
    padding: 16px 14px;
    border-radius: 16px;
  }
  .obstacle-badge-zone {
    font-size: 10px;
    padding: 2px 7px;
  }
  .obstacle-prompt {
    font-size: 15px;
    margin-bottom: 14px;
  }
  .obstacle-options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .obstacle-opt-btn {
    padding: 12px 14px;
    font-size: 13.5px;
    border-radius: 12px;
    min-height: 48px;
  }
  .obstacle-opt-btn .opt-key {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  .obstacle-feedback-banner {
    margin-top: 16px;
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-next-obstacle {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }
  .arena-result-wrap {
    margin: 16px auto;
    padding: 0 10px;
  }
  .arena-result-card {
    padding: 24px 16px;
    border-radius: 18px;
  }
  .result-trophy-icon {
    font-size: 48px;
  }
  .result-big-title {
    font-size: 20px;
  }
  .result-big-subtitle {
    font-size: 13px;
  }
  .result-badge-showcase {
    font-size: 14px;
    padding: 12px 14px;
    flex-direction: column;
    text-align: center;
  }
  .result-actions-row {
    flex-direction: column;
    width: 100%;
  }
  .result-actions-row button {
    width: 100%;
    justify-content: center;
  }

  /* Modules responsive */
  .module-section-header {
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    gap: 8px;
  }
  .module-sec-info h3 {
    font-size: 13px;
  }
  .module-sec-info p {
    display: none !important;
  }
  .vocab-flashcards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .kanji-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .grammar-point-card {
    padding: 14px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
  }
  .grammar-point-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .listening-audio-player-card {
    padding: 14px 12px;
  }
  .listening-options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .listening-opt-btn {
    padding: 11px 12px;
    font-size: 13px;
  }
  .speaking-card {
    padding: 14px 12px;
  }
  .speaking-target-box {
    padding: 12px;
  }
  .speaking-furigana-line {
    font-size: 16px;
  }
  .speaking-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-speaking-mic {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 13.5px;
  }
  .kaiwa-chat-container {
    height: 480px;
  }
  .kaiwa-msg-item {
    max-width: 90%;
  }
  .kaiwa-bubble-content {
    padding: 10px 12px;
  }
  .test-module-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .test-question-card {
    padding: 14px 12px;
    border-radius: 10px;
  }
  .test-q-title {
    font-size: 14px;
    gap: 6px;
  }
  .test-option-label {
    padding: 11px 12px;
    font-size: 13px;
    min-height: 44px;
  }
  .test-submit-bar {
    margin-top: 14px;
  }
  .btn-submit-test {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
  }
  .roadmap-grid-wrapper {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  /* Extra compact for narrow smartphones */
  .learning-top-header {
    padding: 6px 10px !important;
    min-height: 48px !important;
  }
  .learning-brand-icon {
    font-size: 20px;
  }
  .learning-brand-title {
    font-size: 13px;
  }
  .learning-brand-sub {
    display: none; /* Hide subtitle on tiny screens so title never wraps */
  }
  .btn-learning-exit {
    padding: 6px 10px;
    font-size: 12px;
    gap: 4px;
  }
  .btn-learning-exit span {
    font-size: 11.5px;
  }
  .learning-lesson-screen {
    padding: 8px 8px 30px 8px;
  }
  .lesson-top-bar {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 10px;
  }
  .lesson-header-vi {
    font-size: 14px;
  }
  .module-tabs-nav {
    padding: 3px;
    margin-bottom: 6px;
    border-radius: 8px;
    gap: 4px;
  }
  .module-tab-btn {
    padding: 5px 8px;
    font-size: 11.5px;
    gap: 4px;
  }
  .vocab-mode-toolbar {
    padding: 3px 4px;
    margin-bottom: 6px;
    border-radius: 8px;
  }
  .vmode-btn {
    padding: 4px 7px;
    font-size: 11px;
    gap: 3px;
  }
  .quizlet-test-card {
    padding: 10px 12px;
    border-radius: 12px;
  }
  .quizlet-test-prompt-box {
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
  }
  .quizlet-prompt-word {
    font-size: 17px;
  }
  .quizlet-prompt-sub {
    font-size: 11px;
  }
  .quizlet-test-options-grid {
    gap: 5px;
  }
  .quizlet-opt-btn {
    min-height: 36px;
    padding: 5px 10px;
    font-size: 12.5px;
    gap: 8px;
    border-radius: 8px;
  }
  .trail-milestone-row.pos-left {
    transform: translateX(-8px);
  }
  .trail-milestone-row.pos-right {
    transform: translateX(8px);
  }
  .trail-node-combo {
    max-width: 295px;
    gap: 8px;
  }
  .trail-disc {
    width: 48px;
    height: 48px;
  }
  .disc-number {
    font-size: 15px;
  }
  .trail-card-preview {
    max-width: 200px;
    padding: 7px 10px;
  }
  .trail-card-title {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .trail-milestone-row.pos-left,
  .trail-milestone-row.pos-right {
    transform: translateX(0); /* Completely centered on tiny screens */
  }
  .trail-node-combo {
    max-width: 275px;
  }
  .trail-card-preview {
    max-width: 180px;
    padding: 6px 8px;
  }
  .trail-disc {
    width: 44px;
    height: 44px;
  }
  .disc-number {
    font-size: 14px;
  }
  .btn-enter-gate {
    font-size: 11.5px;
    padding: 8px 10px;
  }
}



