.lessons-page { background: #f6eef9; }
.lessons-page main { padding-bottom: 32px; }
.lessons-page h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}
.catalog-intro { margin: 10px 0 22px; color: var(--muted); }
.lesson-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}
.lesson-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fffdfa;
}
.lesson-card.area { --lesson-button: #286448; --lesson-shadow: #15432e; }
.lesson-card.fractions { --lesson-button: #672bb0; --lesson-shadow: #471c83; }
.lesson-card.ratios { --lesson-button: #276c67; --lesson-shadow: #164842; }
.lesson-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.area .lesson-art { object-position: center 19%; }
.fractions .lesson-art { object-position: center 65%; }
.ratios .lesson-art { object-position: center top; }
.lesson-content { padding: 14px 16px 12px; }
.lesson-content h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); margin: 4px 0 7px; letter-spacing: -.035em; }
.lesson-content p { margin: 0 0 12px; }
.lesson-content .lesson-grade { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 700; }
.lesson-play {
  display: grid;
  place-items: center;
  margin: 0 0 12px;
  background: var(--lesson-button);
  box-shadow: 0 4px 0 var(--lesson-shadow);
  text-decoration: none;
}
.lesson-play:hover { background: var(--lesson-button); filter: brightness(1.08); }
.lesson-content summary,
.lesson-material {
  min-height: 44px;
  padding: 10px 0;
  font-size: .93rem;
  color: #54288a;
  font-weight: 700;
}
.lesson-content summary { cursor: pointer; }
.lesson-material { display: block; text-underline-offset: .16em; }
.lesson-content video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #211628; }
@media (max-width: 760px) {
  .lesson-cards { grid-template-columns: 1fr; }
}

.topic-page { max-width: 760px; margin-inline: auto; }
.topic-back { display: inline-block; min-height: 44px; color: #54288a; font-weight: 700; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.topic-actions > a { flex: 1 1 145px; min-height: 49px; }
.topic-actions .lesson-play { margin: 0; background: #672bb0; box-shadow: 0 4px 0 #471c83; }
.topic-watch { display: grid; place-items: center; border: 1px solid #d7c2eb; border-radius: 14px; padding: 8px; background: #fff; color: #54288a; font-weight: 700; }
.topic-section { padding: clamp(12px, 3vw, 24px); border: 1px solid var(--border); border-radius: 20px; background: #fffdfa; margin-bottom: 14px; scroll-margin-top: 12px; }
.topic-section h2 { font-size: 1.55rem; margin: 0 0 12px; }
.topic-section video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #211628; border-radius: 12px; }
.topic-section summary { min-height: 44px; padding-block: 10px; cursor: pointer; color: #54288a; font-weight: 700; }
.topic-section a { color: #54288a; }

#topic-notes,
#topic-tasks,
#topic-answers {
  max-inline-size: 62ch;
  font-size: clamp(1.1875rem, 4.8vw, 1.3125rem);
  line-height: 1.6;
}
#topic-notes p + p { margin-block-start: .9em; }
#topic-tasks,
#topic-answers {
  margin-block: .6em 1em;
  padding-inline-start: 1.5em;
}
#topic-tasks li,
#topic-answers li { padding-inline-start: .2em; }
#topic-tasks li + li,
#topic-answers li + li { margin-block-start: .75em; }
#topic-tasks li::marker,
#topic-answers li::marker { color: #54288a; font-weight: 700; }

.topic-diagrams { display: flex; flex-wrap: wrap; gap: 18px; margin-block: 14px; }
.topic-section figure { margin: 0; }
.topic-section li figure { margin-block: 8px; }
.topic-section figcaption { max-width: 240px; margin-top: 6px; font-size: 1rem; line-height: 1.5; }
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, 26px);
  width: fit-content;
  border: 1px solid #407765;
}
.lesson-grid.area-grid { grid-template-columns: repeat(5, 26px); }
.lesson-grid span { height: 26px; border: 1px solid #407765; background: #fff2e3; }
.lesson-grid span.marked { background: #bce5d0; }
.lesson-flags { display: flex; gap: 4px; border-top: 3px solid #806049; width: fit-content; }
.lesson-flags span { width: 26px; height: 26px; background: #186e67; clip-path: polygon(0 0,100% 0,100% 100%,50% 76%,0 100%); }
.lesson-flags span.marked { background: repeating-linear-gradient(135deg,#a23f3d 0 4px,#ce6657 4px 8px); }

.catalog-intro:has(+ .catalog-share) { margin-bottom: 10px; }
.catalog-share.sound-toggle {
  display: inline-block;
  min-height: 44px;
  margin-bottom: 16px;
  padding-inline: 16px;
  color: #54288a;
}
.share-feedback { margin: 0 0 14px; color: var(--muted); }
.share-feedback:empty { display: none; }
.share-link { max-width: 420px; margin-bottom: 8px; }
.share-link label { display: block; margin-bottom: 4px; font-weight: 700; }
.share-link input {
  width: 100%;
  min-height: 44px;
  padding-inline: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
}
.catalog-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 16px 0 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
}
