/* Общее */
:root {
  --bg: #12141a;
  --card: #1b1f29;
  --card2: #232837;
  --text: #e8ecf3;
  --muted: #98a2b3;
  --accent: #f5a524;
  --accent2: #ff7a00;
  --good: #2ecc71;
  --bad: #e74c3c;
  --line: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px 300px at 15% -10%, rgba(245,165,36,0.18), transparent 60%),
    radial-gradient(600px 400px at 110% 110%, rgba(52,152,219,0.16), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 720px;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

/* Экраны */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

/* Старт */
.start-card { text-align: center; }
.logo {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 8px;
}
.logo span { color: var(--accent); }
.start-card h1 {
  font-size: 28px;
  line-height: 1.25;
  margin-bottom: 14px;
}
.accent { color: var(--accent); }
.subtitle {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 26px;
  font-size: 15px;
}

.btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-main {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a1205;
  font-size: 18px;
  padding: 14px 42px;
  box-shadow: 0 8px 24px rgba(245,165,36,0.28);
}
.btn-main:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-main:active { transform: translateY(0); }

.rules {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.rule {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
}
.rule b { color: var(--text); }

/* Квиз */
.quiz-top {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}
.progress-label { font-weight: 700; color: var(--text); }
.score-label span { color: var(--accent); font-weight: 800; }

.progress-track {
  height: 8px;
  background: var(--card2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 22px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.question-topic {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(245,165,36,0.12);
  border: 1px solid rgba(245,165,36,0.25);
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.question-text {
  font-size: 22px;
  line-height: 1.4;
  margin-bottom: 22px;
  min-height: 60px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}
.answer:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateX(4px);
}
.answer .letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  border-radius: 7px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
}
.answer.correct {
  background: rgba(46,204,113,0.15);
  border-color: var(--good);
}
.answer.correct .letter { background: var(--good); color: #08210f; }
.answer.wrong {
  background: rgba(231,76,60,0.15);
  border-color: var(--bad);
}
.answer.wrong .letter { background: var(--bad); color: #fff; }
.answer:disabled { cursor: default; }

.feedback {
  margin-top: 18px;
  min-height: 24px;
  font-weight: 700;
  font-size: 15px;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.25s ease;
}
.feedback.good, .feedback.bad { opacity: 1; transform: none; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

/* Результаты */
.result-card { text-align: center; }
.result-card h2 { font-size: 24px; margin-bottom: 18px; }

.result-ring {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 14px;
}
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: var(--card2);
  stroke-width: 11;
}
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.9s ease;
}
.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
}

.verdict {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 22px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 6px;
}
.stat-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}
.stat-name {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.topics-block {
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 24px;
}
.topics-block h3 {
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.topic-row {
  display: grid;
  grid-template-columns: 130px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
}
.topic-name { color: var(--text); }
.topic-track {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}
.topic-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--good), #27ae60);
  border-radius: 99px;
  transition: width 0.7s ease;
}
.topic-pct {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .card { padding: 24px 16px; }
  .question-text { font-size: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-row { grid-template-columns: 100px 1fr 42px; font-size: 13px; }
}
