.astra-article figcaption:has(> .full-results-trigger) {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 6px 16px;
  text-align: left;
}
.astra-article figcaption:has(> .full-results-trigger) > span {
  flex: 1 1 0;
  min-width: 0;
}
.astra-article .full-results-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  margin-left: auto;
  align-self: flex-start;
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
  background: none;
  color: var(--green-ink);
  font: inherit;
  font-weight: 600;
  letter-spacing: .05em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.astra-article .full-results-trigger[hidden] { display: none; }
.astra-article .full-results-trigger:focus-visible,
.astra-article .full-results-close:focus-visible {
  outline: 2px solid var(--green-ink);
  outline-offset: 4px;
}
html:has(.astra-article .full-results-dialog[open]) { overflow: hidden; }
.astra-article .full-results-dialog {
  width: min(var(--results-width, 1020px), calc(100% - 32px));
  height: min(820px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 20px 80px #0003;
}
.astra-article .full-results-dialog[open] { display: flex; flex-direction: column; gap: 16px; }
.astra-article .full-results-dialog::backdrop { background: rgb(20 25 16 / 45%); }
.astra-article .full-results-dialog:has(> .task-performance) {
  width: fit-content;
  max-width: calc(100% - 32px);
}
.astra-article .full-results-dialog:has(> .task-performance) > .full-results-header {
  contain: inline-size;
}
.astra-article .full-results-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.astra-article .full-results-header h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font: 500 18px/1.4 var(--font);
  letter-spacing: 0;
}
.astra-article .full-results-header p {
  margin: 6px 0 0;
  font: 400 12px/1.5 var(--font);
  color: var(--muted);
}
.astra-article .full-results-header form { margin: 0; }
.astra-article .full-results-header:has(.full-results-actions) { flex-wrap: wrap; }
.astra-article .full-results-header:has(.full-results-actions) > :first-child { flex: 1 1 230px; min-width: 0; }
.astra-article .full-results-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.astra-article .full-results-open {
  color: var(--green-ink);
  font: 400 12px/1.5 var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.astra-article .full-results-open:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 4px; }
.astra-article .full-results-dialog.full-results-standalone {
  position: relative;
  inset: auto;
  display: flex;
  width: fit-content;
  max-width: 100%;
  height: 100dvh;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.astra-article .full-results-close {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  color: var(--ink);
  font: 400 12px/1.5 var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.astra-article .full-results-close:hover { background: var(--green-wash); }
.astra-article .full-results-dialog .task-performance {
  width: fit-content;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 100%;
  margin: 0;
}
.astra-article .full-results-dialog .task-table-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
}
.astra-article .full-results-dialog .task-table-scroller { flex: 1; max-height: none; }
.astra-article .full-results-dialog .task-performance-table { width: max-content; min-width: 0; }
.astra-article .full-results-dialog .task-score { white-space: nowrap; font-size: 10px; }
.astra-article .full-results-dialog .task-performance-table thead th { white-space: normal; max-width: 150px; }
.astra-article .full-results-dialog .task-performance-table thead small {
  display: block;
  font: inherit;
  font-size: 10px;
  color: var(--muted);
}
.astra-article .full-results-dialog .task-performance-table .full-results-group-start {
  border-left: 1px solid var(--line);
}
.astra-article .full-results-dialog .task-performance figcaption { flex: 0 0 auto; }
.astra-article .full-results-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 0;
  margin: 0;
  padding: 0;
  align-self: flex-start;
  justify-content: flex-start;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--paper);
}
.astra-article .full-results-tabs [role="tab"] {
  flex: 0 0 auto;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-top: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 600 13px/1.4 var(--font);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.astra-article .full-results-tabs [role="tab"]:hover { background: var(--green-wash); }
.astra-article .full-results-tabs [role="tab"]:last-child { border-right: 0; }
.astra-article .full-results-tabs [aria-selected="true"] {
  border-top-color: var(--green);
  color: var(--green-ink);
  background: var(--white);
}
.astra-article .full-results-tabs [role="tab"]:focus-visible { outline: 2px solid var(--green-ink); outline-offset: -4px; }
.astra-article .full-results-dialog [data-results-tabs] > .task-table-frame { border-radius: 0 8px 8px 8px; }
.astra-article .full-results-panel[hidden] { display: none; }
.astra-article .full-results-panel { margin: 0; padding: 0; border: 0; }
.astra-article .full-results-dialog.bspline-dialog {
  width: min(700px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
}
.astra-article .bspline-dialog .full-results-header { flex: 0 0 auto; }
.astra-article .bspline-dialog-body { min-height: 0; overflow: auto; padding: 2px 4px; }
.astra-article .bspline-dialog-body p { margin: 0 0 14px; font-family: var(--font); }
.astra-article .bspline-dialog-body math { font-family: "Latin Modern Math", "STIX Two Math", math; }
.astra-article .bspline-dialog-body p:last-child { margin-bottom: 0; }
.astra-article .bspline-math { margin: 0 0 14px; padding: 8px 0; overflow-x: auto; }
.astra-article .bspline-math math { width: max-content; min-width: 100%; font-size: 18px; }
.astra-article .bspline-main-equation { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 16px 8px; }
.astra-article .bspline-main-equation math { min-width: 0; }
.astra-article a[href="#bspline-construction"]:focus-visible,
.astra-article .bspline-dialog-body:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 2px; }
@media (max-width: 600px) {
  .astra-article .full-results-tabs [role="tab"] { padding: 9px 7px; font-size: 12px; }
  .astra-article .bspline-math math { font-size: 16px; }
  .astra-article .full-results-dialog { width: calc(100% - 16px); height: calc(100dvh - 16px); padding: 12px; }
  .astra-article .full-results-dialog[open] { gap: 12px; }
  .astra-article .full-results-header { gap: 8px; }
  .astra-article .full-results-header h2 { font-size: 16px; }
  .astra-article .full-results-dialog:has(> .task-performance) { max-width: calc(100% - 16px); }
  .astra-article .full-results-dialog.full-results-standalone { max-width: 100%; }
}
@media print {
  .astra-article .full-results-trigger { display: none; }
  .astra-article .full-results-dialog[open] { position: static; width: 100%; height: auto; overflow: visible; box-shadow: none; }
  .astra-article .full-results-close { display: none; }
}

/* Keep the context-results frame stable when switching histories. */
.astra-article #context-sampling-full-results {
  width: min(var(--results-width), calc(100% - 32px));
}
.astra-article #context-sampling-full-results .context-results-tabs,
.astra-article #context-sampling-full-results .full-results-panel { width: 100%; }
