/* ==========================================================================
   HALAMAN: Reading Drill — NihongoDo
   Class names disesuaikan persis dengan output HTML dari js/pages/reading-drill.js
   ========================================================================== */

/* ─── WRAPPER ────────────────────────────────────────────── */
#reading-container {
  max-width: 680px;
  margin: 0 auto;
}
.reading-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* ─── LOADING ────────────────────────────────────────────── */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  color: var(--text-faint);
}
.ql-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ink-4);
  border-top-color: var(--indigo-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── SETUP SCREEN ───────────────────────────────────────── */
.rd-setup {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.rd-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.rd-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  margin: 0;
  font-family: var(--font-display);
}
.rd-desc {
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

.rd-config {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.rd-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.rd-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.rd-opts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rd-diff-btn,
.rd-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  min-width: 90px;
  text-align: left;
}
.rd-diff-btn.active,
.rd-mode-btn.active {
  border-color: var(--indigo-light) !important;
  background: var(--indigo-ghost) !important;
  color: var(--indigo-light) !important;
}
.rd-btn-label {
  font-size: 14px;
  font-weight: 700;
}
.rd-btn-sub {
  font-size: 11px;
}

.rd-start-btn {
  width: 100%;
  max-width: 320px;
  padding: var(--space-3) var(--space-4);
  font-size: 16px;
}

/* ─── PREVIEW KATA ────────────────────────────────────────── */
.rd-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--ink-2);
}
.rd-preview h3 {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
}
.rd-word-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rd-word-ex {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2);
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  min-width: 60px;
  text-align: center;
}
.rd-ex-word {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
}
.rd-word-ex .text-faint {
  font-size: 10px;
}

/* ─── RUNNING SCREEN ─────────────────────────────────────── */
.rd-running {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Progress bar */
.rd-prog-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.rd-prog-bar-bg {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: var(--ink-4);
  overflow: hidden;
}
.rd-prog-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--indigo-light);
  transition: width 0.4s var(--ease);
  width: 0%;
}
.rd-prog-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* Word display container */
.rd-word-display {
  text-align: center;
  padding: var(--space-5) var(--space-3);
  background: var(--ink-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

/* The actual kana word (class used by JS: .rd-word) */
.rd-word {
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: 0.05em;
}

/* Meta row below the word */
.rd-word-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}
.rd-word-level,
.rd-word-script {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  text-transform: uppercase;
}
.rd-audio-btn {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--dur-fast);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.rd-audio-btn:hover {
  opacity: 1;
}

.rd-instruction {
  font-size: 13px;
  margin: 0;
}

/* ─── ANSWER AREA — TYPE MODE ─────────────────────────────── */
.rd-answer-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Wrapper for input + submit button (class used by JS: .rd-type-wrap) */
.rd-type-wrap {
  display: flex;
  gap: var(--space-2);
}
.rd-type-input {
  flex: 1;
  font: inherit;
  font-size: 18px;
  padding: var(--space-3);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--ink-2);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-fast);
}
.rd-type-input:focus {
  border-color: var(--indigo-light);
}

/* ─── ANSWER AREA — CHOICE MODE ───────────────────────────── */
/* Grid of choices (class used by JS: .rd-choices-grid) */
.rd-choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
/* Each choice button (class used by JS: .rd-choice-btn) */
.rd-choice-btn {
  padding: var(--space-3);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-align: center;
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    transform var(--dur-fast);
}
.rd-choice-btn:not(:disabled):hover {
  border-color: var(--indigo-light);
  background: var(--indigo-ghost);
  transform: translateY(-1px);
}
/* After answering: correct/wrong states */
.rd-choice-btn.rd-choice-correct {
  border-color: var(--jade-light) !important;
  background: rgba(0, 180, 120, 0.15) !important;
  color: var(--jade-light) !important;
}
.rd-choice-btn.rd-choice-wrong {
  border-color: var(--shu-light) !important;
  background: rgba(200, 69, 46, 0.12) !important;
  color: var(--shu-light) !important;
}
.rd-choice-btn:disabled {
  cursor: default;
  opacity: 0.8;
}

/* ─── FEEDBACK ───────────────────────────────────────────── */
.rd-feedback {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
  transition: opacity 0.2s;
}
.rd-feedback[hidden] {
  display: none;
}
.rd-feedback.correct {
  background: rgba(0, 180, 120, 0.12);
  color: var(--jade-light);
  border: 1px solid var(--jade-dim);
}
/* JS uses class "wrong" not "incorrect" */
.rd-feedback.wrong {
  background: rgba(200, 69, 46, 0.1);
  color: var(--shu-light);
  border: 1px solid var(--shu-dim);
}
.fb-meaning {
  font-weight: 400;
  font-size: 13px;
}

/* ─── RESULTS SCREEN ─────────────────────────────────────── */
.rd-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-3);
}

/* Score badge (class used by JS: .rdr-score) */
.rdr-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  min-width: 180px;
}
.rdr-score.great {
  border-color: var(--jade-light);
  background: rgba(0, 180, 120, 0.08);
}
.rdr-score.ok {
  border-color: var(--gold-light);
  background: rgba(215, 160, 35, 0.07);
}
.rdr-score.retry {
  border-color: var(--shu-light);
  background: rgba(200, 69, 46, 0.07);
}
.rdr-pct {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}
.rdr-score.great .rdr-pct {
  color: var(--jade-light);
}
.rdr-score.ok .rdr-pct {
  color: var(--gold-light);
}
.rdr-score.retry .rdr-pct {
  color: var(--shu-light);
}
.rdr-label {
  font-size: 16px;
  font-weight: 700;
}

/* Stats row */
.rdr-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}
.rdr-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-faint);
}
.rdr-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
/* Colour helpers from global/theme */
.text-jade {
  color: var(--jade-light) !important;
}
.text-shu {
  color: var(--shu-light) !important;
}
.text-gold {
  color: var(--gold-light) !important;
}

/* Word list */
.rdr-word-list {
  width: 100%;
  max-width: 480px;
  text-align: left;
}
.rdr-word-list h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-bottom: var(--space-2);
}
.rdr-answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdr-answer-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--ink-2);
  font-size: 13px;
}
.rdr-answer-item.correct {
  border-color: var(--jade-dim);
  background: rgba(0, 180, 120, 0.05);
}
.rdr-answer-item.wrong {
  border-color: var(--shu-dim);
  background: rgba(200, 69, 46, 0.05);
}
.rdr-word-glyph {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  min-width: 36px;
}
.rdr-word-romaji {
  font-weight: 700;
  flex: 1;
}
.rdr-user-ans {
  font-size: 12px;
}
.rdr-check {
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.rdr-answer-item.correct .rdr-check {
  color: var(--jade-light);
}
.rdr-answer-item.wrong .rdr-check {
  color: var(--shu-light);
}

/* Actions */
.rdr-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── QUIZ PAGE HEADER ───────────────────────────────────── */
.quiz-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.quiz-page-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0;
}
