* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #74ebd5 0%, #9face6 100%);
  margin: 0;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 { font-weight: 600; }

.quiz-overview {
  width: 100%;
  max-width: 900px;
  margin: 28px auto 0;
  padding: 0 20px;
}

.overview-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 6px 18px rgba(15,23,42,.06);
  color: #374151;
}

.overview-card h2 { margin: 0 0 12px; font-size: 1.35rem; color: #111827; }
.overview-card p { margin: 0 0 12px; line-height: 1.7; }
.overview-card p:last-child { margin-bottom: 0; }
.overview-card a { color: #2563eb; font-weight: 700; text-decoration: underline; }

.quiz-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.card {
  width: 100%;
  max-width: 700px;
  background: #fff;
  border-radius: 24px;
  padding: 35px;
  box-shadow: 0 20px 50px rgba(0,0,0,.1);
}

h1 {
  text-align: center;
  font-size: 26px;
  color: #2c3e50;
  margin: 0 0 8px;
}

.instruction {
  text-align: center;
  color: #718096;
  font-size: 14px;
  margin-bottom: 25px;
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.instruction-label {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}


.start-screen { text-align: center; }
.length-picker {
  border: 0;
  margin: 24px 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.length-picker legend {
  width: 100%;
  margin-bottom: 12px;
  color: #374151;
  font-weight: 700;
}
.length-option {
  position: relative;
  cursor: pointer;
}
.length-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.length-option span {
  display: block;
  min-height: 92px;
  padding: 16px 12px;
  border: 2px solid #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.length-option strong {
  display: block;
  color: #1d4ed8;
  font-size: 1rem;
}
.length-option small {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: .78rem;
}
.length-option:hover span {
  border-color: #93c5fd;
  transform: translateY(-1px);
}
.length-option.selected span,
.length-option:has(input:checked) span {
  border-color: #4f46e5;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}

.fast-track-option {
  margin: 0 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  color: #374151;
}
.fast-track-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.fast-track-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  transition: .18s ease;
}
.fast-track-option strong { display:block; font-size:.9rem; }
.fast-track-option small { display:block; margin-top:2px; font-size:.72rem; color:#6b7280; }
.fast-track-option:has(input:checked) .fast-track-icon {
  background:#eef2ff; border-color:#6366f1; color:#4f46e5;
}
.fast-track-option:has(input:focus-visible) .fast-track-icon {
  outline:3px solid rgba(79,70,229,.2); outline-offset:2px;
}
.quiz-intro-copy {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: .78rem;
  line-height: 1.5;
  text-align: center;
}

.start-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 15px 18px;
  background: #4f46e5;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.start-btn:hover { background: #4338ca; }

.stats {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 15px;
  padding: 10px 20px;
  background: #f8f9fa;
  border-radius: 12px;
}
#good { color: #15803d; }
#bad { color: #b91c1c; }

.progress-container {
  width: 100%;
  background: #e5e7eb;
  border-radius: 10px;
  margin-bottom: 25px;
  height: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6a11cb, #2575fc);
  width: 0;
  transition: width .4s ease;
}

.question-block {
  background: #fff7f7;
  border: 2px solid #fecaca;
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  margin-bottom: 22px;
}
.question-direction {
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .13em;
  margin-bottom: 8px;
}
#q {
  font-size: clamp(2rem, 7vw, 2.75rem);
  line-height: 1.1;
  margin: 0;
  color: #991b1b;
  font-weight: 700;
}
.btn {
  display: block;
  width: 100%;
  padding: 15px 16px;
  margin: 10px 0;
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  font-size: 17px;
  font-family: inherit;
  font-weight: 700;
  color: #1d4ed8;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-2px);
}
.btn.correct { background: #15803d !important; border-color: #15803d !important; color: #fff !important; }
.btn.wrong { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
.btn:disabled { cursor: default; opacity: .92; }

.feedback {
  margin-top: 18px;
  min-height: 0;
}
.feedback-card {
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  line-height: 1.55;
}
.feedback-card.correct { background: #f0fdf4; border: 1px solid #bbf7d0; }
.feedback-card.wrong { background: #fff7ed; border: 1px solid #fed7aa; }
.feedback-title { font-weight: 700; margin-bottom: 10px; }
.feedback-card.correct .feedback-title { color: #166534; }
.feedback-card.wrong .feedback-title { color: #9a3412; }
.word-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.word-side { min-width: 0; }
.word-side strong { display: block; font-size: 1.08rem; color: #111827; }
.word-side span { display: block; color: #6b7280; font-size: .84rem; margin-top: 2px; }
.pair-arrow { color: #7c3aed; font-weight: 700; font-size: 1.2rem; }
.usage-note { margin: 12px 0 0; color: #4b5563; font-size: .86rem; }

.next-btn, .restart-btn, .save-score-btn {
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.next-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px 18px;
  background: #4f46e5;
  color: #fff;
  font-size: 16px;
}
.next-btn:hover { background: #4338ca; }

.finish-screen { text-align: center; }
.finish-screen h2 { font-size: 34px; color: #6a11cb; margin-bottom: 6px; }
.final-score { font-size: 24px; color: #333; margin: 10px 0 25px; }
.leaderboard-card {
  background: #f8f9fa;
  padding: 25px 20px;
  border-radius: 16px;
  margin-bottom: 25px;
  text-align: left;
  border: 1px solid #e2e8f0;
}
.leaderboard-card > p { margin-top: 0; font-weight: 600; font-size: 14px; text-align: center; color: #4a5568; }
.score-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 15px; }
#player-name { padding: 12px 15px; border-radius: 10px; border: 2px solid #cbd5e0; font-family: inherit; width: 100%; max-width: 260px; outline: none; font-size: 14px; }
.save-score-btn { background: #2c3e50; color: #fff; padding: 12px 25px; }
#save-msg { text-align: center; margin-top: 15px; font-size: 14px; }
.leaderboard-card h3 { text-align: center; margin-top: 30px; font-size: 18px; color: #2d3748; }
#leaderboard-list { font-size: 15px; line-height: 1.6; color: #4a5568; padding-left: 24px; margin: 15px 0 0; }
.restart-btn { background: #6a11cb; color: #fff; padding: 12px 30px; font-size: 18px; margin-top: 10px; }
.restart-btn:hover { background: #5a0eb0; }

@media (max-width: 640px) {
  .quiz-overview { margin-top: 18px; padding: 0 14px; }
  .overview-card { padding: 18px; }
  .quiz-main { padding: 14px; align-items: flex-start; }
  .card { padding: 22px 16px; border-radius: 18px; }
  .stats { padding: 10px 12px; }
  .length-picker { grid-template-columns: 1fr; }
  .length-option span { min-height: 0; }
  .word-pair { grid-template-columns: 1fr; text-align: center; }
  .pair-arrow { transform: rotate(90deg); }
}
