/* ==========================================================================
   Review View Stylesheet - Minimalist & Focused Home Screen
   ========================================================================== */

#tab-review.tab-pane.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 12px 16px;
  box-sizing: border-box;
}

.review-minimal-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 500px;
  margin: auto 0;
  box-sizing: border-box;
}

/* ==========================================
   1. Master Goal Bar Card (Thanh Mục Tiêu Học Tập Cá Nhân Hóa)
   ========================================== */
.home-goal-bar-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  width: 100%;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.home-goal-bar-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px -2px rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.home-goal-bar-card:active {
  transform: scale(0.99);
}

[data-theme="dark"] .home-goal-bar-card {
  background: rgba(19, 27, 46, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .home-goal-bar-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 32px -4px rgba(99, 102, 241, 0.2);
}

.goal-bar-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.goal-top-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.goal-eyebrow-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.goal-eyebrow {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.goal-level-badge {
  font-size: 0.66rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
  line-height: 1.3;
}

.goal-target-tag {
  font-size: 0.70rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-goal-bar-card:hover .goal-target-tag {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.3);
}

.goal-main-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.goal-icon-badge {
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.goal-title-content {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.goal-main-title {
  font-size: 0.98rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
  white-space: normal;
  word-break: break-word;
}

/* ==========================================
   Multi-Segment CEFR Roadmap Track (A1 -> A2 -> B1 -> B2 -> C1)
   ========================================== */
.cefr-milestone-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 2px 2px 2px;
  box-sizing: border-box;
}

.cefr-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.cefr-step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.cefr-step-dot.completed {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  font-size: 0.72rem;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.cefr-step-dot.active {
  background: var(--primary, #6366f1);
  border-color: #ffffff;
  color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.cefr-step-dot.in-progress {
  border-color: var(--primary, #6366f1);
  color: var(--primary, #6366f1);
  background: rgba(99, 102, 241, 0.1);
}

.cefr-step-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.cefr-step-item[data-step="A1"] .cefr-step-dot.active { background: #10b981; box-shadow: 0 0 12px rgba(16, 185, 129, 0.5); }
.cefr-step-item[data-step="A2"] .cefr-step-dot.active { background: #f59e0b; box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }
.cefr-step-item[data-step="B1"] .cefr-step-dot.active { background: #6366f1; box-shadow: 0 0 12px rgba(99, 102, 241, 0.5); }
.cefr-step-item[data-step="B2"] .cefr-step-dot.active { background: #8b5cf6; box-shadow: 0 0 12px rgba(139, 92, 246, 0.5); }
.cefr-step-item[data-step="C1"] .cefr-step-dot.active { background: #ec4899; box-shadow: 0 0 12px rgba(236, 72, 153, 0.5); }

.cefr-step-line {
  flex: 1;
  height: 4px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.06));
  border-radius: 99px;
  margin: 0 4px 16px 4px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

[data-theme="dark"] .cefr-step-line {
  background: rgba(255, 255, 255, 0.08);
}

.cefr-step-line-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #10b981, #6366f1);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tiến độ mục tiêu */
.goal-progress-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.goal-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.goal-progress-label strong {
  color: var(--text-primary);
  font-weight: 800;
  font-family: var(--font-mono, monospace);
}

.goal-percent-badge {
  font-size: 0.74rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.goal-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.06));
  border-radius: 99px;
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hàng chỉ số phụ: Từ mới hôm nay & Dự kiến hoàn thành (50% - 50% Symmetrical Grid) */
.goal-daily-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.goal-daily-badge, .goal-eta-badge {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 9px;
  white-space: nowrap;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.goal-daily-badge {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--text-secondary);
}

.goal-daily-badge strong {
  color: #10b981;
  font-weight: 800;
}

.goal-eta-badge {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-secondary);
  cursor: pointer;
}

.goal-eta-badge strong {
  color: var(--primary, #6366f1);
  font-weight: 800;
}

.goal-eta-badge:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: var(--primary, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.goal-stat-icon {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ==========================================
   2. 4 Metrics Grouped Card (Từ tới hạn, Đã ôn hôm nay, Thời gian, Từ đã thuộc)
   ========================================== */
.home-metrics-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 20px;
  padding: 14px 6px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  width: 100%;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  gap: 2px;
}

[data-theme="light"] .home-metrics-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.home-metric-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  padding: 6px 3px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  outline: none;
  min-width: 0;
}

.home-metric-item:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

[data-theme="dark"] .home-metric-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.home-metric-item:active {
  transform: scale(0.96);
}

.metric-tap-hint {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.75;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.home-metric-item:hover .metric-tap-hint {
  opacity: 1;
  color: var(--primary);
}

.metric-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.home-metric-item:hover .metric-icon-badge {
  transform: scale(1.1);
}

.metric-icon-badge.badge-due {
  background: rgba(245, 158, 11, 0.12);
}

.metric-icon-badge.badge-reviewed {
  background: rgba(16, 185, 129, 0.12);
}

.metric-icon-badge.badge-time {
  background: rgba(168, 85, 247, 0.12);
}

.metric-icon-badge.badge-mastered {
  background: rgba(14, 165, 233, 0.12);
}

.metric-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.metric-label {
  font-size: 0.60rem;
  font-weight: 750;
  color: var(--text-secondary, #8e8e93);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.metric-val-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.metric-val {
  font-size: 1.3rem;
  font-weight: 850;
  color: var(--text-primary);
  line-height: 1.1;
  font-family: var(--font-mono, monospace);
}

.badge-due + .metric-info .metric-val {
  color: #f59e0b;
}

.badge-reviewed + .metric-info .metric-val {
  color: #10b981;
}

.badge-mastered + .metric-info .metric-val {
  color: #0ea5e9;
}

.badge-time + .metric-info .metric-val {
  color: #a855f7;
}

.metric-unit {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary, #8e8e93);
}

.metric-divider {
  width: 1px;
  background: var(--border, rgba(0, 0, 0, 0.08));
  margin: 6px 0;
}

/* ==========================================
   3. HERO CTA BUTTON (BẮT ĐẦU HỌC)
   ========================================== */
.home-cta-section {
  width: 100%;
}

.btn-hero-flashcard-cta {
  width: 100%;
  min-height: 56px;
  padding: 14px 22px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35), 0 2px 8px rgba(99, 102, 241, 0.18);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.btn-hero-flashcard-cta:hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45), 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-hero-flashcard-cta:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-cta-glare {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  animation: ctaGlare 4s infinite ease-in-out;
  pointer-events: none;
}

@keyframes ctaGlare {
  0% { left: -100%; }
  35%, 100% { left: 200%; }
}

.btn-cta-body {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.btn-cta-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.btn-cta-icon svg {
  display: block;
  margin-left: 2px;
}

.btn-cta-main-text {
  font-size: 1.12rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   5. QUICK PREVIEW DIALOGS (Due Words, Study Time, Memory Tiers)
   ========================================================================== */
.quick-preview-dialog {
  max-width: 440px !important;
  width: 100%;
  max-height: min(88vh, calc(100dvh - 32px));
  margin: auto;
  border-radius: 24px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

[data-theme="light"] .quick-preview-dialog {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

.quick-modal-header {
  padding: 16px 18px 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.quick-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quick-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.quick-modal-headings {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-modal-title {
  font-size: 1.12rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.quick-modal-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-modal-body {
  padding: 16px 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.quick-modal-footer {
  padding: 12px 18px max(14px, env(safe-area-inset-bottom, 14px)) 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-card, #ffffff);
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Quick Action Buttons */
.btn-quick-action-primary {
  flex: 1;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}

.btn-quick-action-primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.btn-quick-action-secondary {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.05));
  color: var(--text-primary);
  font-weight: 750;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-quick-action-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover, var(--border));
}

/* --- POPUP 1: Due Words List Styles --- */
.due-word-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.due-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.due-word-row:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.25);
}

.due-word-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.due-word-text {
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--text-primary);
}

.due-word-ipa {
  font-size: 0.82rem;
  font-family: var(--font-mono, monospace);
  color: #6366f1;
  font-weight: 600;
}

[data-theme="dark"] .due-word-ipa {
  color: #a5b4fc;
}

.due-word-pos {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

[data-theme="dark"] .due-word-pos {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.quick-modal-empty {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.quick-modal-empty .empty-emoji {
  font-size: 2.8rem;
  margin-bottom: 4px;
}

.quick-modal-empty .empty-title {
  font-size: 1.15rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0;
}

.quick-modal-empty .empty-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* --- POPUP 2: Study Time Overview Styles --- */
.quick-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.quick-stat-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
}

.quick-stat-tile .tile-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.quick-stat-tile .tile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-stat-tile .tile-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.quick-stat-tile .tile-val {
  font-size: 1.12rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

.tile-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-tip-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.quick-tip-box .tip-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.quick-tip-box .tip-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* --- POPUP 3: Mastered Stability Tiers Styles --- */
.tier-distribution-track {
  display: flex;
  height: 10px;
  width: 100%;
  border-radius: 99px;
  overflow: hidden;
  background: var(--bg-hover, rgba(0, 0, 0, 0.06));
  gap: 2px;
  margin-bottom: 4px;
}

.tier-seg {
  height: 100%;
  transition: flex 0.3s ease;
}

.tier-seg.seg-5 { background: #10b981; }
.tier-seg.seg-4 { background: #06b6d4; }
.tier-seg.seg-3 { background: #3b82f6; }
.tier-seg.seg-2 { background: #f59e0b; }
.tier-seg.seg-1 { background: #8b5cf6; }

.quick-tier-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.tier-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
}

.tier-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tier-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tier-dot.dot-5 { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.tier-dot.dot-4 { background: #06b6d4; box-shadow: 0 0 8px rgba(6, 182, 212, 0.5); }
.tier-dot.dot-3 { background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.5); }
.tier-dot.dot-2 { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.tier-dot.dot-1 { background: #8b5cf6; box-shadow: 0 0 8px rgba(139, 92, 246, 0.5); }

.tier-names {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tier-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
}

.tier-desc {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tier-count {
  font-size: 1.05rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

/* --- POPUP 4: Goal Customizer Modal Styles --- */
.goal-customizer-dialog {
  max-width: 480px !important;
  width: 100%;
  max-height: min(90vh, calc(100dvh - 32px));
  margin: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.goal-customizer-dialog .quick-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 16px;
  padding: 16px 18px 20px 18px;
  box-sizing: border-box;
}

.goal-sec-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.goal-presets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.goal-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-sizing: border-box;
}

.goal-preset-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  transform: translateY(-1px);
}

.goal-preset-item.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.goal-preset-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.goal-preset-icon {
  font-size: 1.35rem;
  line-height: 1.2;
  flex-shrink: 0;
  margin-top: 1px;
}

.goal-preset-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.goal-preset-title {
  font-size: 0.90rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.goal-preset-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
  word-break: break-word;
}

.goal-preset-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.75rem;
  font-weight: 850;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.goal-preset-item.active .goal-preset-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Pace selector pills */
.pace-selector-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
}

.pace-pill-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.pace-pill-btn strong {
  font-size: 0.92rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

.pace-pill-btn span {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pace-pill-btn:hover {
  border-color: var(--primary);
}

.pace-pill-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}

.pace-pill-btn.active strong {
  color: var(--primary);
}

/* Live Analytics Card inside modal */
.goal-live-calc-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-tertiary, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
}

.goal-calc-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-calc-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.goal-calc-val {
  font-size: 1.05rem;
  font-weight: 850;
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
}

.goal-calc-sub {
  font-size: 0.66rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   CEFR ROADMAP & PERSONALIZED PACE ANALYZER STYLES
   ========================================================================== */
.cefr-roadmap-modal {
  max-width: 520px !important;
}

.cefr-analyzer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.cefr-cur-level-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-tertiary, rgba(0, 0, 0, 0.025));
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.cefr-cur-level-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cefr-card-eyebrow {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cefr-cur-title {
  font-size: 0.95rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 2px 0 0 0;
}

.cefr-cur-badge {
  font-size: 0.74rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.cefr-cur-desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 0;
}

.cefr-cur-desc strong {
  color: var(--text-primary);
}

/* POS Breakdown Chips (Danh từ, Động từ, Tính từ, Khác) */
.pos-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.pos-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.pos-chip-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.pos-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pos-chip-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pos-chip-count {
  font-size: 0.78rem;
  font-weight: 850;
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
}

.cefr-priority-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.cefr-priority-hint strong {
  color: var(--primary);
}

/* 5 Bậc CEFR Grid (A1 -> A2 -> B1 -> B2 -> C1) */
.cefr-5levels-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.cefr-level-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.cefr-level-row-item.is-current {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.cefr-level-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.cefr-lvl-tag {
  font-size: 0.72rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  padding: 3px 7px;
  border-radius: 7px;
  flex-shrink: 0;
}

.cefr-lvl-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.cefr-lvl-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cefr-lvl-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cefr-current-indicator {
  font-size: 0.60rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
  text-transform: uppercase;
}

.cefr-lvl-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.70rem;
  color: var(--text-muted);
}

.cefr-level-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  width: 65px;
}

.cefr-lvl-pct-text {
  font-size: 0.76rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

.cefr-lvl-bar-mini {
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.08));
  overflow: hidden;
}

.cefr-lvl-fill-mini {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Forecast Header & Badge */
.cefr-forecast-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pace-status-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 7px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  #tab-review.tab-pane.active {
    padding: 12px 12px 28px 12px;
  }

  .home-metrics-card {
    padding: 12px 6px;
    border-radius: 16px;
  }

  .btn-hero-flashcard-cta {
    min-height: 52px;
    padding: 12px 18px;
    border-radius: 16px;
  }

  .btn-cta-main-text {
    font-size: 1.05rem;
  }

  .btn-cta-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
}

/* ==========================================
   Forecast Detail Modal (FSRS-6 Maturity S >= 30d)
   ========================================== */
.forecast-detail-dialog {
  max-width: 460px;
}

.forecast-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.12) 100%);
  border: 1.5px solid rgba(99, 102, 241, 0.25);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}

[data-theme="dark"] .forecast-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(16, 185, 129, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.4);
}

.forecast-hero-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary, #6366f1);
  margin-bottom: 6px;
}

.forecast-hero-title {
  font-size: 1.05rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  line-height: 1.35;
}

.forecast-hero-title strong {
  color: var(--primary, #6366f1);
}

.forecast-hero-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.forecast-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.forecast-metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.forecast-box-icon {
  font-size: 1.15rem;
  line-height: 1;
  margin-top: 1px;
}

.forecast-box-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.forecast-box-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.forecast-box-val {
  font-size: 0.92rem;
  font-weight: 850;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

.forecast-box-val small {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.forecast-box-sub {
  font-size: 0.66rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.forecast-formula-card {
  background: rgba(148, 163, 184, 0.08);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.formula-card-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.formula-steps-list {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.formula-steps-list li {
  line-height: 1.35;
}

.formula-steps-list strong {
  color: var(--text-primary);
}

/* ==========================================================================
   BỘ CHẾ ĐỘ HỌC CÓ CHỦ ĐÍCH (Targeted Systematic Study Modes)
   ========================================================================== */
.home-study-modes-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.modes-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.modes-header-title {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modes-header-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.home-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

@media (max-width: 480px) {
  .home-modes-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.home-mode-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.home-mode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
}

.home-mode-card:active {
  transform: scale(0.98);
}

.home-mode-card.mode-weak:hover {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.12);
}

.home-mode-card.mode-audio:hover {
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.12);
}

.home-mode-card.mode-sprint:hover {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.12);
}

.mode-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.1);
}

.mode-weak .mode-icon-wrap {
  background: rgba(239, 68, 68, 0.12);
}

.mode-audio .mode-icon-wrap {
  background: rgba(14, 165, 233, 0.12);
}

.mode-sprint .mode-icon-wrap {
  background: rgba(245, 158, 11, 0.12);
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.mode-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.mode-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-badge {
  font-size: 0.6rem;
  font-weight: 750;
  padding: 2px 5px;
  border-radius: 99px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  white-space: nowrap;
}

.badge-audio {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
}

.badge-sprint {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.mode-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .home-mode-card {
  background: rgba(19, 27, 46, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
}

