.math-main {
  padding-bottom: 2.5rem;
}

.math-heading {
  margin-bottom: 1.35rem;
}

.math-heading__mark {
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 22px;
  background: #eef0ff;
  place-items: center;
}

.math-heading__mark img {
  width: 48px;
  height: 48px;
}

.math-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  grid-template-areas:
    "path challenge"
    "lessons challenge"
    "continue goal";
  align-items: stretch;
  gap: 20px;
  margin-top: 24px;
}

.math-dashboard-grid > section {
  min-width: 0;
}

.math-hero {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  padding: 24px;
  border-radius: 24px;
  background: #c9c7ff;
  isolation: isolate;
}

.math-hero__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

.math-hero__content {
  width: min(100%, 390px);
  padding: 26px 28px;
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: 24px;
  background: rgb(255 255 255 / 95%);
  box-shadow: 0 6px 24px rgb(31 58 112 / 6%);
}

.math-hero h2,
.math-path h2,
.quick-challenge h2,
.math-goal h2,
.lesson-card h2 {
  color: var(--color-navy);
  font-family: var(--font-heading);
}

.math-hero h2 {
  margin: 0;
  font-size: clamp(26px, 2vw, 30px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.math-hero p {
  margin: 10px 0 18px;
  color: var(--color-muted);
  font-size: 17px;
  line-height: 1.55;
}

.math-hero .button {
  width: 100%;
}

.math-path {
  grid-area: path;
  padding: 20px 24px 22px;
  overflow: hidden;
  border: 1px solid rgb(220 228 241 / 55%);
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: 0 4px 16px rgb(64 52 26 / 4%);
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.math-path h2 {
  margin: 0 0 20px;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.math-path__track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.math-path__track::before {
  position: absolute;
  top: 48px;
  right: 9%;
  left: 9%;
  z-index: 0;
  border-top: 3px dashed #b9b1f4;
  content: "";
}

.path-stage {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: 0;
  color: var(--color-text);
  background: transparent;
  text-align: center;
}

button.path-stage {
  cursor: pointer;
}

.path-stage__planet {
  position: relative;
  display: grid;
  width: 96px;
  max-width: 100%;
  aspect-ratio: 1;
  isolation: isolate;
  place-items: center;
}

.path-stage__planet img {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 5px 4px rgb(49 50 91 / 12%));
}

.path-stage.is-current .path-stage__planet::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid #c9bfff;
  border-radius: 50%;
  background: #f0edff;
  box-shadow: 0 0 0 5px rgb(227 221 255 / 45%);
  content: "";
}

.path-stage.is-locked .path-stage__planet img {
  filter: saturate(0.65) drop-shadow(0 5px 4px rgb(49 50 91 / 12%));
}

.path-stage.is-current .path-stage__planet::after {
  position: absolute;
  bottom: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid transparent;
  border-bottom: 0;
  border-left: 8px solid transparent;
  border-top: 9px solid var(--color-primary);
  content: "";
}

.path-stage__badge {
  position: absolute;
  top: 3px;
  right: 0;
  display: grid;
  width: 27px;
  height: 27px;
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  background: #2aaa70;
  font-size: 14px;
  place-items: center;
}

.path-stage.is-locked .path-stage__badge {
  background: #7381aa;
}

.path-stage__badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.path-stage__label {
  max-width: 120px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.path-stage__name {
  display: block;
  font-family: var(--font-heading);
  font-size: 15px;
}

.path-stage__title {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 13px;
}

.path-stage.is-current .path-stage__label {
  color: var(--color-primary);
  font-weight: 700;
}

.lesson-grid {
  grid-area: lessons;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.lesson-card {
  position: relative;
  min-height: 184px;
  overflow: hidden;
  padding: 22px 150px 22px 24px;
  border: 1px solid rgb(220 228 241 / 55%);
  border-radius: 22px;
  background: var(--color-surface);
  box-shadow: 0 4px 16px rgb(64 52 26 / 4%);
}

.lesson-card h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.lesson-card p {
  margin: 7px 0 16px;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.45;
}

.lesson-card__open {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--color-primary);
  cursor: pointer;
  place-items: center;
}

.lesson-card__open:hover {
  background: var(--color-primary-hover);
}

.lesson-card__open svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.lesson-card__visual {
  position: absolute;
  right: 14px;
  bottom: 10px;
  display: flex;
  width: 140px;
  height: 120px;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  transform: scale(0.86);
  transform-origin: right bottom;
}

.equation-block {
  display: grid;
  width: 52px;
  height: 62px;
  border-radius: 11px;
  color: white;
  background: #4f9ae8;
  box-shadow: inset -6px -7px 0 rgb(25 74 151 / 12%);
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  place-items: center;
  transform: rotate(-5deg);
}

.equation-block:nth-child(2) {
  align-self: flex-start;
  color: #814d00;
  background: #ffd26e;
  transform: rotate(2deg);
}

.equation-block:nth-child(3) {
  background: #ec72aa;
  transform: rotate(7deg);
}

.shape {
  display: block;
  box-shadow: inset -8px -8px 0 rgb(31 58 112 / 10%);
}

.shape--triangle {
  width: 0;
  height: 0;
  border-right: 38px solid transparent;
  border-bottom: 72px solid #57c38c;
  border-left: 38px solid transparent;
  filter: drop-shadow(6px 6px 0 rgb(31 58 112 / 8%));
}

.shape--square {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: #51a8ef;
}

.shape--circle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #f17665;
}

.math-continue {
  grid-area: continue;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e3def8;
  border-radius: 22px;
  background: #f3f0fc;
  box-shadow: 0 4px 16px rgb(64 52 26 / 4%);
}

.math-continue[hidden] {
  display: none;
}

.math-continue__image {
  width: 112px;
  height: 112px;
  border-radius: 14px;
  object-fit: cover;
  object-position: 70% center;
}

.math-continue__content {
  min-width: 0;
}

.math-continue h2 {
  margin: 0;
  color: var(--color-navy);
  font-family: var(--font-heading);
  font-size: 21px;
  line-height: 1.25;
}

.math-continue__topic {
  margin: 5px 0 0;
  color: var(--color-primary);
  font-size: 15px;
  line-height: 1.4;
}

.math-continue__note {
  margin: 4px 0 10px;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.4;
}

.math-continue progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 999px;
  color: #8275e8;
  background: #e2ddf3;
}

.math-continue progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #e2ddf3;
}

