/* ════════════════════════════════════════
   STUDY — trang chọn chế độ học (redesign)
   + 4 chế độ: Flashcard, Quiz, Điền, Nghe
════════════════════════════════════════ */

/* ── Study Page v2 ─────────────────────────────────────────── */
.sp-wrap {
  padding: 4px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.sp-subtitle { font-size: 0.8rem; color: #38BDF8; text-align: center; margin: -4px 0 0; font-weight: 500; }

/* White elevated card */
.sp-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.sp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.sp-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* Today card */
.sp-today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.sp-today-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.sp-detail-btn {
  background: none; border: none;
  color: var(--purple); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit; padding: 0;
}
.sp-today-stats { display: flex; gap: 8px; }
.sp-stat-chip {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--purple-light); border-radius: var(--radius-sm); padding: 10px 4px;
}
.sp-stat-chip--orange { background: var(--orange-light); }
.sp-stat-chip--red    { background: var(--red-light); }
.sp-stat-icon  { font-size: 1.15rem; line-height: 1; }
.sp-stat-num   { font-size: 1.15rem; font-weight: 700; color: var(--purple); line-height: 1.1; }
.sp-stat-chip--orange .sp-stat-num { color: var(--orange); }
.sp-stat-chip--red    .sp-stat-num { color: var(--red); }
.sp-stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; text-align: center; line-height: 1.2; }

/* CTA */
.sp-cta-btn {
  width: 100%; background: var(--purple); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 15px; font-size: 0.92rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: opacity 0.18s, transform 0.15s;
}
.sp-cta-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.sp-cta-btn:disabled { background: var(--border); cursor: default; opacity: 0.6; transform: none; }

.sp-cta-sub {
  margin-top: 2px; font-size: 0.84rem; color: var(--text-muted);
  text-align: center; line-height: 1.5;
  padding: 8px 14px;
  background: var(--bg); border-radius: var(--radius-sm);
}
.sp-cta-sub b { color: var(--purple); font-weight: 700; }

.sp-today-progress {
  margin-top: 8px; padding: 7px 12px;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: var(--radius-sm); font-size: 0.8rem;
  color: #9a3412; text-align: center;
}
.sp-today-progress b { font-weight: 700; }
.sp-today-progress.hidden { display: none; }

