.maths-progress { max-width: 1330px; }
.maths-layout {
  display: grid;
  grid-template-columns: minmax(160px, .29fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.maths-layout:has(.maths-sidebar[hidden]) { grid-template-columns: minmax(0, 740px); }
.maths-panel, .maths-details { min-width: 0; }
.maths-stack, .maths-form, .maths-card { display: grid; min-width: 0; align-content: start; gap: 13px; }
.maths-card { padding: clamp(15px, 2vw, 23px); overflow-wrap: anywhere; }
.maths-card h2 { font-size: 1.28rem; letter-spacing: -.025em; }
.maths-card h3 { font-size: 1.08rem; }
.maths-sidebar { gap: 10px; }
.maths-sidebar > .button { justify-self: start; }
.maths-actions, .maths-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.maths-actions:empty, .maths-tags:empty { display: none; }
.maths-muted, .maths-feedback { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.maths-feedback { color: var(--purple-dark); }
.maths-feedback[data-error="true"] { color: #9f2d47; }
.maths-feedback:not(:empty) { padding: 6px 0; }
.maths-feedback:empty { position: absolute; }
.maths-list { list-style: none; padding: 0; margin: 0; }
.maths-list li { display: flex; align-items: start; justify-content: space-between; gap: 8px; padding: 9px 0; }
.maths-list li + li { border-top: 1px solid var(--line); }
.maths-list .button-text { justify-content: start; padding-inline: 0; min-height: 32px; text-align: left; }
.maths-list .maths-details > .maths-muted { margin-bottom: 6px; }
.maths-sidebar .maths-list li { display: block; padding-block: 3px; border: 0; }
.maths-sidebar .maths-class-link {
  display: grid;
  justify-content: stretch;
  width: 100%;
  padding: 9px 10px;
  gap: 4px;
  overflow-wrap: anywhere;
}
.maths-class-link small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.maths-class-link[aria-current="true"] { background: var(--purple-light); }
.maths-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.maths-report-layout { grid-template-columns: minmax(0, .72fr) minmax(0, 1.3fr); }
.maths-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--tone-bg, var(--background));
  color: var(--tone-ink, var(--muted));
  font-size: .78rem;
  font-weight: 650;
}
.maths-list > li > .maths-badge { flex: 0 0 auto; margin-top: 4px; }
.maths-disclosure { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.maths-disclosure summary { color: var(--purple); font-weight: 650; cursor: pointer; }
.maths-disclosure summary strong { margin-right: 6px; }
.maths-disclosure summary .maths-badge { margin-block: 3px; margin-right: 4px; }
.maths-disclosure[open] > :not(summary) { margin-top: 12px; }
.maths-student-response[open] .maths-form { padding-top: 12px; border-top: 1px solid var(--line); }
.maths-prompt, .maths-response-text {
  border-radius: 9px;
  background: var(--background);
  padding: 11px 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.maths-response-text strong { display: block; margin-bottom: 5px; }
.maths-preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.maths-picker { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.maths-picker legend { font-weight: 700; padding-inline: 5px; }
.maths-tag-toolbar {
  display: grid;
  grid-template-columns: minmax(115px, .33fr) minmax(0, 1fr);
  gap: 9px;
  margin-block: 10px;
}
.maths-tag-options {
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-block: 8px 10px;
  background: var(--surface);
}
.maths-tag-options > .maths-muted { padding: 11px 13px; }
.maths-tag-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; padding: 9px 10px; cursor: pointer; }
.maths-tag-option + .maths-tag-option { border-top: 1px solid var(--line); }
.maths-tag-option:has(input:checked) { background: var(--purple-light); }
.maths-tag-option:has(input:disabled) { cursor: default; opacity: .6; }
.maths-tag-option input { accent-color: var(--purple); width: 17px; height: 17px; margin: 3px 0 0; }
.maths-tag-copy strong, .maths-tag-copy small { display: block; }
.maths-tag-copy small { color: var(--muted); line-height: 1.35; }
.maths-tag-remove { min-height: 34px; padding: 5px 9px; font-size: .8rem; }
.maths-picker > .maths-muted:last-child { margin-top: 6px; }
.maths-form-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

@media (max-width: 1080px) {
  .maths-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 880px) {
  .maths-layout { grid-template-columns: minmax(0, 1fr); }
  .maths-sidebar .maths-list { display: flex; flex-wrap: wrap; gap: 4px; }
}

@media (max-width: 430px) {
  .maths-tag-toolbar, .maths-form-meta { grid-template-columns: minmax(0, 1fr); }
}
