:root {
  --ink: #1d2733;
  --muted: #637083;
  --page: #f6f8fb;
  --panel: #ffffff;
  --line: #dce3ed;
  --blue: #2864d8;
  --teal: #07847f;
  --amber: #d88a14;
  --pink: #c84f7a;
  --violet: #7057c8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 20px;
  padding: 30px clamp(18px, 4vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  max-width: 920px;
  margin: 8px 0 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

.progress-ring {
  width: 118px;
  height: 118px;
  align-self: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 10px solid #cfe8e6;
  box-shadow: inset 0 0 0 1px var(--line);
  background: #ffffff;
}

.progress-ring span {
  font-size: 32px;
  font-weight: 850;
  line-height: 1;
}

.progress-ring small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 44px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
}

.topic-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.topic-list button,
#run-lab,
.answers button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 780;
}

.topic-list button.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.coach {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.explain,
.lab,
.quiz {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 24px rgba(40, 52, 72, 0.08);
}

.explain,
.quiz {
  padding: 18px;
}

.explain {
  min-height: 260px;
}

.explain h2,
.lab h2,
.quiz h2 {
  margin: 10px 0;
  font-size: 25px;
  letter-spacing: 0;
}

.explain p,
.lab p,
.feedback {
  color: var(--muted);
  line-height: 1.6;
}

.formula {
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #cfe8e6;
  background: #f1fbfa;
  color: #0f5753;
  font-size: 22px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.lab {
  grid-row: span 2;
  padding: 18px;
}

.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#run-lab {
  min-width: 96px;
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

canvas {
  width: 100%;
  height: 260px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

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

.answers button {
  text-align: left;
  padding: 0 12px;
}

.answers button.correct {
  border-color: #2f9d62;
  background: #eefaf2;
}

.answers button.wrong {
  border-color: var(--pink);
  background: #fff0f5;
}

@media (max-width: 900px) {
  .masthead,
  .layout,
  .coach {
    grid-template-columns: 1fr;
  }

  .topic-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .progress-ring {
    width: 102px;
    height: 102px;
  }
}

@media (max-width: 560px) {
  .topic-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
