:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #5d6a64;
  --paper: #f8faf7;
  --panel: #ffffff;
  --line: #d9e2db;
  --green: #2d7d5a;
  --green-dark: #1e5f42;
  --mint: #dff4e8;
  --yellow: #ffe6a3;
  --blue: #dceeff;
  --red: #b43d3d;
  --shadow: 0 18px 38px rgba(42, 67, 55, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(223, 244, 232, 0.85), rgba(248, 250, 247, 0.6) 340px),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 18px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.intro,
.result-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro h2,
.result-panel h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.intro p,
.result-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  background: var(--green);
  color: white;
}

.primary:hover {
  background: var(--green-dark);
}

.secondary {
  background: var(--mint);
  color: var(--green-dark);
}

.score-pill {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
}

.progress-wrap {
  height: 12px;
  margin: 18px 0;
  background: #e9efe9;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

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

.quiz {
  display: grid;
  gap: 16px;
}

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

.question.correct {
  border-color: #77bf95;
  background: #fbfffc;
}

.question.wrong {
  border-color: #e3a1a1;
  background: #fffafa;
}

.question-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: start;
}

.number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 800;
}

.question h3 {
  margin-bottom: 14px;
  font-size: 1.08rem;
  line-height: 1.4;
}

.marks {
  color: var(--green-dark);
  font-weight: 800;
}

.question-body {
  margin-left: 56px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

input,
select {
  min-height: 42px;
  border: 1px solid #b9c8bf;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input[type="number"] {
  width: 140px;
}

.wide-input {
  width: min(100%, 560px);
}

.mini-input {
  width: 90px;
}

.table {
  width: min(100%, 620px);
  border-collapse: collapse;
  margin: 12px 0;
  background: #fff;
}

.table th,
.table td {
  border: 1px solid #afbbb4;
  padding: 10px;
  text-align: left;
}

.table th {
  background: var(--mint);
}

.place-value {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  width: min(100%, 430px);
  border: 1px solid #9aaba1;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.place-value div {
  min-height: 72px;
  display: grid;
  place-items: center;
  border-right: 1px solid #9aaba1;
  text-align: center;
}

.place-value div:last-child {
  border-right: 0;
}

.place-value strong {
  display: block;
  color: var(--green-dark);
  font-size: 1.6rem;
}

.hundred-grid {
  display: grid;
  grid-template-columns: repeat(10, 24px);
  gap: 2px;
  margin: 12px 0;
}

.hundred-grid button {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #9baaa1;
}

.hundred-grid button.on {
  background: var(--yellow);
}

.shape-board {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
}

.shape {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.shape.circle {
  border-radius: 50%;
  background: #4f7ecf;
}

.shape.triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-bottom: 46px solid #d89436;
}

.shape.star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
  background: #8159b9;
}

.fraction-row {
  display: grid;
  grid-template-columns: 110px 90px 90px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.feedback {
  margin: 12px 0 0 56px;
  color: var(--muted);
  font-weight: 700;
}

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

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .topbar,
  .intro,
  .result-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button,
  .result-panel button {
    width: 100%;
  }

  .question-head {
    grid-template-columns: 38px 1fr;
  }

  .marks {
    grid-column: 2;
  }

  .question-body,
  .feedback {
    margin-left: 0;
  }

  .hundred-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .hundred-grid button {
    width: 100%;
  }
}
