:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5a6675;
  --line: #d7dee8;
  --soft: #f6f8fb;
  --paper: #ffffff;
  --blue: #2463eb;
  --green: #16805a;
  --red: #c2413a;
  --yellow: #f7c948;
  --teal: #0f766e;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(36, 99, 235, 0.12), rgba(22, 128, 90, 0.10)),
    var(--soft);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: center;
  min-height: 230px;
  padding: 30px;
  color: white;
  background:
    linear-gradient(rgba(13, 32, 63, 0.50), rgba(13, 32, 63, 0.58)),
    url("https://images.unsplash.com/photo-1509062522246-3755977927d7?auto=format&fit=crop&w=1600&q=80") center/cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 1.02;
}

.hero-copy {
  max-width: 620px;
  margin: 16px 0 0;
  font-size: 1.08rem;
  line-height: 1.55;
}

.score-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: center;
  min-height: 140px;
  padding: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
}

.score-card span {
  color: var(--muted);
  font-weight: 700;
}

.score-card strong {
  font-size: 2.2rem;
}

.student-panel,
.share-panel,
.toolbar,
.result-panel {
  margin-top: 18px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.share-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
}

.share-panel h2 {
  margin: 0 0 5px;
  font-size: 1.1rem;
}

.share-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.share-panel span {
  min-width: 86px;
  color: var(--green);
  font-weight: 700;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus {
  outline: 3px solid rgba(36, 99, 235, 0.22);
  border-color: var(--blue);
}

.student-panel button,
.share-panel button,
.result-panel button,
.check {
  min-height: 46px;
  padding: 0 18px;
  color: white;
  background: var(--blue);
  border-radius: 8px;
  font-weight: 700;
}

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

.tab {
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: #eef2f7;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}

.tab.active {
  color: white;
  background: var(--teal);
}

.question-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.question-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 700;
}

.topic {
  color: var(--muted);
  font-weight: 700;
}

.prompt {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.5;
}

.visual {
  margin-top: 14px;
}

.number-card,
.sequence,
.fraction-card,
.data-table {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  min-width: 76px;
  padding: 12px 14px;
  text-align: center;
  background: #fff7df;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  font-weight: 800;
}

.fraction {
  display: inline-grid;
  grid-template-rows: auto 2px auto;
  min-width: 34px;
  margin: 0 3px;
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
}

.fraction .bar {
  background: currentColor;
}

.data-table {
  display: grid;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.data-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
}

.data-row span {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.data-row:last-child span {
  border-bottom: 0;
}

.data-row span:first-child {
  background: #eef7f5;
  font-weight: 700;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  line-height: 1.55;
}

.feedback.correct {
  background: #eaf7f1;
  border: 1px solid rgba(22, 128, 90, 0.28);
}

.feedback.wrong {
  background: #fff0ef;
  border: 1px solid rgba(194, 65, 58, 0.28);
}

.feedback strong {
  display: block;
  margin-bottom: 8px;
}

.feedback ol {
  margin: 8px 0 0 22px;
  padding: 0;
}

.feedback li {
  margin: 4px 0;
}

.result-panel h2 {
  margin: 0 0 8px;
}

.result-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .hero,
  .student-panel,
  .share-panel,
  .answer-row {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 22px;
  }

  .score-card {
    min-height: 100px;
    justify-items: start;
  }

  .student-panel button,
  .share-panel button,
  .check {
    width: 100%;
  }

  .data-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .toolbar,
  .student-panel button,
  .result-panel button {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .hero,
  .question-card,
  .student-panel,
  .result-panel {
    box-shadow: none;
    break-inside: avoid;
  }
}