.math-continue progress::-webkit-progress-value {
  border-radius: 999px;
  background: #8275e8;
}

.math-continue progress::-moz-progress-bar {
  border-radius: 999px;
  background: #8275e8;
}

.math-continue__button {
  min-width: 120px;
  font-size: 15px;
}

.quick-challenge,
.math-goal {
  border: 1px solid rgb(220 228 241 / 55%);
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: 0 4px 16px rgb(64 52 26 / 4%);
}

.quick-challenge {
  display: flex;
  grid-area: challenge;
  flex-direction: column;
  padding: 18px 16px 16px;
}

.quick-challenge header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.quick-challenge h2,
.math-goal h2 {
  margin: 0;
  font-size: 20px;
}

.quick-challenge__bolt {
  color: var(--color-yellow);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.quick-challenge__scene {
  height: 112px;
  min-height: 112px;
  flex: 1 0 112px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(150deg, #8e8ced, #b3a8ff);
}

.quick-challenge__scene svg {
  width: 100%;
  height: 100%;
}

.quick-cloud {
  fill: #eeeaff;
}

.quick-cloud--right {
  fill: #f8f6ff;
}

.quick-star {
  fill: #ffd565;
  stroke: #f1b72d;
  stroke-width: 2;
}

.quick-challenge__scene circle {
  fill: var(--color-navy);
}

.quick-smile {
  fill: none;
  stroke: var(--color-navy);
  stroke-linecap: round;
  stroke-width: 2.5;
}

.quick-challenge__question {
  margin: 0;
  padding: 22px 10px;
  border-radius: 0 0 18px 18px;
  color: var(--color-navy);
  background: #f4f5ff;
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  text-align: center;
}

.quick-challenge__answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.answer-button {
  min-height: 58px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-navy);
  background: white;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.answer-button:hover {
  border-color: #9dadde;
  background: var(--color-primary-soft);
}

.answer-button.is-correct {
  border-color: #37a974;
  color: #176b47;
  background: var(--color-success-soft);
}

.answer-button.is-wrong {
  border-color: #e38c82;
  color: #9b342b;
  background: #fff0ed;
}

.quick-challenge__feedback {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}

.math-goal {
  position: relative;
  display: grid;
  grid-area: goal;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 14px 10px;
  padding: 18px;
}

.math-goal__heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  gap: 10px;
}

.math-goal__heading svg {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  fill: none;
  stroke: var(--color-primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.math-goal__heading p {
  margin: 5px 0 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.4;
}

.math-goal__progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.math-goal__segment {
  height: 12px;
  border-radius: 999px;
  background: var(--color-track);
}

.math-goal__segment.is-complete {
  background: var(--color-yellow);
}

.math-goal__count {
  color: var(--color-muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.math-dialog__summary {
  margin: 0 0 18px;
  color: var(--color-muted);
  line-height: 1.6;
}

@media (max-width: 1279.98px) {
  .math-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "path" "lessons" "challenge" "continue" "goal";
  }
}

@media (min-width: 768px) and (max-width: 1279.98px) {
  .quick-challenge {
    display: grid;
    grid-template-columns: minmax(120px, 0.65fr) minmax(0, 1fr);
    gap: 12px 20px;
  }

  .quick-challenge header {
    grid-column: 1 / -1;
    margin: 0;
  }

  .quick-challenge__scene {
    grid-column: 1;
    grid-row: 2 / 5;
    height: 100%;
    border-radius: 18px;
  }

  .quick-challenge__question,
  .quick-challenge__answers,
  .quick-challenge__feedback {
    grid-column: 2;
    margin: 0;
  }

  .quick-challenge__question {
    padding: 14px 10px;
    border-radius: 18px;
  }

  .quick-challenge__answers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 899.98px) {
  .path-stage__planet {
    width: 72px;
  }

  .math-path__track::before {
    top: 36px;
  }

  .lesson-card {
    padding-right: 150px;
  }

  .lesson-card__visual {
    width: 140px;
    transform: scale(0.86);
    transform-origin: right bottom;
  }
}

@media (max-width: 767.98px) {
  .math-heading__mark {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 18px;
  }

  .math-heading__mark img {
    width: 42px;
    height: 42px;
  }

  .math-dashboard-grid {
    gap: 16px;
  }

  .math-hero {
    display: flex;
    min-height: 435px;
    align-items: flex-end;
    padding: 16px;
  }

  .math-hero__art {
    height: 230px;
    object-position: right top;
  }

  .math-hero__content {
    width: 100%;
    padding: 22px;
    border-radius: 20px;
    background: var(--color-surface);
  }

  .math-hero p {
    font-size: 16px;
  }

  .math-dashboard-grid {
    margin-top: 20px;
  }

  .math-continue {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 14px;
  }

  .math-continue__image {
    width: 80px;
    height: 96px;
  }

  .math-continue h2 {
    font-size: 20px;
  }

  .math-continue__button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .math-path {
    padding: 20px 16px;
  }

  .math-path__track {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .math-path__track::before {
    top: 40px;
    bottom: 40px;
    left: 40px;
    width: 0;
    border-top: 0;
    border-left: 3px dashed #b9b1f4;
  }

  .path-stage {
    min-height: 80px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 16px;
    text-align: left;
  }

  .path-stage__planet {
    width: 80px;
    height: 80px;
    flex: 0 0 80px;
  }

  .path-stage.is-current .path-stage__planet::after {
    display: none;
  }

  .path-stage__label {
    max-width: none;
    margin: 0;
    font-size: 16px;
  }

  .lesson-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-card {
    min-height: 194px;
    padding: 22px 158px 22px 20px;
  }

  .lesson-card__visual {
    right: 8px;
  }
}

@media (max-width: 399.98px) {
  .lesson-card {
    padding-right: 128px;
  }

  .lesson-card__visual {
    width: 126px;
    transform: scale(0.75);
  }
}
