:root {
  --bg1: #eef2ff;
  --bg2: #cffafe;
  --card: rgba(255, 255, 255, 0.92);
  --text: #172033;
  --muted: #5f6b85;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --good: #15803d;
  --bad: #b91c1c;
  --shadow: 0 20px 60px rgba(31, 41, 55, 0.20);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.app { width: min(100%, 520px); }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.screen { display: none; }
.screen.active { display: block; }

.hero {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 24px;
  background: white;
  font-size: 42px;
}

h1, h2, p { margin-top: 0; }
h1 { text-align: center; font-size: clamp(2rem, 9vw, 3rem); line-height: 1; margin-bottom: 14px; }
.lead { color: var(--muted); text-align: center; font-size: 1.05rem; line-height: 1.45; }

.levels {
  border: 0;
  padding: 0;
  margin: 22px 0;
  display: grid;
  gap: 12px;
}

.levels legend {
  font-weight: 800;
  margin-bottom: 8px;
}

.levels label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #fff;
  font-size: 1.08rem;
  font-weight: 750;
}

.levels label:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.levels input { width: 24px; height: 24px; }
.levels span { margin-left: auto; color: var(--muted); font-weight: 650; }

button {
  border: 0;
  border-radius: 18px;
  min-height: 58px;
  padding: 14px 18px;
  width: 100%;
  font-size: 1.12rem;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.primary { background: var(--primary); color: white; }
.primary:active { background: var(--primary-dark); transform: translateY(1px); }
.secondary { margin-top: 12px; background: white; color: var(--primary); }

.topbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.topbar div {
  background: white;
  border-radius: 18px;
  padding: 12px 8px;
  text-align: center;
}

.topbar strong { display: block; font-size: 1.5rem; }
.topbar span { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 750; text-transform: uppercase; }

.question {
  text-align: center;
  padding: 14px 8px 18px;
}

.question p { color: var(--muted); margin-bottom: 6px; }
.question h2 { font-size: clamp(2.1rem, 11vw, 3.8rem); line-height: 1; margin-bottom: 0; }

.answers {
  display: grid;
  gap: 12px;
}

.answer {
  background: white;
  color: var(--text);
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(31, 41, 55, 0.08);
}

.answer:focus-visible { outline: 4px solid rgba(79, 70, 229, 0.35); }
.answer.correct { border-color: var(--good); color: var(--good); }
.answer.wrong { border-color: var(--bad); color: var(--bad); }
.answer:disabled { opacity: 0.85; }

.feedback {
  min-height: 28px;
  margin: 14px 0 0;
  text-align: center;
  font-weight: 850;
}
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

@media (max-width: 380px) {
  .card { padding: 18px; border-radius: 22px; }
  .answer, button { min-height: 54px; }
}

.danger {
  margin-top: 14px;
  background: #fee2e2;
  color: var(--bad);
}

.stats-content {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.stat-card {
  background: white;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(31, 41, 55, 0.08);
}

.stat-card h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-grid div {
  background: var(--bg1);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
}

.stat-grid strong {
  display: block;
  font-size: 1.2rem;
}

.stat-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  padding: 8px 4px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.empty, .hint {
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.small {
  font-size: 0.95rem;
  margin-bottom: 0;
}

.hint {
  font-size: 0.9rem;
  margin: 10px 0 0;
}