/* Section labels */
.sp-section-label {
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sp-section-row { display: flex; justify-content: space-between; align-items: center; }
.sp-customize-btn {
  background: none; border: 1.5px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.sp-customize-btn:hover { border-color: var(--purple); color: var(--purple); }

/* Queue list — bên trong sp-card, không cần border riêng */
.sp-queue-list { display: flex; flex-direction: column; }
.sp-queue-row {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; border-radius: var(--radius-sm);
  padding: 12px 4px; cursor: pointer; width: 100%; text-align: left; font-family: inherit;
  transition: background 0.15s;
}
.sp-queue-row + .sp-queue-row { border-top: 1px solid var(--border); }
.sp-queue-row:hover { background: var(--bg); border-radius: var(--radius-sm); }
.sp-qi {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.sp-qi--orange { background: var(--orange-light); }
.sp-qi--red    { background: var(--red-light); }
.sp-qi--green  { background: var(--green-light); }
.sp-queue-body  { flex: 1; min-width: 0; }
.sp-queue-name  { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.sp-queue-desc  { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.sp-queue-badge {
  background: #F3F4F6; color: #6B7280;
  font-size: 0.8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  flex-shrink: 0; min-width: 28px; text-align: center;
}
.sp-queue-badge--red   { background: var(--red-light); color: var(--red); }
.sp-queue-badge--green { background: var(--green-light); color: var(--green); }
.sp-qi-arrow { color: #9CA3AF; font-size: 1.25rem; flex-shrink: 0; }

/* Mode pills (horizontal scroll row) */
.sp-mode-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.sp-mode-pills::-webkit-scrollbar { display: none; }
.sp-mode-pill {
  flex-shrink: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}
.sp-mode-pill:hover:not(.sp-mode-pill--active) { border-color: var(--purple); color: var(--purple); }
.sp-mode-pill--active {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple);
}

/* Dimmed queue row when count = 0 */
.sp-queue-row--dim {
  opacity: 0.45;
  pointer-events: none;
}

/* Streak banner */
.sp-streak-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 1px solid #FCD34D; border-radius: var(--radius); padding: 14px 16px;
}
.sp-streak-left { display: flex; align-items: center; gap: 10px; }
.sp-streak-fire { font-size: 1.5rem; flex-shrink: 0; }
.sp-streak-main { font-size: 0.84rem; font-weight: 600; color: #92400E; }
.sp-streak-main b { color: #D97706; font-size: 1rem; }
.sp-streak-sub  { font-size: 0.7rem; color: #A16207; margin-top: 2px; }
.sp-streak-gear { background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: 4px; opacity: 0.6; transition: opacity 0.15s; }
.sp-streak-gear:hover { opacity: 1; }

/* ══════════════════════════════════════
   Study Dashboard Phase B
══════════════════════════════════════ */
.sp-dashboard { display: flex; flex-direction: column; gap: 12px; }
.sp-panel-left, .sp-panel-right { display: flex; flex-direction: column; gap: 10px; }

/* Hero card */
.sp-hero {
  background: linear-gradient(135deg, var(--purple), #38BDF8);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(14,165,233,0.25);
}
.sp-hero--red    { background: linear-gradient(135deg, #EF4444, #F87171); box-shadow: 0 4px 20px rgba(239,68,68,0.25); }
.sp-hero--green  { background: linear-gradient(135deg, var(--green), #34D399); box-shadow: 0 4px 20px rgba(5,150,105,0.25); }
.sp-hero--purple { background: linear-gradient(135deg, var(--purple), #38BDF8); box-shadow: 0 4px 20px rgba(14,165,233,0.25); }

.sp-hero-inner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.sp-hero-icon {
  font-size: 1.8rem; flex-shrink: 0;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.2); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.sp-hero-content { flex: 1; min-width: 0; }
.sp-hero-title { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1.2; }
.sp-hero-sub   { font-size: 0.75rem; color: rgba(255,255,255,0.82); margin-top: 2px; line-height: 1.4; }
.sp-hero-right { text-align: right; flex-shrink: 0; }
.sp-hero-count { display: block; font-size: 1.9rem; font-weight: 900; color: #fff; line-height: 1; }
.sp-hero-unit  { font-size: 0.68rem; color: rgba(255,255,255,0.75); font-weight: 500; }
.sp-hero-btn {
  width: 100%;
  background: rgba(255,255,255,0.22);
  color: #fff; border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background 0.18s, border-color 0.18s;
}
.sp-hero-btn:hover { background: rgba(255,255,255,0.33); border-color: rgba(255,255,255,0.6); }

/* Stat tiles row */
.sp-stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.sp-stat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 6px;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
}
.sp-stat-tile:hover { transform: translateY(-1px); }
.sp-stat-tile--review:hover { border-color: var(--purple); background: var(--purple-light); }
.sp-stat-tile--weak:hover   { border-color: #EF4444; background: #FFF5F5; }
.sp-stat-tile--new:hover    { border-color: var(--green); background: #F0FDF4; }
.sp-stat-tile--dim { opacity: 0.38; pointer-events: none; }
.sp-stat-tile .sp-stat-icon { font-size: 1rem; line-height: 1; }
.sp-stat-tile .sp-stat-num  { font-size: 1.25rem; font-weight: 900; color: var(--purple); line-height: 1.1; }
.sp-stat-tile--weak .sp-stat-num { color: #EF4444; }
.sp-stat-tile--new  .sp-stat-num { color: var(--green); }
.sp-stat-tile .sp-stat-lbl { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); text-align: center; }

/* Modes section */
.sp-modes-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px;
}
.sp-modes-hd {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.sp-modes-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.sp-mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 4px;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.sp-mode-btn:hover { border-color: var(--purple); background: var(--purple-light); transform: translateY(-1px); }
.sp-mode-icon { font-size: 1.05rem; line-height: 1; }
.sp-mode-lbl  { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.sp-mode-btn:hover .sp-mode-lbl { color: var(--purple); }

/* ── Layout cũ (giữ cho PC sidebar compat) ─────────────────── */
.study-layout { display: block; }
.study-main   { min-width: 0; }

/* ── CTA bar gọn ──────────────────────────────────────────── */
.study-cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
/* Countdown / due-count block */
.study-next-review { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.snr-due-block {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: #FEF3C7;
  border: 1.5px solid #FCD34D;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
}
.snr-due-num   { font-size: 1.5rem; font-weight: 900; color: #D97706; line-height: 1; }
.snr-due-label { font-size: 0.82rem; font-weight: 600; color: #92400E; }

.snr-countdown { font-size: 0.78rem; color: var(--text-muted); }
.snr-countdown b { color: var(--purple); font-weight: 700; }

.study-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.18s, transform 0.15s;
}
.study-hero-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.study-hero-btn-free {
  background: linear-gradient(135deg, #0891B2, #0E7490);
}
.study-hero-btn-free:hover { opacity: 0.88; transform: translateY(-1px); }
.study-hero-btn-new {
  background: linear-gradient(135deg, #059669, #047857);
}
.study-hero-btn-new:hover { opacity: 0.88; transform: translateY(-1px); }


/* ── Section header ───────────────────────────────────────── */
.study-section-hd {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.study-link-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--purple);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.study-link-btn:hover { text-decoration: underline; }

/* ── Chế độ học ───────────────────────────────────────────── */
#study-modes-section { margin-bottom: 20px; }

/* ── 3 Big Action Cards ──────────────────────────────────── */
.sp-main-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.sp-main-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.15s, box-shadow 0.18s;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.sp-main-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.sp-main-card--review { border-color: #BAE6FD; }
.sp-main-card--review:hover { border-color: var(--purple); background: #F0F9FF; }
.sp-main-card--weak   { border-color: #FECACA; }
.sp-main-card--weak:hover { border-color: #EF4444; background: #FFF5F5; }
.sp-main-card--new    { border-color: #A7F3D0; }
.sp-main-card--new:hover { border-color: var(--green); background: #F0FDF4; }
.sp-main-card--dim { opacity: 0.52; pointer-events: none; }

.sp-mc-icon { font-size: 1.6rem; flex-shrink: 0; width: 44px; text-align: center; }
.sp-mc-body { flex: 1; min-width: 0; }
.sp-mc-title { font-size: 0.95rem; font-weight: 800; color: var(--text); }
.sp-mc-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.sp-mc-badge {
  background: #E0F2FE; color: var(--purple);
  font-size: 0.95rem; font-weight: 700;
  min-width: 36px; padding: 4px 10px;
  border-radius: 20px; text-align: center; flex-shrink: 0;
}
.sp-mc-badge--weak { background: #FEE2E2; color: #EF4444; }
.sp-mc-badge--new  { background: #D1FAE5; color: var(--green); }

/* ── Collapsible: Luyện tập thêm ────────────────────────── */
.sp-extra {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  margin-top: 6px;
  overflow: hidden;
}
.sp-extra-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 16px;
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; list-style: none; user-select: none;
}
.sp-extra-toggle::-webkit-details-marker { display: none; }
.sp-extra-toggle::before { content: '▸'; transition: transform 0.2s; }
details[open] .sp-extra-toggle::before { transform: rotate(90deg); }
.sp-extra-toggle:hover { color: var(--purple); }
.sp-extra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2×2 on mobile */
  gap: 8px;
  padding: 0 12px 12px;
}
/* Tablet: 2x2 */
@media (min-width: 640px) and (max-width: 1023px) {
  .sp-extra-grid { grid-template-columns: repeat(2, 1fr); }
}
.sp-extra-btn {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 0.84rem; font-weight: 600; color: var(--text);
  cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sp-extra-btn:hover { border-color: var(--purple); color: var(--purple); background: var(--purple-light); }
.sp-extra-btn span { white-space: nowrap; }

.study-more-wrap { margin-top: 12px; }
.study-more-toggle {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.study-more-toggle:hover { color: var(--purple); border-color: var(--purple); }
.study-modes-advanced { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Mobile: 2×2 grid */
.study-modes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.study-mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.study-mode-card:hover {
  border-color: var(--purple);
  background: var(--purple-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
/* Icon vuông bo tròn */
.smc-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.smc-purple { background: var(--purple-light); }
.smc-green  { background: var(--green-light); }
.smc-orange { background: var(--orange-light); }
.smc-pink   { background: var(--pink-light); }

.smc-body  { flex: 1; min-width: 0; }
.smc-name  { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.smc-desc  { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.smc-arrow { color: var(--text-muted); font-size: 1.2rem; flex-shrink: 0; }


/* ── Fill in blank mode ───────────────────────────────────── */
.fillin-sentence {
  font-size: 1.05rem; line-height: 1.75;
  color: var(--text); font-weight: 500;
  text-align: center; margin-bottom: 8px;
}
.fillin-blank {
  color: var(--text); font-weight: 800;
  border-bottom: 2px dashed var(--text-muted);
  padding: 0 4px; letter-spacing: 2px;
}
.fillin-meaning {
  font-size: 0.88rem; color: var(--text-muted);
  text-align: center; margin-bottom: 16px; font-style: italic;
}
.fillin-no-ctx { font-size: 0.85rem; color: var(--text-muted); }
.fillin-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Phần ôn tập (tất cả 4 mode chung) ───────────────────── */
.fc-counter, .quiz-counter { text-align: center; font-size: 0.84rem; color: var(--text-muted); margin-bottom: 16px; font-weight: 600; }
.counter-hint { font-weight: 400; font-size: 0.78rem; opacity: 0.65; }

/* ── Flashcard ────────────────────────────────────────────── */
.fc-scene { perspective: 1000px; margin-bottom: 20px; }
.fc-card  { width: 100%; min-height: 200px; border-radius: var(--radius); position: relative; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.fc-card.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back {
  position: absolute; top: 0; left: 0;
  width: 100%; min-height: 200px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 22px;
}
.fc-front { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.fc-back  {
  background: var(--surface); color: var(--text); border: 1.5px solid var(--border);
  transform: rotateY(180deg);
  align-items: flex-start !important; justify-content: flex-start !important;
  text-align: left; overflow-y: auto; padding: 20px 22px !important;
}
.fc-icon     { font-size: 3.2rem; text-align: center; margin-bottom: 10px; min-height: 52px; line-height: 1; }
.fc-word     { font-size: 1.5rem; font-weight: 800; text-align: center; line-height: 1.1; }
.fc-phonetic { font-size: 1rem; opacity: 0.85; margin-bottom: 8px; }
.fc-hint     { position: absolute; bottom: 12px; font-size: 0.74rem; opacity: 0.55; }
.fc-actions  { display: flex; gap: 12px; }
.btn-wrong   { flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 700; cursor: pointer; background: var(--red-light);   color: var(--red);   transition: transform 0.15s; font-family: inherit; }
.btn-correct { flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 700; cursor: pointer; background: var(--green-light); color: var(--green); transition: transform 0.15s; font-family: inherit; }
.btn-wrong:hover, .btn-correct:hover { transform: scale(1.03); }

/* Dots progress + counter row */
.fc-progress-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.fc-dots { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; flex: 1; }
.fc-dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background 0.2s; flex-shrink: 0; }
.fc-dot.done   { background: var(--purple); opacity: 0.35; }
.fc-dot.active { background: var(--purple); box-shadow: 0 0 0 2px rgba(14,165,233,0.22); }
.fc-counter    { margin-bottom: 0; white-space: nowrap; }

/* Word + pos inline (mặt trước) */
.fc-word-row { display: flex; align-items: baseline; gap: 7px; justify-content: center; margin-bottom: 8px; flex-wrap: wrap; }
.fc-pos-badge { font-size: 0.7rem; font-weight: 700; font-style: italic; color: var(--purple); background: var(--purple-light); padding: 2px 8px; border-radius: 20px; line-height: 1.4; }

/* Mặt sau — hierarchy */
.fc-back-word-row { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.fc-back-en  { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.fc-back-pos { font-size: 0.7rem; font-weight: 700; font-style: italic; color: var(--purple); background: var(--purple-light); padding: 2px 8px; border-radius: 20px; }
.fc-back-ph  { font-size: 0.85rem; color: var(--purple); margin-bottom: 12px; opacity: 0.85; }
.fc-back-section { margin-top: 12px; margin-bottom: 3px; }
.fc-back-label   { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); }
.fc-back-meaning { font-size: 1.35rem; font-weight: 800; color: var(--text); line-height: 1.25; }
.fc-back-example { font-size: 0.92rem; color: var(--text); font-style: italic; line-height: 1.55; }
.fc-ex-vi        { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.fc-back-insight { font-size: 0.84rem; color: var(--text); line-height: 1.5; }
.fc-back-speak {
  margin-top: 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 50px; padding: 6px 16px; font-size: 0.8rem; cursor: pointer;
  font-family: inherit; color: var(--text-muted); transition: background 0.15s;
}
.fc-back-speak:hover { background: var(--purple-light); color: var(--purple); }

/* ── Quiz ─────────────────────────────────────────────────── */
.quiz-word-icon { font-size: 2.4rem; text-align: center; margin-bottom: 8px; min-height: 40px; line-height: 1; }
.quiz-question  { background: var(--surface); border-radius: var(--radius); padding: 24px; text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 16px; box-shadow: var(--shadow-sm); min-height: 80px; display: flex; align-items: center; justify-content: center; }
.quiz-options  { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.quiz-option   { background: var(--surface); color: var(--text); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; text-align: left; font-size: 0.95rem; cursor: pointer; transition: all 0.18s; font-family: inherit; }
.quiz-option:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-light); }
.quiz-option.correct { border-color: var(--green); background: var(--green-light); color: var(--green); font-weight: 700; }
.quiz-option.wrong   { border-color: var(--red);   background: var(--red-light);   color: var(--red); }
.quiz-feedback     { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; text-align: center; }
.quiz-feedback.ok  { background: var(--green-light); color: var(--green); }
.quiz-feedback.bad { background: var(--red-light);   color: var(--red); }

/* ── Điền từ ──────────────────────────────────────────────── */
.typing-card      { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.typing-word-icon { font-size: 2.4rem; text-align: center; margin-bottom: 10px; min-height: 40px; line-height: 1; }
.typing-meaning   { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 8px; }
.sess-typing-vi   { font-size: 1.4rem; font-weight: 700; color: var(--text); text-align: center; }

/* ── Typing-EN card ───────────────────────────────────────── */
.sten-q       { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; }
.sten-emoji   { font-size: 2.6rem; line-height: 1; margin-bottom: 6px; }
.sten-meta    { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.sten-pos     { font-size: 0.75rem; font-weight: 700; color: var(--purple); background: var(--purple-light); padding: 2px 9px; border-radius: 20px; }
.sten-cefr    { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); background: var(--border); padding: 2px 8px; border-radius: 20px; }
.sten-diff    { font-size: 0.72rem; color: #F59E0B; letter-spacing: 1px; }
.sten-def     {
  font-size: 0.82rem; color: var(--text-muted); font-style: italic;
  line-height: 1.55; margin-top: 10px; max-width: 300px;
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 8px 12px; border: 1px solid var(--border);
}
.sten-hint-btn {
  margin-top: 12px; background: none; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 50px;
  padding: 5px 16px; font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); font-family: inherit; transition: all 0.15s;
}
.sten-hint-btn:hover { border-color: var(--purple); color: var(--purple); }

/* Typing inline feedback (replace input area) */
.sess-type-fb   { border-radius: var(--radius); padding: 14px 16px; margin-top: 2px; animation: slideUpFade 0.18s ease; }
.stf-ok         { background: rgba(5,150,105,0.06); border: 1.5px solid rgba(5,150,105,0.25); }
.stf-bad        { background: rgba(220,38,38,0.05); border: 1.5px solid rgba(220,38,38,0.2); }
.stf-almost     { background: rgba(217,119,6,0.05); border: 1.5px solid rgba(217,119,6,0.3); }
.stf-header     { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.stf-ok .stf-header     { color: #065F46; }
.stf-bad .stf-header    { color: #991B1B; }
.stf-almost .stf-header { color: #92400E; }
.typing-progress { font-size: 0.82rem; color: #065F46; font-weight: 600; margin-bottom: 6px; background: rgba(5,150,105,0.08); border-radius: 6px; padding: 4px 8px; }
.stf-wrong-ans  { font-size: 0.88rem; color: var(--text); margin-bottom: 6px; }
.stf-ex         { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-bottom: 10px; }
.typing-phonetic { font-size: 0.9rem; color: var(--purple); text-align: center; margin-bottom: 6px; }
.typing-example  { font-size: 0.85rem; color: var(--text-muted); text-align: center; font-style: italic; margin-bottom: 16px; }
.typing-input    { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 1.1rem; font-family: inherit; outline: none; text-align: center; transition: border-color 0.2s; }
.typing-input:focus   { border-color: var(--purple); }
.typing-input.correct { border-color: var(--green); background: var(--green-light); }
.typing-input.wrong   { border-color: var(--red);   background: var(--red-light); }
.typing-feedback     { padding: 10px; border-radius: var(--radius-sm); text-align: center; font-weight: 600; font-size: 0.9rem; margin-bottom: 10px; }
.typing-feedback.ok  { background: var(--green-light); color: var(--green); }
.typing-feedback.bad { background: var(--red-light);   color: var(--red); }

/* ── Nghe & đoán ──────────────────────────────────────────── */
.listen-card  { text-align: center; }
.btn-listen-big       { background: linear-gradient(135deg, var(--purple-d), #38BDF8); border: none; color: #fff; width: clamp(80px, 18vw, 110px); height: clamp(80px, 18vw, 110px); border-radius: 50%; font-size: clamp(2rem, 5vw, 2.8rem); cursor: pointer; box-shadow: 0 8px 24px rgba(14,165,233,0.35); transition: transform 0.18s, box-shadow 0.18s; margin-bottom: 12px; }
.btn-listen-big:hover { transform: scale(1.08); box-shadow: 0 12px 32px rgba(14,165,233,0.45); }
.listen-hint  { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 20px; }

/* ── Wrapper căn giữa khi đang học (mobile) ───────────────── */
.study-page-inner { max-width: 100%; }

/* ── Deck picker trong hero ───────────────────────────────── */
.study-deck-select {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid rgba(14,165,233,0.3);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
  cursor: pointer;
}
.study-deck-select:focus { border-color: var(--purple); }

/* ════════════════════════════════════════
   SESSION PAGE — flashcard + quiz combined
════════════════════════════════════════ */

.sess-wrap    { max-width: 480px; margin: 0 auto; }
.sess-header  { margin-bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.sess-header .sess-info-bar    { width: 100%; order: 0; }
.sess-header .progress-bar-wrap { width: 100%; order: 1; margin-bottom: 4px; }
.sess-header .sess-counter     { flex: 1; order: 2; margin-top: 2px; }
.sess-header .sess-mode-indicator { order: 2; flex-shrink: 0; margin-top: 2px; }

.sess-info-bar  { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; min-height: 24px; }
.learn-info-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; min-height: 28px; }
.sib-left  { display: flex; align-items: center; flex-wrap: nowrap; gap: 5px; overflow: hidden; }
.sib-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; justify-content: flex-end; }
.srb-acc-bad { background: #FEE2E2 !important; color: #DC2626 !important; border-color: #FCA5A5 !important; }
.sib-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); white-space: nowrap;
}
.sess-counter {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-muted); font-weight: 700;
  margin-top: 4px; letter-spacing: 0.3px;
}
/* Mode indicator: chỉ hiện dots, nằm cùng hàng với counter (flex order) */
.sess-mode-indicator {
  display: flex; align-items: center; justify-content: flex-end;
}
.smi-dots  { display: flex; align-items: center; gap: 4px; }
.smi-dot   { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.smi-dot.active { background: var(--purple); }
.smi-dot.done   { background: var(--purple); opacity: 0.4; }

.sess-fill-sentence {
  font-size: 1rem; line-height: 1.6; color: var(--text);
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-top: 8px; font-style: italic;
}

/* ── Flashcard 3D flip ────────────────────────────────────── */
.sess-fc {
  perspective: 1000px;
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sess-fc-inner {
  width: 100%;
  display: grid;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.52s cubic-bezier(0.4, 0, 0.2, 1);
}
.sess-fc-inner.flipped { transform: rotateY(180deg); }

.sess-fc-front,
.sess-fc-back {
  grid-area: 1/1;
  width: 100%; min-height: 280px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}
.sess-fc-front {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.sess-fc-back {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  transform: rotateY(180deg);
}

/* Mặt trước */
.sess-word      { font-size: 1.5rem; font-weight: 900; margin-bottom: 8px; line-height: 1.1; }
.sess-phonetic  { font-size: 0.95rem; opacity: 0.85; margin-bottom: 14px; }
.sess-flip-hint { font-size: 0.75rem; opacity: 0.6; margin-top: 20px; }
.sess-speak-btn {
  background: var(--purple-light);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--purple);
  transition: background 0.15s;
}
@media (hover: hover) {
  .sess-speak-btn:hover { background: var(--purple); color: #fff; }
}
.sess-speak-btn.looping {
  background: #FEF3C7;
  color: #D97706;
  border-color: #FDE68A;
  animation: speakPulse 0.8s ease-in-out infinite alternate;
}
@keyframes speakPulse {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}
.hint-speak-btn {
  font-size: 0.78rem; padding: 4px 12px; opacity: 0.7;
  margin-bottom: 8px;
}
@media (hover: hover) {
  .hint-speak-btn:hover { opacity: 1; }
}

/* Mặt sau */
.sess-back-en  { font-size: 1.1rem; font-weight: 700; opacity: 0.75; margin-bottom: 4px; }
.sess-back-ph  { font-size: 0.88rem; opacity: 0.7; margin-bottom: 12px; }
.sess-meaning  { font-size: 1.6rem; font-weight: 900; margin-bottom: 10px; line-height: 1.2; }
.sess-example    { font-size: 0.83rem; opacity: 0.82; font-style: italic; line-height: 1.6; max-width: 340px; margin-top: 10px; }
.sess-example-vi { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; max-width: 340px; margin-top: 3px; }

/* Nút ngoài card */
.sess-fc-actions { display: flex; justify-content: center; }
.sess-fc-actions.hidden { display: none; }
.sess-next-btn {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 32px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: opacity 0.18s, transform 0.15s;
}
.sess-next-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.sess-next-btn:disabled, .lif-next-btn:disabled, .wp-continue-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── Quiz ─────────────────────────────────────────────────── */
.sess-quiz-q {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  transition: border-radius 0.15s;
}
.sess-quiz-word  { font-size: 1.35rem; font-weight: 900; color: var(--text); line-height: 1.1; }
.sess-quiz-pos   { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: rgba(99,102,241,0.1); color: var(--purple); margin-top: 5px; }
.sess-quiz-ph    { font-size: 0.85rem; color: var(--purple); margin-top: 3px; }
.sess-quiz-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

.sess-options { display: flex; flex-direction: column; gap: 10px; }
.sess-opt {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  line-height: 1.4;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
}
.sess-opt-radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  transition: all 0.15s;
  background: var(--bg);
}
.sess-opt:not(:disabled):hover { border-color: var(--purple); background: var(--purple-light); }
.sess-opt:not(:disabled):hover .sess-opt-radio { border-color: var(--purple); }
.sess-opt-text { flex: 1; }
.sess-opt-correct .sess-opt-radio { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.sess-opt-wrong  .sess-opt-radio  { border-color: var(--red);   background: var(--red);   box-shadow: inset 0 0 0 3px #fff; }
.sess-opt-correct { border-color: var(--green) !important; background: rgba(5,150,105,0.08) !important; color: var(--green) !important; font-weight: 700 !important; }
.sess-opt-wrong   { border-color: var(--red)   !important; background: rgba(220,38,38,0.08)  !important; color: var(--red)   !important; }

.learn-inline-feedback {
  margin-top: 14px; padding: 10px 14px;
  border-radius: 10px; font-size: 0.88rem;
  line-height: 1.5; animation: fadeIn 0.2s ease;
}
.learn-inline-feedback.hidden { display: none; }
.lif-ok  { background: rgba(5,150,105,0.08); color: var(--green); border: 1px solid rgba(5,150,105,0.2); }
.lif-bad { background: rgba(220,38,38,0.06); color: var(--red);   border: 1px solid rgba(220,38,38,0.18); }
.lif-ex  { color: var(--text-muted); font-style: italic; font-size: 0.82rem; }
.lif-next-btn {
  display: block; width: 100%; margin-top: 10px;
  padding: 10px; border-radius: 10px;
  background: var(--purple); color: #fff;
  border: none; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }


/* ════════════════════════════════════════
   Desktop ≥ 1024px
════════════════════════════════════════ */
@media (min-width: 1024px) {

  .study-layout { display: block; }

  /* Study page chính: không giới hạn width trên PC */
  .sp-wrap {
    gap: 16px;
    padding: 8px 0 24px;
  }

  /* Dashboard Phase B — 2 cột trên desktop */
  .sp-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .sp-panel-left, .sp-panel-right { gap: 14px; }
  .sp-hero { padding: 22px 20px 18px; }
  .sp-hero-count { font-size: 2.2rem; }
  .sp-stat-tile { padding: 14px 8px; }
  .sp-stat-tile .sp-stat-num { font-size: 1.5rem; }
  .sp-modes-grid { grid-template-columns: repeat(3, 1fr); }
  .sp-mode-btn { padding: 12px 6px; }
  .sp-mode-icon { font-size: 1.15rem; }
  .sp-mode-lbl  { font-size: 0.68rem; }

  /* 3 card chính xếp ngang thành 3 cột */
  .sp-main-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 14px;
  }

  /* Card lớn hơn, giữ hàng ngang nhưng wrap để badge xuống góc phải */
  .sp-main-card {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 14px;
    padding: 20px 20px 18px;
    min-height: 110px;
    position: relative;
  }

  .sp-mc-icon  { font-size: 2rem; width: auto; margin-top: 2px; }
  .sp-mc-body  { flex: 1 1 60%; }
  .sp-mc-title { font-size: 1.05rem; }
  .sp-mc-sub   { font-size: 0.78rem; }
  .sp-mc-badge {
    font-size: 1.35rem;
    min-width: 44px;
    padding: 5px 12px;
    position: absolute;
    bottom: 16px;
    right: 16px;
  }

  /* Today progress banner to hơn */
  .sp-today-progress {
    font-size: 0.92rem;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
  }

  /* Extra grid luôn hiện trên PC (details luôn open, ẩn toggle) */
  .sp-extra { padding: 14px 16px; border-radius: var(--radius); }
  .sp-extra-toggle { display: none; }
  .sp-extra-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 0;
  }
  .sp-extra-btn {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    font-size: 0.8rem;
    gap: 7px;
    text-align: center;
  }

  /* Căn giữa nội dung flashcard/quiz */
  .study-page-inner { max-width: 600px; margin: 0 auto; }

  /* Session PC */
  .sess-wrap      { max-width: 540px; }
  .sess-fc-front,
  .sess-fc-back   { min-height: 300px; }
  .sess-word      { font-size: 2.4rem; }
  .sess-meaning   { font-size: 1.8rem; }
  .fc-scene  { perspective: 1200px; }
  .fc-card   { min-height: 240px; }
  .fc-front, .fc-back { min-height: 240px; }
  .fc-icon   { font-size: 4rem; }
  .fc-word   { font-size: 2.5rem; }
  .fc-back-meaning { font-size: 1.6rem; }
}

/* ════════════════════════════════════════
   Large PC ≥ 1200px
════════════════════════════════════════ */

@media (min-width: 1200px) {
  .sp-wrap { max-width: none; }
  .sp-main-card { min-height: 130px; padding: 24px 22px 20px; }
  .sp-mc-icon  { font-size: 2.2rem; }
  .sp-mc-title { font-size: 1.1rem; }
  .sp-mc-badge { font-size: 1.5rem; }
}

/* ════════════════════════════════════════
   LEARN MODE — học từ mới theo nhóm
════════════════════════════════════════ */

/* Nút ℹ trong focus-header */
.learn-info-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, transform 0.12s;
  flex-shrink: 0;
  margin-left: auto;
}
.learn-info-btn:hover  { background: rgba(0,0,0,0.06); color: var(--purple); }
.learn-info-btn:active { transform: scale(0.88); }

/* Thanh thông tin tiến độ (ẩn mặc định, hiện khi .open) */
.learn-info-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 16px;
  background: var(--purple-light);
  border-bottom: 1px solid rgba(14,165,233,0.18);
  max-height: 0; overflow: hidden;
  transition: max-height 0.22s ease, padding 0.22s ease;
}
.learn-info-panel.open {
  max-height: 44px;
  padding: 9px 16px;
}


.learn-wrap { max-width: 480px; margin: 0 auto; }

.learn-hd {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.learn-batch-lbl {
  font-size: 0.82rem; font-weight: 700;
  color: var(--purple);
}
.learn-sort-btn {
  font-size: 0.72rem; font-weight: 600; font-family: inherit;
  padding: 3px 10px; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.learn-sort-btn:hover { border-color: var(--purple); color: var(--purple); }

.learn-dots { display: flex; align-items: center; gap: 6px; }
.learn-dot  {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border); transition: background 0.25s;
}
.learn-dot.done    { background: var(--green); }
.learn-dot.current { background: var(--purple); box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }
.learn-quiz-tag {
  font-size: 0.7rem; font-weight: 700; color: var(--purple);
  background: var(--purple-light); padding: 2px 8px;
  border-radius: 50px; margin-left: 4px;
}

/* Số thứ tự thẻ trên mặt trước flashcard */
.learn-fc-num {
  position: absolute; top: 12px; right: 16px;
  font-size: 0.74rem; color: var(--text-muted); font-weight: 600;
}
.learn-fc-icon { font-size: 2.5rem; margin-bottom: 10px; line-height: 1; }
.learn-pos {
  font-size: 0.75rem; color: var(--purple);
  background: var(--purple-light); padding: 3px 10px;
  border-radius: 50px; margin-top: 8px;
}
.learn-quiz-label {
  font-size: 0.8rem; font-weight: 600;
  color: var(--purple); text-align: center;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: var(--purple-light);
  border-radius: var(--radius-sm);
}

/* Màn hình nhóm hoàn thành */
.learn-batch-complete {
  text-align: center; padding: 48px 20px 32px;
}
.lbc-icon  { font-size: 3.5rem; margin-bottom: 12px; }
.lbc-title { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.lbc-sub   { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; }
.lbc-stats {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  margin-bottom: 20px; text-align: left;
}
.lbc-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem; color: var(--text-muted); padding: 4px 0;
}
.lbc-stat-row strong { color: var(--text); font-weight: 800; }
.lbc-actions  { display: flex; flex-direction: column; gap: 10px; }
.lbc-btn-back { background: none; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 11px; font-size: 0.88rem; font-weight: 700; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: border-color 0.15s; }
.lbc-btn-back:hover { border-color: var(--purple); color: var(--purple); }

/* ── Learn result card (thay toàn bộ quiz view) ──────────────── */
/* ── MCQ options-replace feedback ─────── */
.smfb {
  border-radius: var(--radius); padding: 12px 14px;
  animation: slideUpFade 0.25s ease;
}
.smfb-ok  { background: rgba(5,150,105,0.06); border: 1.5px solid rgba(5,150,105,0.3); }
.smfb-bad { background: rgba(220,38,38,0.05); border: 1.5px solid rgba(220,38,38,0.25); }
.smfb-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.smfb-icon   { font-size: 0.85rem; }
.smfb-title  { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.smfb-ok  .smfb-title { color: #4B9E6F; }
.smfb-bad .smfb-title { color: #B45555; }
.smfb-word { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.smfb-top  { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.smfb-en   { font-size: 1rem; }
.srb-penalty { font-size: 0.72rem; color: #DC2626; font-weight: 600; }
.smfb-rewards { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.smfb-xp     { background: #FEF9C3; color: #854D0E; border: 1px solid #FDE68A; border-radius: 20px; padding: 2px 9px; font-size: 0.75rem; font-weight: 700; }
.smfb-streak { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; border-radius: 20px; padding: 2px 9px; font-size: 0.75rem; font-weight: 700; }
.smfb-penalty{ font-size: 0.78rem; color: #DC2626; font-weight: 600; margin-bottom: 10px; }
.smfb-acc    { background: var(--purple-light); color: var(--purple); border: 1px solid var(--purple); border-radius: 20px; padding: 2px 9px; font-size: 0.75rem; font-weight: 700; }
@keyframes slideUpFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Card câu hỏi mới xuất hiện sau khi bấm Tiếp theo */
.sess-quiz    { animation: slideUpFade 0.22s ease; }
.sess-produce { animation: slideUpFade 0.22s ease; }
.sess-fc      { animation: slideUpFade 0.22s ease; }

/* ── Shared word detail classes (dùng trong wordDetailHTML) ─────── */
.lrc-pos   { font-size: 0.7rem; font-weight: 700; color: var(--purple); background: var(--purple-light); padding: 2px 8px; border-radius: 50px; }
.lrc-speak { background: none; border: none; font-size: 1.1rem; cursor: pointer; margin-left: auto; padding: 0; line-height: 1; }
.lrc-ph    { font-size: 0.85rem; color: var(--purple); margin-bottom: 8px; }
.lrc-vi    { font-size: 1.2rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.lrc-ex    { font-size: 0.82rem; color: var(--text-muted); font-style: italic; line-height: 1.5; margin-top: 5px; }
.lrc-ex-vi { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.lrc-translate-btn {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 4px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 0.72rem; color: var(--text-muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lrc-translate-btn:hover { background: var(--purple-light); color: var(--purple); border-color: var(--purple); }

/* ── Mixed mode: mode badge ──────────────────────────────────── */
.sess-mode-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 700; border-radius: 50px;
  padding: 4px 12px; margin-bottom: 14px;
  letter-spacing: 0.3px;
}
.sess-mode-fc   { color: var(--purple); background: var(--purple-light); }
.sess-mode-quiz { color: var(--green);  background: var(--green-light); }
.sess-mode-type { color: var(--orange); background: var(--orange-light); }

@media (min-width: 1024px) {
  .learn-wrap { max-width: 540px; }
}

/* ════════════════════════════════════════
   MATCH MODE — nối từ
════════════════════════════════════════ */
.match-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 4px;
}
.match-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.match-score {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.match-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 14px;
}
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-item {
  padding: 12px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  min-height: 56px;
  word-break: break-word;
  line-height: 1.35;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.match-item:hover:not(:disabled):not(.match-done) {
  border-color: var(--purple);
}
.match-selected {
  border-color: var(--purple) !important;
  background: var(--purple-light) !important;
  color: var(--purple) !important;
}
.match-correct {
  border-color: #059669 !important;
  background: #D1FAE5 !important;
  color: #059669 !important;
}
.match-wrong {
  border-color: #DC2626 !important;
  background: #FEE2E2 !important;
  color: #DC2626 !important;
  animation: matchShake 0.45s ease;
}
.match-done {
  opacity: 0.22;
  pointer-events: none;
}
@keyframes matchShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  80%       { transform: translateX(-3px); }
}

/* ── FSRS retention badge (review page) ───────────────────── */
.review-ret-badge {
  display: inline-block; font-size: 0.73rem; font-weight: 700;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 10px;
}
.ret-high { background: rgba(5,150,105,0.1);  color: var(--green); }
.ret-mid  { background: rgba(217,119,6,0.1);  color: #D97706; }
.ret-low  { background: rgba(220,38,38,0.08); color: var(--red); }

/* ── FSRS stats row trong word detail ──────────────────────── */
.wd-fsrs-row {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 6px;
}
.wd-fsrs-s { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.wd-fsrs-d {
  font-size: 0.73rem; font-weight: 700; padding: 2px 8px; border-radius: 12px;
}
.wd-fsrs-hard { background: rgba(220,38,38,0.08);  color: var(--red); }
.wd-fsrs-mid  { background: rgba(217,119,6,0.08);  color: #D97706; }
.wd-fsrs-easy { background: rgba(5,150,105,0.1);   color: var(--green); }

/* ── Review SRS — nút tự chấm + badge leech ───────────────── */
.review-leech {
  font-size: 0.78rem; font-weight: 700; color: var(--red);
  background: var(--red-light); padding: 3px 11px; border-radius: 20px; margin-bottom: 10px;
}
.review-grades { display: flex; gap: 10px; margin-top: 16px; }
.review-grade {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-family: inherit;
  font-size: 1.5rem; transition: transform 0.15s, background 0.15s;
}
.review-grade span { font-size: 0.82rem; font-weight: 700; }
.review-grade:hover { transform: translateY(-2px); }
.rg-forget { border-color: #FCA5A5; } .rg-forget span { color: var(--red); }
.rg-good   { border-color: #93C5FD; } .rg-good   span { color: #2563EB; }
.rg-easy   { border-color: #86EFAC; } .rg-easy   span { color: var(--green); }
.rg-forget:hover { background: var(--red-light); }
.rg-good:hover   { background: rgba(37,99,235,0.12); }
.rg-easy:hover   { background: var(--green-light); }

/* ── Collocation / Word Family / Related — chips chung ──────────── */
.wd-chips-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-top: 7px;
}
.wd-chips-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); flex-shrink: 0;
  margin-right: 2px;
}
.wd-chip {
  font-size: 0.75rem; padding: 2px 8px; border-radius: 20px;
  background: rgba(14,165,233,0.1); color: var(--purple);
  font-weight: 500; white-space: nowrap;
}
.wd-chip-fam {
  background: rgba(5,150,105,0.1); color: var(--green);
}
.wd-chip-rel {
  background: rgba(217,119,6,0.1); color: var(--orange);
}
.wd-chip-syn   { background: rgba(219,39,119,0.1); color: var(--pink); }
.wd-chip-topic { background: rgba(99,102,241,0.08); color: var(--purple); font-size: 0.72rem; }
.wd-toeic-freq {
  font-size: 0.65rem; font-weight: 700; padding: 1px 7px;
  border-radius: 20px; letter-spacing: 0.03em; flex-shrink: 0;
}
.wd-toeic-high { background: rgba(5,150,105,0.12); color: var(--green); }
.wd-toeic-mid  { background: rgba(217,119,6,0.12); color: var(--orange); }
.wd-toeic-low  { background: rgba(107,114,128,0.12); color: var(--text-muted); }

/* ── Learn flashcard back — chips ─────────────────────────────── */
.lfc-chips-row {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 8px; justify-content: center;
}
.lfc-chip {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 20px;
  background: rgba(14,165,233,0.12); color: var(--purple); font-weight: 500;
}
.lfc-chip-fam {
  background: rgba(5,150,105,0.12); color: var(--green);
}

/* ── Produce mode ──────────────────────────────────────────────── */
.sess-produce {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 8px 0;
}
.sess-produce-word {
  font-size: 1.5rem; font-weight: 800; color: var(--text);
}
.sess-produce-vi {
  font-size: 0.9rem; color: var(--text-muted); margin-top: -4px;
}
.sess-produce-prompt {
  font-size: 0.85rem; color: var(--purple); font-weight: 600; margin-top: 4px;
}
.sess-produce-ta {
  width: 100%; border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 0.95rem; font-family: var(--font);
  resize: none; background: var(--surface); color: var(--text);
  transition: border-color 0.15s;
}
.sess-produce-ta:focus { outline: none; border-color: var(--purple); }
.sess-produce-btns {
  display: flex; gap: 10px; width: 100%; justify-content: flex-end;
}
.sess-skip-btn {
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-muted); font-size: 0.9rem;
  cursor: pointer; font-weight: 600;
}

/* ── Recall Phase ──────────────────────────────────────────────── */
.learn-recall-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.learn-recall-header {
  font-size: 0.78rem; font-weight: 700;
  color: var(--purple); background: var(--purple-light);
  padding: 3px 12px; border-radius: 20px;
  margin-bottom: 16px;
}
.learn-recall-word {
  font-size: 2rem; font-weight: 800; color: var(--text);
  line-height: 1.15; margin-bottom: 6px;
}
.learn-recall-hint {
  font-size: 0.82rem; color: var(--text-muted);
  font-style: italic; margin-bottom: 20px;
}
.learn-recall-hint.hidden { display: none; }
.learn-recall-reveal-btn {
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 22px;
  font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; font-family: var(--font);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-bottom: 0;
}
.learn-recall-reveal-btn:hover { border-color: var(--purple); color: var(--purple); background: var(--purple-light); }
.learn-recall-answer {
  font-size: 1.3rem; font-weight: 800; color: var(--text);
  margin: 16px 0 6px; line-height: 1.3;
}
.learn-recall-ex {
  font-size: 0.8rem; color: var(--text-muted);
  font-style: italic; margin-bottom: 6px; line-height: 1.5;
}
.learn-recall-detail-link {
  font-size: 0.75rem; color: var(--purple); cursor: pointer;
  text-decoration: none; font-weight: 500; margin-bottom: 18px; display: inline-block;
}
.learn-recall-detail-link:hover { text-decoration: underline; }
.learn-recall-btns {
  display: flex; gap: 10px; width: 100%; margin-top: 14px;
}
.learn-recall-btn {
  flex: 1; padding: 13px 10px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); border: 1.5px solid transparent;
  transition: opacity 0.15s, transform 0.1s;
}
.learn-recall-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.learn-recall-btn--yes { background: var(--green);   color: #fff;             border-color: var(--green); }
.learn-recall-btn--mid { background: var(--orange);  color: #fff;             border-color: var(--orange); }
.learn-recall-btn--no  { background: var(--surface); color: var(--text-muted); border-color: var(--border); }

/* ── Typing Phase ──────────────────────────────────────────────── */
.learn-typing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.learn-typing-header {
  font-size: 0.8rem; font-weight: 700; color: var(--purple);
  text-align: center;
}
.learn-typing-vi {
  font-size: 1.3rem; font-weight: 800; color: var(--text);
  text-align: center; line-height: 1.3;
}
.learn-typing-ph {
  font-size: 0.82rem; color: var(--purple);
  text-align: center; margin-top: -6px;
}
.learn-typing-fb {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; line-height: 1.4;
  animation: fadeIn 0.15s ease;
}
.learn-typing-fb.hidden { display: none; }
.learn-typing-fb--ok     { background: rgba(5,150,105,0.08);  color: #065F46; border: 1px solid rgba(5,150,105,0.22); }
.learn-typing-fb--bad    { background: rgba(220,38,38,0.06);  color: #991B1B; border: 1px solid rgba(220,38,38,0.2); }
.learn-typing-fb--almost { background: rgba(217,119,6,0.07);  color: #92400E; border: 1px solid rgba(217,119,6,0.28); }
.learn-typing-fb strong { font-weight: 800; }
.learn-typing-input {
  width: 100%; border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; font-size: 1rem; font-family: var(--font);
  font-weight: 600; color: var(--text); background: var(--surface);
  outline: none; transition: border-color 0.15s; box-sizing: border-box;
}
.learn-typing-input:focus { border-color: var(--purple); }
.learn-typing-input:disabled { opacity: 0.7; }
.learn-typing-btns {
  display: flex; gap: 10px; justify-content: flex-end;
}
.learn-typing-skip {
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text-muted); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
}

/* ── Hard Words Dialog ─────────────────────────────────────────── */
.learn-hard-dialog {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 20px 24px;
  text-align: center; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lhd-icon { font-size: 2.4rem; line-height: 1; }
.lhd-title {
  font-size: 1.1rem; font-weight: 800; color: var(--text); margin-top: 2px;
}
.lhd-sub {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.5;
}
.lhd-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center; margin: 4px 0 8px;
}
.lhd-chip {
  font-size: 0.8rem; font-weight: 600;
  padding: 4px 12px; border-radius: 20px;
  background: rgba(220,38,38,0.08); color: var(--red);
  border: 1px solid rgba(220,38,38,0.18);
}
.lhd-btns {
  display: flex; gap: 10px; width: 100%; margin-top: 6px;
}
.lhd-btn-delay {
  flex: 1; padding: 13px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: var(--font);
}
.lhd-btn-now {
  flex: 1; padding: 13px; border-radius: var(--radius-sm);
  border: none; background: var(--purple); color: #fff;
  font-size: 0.9rem; font-weight: 700; cursor: pointer; font-family: var(--font);
  transition: opacity 0.15s;
}
.lhd-btn-now:hover { opacity: 0.88; }

/* ── Mini Review Label ─────────────────────────────────────────── */
.learn-mini-rv-label {
  color: var(--orange) !important;
  background: rgba(217,119,6,0.1) !important;
  padding: 3px 10px; border-radius: 20px;
}

/* ── Example toggle (smfb-ex-details) ─────────────────────────── */
.smfb-ex-details { margin-top: 5px; }
.smfb-ex-sum {
  font-size: 0.74rem; color: var(--purple); font-weight: 600;
  cursor: pointer; list-style: none; user-select: none;
  display: inline-flex; align-items: center; gap: 3px;
}
.smfb-ex-sum::-webkit-details-marker { display: none; }
.smfb-ex-details[open] .smfb-ex-sum::before     { content: '▼ '; font-size: 0.65rem; }
.smfb-ex-details:not([open]) .smfb-ex-sum::before { content: '▶ '; font-size: 0.65rem; }
.smfb-ex-details .lrc-ex { margin-top: 5px; }

/* ── Explanation inline ───────────────────────────────────────── */
.wd-explain-text {
  font-size: 0.82rem; color: var(--text); line-height: 1.5;
  margin: 6px 0 2px;
}
.wd-explain-note {
  font-size: 0.78rem; color: var(--orange); font-weight: 500;
  margin: 2px 0 0; background: rgba(217,119,6,.08); border-radius: 6px;
  padding: 4px 8px;
}

/* ── Extras collapsible (collocations/word family/related) ─────── */
.wd-extra { margin-top: 8px; }
.wd-extra-sum {
  font-size: 0.74rem; color: var(--purple); font-weight: 600;
  cursor: pointer; list-style: none; user-select: none;
}
.wd-extra-sum::-webkit-details-marker { display: none; }
.wd-extra-sum::before { content: '▶ '; font-size: 0.65rem; }
.wd-extra[open] .wd-extra-sum::before { content: '▼ '; }
.wd-extra[open] > summary { margin-bottom: 6px; }

/* ── Wrong vs correct comparison row ─────────────────────────── */
.smfb-wrong-vs {
  font-size: 0.83rem; background: rgba(220,38,38,.07);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.smfb-wv-row   { display: flex; align-items: center; gap: 6px; }
.smfb-wv-label { color: var(--text-muted); font-size: 0.78rem; min-width: 80px; }
.smfb-wv-wrong { color: var(--red); font-weight: 600; }
.smfb-wv-right { color: var(--green); font-weight: 700; }

/* Bỏ card lồng card: word detail tràn thẳng vào nền smfb */
.smfb .smfb-word {
  background: transparent;
  border-radius: 0;
  padding: 2px 0 0;
  margin-bottom: 0;
}

/* ── Sticky next button (session + learn) ─────────────────────── */
/* Focus mode không có nav bar → đặt sát đáy hơn */
#app.focus-mode .sess-sticky-next { bottom: 16px; }
.sess-sticky-next {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  z-index: 50;
  box-shadow: 0 4px 20px rgba(14,165,233,0.3);
  transition: opacity 0.15s, transform 0.15s;
  animation: slideUpFade 0.18s ease;
}
.sess-sticky-next:hover { opacity: 0.9; transform: translateX(-50%) translateY(-1px); }
.sess-sticky-next.hidden { display: none; }

/* Thêm padding dưới sess-card khi sticky btn hiện */
#page-session .sess-card-area { padding-bottom: calc(var(--nav-h) + 80px); }

/* Khoảng cách giữa card kết quả và nút tiếp theo (nút nằm ngoài border) */
.smfb + .sess-next-btn { margin-top: 10px; }

/* ── Forget reinforcement typing ──────────────────────────────── */
.rft-wrap { margin-top: 10px; }
.rft-prompt {
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: 8px;
}
.rft-input-row { display: flex; gap: 8px; }
.rft-input {
  flex: 1; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; font-family: inherit; outline: none;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface); color: var(--text);
}
.rft-input:focus { border-color: var(--purple); }
.rft-input--ok  { border-color: var(--green) !important; background: rgba(5,150,105,0.06) !important; }
.rft-input--err { animation: rftShake 0.42s ease; border-color: var(--red) !important; }
.rft-check-btn {
  flex-shrink: 0; width: 44px;
  background: var(--purple); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 1.1rem;
  cursor: pointer; transition: opacity 0.15s;
}
.rft-check-btn:hover { opacity: 0.85; }
.rft-result { font-size: 0.82rem; margin-top: 7px; font-weight: 600; }
.rft-result.hidden { display: none; }
.rft-ok  { color: var(--green); }
.rft-bad { color: var(--red); }
.rft-skip-btn {
  display: block; width: 100%; margin-top: 8px;
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px;
  font-size: 0.8rem; color: var(--text-muted);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.rft-skip-btn:hover { border-color: var(--purple); color: var(--purple); }
.rft-skip-btn.hidden { display: none; }
@keyframes rftShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  65% { transform: translateX(-4px); }
  85% { transform: translateX(3px); }
}

/* ── Letter Tiles (mobile typing) ──────────────────────────────── */
#sess-tile-built {
  min-height: 54px;
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center; align-items: center;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px; padding-bottom: 12px;
}
#sess-tile-pool {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.stile {
  min-width: 40px; height: 46px; padding: 0 10px;
  border-radius: 10px; border: 2px solid var(--purple);
  background: var(--surface); color: var(--purple);
  font-size: 1.15rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: background 0.1s, transform 0.1s;
  display: inline-flex; align-items: center; justify-content: center;
}
.stile:active { transform: scale(0.9); background: rgba(99,102,241,0.1); }
.stile--built {
  border-color: var(--green); color: var(--green);
  background: rgba(5,150,105,0.08);
}
.stile--built:active { background: rgba(5,150,105,0.18); }
.stile--ghost {
  border-color: transparent; background: transparent;
  pointer-events: none; opacity: 0;
}
.stile-ph { color: var(--text-muted); font-size: 0.88rem; }
.dark-mode .stile { background: #1e293b; }
.dark-mode .stile--built { background: rgba(5,150,105,0.15); }
