:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #607086;
  --line: #d9e0ea;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --success: #1f8a4c;
  --warning: #b26a00;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(28, 45, 74, 0.12);
}

* {
  box-sizing: border-box;
}

body.practice-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  background: #e8eef8;
  color: var(--ink);
}

.secondary:hover {
  background: #d7e1f1;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.danger:hover {
  background: #8f1d14;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:hover,
.ghost.active {
  background: #fff3d9;
  border-color: #e4ae39;
}

.practice-body .shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-panel,
.result-panel {
  display: grid;
  gap: 24px;
  padding: 32px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 2.1rem;
  margin-bottom: 10px;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stats-grid span {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
}

.stats-grid label {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
  margin-top: 4px;
}

.setup-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: 150px 150px minmax(260px, 1fr) auto;
}

.setup-form label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  padding: 0.75rem;
  width: 100%;
}

.research-note {
  background: #f0f5ff;
  border: 1px solid #cfdbf4;
  border-radius: 8px;
  color: #30415f;
  line-height: 1.5;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.test-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 300px minmax(0, 1fr);
}

.side-panel {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  padding: 20px;
  position: sticky;
  top: 24px;
}

.timer span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.timer label,
.progress-row {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bar {
  background: #e7edf6;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.bar div {
  background: var(--accent);
  height: 100%;
  width: 0%;
}

.palette {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, 1fr);
}

.palette button {
  background: #f3f6fb;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.55rem 0;
}

.palette button.current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.palette button.answered {
  background: #e8f7ee;
  border-color: #92d4ab;
}

.palette button.flagged::after {
  content: "!";
  color: var(--warning);
  font-weight: 900;
  margin-left: 2px;
}

.question-panel {
  min-height: 520px;
  padding: 28px;
}

.question-meta {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

#courseLabel {
  color: var(--muted);
  font-weight: 700;
}

#questionText {
  font-size: 1.45rem;
  line-height: 1.35;
  margin-bottom: 22px;
}

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

.option {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 32px 1fr;
  padding: 16px;
}

.option:hover {
  border-color: #9ab6dc;
}

.option.selected {
  background: #fff;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px rgba(31, 111, 235, 0.12);
  color: var(--ink);
}

.option.selected .letter {
  background: var(--accent);
  color: #fff;
}

.letter {
  align-items: center;
  background: #edf2f9;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.question-actions,
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
}

.result-panel {
  margin-bottom: 20px;
}

.result-panel h1 {
  font-size: 3rem;
  margin-bottom: 0;
}

.review-list {
  display: grid;
  gap: 14px;
}

.review-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.review-card.correct {
  border-left: 6px solid var(--success);
}

.review-card.missed {
  border-left: 6px solid var(--danger);
}

.review-card h3 {
  line-height: 1.4;
  margin: 0 0 12px;
}

.review-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 8px;
}

.review-card a {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 860px) {
  .stats-grid,
  .setup-form,
  .test-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .question-actions,
  .result-actions {
    flex-direction: column;
  }
}
