:root {
  --bg: #f4f6f9;
  --panel-bg: #ffffff;
  --text: #1c2530;
  --muted: #6b7685;
  --border: #e2e6ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-contrast: #ffffff;
  --correct: #15803d;
  --correct-bg: #e9f9ee;
  --wrong: #b91c1c;
  --wrong-bg: #fdecec;
  --badge-bio: #0f766e;
  --badge-bio-bg: #e3f7f4;
  --badge-fyz: #7c3aed;
  --badge-fyz-bg: #f1e9fe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
}

.set-menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.set-menu button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.set-menu button:hover {
  border-color: var(--primary);
}

.set-menu button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
  font-weight: 600;
}

/* ---------- Layout ---------- */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.muted { color: var(--muted); }

h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0; }

/* ---------- Intro ---------- */
#intro-panel p { margin: 10px 0; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); }

/* ---------- Quiz ---------- */
.quiz-head {
  margin-bottom: 18px;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.biologie { color: var(--badge-bio); background: var(--badge-bio-bg); }
.badge.fyzika { color: var(--badge-fyz); background: var(--badge-fyz-bg); }

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.jump-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.jump-grid button {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.jump-grid button.current {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.jump-grid button.answered-correct {
  background: var(--correct-bg);
  color: var(--correct);
  border-color: var(--correct-bg);
}

.jump-grid button.answered-wrong {
  background: var(--wrong-bg);
  color: var(--wrong);
  border-color: var(--wrong-bg);
}

.question-text {
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 1.1rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  cursor: pointer;
  font-size: 0.96rem;
  transition: border-color 0.15s, background 0.15s;
}

.option:hover:not(.disabled) {
  border-color: var(--primary);
}

.option.disabled {
  cursor: default;
}

.option .option-marker {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.option.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}
.option.correct .option-marker {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}

.option.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
}
.option.wrong .option-marker {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
}

.explanation-box {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.verdict {
  font-weight: 700;
  margin-bottom: 6px;
}
.verdict.correct { color: var(--correct); }
.verdict.wrong { color: var(--wrong); }

.explanation-text {
  font-size: 0.92rem;
  color: var(--text);
}

.nav-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---------- Result ---------- */
.result-summary {
  font-size: 1.1rem;
}

.score-ring {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  margin: 10px 0 20px;
}

.result-breakdown {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.result-stat {
  flex: 1 1 140px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.result-stat .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.result-stat .stat-label {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
}

@media (max-width: 520px) {
  .panel { padding: 18px; }
  .nav-buttons { flex-wrap: wrap; }
  .nav-buttons .btn { flex: 1 1 auto; }
}
