.ct-index-page,
.ct-test-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #eff6ff 0, #fff 26rem);
  color: #172033;
}

.ct-index-hero,
.ct-page-heading {
  max-width: 780px;
}

.ct-index-hero > span,
.ct-topic {
  color: #2357d9;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ct-index-hero h1,
.ct-page-heading h1 {
  margin: 0.6rem 0 1rem;
  color: #0f172a;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.ct-index-hero p,
.ct-page-heading p,
.ct-topic-overview p {
  color: #526077;
  font-size: 1.05rem;
  line-height: 1.75;
}

.ct-page-heading > a {
  color: #2357d9;
  font-weight: 650;
  text-decoration: none;
}

.ct-grade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 42px;
}

.ct-grade-grid a {
  display: flex;
  min-height: 145px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  border: 1px solid #d9e1ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
  color: #0f172a;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ct-grade-grid a:hover {
  box-shadow: 0 16px 38px rgb(15 23 42 / 10%);
  transform: translateY(-2px);
}

.ct-grade-grid strong {
  font-size: 1.55rem;
}

.ct-grade-grid span {
  margin-top: 4px;
  color: #64748b;
}

.ct-topic-overview {
  margin-top: 64px;
  padding: 32px;
  border: 1px solid #d9e1ef;
  border-radius: 20px;
  background: #fff;
}

.ct-topic-overview h2 {
  margin: 0;
  font-size: 1.5rem;
}

.ct-topic-overview ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.ct-topic-overview li {
  position: relative;
  padding-left: 20px;
  color: #334155;
}

.ct-topic-overview li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2357d9;
  content: "";
}

.ct-runner {
  margin-top: 36px;
}

.ct-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.ct-variant-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid #d7deeb;
  border-radius: 12px;
  background: #fff;
}

.ct-variant-switch button,
.ct-exercise-nav button,
.ct-pager button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.ct-variant-switch button {
  padding: 9px 15px;
  border-radius: 8px;
}

.ct-variant-switch button.is-active {
  background: #2357d9;
  color: #fff;
}

.ct-exercise-select {
  display: grid;
  gap: 5px;
  min-width: min(330px, 100%);
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 650;
}

.ct-exercise-select select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #fff;
  color: #172033;
  font: inherit;
}

.ct-layout {
  display: block;
}

.ct-work-panel {
  overflow: hidden;
  border: 1px solid #d7deeb;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 36px rgb(15 23 42 / 7%);
}

.ct-test-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -18px -18px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ct-test-meta span {
  color: #64748b;
  font-size: 0.82rem;
}

.ct-work-panel {
  padding: 18px;
}

.ct-exercise-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
}

.ct-exercise-nav button {
  min-width: 38px;
  padding: 8px 10px;
  border: 1px solid #d7deeb;
  border-radius: 9px;
  background: #fff;
}

.ct-exercise-nav button.is-active {
  border-color: #2357d9;
  background: #eff4ff;
  color: #1742af;
}

.ct-exercise {
  width: 100%;
  padding: 24px 4px 4px;
}

.ct-exercise-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.ct-exercise-header h2 {
  margin: 6px 0 0;
  color: #0f172a;
  font-size: 1.35rem;
  line-height: 1.35;
}

.ct-points {
  flex: none;
  padding: 6px 9px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
}

.ct-statement {
  margin-top: 20px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fbfdff;
}

.ct-statement h3 {
  margin: 0 0 14px;
  color: #0f172a;
  font-size: 1rem;
}

.ct-statement pre {
  overflow: visible;
  margin: 0;
  color: #263449;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.ct-statement-content {
  display: grid;
  gap: 14px;
  color: #263449;
  font-size: 0.95rem;
}

.ct-statement-text,
.ct-statement-math {
  margin: 0;
}

.ct-statement-text {
  line-height: 1.65;
  white-space: pre-wrap;
}

.ct-statement-math {
  display: flex;
  min-height: 2.5em;
  align-items: center;
  overflow-x: auto;
  font-family: "Times New Roman", Cambria, "STIX Two Math", serif;
  font-size: 1.2rem;
  line-height: 1;
}

