/* ════════ Practice (Quiz / MCQ / Typing / Results / Practice overlays) ════════ */

/* ── Quiz header ── */
.quiz-header { margin-bottom: var(--space-4); }

.quiz-progress-track {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-counter {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
}

.quiz-score-badge {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  padding: 3px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-pill);
}

.quiz-card {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-7);
}

.quiz-prompt {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  text-align: center;
  margin-bottom: var(--space-7);
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.quiz-opt {
  padding: var(--space-4) var(--space-5);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.quiz-opt:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.quiz-opt.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success-text);
}

.quiz-opt.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger-text);
}

.quiz-opt:disabled { cursor: default; }

/* ── Result screens ── */
.result-wrap { display: flex; justify-content: center; }

.result-card {
  max-width: 480px;
  width: 100%;
  padding: var(--space-8) var(--space-7);
  text-align: center;
}

.result-emoji {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
}

.result-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.result-sub {
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.result-score-big {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin: var(--space-4) 0;
}

.result-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.result-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-pill);
  transition: width 0.8s ease;
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.wrong-section {
  margin: var(--space-4) 0;
  text-align: left;
}

.wrong-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  text-align: center;
}

.wrong-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: var(--text-sm);
}

.wrong-word    { font-weight: var(--font-weight-bold); color: var(--danger-text); }
.wrong-meaning { color: var(--text-muted); }

/* ── Practice home ── */
.stat-card.clickable { cursor: pointer; }

.stat-card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-icon.red { background: var(--danger-light); }

/* Mode selection grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.mode-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  box-shadow: var(--shadow-xs);
}

.mode-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.mode-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow);
}

.mode-icon-bg {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.mode-info { flex: 1; }

.mode-name {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: 2px;
}

.mode-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.mode-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.srs-tag    { background: var(--primary-light); color: var(--primary); }
.recall-tag { background: var(--success-light); color: var(--success-text); }
.speed-tag  { background: var(--danger-light);  color: var(--danger-text); }
.weak-tag   { background: var(--warning-light); color: var(--warning-text); }

/* Count buttons */
.count-row { margin-bottom: var(--space-4); }

.count-btns {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.count-btn {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--card);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  transition: var(--transition);
}

.count-btn:hover { border-color: var(--primary); color: var(--primary); }
.count-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* qtype pills */
.qtype-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.qtype-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--card);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  transition: var(--transition);
}

.qtype-pill:hover { border-color: var(--primary); color: var(--primary); }
.qtype-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Speed timer */
.speed-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  font-size: var(--text-base);
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: var(--transition);
}

.speed-timer.urgent {
  background: var(--danger-light);
  color: var(--danger);
  animation: pulse-timer 0.8s ease-in-out infinite;
}

@keyframes pulse-timer {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

/* Listen button */
.listen-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.listen-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  border: 2px solid var(--warning);
  background: var(--warning-light);
  color: var(--warning-text);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  transition: var(--transition);
}

.listen-btn:hover { background: var(--warning); color: #fff; }

/* ── Typing mode ── */
.typing-card {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-5);
}

.typing-meaning-box {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  text-align: center;
}

.typing-label {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.typing-prompt {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  text-align: center;
  margin-bottom: var(--space-3);
  line-height: 1.35;
}

.typing-input-wrap {
  display: flex;
  gap: var(--space-3);
}

.typing-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.typing-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
  background: var(--card);
}

.typing-input.input-correct { border-color: var(--success); background: color-mix(in srgb, var(--success) 8%, transparent); }
.typing-input.input-wrong   { border-color: var(--danger);  background: color-mix(in srgb, var(--danger)  8%, transparent); }

.typing-feedback {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-align: center;
}

.typing-feedback.fb-correct {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid var(--success);
}

.typing-feedback.fb-typo {
  background: var(--warning-light);
  color: var(--warning-text);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
}

.typing-feedback.fb-wrong {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid var(--danger);
}

.fb-requeue {
  margin-top: 6px;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--warning-text);
  opacity: 0.9;
}

/* ── Practice overlays ── */
#practiceSetupCard:not(.hidden),
#practiceQuestion:not(.hidden),
#practiceResult:not(.hidden),
#typingSession:not(.hidden),
#typingResult:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  overflow-y: auto;
  padding: 28px max(24px, calc((100vw - 680px) / 2)) 32px;
  max-width: none;
  margin: 0;
  border-radius: 0;
}

#practiceResult:not(.hidden),
#typingResult:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  #practiceSetupCard:not(.hidden),
  #practiceQuestion:not(.hidden),
  #practiceResult:not(.hidden),
  #typingSession:not(.hidden),
  #typingResult:not(.hidden) {
    padding: 16px 12px calc(74px + env(safe-area-inset-bottom, 0px));
    display: block;
  }
}

.overlay-close-btn {
  position: sticky;
  top: 0;
  float: right;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 10px 12px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
}

.overlay-close-btn:hover { color: var(--text); }

/* Typing extras */
.typing-context-row {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.typing-phonetic-hint {
  font-size: var(--text-sm); color: var(--text-secondary); font-style: italic;
}
.typing-speak-btn {
  background: none; border: none; cursor: pointer;
  font-size: var(--text-base); color: var(--text-secondary); padding: 2px 4px; flex-shrink: 0; line-height: 1;
}
.typing-speak-btn:hover { color: var(--primary); }

.typing-hint-row {
  display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3);
}
.typing-hint-btn {
  background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 5px 12px; font-size: var(--text-xs); cursor: pointer; color: var(--text-secondary);
  transition: var(--transition); flex-shrink: 0;
}
.typing-hint-btn:hover:not(:disabled) { border-color: var(--warning); color: var(--warning-text); }
.typing-hint-btn:disabled { opacity: 0.4; cursor: default; }
.typing-hint-text {
  font-family: monospace; font-size: 1.05rem; letter-spacing: 4px;
  color: var(--primary); font-weight: var(--font-weight-semibold);
}

.fb-phonetic { font-size: var(--text-xs); margin-left: var(--space-2); opacity: 0.8; }
.fb-example  { font-size: var(--text-sm); font-style: italic; margin-top: 6px; opacity: 0.9; }

/* Quick start strip */
.typing-qs { margin-bottom: 4px; }
.typing-qs-strip {
  display: flex; align-items: center; gap: var(--space-3);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  cursor: pointer; transition: filter 0.15s;
}
.typing-qs-strip:hover { filter: brightness(1.07); }
.typing-qs-icon  { font-size: 1.3rem; flex-shrink: 0; }
.typing-qs-info  { flex: 1; min-width: 0; }
.typing-qs-label { font-size: var(--text-sm); font-weight: var(--font-weight-bold); }
.typing-qs-sub   { font-size: var(--text-xs); opacity: 0.85; margin-top: 1px; }
.typing-qs-btn {
  flex-shrink: 0; background: var(--white-20);
  border: 1px solid rgba(255,255,255,0.4); color: #fff;
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold); cursor: pointer; white-space: nowrap;
}
.typing-qs-divider {
  text-align: center; font-size: var(--text-xs); color: var(--text-muted);
  margin: var(--space-2) 0 4px;
}
