/* ============================================================
   typing_test.css  –  Styles for all typing_test app templates
   ============================================================ */


/* ----------------------------------------------------------
   exam_list.html
   ---------------------------------------------------------- */
.tt-hero {
  text-align: center;
  padding: 40px 0 24px;
}
.tt-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ck-text, #1e293b);
}
.tt-hero p {
  color: #64748b;
  margin-top: 6px;
  font-size: 0.97rem;
}
.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.tt-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 20px 22px;
  text-align: center;
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.tt-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.10);
  transform: translateY(-3px);
}
.tt-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
}
.tt-card .tt-card__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.tt-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}
.tt-card .tt-btn {
  margin-top: 4px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 22px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.tt-card .tt-btn:hover { background: #1d4ed8; }


/* ----------------------------------------------------------
   history.html
   ---------------------------------------------------------- */
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-top: 20px;
}
.history-table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
}
.history-table tbody tr { border-top: 1px solid #f1f5f9; }
.history-table tbody tr:hover { background: #f8fafc; }
.history-table tbody td { padding: 12px 16px; font-size: 0.88rem; color: #334155; }
.badge-q  { background: #dcfce7; color: #16a34a; border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 0.78rem; }
.badge-nq { background: #fee2e2; color: #dc2626; border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 0.78rem; }


/* ----------------------------------------------------------
   passage_list.html
   ---------------------------------------------------------- */
.pl-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin: 40px 0 28px;
}
.pl-header__logo img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.pl-header__icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.pl-header__info h1 { font-size: 1.8rem; font-weight: 800; color: #1e293b; }
.pl-header__info p  { color: #64748b; font-size: 0.95rem; margin-top: 6px; max-width: 680px; line-height: 1.6; }

.lang-toggle { display: flex; gap: 8px; margin-bottom: 20px; }
.lang-btn {
  padding: 7px 22px;
  border-radius: 999px;
  border: 2px solid #2563eb;
  background: transparent;
  color: #2563eb;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}
.lang-btn.active { background: #2563eb; color: #fff; }

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  margin: 24px 0 10px;
  color: #16a34a;
}
.level-badge .dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; }
.level-badge.medium       { color: #d97706; }
.level-badge.medium .dot  { background: #d97706; }
.level-badge.hard         { color: #dc2626; }
.level-badge.hard   .dot  { background: #dc2626; }

.pl-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.pl-table thead th {
  background: #f0fdf4;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pl-table tbody tr { border-top: 1px solid #f1f5f9; }
.pl-table tbody tr:hover { background: #f8fafc; }
.pl-table tbody td { padding: 13px 16px; font-size: 0.9rem; color: #334155; }

.btn-start {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-start:hover { background: #15803d; }

.btn-premium {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
}
.btn-premium:hover { background: #d97706; }

.btn-login {
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-login:hover { background: #2563eb; }

.btn-attempt {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-attempt:hover { background: #1d4ed8; }

.pl-info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.88rem;
  color: #1d4ed8;
  margin-bottom: 20px;
}


/* ----------------------------------------------------------
   result.html
   ---------------------------------------------------------- */
.result-wrap { max-width: 960px; margin: 0 auto; padding: 20px 0 60px; }

.result-title { text-align: center; margin-bottom: 6px; }
.result-title h1 { font-size: 1.4rem; font-weight: 800; color: #1e293b; }
.result-title p  { color: #64748b; font-size: 0.9rem; }
.result-saved { text-align: center; color: #16a34a; font-weight: 600; margin: 6px 0 20px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.metric-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
}
.metric-card .mc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.metric-card .mc-value {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}
.metric-card .mc-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 6px;
  line-height: 1.4;
}

.qual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.qual-card { border-radius: 14px; padding: 20px 24px; color: #fff; }
.qual-card.qualified     { background: #16a34a; }
.qual-card.not-qualified { background: #dc2626; }
.qual-card .qc-label  { font-size: 0.8rem; font-weight: 700; opacity: .85; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.qual-card .qc-status { font-size: 1.5rem; font-weight: 800; }
.qual-card .qc-cutoff { font-size: 0.8rem; opacity: .8; margin-top: 4px; }

.accordion {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  user-select: none;
}
.accordion-header:hover { background: #f8fafc; }

/* Animated chevron — replaces plain ∨ text */
.accordion-header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  flex-shrink: 0;
  transition: background 0.2s;
}
.accordion-header:hover span { background: #e2e8f0; }
.accordion-header span::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s ease;
}
.accordion-body.open ~ * { display: none; }
.accordion-header.open span::before {
  transform: rotate(-135deg) translateY(-2px);
}

.accordion-body { display: none; padding: 16px 20px; border-top: 1px solid #f1f5f9; }
.accordion-body.open { display: block; }

.breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.breakdown-table th { text-align: left; padding: 8px 12px; background: #f8fafc; color: #475569; font-weight: 700; }
.breakdown-table td { padding: 8px 12px; border-top: 1px solid #f1f5f9; }

.diff-text { font-size: 0.92rem; line-height: 2; word-spacing: 2px; }
.diff-text .w-correct    { color: #1e293b; }
.diff-text .w-omission   { background: #fee2e2; color: #dc2626; border-radius: 3px; padding: 1px 3px; }
.diff-text .w-addition   { background: #fef9c3; color: #92400e; border-radius: 3px; padding: 1px 3px; }
.diff-text .w-full-error { background: #fee2e2; color: #dc2626; text-decoration: line-through; border-radius: 3px; padding: 1px 3px; }
.diff-text .w-half-error { background: #dbeafe; color: #1d4ed8; border-radius: 3px; padding: 1px 3px; }

.diff-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: 0.8rem; }
.dl-item { display: flex; align-items: center; gap: 5px; }
.dl-dot  { width: 12px; height: 12px; border-radius: 3px; }

.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.btn-action {
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  border: none;
  display: inline-block;
}
.btn-action.green { background: #16a34a; color: #fff; }
.btn-action.blue  { background: #2563eb; color: #fff; }
.btn-action.dark  { background: #1e293b; color: #fff; }
.btn-action:hover { opacity: .9; }


/* ----------------------------------------------------------
   test.html
   ---------------------------------------------------------- */
.test-wrap { max-width: 960px; margin: 0 auto; padding: 20px 0 40px; }

.timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border-radius: 12px;
  padding: 14px 24px;
  margin-bottom: 20px;
  color: #fff;
}
.timer-bar .exam-name    { font-size: 0.9rem; opacity: .7; }
.timer-bar .passage-name { font-weight: 700; font-size: 1rem; }

.timer-display {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: monospace;
  color: #4ade80;
  letter-spacing: 2px;
}
.timer-display.warning { color: #fbbf24; }
.timer-display.danger  { color: #f87171; }

.passage-box {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  font-size: 1.05rem;
  line-height: 1.9;
  color: #1e293b;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
  user-select: none;
}

.typing-area {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 20px;
  font-size: 1.05rem;
  line-height: 1.8;
  width: 100%;
  box-sizing: border-box;
  min-height: 160px;
  resize: none;
  font-family: inherit;
  color: #1e293b;
  outline: none;
  transition: border-color .2s;
}
.typing-area:focus    { border-color: #22c55e; }
.typing-area:disabled { opacity: .6; cursor: not-allowed; }

.live-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0; }
.stat-chip {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
}
.stat-chip span { color: #2563eb; font-size: 1rem; }

.btn-end {
  display: block;
  margin: 20px auto 0;
  background: #1e293b;
  color: #fff;
  border: 2px solid #1e293b;
  border-radius: 10px;
  padding: 12px 40px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  text-transform: uppercase;
  transition: background .2s;
}
.btn-end:hover { background: #0f172a; }

#end-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#end-overlay.show { display: flex; }

.overlay-box {
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  max-width: 360px;
}
.overlay-box h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.overlay-box p  { color: #64748b; margin-bottom: 20px; }
.overlay-box .spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ----------------------------------------------------------
   Utility classes replacing remaining inline styles
   ---------------------------------------------------------- */

/* exam_list.html */
.tt-empty { color: #64748b; }

/* history.html */
.history-heading { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.history-sub     { color: #64748b; font-size: 0.9rem; }
.history-view-link { color: #2563eb; font-weight: 600; font-size: 0.85rem; }
.history-empty   { text-align: center; color: #64748b; padding: 30px; }

/* passage_list.html */
.pl-empty { color: #64748b; margin-top: 24px; }

/* result.html */
.typed-text-output { color: #64748b; font-size: 0.9rem; line-height: 1.7; }

/* diff legend dot colour variants */
.dl-dot--omission { background: #fee2e2; }
.dl-dot--addition { background: #fef9c3; }
.dl-dot--half     { background: #dbeafe; }
.dl-dot--full     { background: #fee2e2; }
.btn-reattempt {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-reattempt:hover { background: #6d28d9; }

.btn-view-result {
  background: #0891b2;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-view-result:hover { background: #0e7490; }

.text-muted {
  color: #9ca3af;
  font-size: 1rem;
}

.pl-empty-lang {
  text-align: center;
  padding: 48px 20px;
  color: #64748b;
}
.pl-empty-lang span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}
.pl-empty-lang p {
  font-size: 1rem;
  color: #475569;
}

/* ── Exam Rules & WPM Notice ─────────────────────────────── */
.exam-rules-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.exam-rules-text { flex: 1; min-width: 200px; }

.exam-rules-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 8px;
}

.exam-rules-text p {
  font-size: 0.87rem;
  color: #475569;
  line-height: 1.7;
  margin: 0;
}

.exam-rules-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
  align-self: center;
}
.exam-rules-pdf-btn:hover { background: #0f172a; }

.exam-wpm-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  color: #1d4ed8;
  margin-bottom: 20px;
}

/* Rules box header row */
.exam-rules-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.exam-rules-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-rules-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid #dc2626;
  color: #dc2626;
  background: #fff;
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.exam-rules-pdf-btn:hover { background: #dc2626; color: #fff; }

.exam-rules-text p {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.75;
  margin: 0;
}
/* ═══════════════════════════════════════════════════════
   MOBILE — passage list, test & result pages
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Passage list header ── */
  .pl-header { gap: 14px; }
  .pl-header__logo img,
  .pl-header__icon { width: 64px; height: 64px; font-size: 1.8rem; }
  .pl-header__info h1 { font-size: 1.25rem; }
  .pl-header__info p  { font-size: 0.85rem; }

  /* Banners & rules */
  .pl-info-banner   { padding: 10px 14px; font-size: 0.82rem; }
  .exam-rules-header { flex-wrap: wrap; gap: 8px; }
  .exam-wpm-notice  { font-size: 0.82rem; line-height: 1.7; }

  /* ── Passage table: scroll sideways inside its card ── */
  .pl-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pl-table thead th { padding: 10px 12px; font-size: 0.72rem; }
  .pl-table tbody td { padding: 11px 12px; font-size: 0.84rem; }
  .btn-start, .btn-premium, .btn-attempt, .btn-login,
  .btn-reattempt, .btn-view-result {
    padding: 6px 14px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* ── Result page ── */
  .result-wrap { padding: 8px 0 40px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 14px; }
  .metric-card .mc-value { font-size: 1.4rem; }
  .qual-grid { grid-template-columns: 1fr; gap: 10px; }
  .qual-card { padding: 16px 18px; }
  .diff-text { font-size: 0.88rem; }

  /* ── Test page ── */
  .test-wrap { padding: 8px 0 24px; }
}

@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .pl-header__info h1 { font-size: 1.1rem; }
}