.ct-statement-math > span,
.ct-math-numerator,
.ct-math-denominator {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.ct-math-fraction {
  display: inline-grid;
  grid-template-rows: auto 1.5px auto;
  min-width: 1.25em;
  margin: 0 0.12em;
  align-items: center;
  justify-items: stretch;
  vertical-align: middle;
}

.ct-math-numerator,
.ct-math-denominator {
  justify-content: center;
  padding: 0.14em 0.22em;
}

.ct-math-fraction-line {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
}

.ct-math-fraction .ct-math-fraction {
  font-size: 0.88em;
}

.ct-figure {
  margin: 22px 0 0;
  padding: 14px;
  border: 1px solid #d8e3fa;
  border-radius: 12px;
  background: #fff;
}

.ct-figure svg {
  display: block;
  width: 100%;
  max-height: 330px;
}

.ct-figure text {
  fill: #334155;
  font: 12px ui-sans-serif, system-ui, sans-serif;
}

.ct-figure figcaption {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.78rem;
  text-align: center;
}

.ct-svg-gridline {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.ct-svg-line,
.ct-svg-construction {
  fill: none;
  stroke: #334155;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.ct-svg-construction {
  stroke: #2357d9;
  stroke-width: 2.5;
}

.ct-svg-fill,
.ct-svg-shape,
.ct-svg-shape-alt {
  fill: #dbe7ff;
  stroke: #2357d9;
  stroke-width: 2;
}

.ct-svg-shape-alt {
  fill: none;
}

.ct-svg-point {
  fill: #172033;
}

.ct-svg-solid-top {
  fill: #dbe7ff;
  stroke: #334155;
}

.ct-svg-solid-left {
  fill: #b9cdf8;
  stroke: #334155;
}

.ct-svg-solid-right {
  fill: #8eacef;
  stroke: #334155;
}

.ct-exercise .me-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ct-exercise .me-answer {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  font-size: 0.95rem;
}

.ct-exercise .me-answer input,
.ct-exercise .me-answer select,
.ct-exercise .me-answer-choice select {
  width: 100%;
  min-width: 0;
}

.ct-answer-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.ct-answer-card {
  padding: 16px;
  border: 1px solid #d7deeb;
  border-radius: 14px;
  background: #fff;
}

.ct-answer-card .me-answer-grid {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.ct-answer-card .me-actions {
  margin-top: 12px;
}

.ct-solution-history {
  display: grid;
  gap: 12px;
}

.ct-solution-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 1fr);
  overflow: hidden;
  border: 1px solid #d8e3fa;
  border-radius: 12px;
  background: #fff;
}

.ct-solution-row.is-latest {
  animation: ct-solution-step-enter 360ms ease both;
}

.ct-solution-row-active {
  border-color: #9db7f2;
  box-shadow: 0 0 0 3px rgb(35 87 217 / 8%);
}

.ct-solution-formula {
  display: flex;
  min-width: 0;
  min-height: 7em;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  padding: 16px;
  font-family: "Times New Roman", Cambria, "STIX Two Math", serif;
  font-size: clamp(1.15rem, 3vw, 1.65rem);
  line-height: 1;
}

.ct-solution-description {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  border-left: 1px solid #d8e3fa;
  background: #f7f9ff;
  color: #334155;
  line-height: 1.5;
}

.ct-solution-description p {
  margin: 5px 0 0;
  font-size: 0.92rem;
}

.ct-solution-description small {
  margin-top: 7px;
  color: #64748b;
  font-size: 0.78rem;
}

.ct-solution-step-label {
  color: #2357d9;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ct-solution-guidance {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.ct-answer-animation {
  width: 100%;
  min-height: 0;
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: inherit;
}

.ct-answer-animation .me-equation-stage {
  min-height: 4.6em;
}

.ct-answer-animation .me-equation-stage.has-next-line {
  min-height: 9.6em;
}

@keyframes ct-solution-step-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ct-answer-card .ct-solution {
  margin-top: 14px;
}

.ct-construction {
  display: grid;
  gap: 11px;
  margin: 22px 0 0;
  padding: 18px;
  border: 1px solid #d7deeb;
  border-radius: 14px;
  background: #f8fafc;
}

.ct-construction legend {
  padding: 0 6px;
  color: #0f172a;
  font-weight: 750;
}

.ct-construction p {
  margin: 0 0 3px;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.55;
}

.ct-construction label {
  display: flex;
  align-items: start;
  gap: 10px;
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ct-construction input {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 2px;
  accent-color: #2357d9;
}

.ct-solution {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #d8e3fa;
  border-radius: 14px;
  background: #f7f9ff;
}

.ct-solution h3 {
  margin: 0 0 10px;
  color: #172033;
  font-size: 1rem;
}

.ct-solution ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 1.25rem;
  color: #334155;
  font-size: 0.93rem;
  line-height: 1.55;
}

.ct-solution-complete {
  margin: 13px 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.ct-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.ct-pager button {
  padding: 9px 10px;
  border: 1px solid #d7deeb;
  border-radius: 9px;
}

.ct-pager button:first-child {
  justify-self: start;
}

.ct-pager button:last-child {
  justify-self: end;
}

.ct-pager button:disabled {
  cursor: default;
  opacity: 0.45;
}

.ct-pager span {
  color: #64748b;
  font-size: 0.84rem;
}

.ct-attribution {
  margin: 18px 2px 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.5;
}

@media (max-width: 680px) {
  .ct-grade-grid,
  .ct-topic-overview ul,
  .ct-exercise .me-answer-grid {
    grid-template-columns: 1fr;
  }

  .ct-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ct-variant-switch {
    align-self: start;
  }

  .ct-work-panel {
    padding: 14px;
  }

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

  .ct-solution-description {
    border-top: 1px solid #d8e3fa;
    border-left: 0;
  }

  .ct-pager {
    grid-template-columns: 1fr 1fr;
  }

  .ct-pager span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ct-solution-row.is-latest {
    animation: none;
  }
}
