:root {
  color-scheme: light;
  --bg: #f6efd9;
  --paper: #fffaf0;
  --paper-deep: #f2e4c4;
  --ink: #2a2218;
  --muted: #6d5f4e;
  --rule: #c9b98f;
  --blue: #355f8d;
  --green: #4f743d;
  --red: #9b3f33;
  --gold: #d7aa3c;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    linear-gradient(rgba(53, 95, 141, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 95, 141, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

.site-header,
main {
  width: min(1050px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  min-height: 28vh;
  display: flex;
  align-items: center;
  padding: 48px 0 30px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: 5rem;
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.55;
}

.plain-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  margin-top: 18px;
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 22px;
  padding: 24px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--paper-deep);
}

.intro-panel h2,
.answer-key h2 {
  margin: 0 0 10px;
  font-size: 1.75rem;
}

.intro-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 1.07rem;
  line-height: 1.55;
}

.section-label {
  margin: 0 0 8px;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.study-steps {
  margin: 0;
  padding: 18px 18px 18px 38px;
  border-left: 5px solid var(--green);
  color: var(--ink);
  background: #f7f1dc;
  line-height: 1.55;
}

.reference-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.reference-strip article {
  padding: 18px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: #fffdf7;
}

.reference-strip h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

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

.lesson-list {
  display: grid;
  gap: 18px;
  padding-bottom: 56px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 18px;
  padding: 24px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--paper-deep);
}

.lesson-card__number {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  background: #f7f1dc;
}

.lesson-card h2,
.game-card h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  letter-spacing: 0;
}

.lesson-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}

.lesson-card h3 {
  margin: 0 0 10px;
  font: 700 1rem Arial, Helvetica, sans-serif;
  color: var(--green);
}

.rule-list {
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.worked-grid,
.times-table,
.operation-clues {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.worked-grid div,
.times-table div,
.operation-clues div {
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fffdf7;
}

.worked-grid strong,
.operation-clues strong {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
}

.worked-grid span,
.operation-clues span {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.times-table {
  grid-template-columns: repeat(4, 1fr);
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.example-box {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 5px solid var(--gold);
  background: #f9edc9;
}

.example-box p + p {
  margin-top: 8px;
}

.lesson-card .try-it {
  color: var(--ink);
}

.note-line {
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fffdf7;
}

.practice-box {
  margin-top: 16px;
  padding: 16px;
  border: 2px dashed var(--rule);
  border-radius: 8px;
  background: #fffdf7;
}

.practice-box ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 18px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.45;
}

.fraction-model {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 320px);
  min-height: 54px;
  margin-top: 16px;
  border: 2px solid var(--green);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf7;
}

.fraction-model span {
  border-right: 2px solid var(--green);
}

.fraction-model span:last-child {
  border-right: 0;
}

.fraction-model .filled {
  background: #c9dda9;
}

.measure-table {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.measure-table div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fffdf7;
}

.measure-table strong {
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
}

.measure-table span {
  color: var(--muted);
}

.shape-demo {
  margin-top: 16px;
}

.shape-box {
  position: relative;
  width: 220px;
  height: 90px;
  border: 3px solid var(--blue);
  background: #dbe7f3;
}

.shape-label {
  position: absolute;
  padding: 2px 6px;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--paper);
}

.shape-label.top {
  top: -14px;
  left: 86px;
}

.shape-label.side {
  top: 32px;
  right: -44px;
}

.operation-clues {
  grid-template-columns: repeat(2, 1fr);
}

.answer-key {
  margin-bottom: 58px;
  padding: 24px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--paper-deep);
}

.answer-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.answer-columns ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.password-panel {
  max-width: 560px;
  margin-bottom: 30px;
  padding: 24px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--paper-deep);
}

.password-panel h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.password-panel label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.password-row {
  display: flex;
  gap: 10px;
}

.password-row input {
  min-width: 0;
  flex: 1;
  min-height: 42px;
  padding: 8px 10px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  font: 1rem Arial, Helvetica, sans-serif;
  background: #fffdf7;
}

.password-row button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  color: #fffaf0;
  background: var(--blue);
  font: 700 1rem Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.password-row button:hover {
  background: #294a70;
}

.password-message {
  min-height: 1.3em;
  margin: 12px 0 0;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.games-locked .game-grid {
  display: none;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
  padding-bottom: 48px;
}

.game-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 22px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--paper-deep);
}

.game-card__description {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.game-card__link {
  display: inline-flex;
  width: fit-content;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  color: #fffaf0;
  background: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-decoration: none;
}

.game-card__link:hover {
  background: #294a70;
}

@media (max-width: 620px) {
  h1 {
    font-size: 2.45rem;
  }

  .intro-panel,
  .reference-strip,
  .worked-grid,
  .times-table,
  .operation-clues,
  .answer-columns {
    grid-template-columns: 1fr;
  }

  .lesson-card {
    grid-template-columns: 1fr;
  }

  .site-header {
    min-height: 0;
  }

  .password-row {
    flex-direction: column;
  }

  .practice-box ol {
    grid-template-columns: 1fr;
  }

  .measure-table div {
    grid-template-columns: 1fr;
  }

  .shape-box {
    width: 190px;
  }
}
