:root {
  --red: #d21e2c;
  --blue: #1e3a8a;
  --ink: #1a202c;
  --muted: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.flag {
  width: 64px;
  height: 32px;
  border-radius: 5px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: var(--shadow);
  display: block;
}
h1 {
  font-size: 1.4rem;
  margin: 0;
  line-height: 1.2;
}
h1 span { color: var(--red); }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; }

.rules {
  padding-left: 20px;
  color: var(--muted);
}
.rules strong { color: var(--ink); }

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(210, 30, 44, 0.3);
}
.btn-primary:hover { background: #b91826; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* Progress */
.progress { margin-bottom: 20px; }
.progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--red);
  border-radius: 99px;
  transition: width 0.25s ease;
}
.progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Questions */
.q {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.q-num {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red);
  background: #fdeaec;
  border-radius: 99px;
  padding: 3px 12px;
  margin-bottom: 10px;
}
.q-text {
  font-weight: 600;
  margin: 0 0 16px;
}

/* Choice options */
.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.option:hover { border-color: #cbd5e1; }
.option input { margin-top: 3px; accent-color: var(--red); }
.option.selected { border-color: var(--red); background: #fdf5f5; }
.option .letter { font-weight: 700; color: var(--muted); }

/* Fill inputs */
.blanks { display: grid; gap: 12px; }
.blank-field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.blank-field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.blank-field input:focus {
  outline: none;
  border-color: var(--blue);
}

/* Quiz actions */
.quiz-actions { text-align: center; margin-top: 8px; }
.hint { color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

/* Result */
.result-summary { text-align: center; }
.score-big {
  font-size: 3rem;
  font-weight: 800;
  margin: 4px 0;
}
.badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 99px;
  font-weight: 700;
  margin-top: 8px;
}
.badge.pass { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }

.review-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
  border-left: 6px solid var(--line);
}
.review-item.correct { border-left-color: var(--ok); }
.review-item.incorrect { border-left-color: var(--bad); }
.review-status {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.review-item.correct .review-status { color: var(--ok); }
.review-item.incorrect .review-status { color: var(--bad); }
.review-q { font-weight: 600; margin: 0 0 12px; }
.answer-row { margin: 4px 0; font-size: 0.95rem; }
.answer-row .k { color: var(--muted); }
.answer-row .your.bad { color: var(--bad); }
.answer-row .correct-ans { color: var(--ok); font-weight: 600; }

.app-footer {
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 520px) {
  h1 { font-size: 1.15rem; }
  .score-big { font-size: 2.4rem; }
}
