:root {
  --math-cinnabar: #8c2f39;
  --math-jade: #2f5d50;
  --math-gold: #b08a4a;
  --math-ink: #17231f;
  --math-paper: #fbf7ef;
}

.math-domain-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(176, 138, 74, .3);
  border-radius: 999px;
  color: #765f36;
  background: rgba(255, 252, 244, .76);
  font-size: 12px;
  white-space: nowrap;
}

.math-domain-ribbon::before {
  content: "∑";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--math-cinnabar);
  font: 700 15px Georgia, serif;
}

.math-intro {
  position: relative;
  overflow: hidden;
  border-color: rgba(140, 47, 57, .12);
  background:
    radial-gradient(circle at 86% 16%, rgba(176, 138, 74, .16), transparent 22%),
    linear-gradient(135deg, #fffdf8 0%, #f8f0e3 54%, #eef4ed 100%);
}

.math-intro::after {
  content: "∫  ∑  ∂  π";
  position: absolute;
  right: 3%;
  bottom: -20px;
  color: rgba(47, 93, 80, .08);
  font: 700 92px Georgia, serif;
  letter-spacing: 10px;
  pointer-events: none;
}

.math-intro .intro-stat-grid article b {
  color: var(--math-cinnabar);
}

.math-guard-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-top: -5px;
  border: 1px solid #ded4c2;
  border-radius: 16px;
  background: #ded4c2;
}

.math-guard-strip article {
  padding: 13px 16px;
  background: rgba(255, 253, 248, .93);
}

.math-guard-strip b {
  display: block;
  margin-bottom: 3px;
  color: var(--math-ink);
}

.math-guard-strip small {
  color: #77756e;
}

.math-branch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.math-branch-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid #dfd4c2;
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(255, 253, 248, .96), rgba(243, 238, 226, .86));
  box-shadow: 0 10px 28px rgba(48, 43, 33, .05);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.math-branch-card:hover {
  transform: translateY(-3px);
  border-color: rgba(140, 47, 57, .35);
  box-shadow: 0 16px 34px rgba(48, 43, 33, .09);
}

.math-branch-card > span {
  color: var(--math-cinnabar);
  font: 700 11px Georgia, serif;
  letter-spacing: .08em;
}

.math-branch-card h3 {
  margin: 8px 0 7px;
  font-size: 17px;
}

.math-branch-card p {
  min-height: 42px;
  margin: 0 0 14px;
  color: #76766f;
  font-size: 12px;
  line-height: 1.7;
}

.math-branch-card > div {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7dfd2;
}

.math-branch-card > div i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--math-jade), var(--math-gold));
}

.math-branch-card small {
  display: block;
  margin-top: 8px;
  color: #696a64;
}

.math-tool-tabs {
  display: flex;
  gap: 7px;
  padding: 7px;
  border: 1px solid #dfd4c2;
  border-radius: 16px;
  background: rgba(247, 242, 232, .82);
}

.math-tool-tabs button {
  flex: 1;
  min-height: 45px;
  border: 0;
  border-radius: 12px;
  color: #6f706a;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.math-tool-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--math-ink), var(--math-jade));
  box-shadow: 0 8px 18px rgba(23, 35, 31, .16);
}

.math-tool-panel {
  display: none;
  margin-top: 14px;
}

.math-tool-panel.active {
  display: block;
  animation: mathPanelIn .28s ease;
}

@keyframes mathPanelIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.math-workspace-grid,
.verification-grid,
.modeling-grid {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr);
  gap: 14px;
}

.math-tool-card {
  padding: 22px;
}

.proof-level-row,
.verify-row,
.plot-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.proof-level-note,
.verification-boundary,
.source-boundary {
  margin-top: 12px;
  padding: 11px 13px;
  border-left: 3px solid var(--math-gold);
  border-radius: 0 10px 10px 0;
  color: #6d6659;
  background: #f7f0e3;
  font-size: 12px;
  line-height: 1.7;
}

.generated-answer {
  max-height: 680px;
  overflow: auto;
}

.verify-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid;
  border-radius: 15px;
}

.verify-verdict > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.verify-verdict.pass {
  border-color: rgba(47, 93, 80, .25);
  background: rgba(47, 93, 80, .08);
}

.verify-verdict.pass > span {
  background: var(--math-jade);
}

.verify-verdict.fail {
  border-color: rgba(140, 47, 57, .25);
  background: rgba(140, 47, 57, .07);
}

.verify-verdict.fail > span {
  background: var(--math-cinnabar);
}

.verify-verdict h3,
.verify-verdict p {
  margin: 0;
}

.verify-verdict p {
  margin-top: 4px;
  color: #70716a;
  font-size: 12px;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.sample-grid span {
  padding: 8px;
  border-radius: 9px;
  text-align: center;
  font-size: 11px;
}

.sample-grid .pass {
  color: #2f5d50;
  background: #e8f1ec;
}

.sample-grid .fail {
  color: #8c2f39;
  background: #f8e9e7;
}

.function-plot-wrap {
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid #ded4c2;
  border-radius: 14px;
  background: var(--math-paper);
}

#function-plot {
  display: block;
  width: 100%;
  height: auto;
}

#plot-caption {
  display: block;
  padding: 9px 12px;
  color: #73756f;
  font-size: 11px;
  background: rgba(241, 235, 223, .8);
}

.math-evidence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.adaptive-path-list {
  display: grid;
  gap: 8px;
}

.adaptive-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2d8c7;
  border-radius: 13px;
  background: #fffdf8;
}

.adaptive-step > b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--math-cinnabar);
}

.adaptive-step h3,
.adaptive-step p {
  margin: 0;
}

.adaptive-step span {
  color: var(--math-gold);
  font-size: 10px;
  font-weight: 800;
}

.adaptive-step p {
  margin-top: 4px;
  color: #75766e;
  font-size: 11px;
}

.adaptive-step aside {
  text-align: right;
}

.adaptive-step aside strong,
.adaptive-step aside small {
  display: block;
}

.adaptive-step aside strong {
  color: var(--math-jade);
  font-size: 20px;
}

.adaptive-step aside small {
  margin-top: 3px;
  color: #77766f;
}

.math-source-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.source-card {
  display: block;
  padding: 13px;
  border: 1px solid #e0d5c3;
  border-radius: 13px;
  color: inherit;
  background: #fffdf8;
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease;
}

.source-card:hover {
  transform: translateY(-2px);
  border-color: var(--math-gold);
}

.source-card > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--math-gold);
  font-size: 10px;
}

.source-card h3,
.source-card p {
  margin: 0;
}

.source-card h3 {
  margin-top: 7px;
  font-size: 13px;
}

.source-card p,
.source-card small {
  display: block;
  margin-top: 4px;
  color: #77776f;
  font-size: 10px;
  line-height: 1.5;
}

.verification-history {
  display: grid;
  gap: 7px;
}

.verification-history article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #ece4d7;
}

.verification-history article > span {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.verification-history .pass {
  color: #2f5d50;
  background: #e5efe9;
}

.verification-history .fail {
  color: #8c2f39;
  background: #f5e5e4;
}

.verification-history b,
.verification-history small {
  display: block;
}

.verification-history small,
.verification-history time {
  color: #77766f;
  font-size: 10px;
}

@media (max-width: 1240px) {
  .math-branch-grid { grid-template-columns: repeat(3, 1fr); }
  .math-evidence-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .math-guard-strip,
  .math-branch-grid,
  .math-workspace-grid,
  .verification-grid,
  .modeling-grid,
  .math-source-list { grid-template-columns: 1fr; }
  .math-tool-tabs { display: grid; grid-template-columns: repeat(2, 1fr); }
  .adaptive-step { grid-template-columns: 32px minmax(0, 1fr); }
  .adaptive-step aside { grid-column: 2; text-align: left; }
  .sample-grid { grid-template-columns: repeat(2, 1fr); }
}

/* v1.9 数学建模助手 */
.modeling-intro h1 {
  max-width: 880px;
}

.modeling-capability-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid #ded4c2;
  border-radius: 18px;
  background: #ded4c2;
}

.modeling-capability-strip article {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px 18px;
  background: rgba(255, 253, 248, .96);
}

.modeling-capability-strip article > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--math-cinnabar);
  background: rgba(140, 47, 57, .09);
  font: 700 11px Georgia, serif;
}

.modeling-capability-strip b,
.modeling-capability-strip small {
  display: block;
}

.modeling-capability-strip b {
  color: var(--math-ink);
  font-size: 13px;
}

.modeling-capability-strip small {
  overflow: hidden;
  margin-top: 3px;
  color: #78776f;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.math-tool-tabs-two {
  max-width: 720px;
  margin: 0 auto;
}

.modeling-assistant-layout {
  display: grid;
  grid-template-columns: minmax(340px, .8fr) minmax(560px, 1.35fr);
  align-items: start;
  gap: 15px;
}

.modeling-input-card {
  position: sticky;
  top: 76px;
  padding: 22px;
}

.modeling-input-card .card-title > b,
.workflow-overview-card .card-title > b,
.modeling-output-card .card-title > b,
.function-explorer-card .card-title > b {
  color: #8a806f;
  font-size: 10px;
  font-weight: 700;
}

.modeling-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 12px 0;
}

.modeling-dropzone {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  min-height: 78px;
  padding: 12px;
  border: 1px dashed #cfc1aa;
  border-radius: 14px;
  background: #faf6ed;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.modeling-dropzone:hover {
  transform: translateY(-2px);
  border-color: var(--math-cinnabar);
  background: #fffaf1;
}

.modeling-dropzone > span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: var(--math-jade);
  font-weight: 800;
}

.modeling-dropzone b,
.modeling-dropzone small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modeling-dropzone b { color: var(--math-ink); font-size: 12px; }
.modeling-dropzone small { color: #858178; font-size: 9px; }

.modeling-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 28px;
  margin: -2px 0 13px;
}

.modeling-file-list > span {
  color: #999286;
  font-size: 10px;
}

.modeling-file-list button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #ded3c2;
  border-radius: 9px;
  color: #4e534e;
  background: #fffdf8;
  cursor: pointer;
}

.modeling-file-list button i {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  color: #fff;
  background: var(--math-jade);
  font-size: 9px;
  font-style: normal;
}

.modeling-file-list button span {
  overflow: hidden;
  max-width: 190px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modeling-file-list button small { color: #969087; font-size: 9px; }
.modeling-file-list button b { color: #a06962; font-size: 13px; }

.modeling-case-resources {
  display: grid;
  gap: 11px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(47, 93, 80, .2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(47, 93, 80, .07), rgba(180, 137, 70, .07));
}

.modeling-case-resources[hidden],
.case-answer-delivery[hidden] { display: none; }
.modeling-case-resources > div:first-child span,
.modeling-case-resources > div:first-child b,
.modeling-case-resources > div:first-child small { display: block; }
.modeling-case-resources > div:first-child span { color: var(--math-cinnabar); font: 700 9px Georgia, serif; letter-spacing: .1em; }
.modeling-case-resources > div:first-child b { margin-top: 4px; color: #34463f; font-size: 12px; }
.modeling-case-resources > div:first-child small { margin-top: 3px; color: #868178; font-size: 9px; }

.modeling-case-resource-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.modeling-case-resource-links a {
  padding: 8px 10px;
  border: 1px solid #dcd2c2;
  border-radius: 9px;
  color: #365c51;
  background: rgba(255, 255, 255, .74);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.modeling-case-resource-links a:hover { border-color: rgba(47, 93, 80, .4); background: #fff; }

.modeling-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 13px;
}

.modeling-action-row .primary-button {
  min-width: 180px;
}

.modeling-safe-note {
  margin: 11px 0 0;
  color: #888178;
  font-size: 10px;
  line-height: 1.65;
}

.modeling-workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.workflow-overview-card,
.modeling-result-card,
.modeling-output-card,
.api-settings-panel {
  padding: 22px;
}

.api-connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid #ddd2c1;
  border-radius: 999px;
  color: #857e72;
  background: #faf6ed;
  font-size: 10px;
}

.api-connection-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b6aa98;
}

.api-connection-pill.ready {
  color: #356456;
  border-color: rgba(47, 93, 80, .25);
  background: rgba(47, 93, 80, .08);
}

.api-connection-pill.ready i { background: #4e9b77; box-shadow: 0 0 0 4px rgba(78, 155, 119, .12); }

.modeling-intro-actions {
  align-items: stretch;
  flex-direction: column;
  min-width: 220px;
}

.judge-demo-button {
  display: grid;
  gap: 3px;
  min-width: 220px;
  padding: 13px 18px;
  border: 1px solid #8f2f2a;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #a83d34, #7d2427);
  box-shadow: 0 12px 28px rgba(126, 38, 41, .24), inset 0 1px rgba(255, 255, 255, .22);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}

.judge-demo-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(126, 38, 41, .3); }
.judge-demo-button:focus-visible { outline: 3px solid rgba(168, 61, 52, .25); outline-offset: 3px; }
.judge-demo-button span { color: #f6d7ae; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.judge-demo-button b { font-size: 14px; }

.judge-demo-button small {
  color: rgba(255, 255, 255, .78);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.5;
}

.judge-demo-callout {
  display: grid;
  gap: 14px;
  margin: 14px 0 18px;
  padding: 17px;
  border: 1px solid rgba(151, 50, 45, .28);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(168, 61, 52, .08), rgba(255, 252, 245, .96) 58%, rgba(178, 139, 70, .1));
  box-shadow: 0 12px 28px rgba(82, 54, 36, .08);
}

.judge-demo-copy > span {
  display: block;
  color: #9a332f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
}

.judge-demo-copy h3 {
  margin: 6px 0 8px;
  color: #263d34;
  font-family: var(--math-serif);
  font-size: 17px;
  line-height: 1.4;
}

.judge-demo-copy p {
  margin: 0;
  color: #666b64;
  font-size: 10.5px;
  line-height: 1.85;
}

.judge-demo-callout .judge-demo-button {
  width: 100%;
  min-width: 0;
  padding: 15px 17px;
}

.learning-evidence-card {
  margin-bottom: 16px;
  border-color: rgba(47, 93, 80, .2);
  background: linear-gradient(135deg, #fffdf8, rgba(232, 241, 235, .62));
}

.learning-evidence-card .card-title > b {
  color: #39705f;
  font-size: 10px;
}

.learning-evidence-intro {
  margin: -7px 0 14px;
  color: #6f746e;
  font-size: 11px;
  line-height: 1.75;
}

.learning-evidence-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }

.learning-evidence-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #e2d9cb;
  border-radius: 13px;
  background: rgba(255, 255, 255, .78);
}

.learning-evidence-item > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #fff;
  background: #356758;
  font-size: 10px;
  font-weight: 900;
}

.learning-evidence-item b { display: block; color: #34473f; font-size: 11px; line-height: 1.45; }
.learning-evidence-item p { margin: 4px 0; color: #6f746e; font-size: 10px; line-height: 1.55; }
.learning-evidence-item small { color: #988871; font-size: 9px; }
.learning-evidence-empty { padding: 16px; border: 1px dashed #d8cdbd; border-radius: 13px; color: #7b7b73; font-size: 11px; text-align: center; }

.modeling-progress-summary {
  margin: 2px 0 15px;
  padding: 12px 14px;
  border: 1px solid #e4dacc;
  border-radius: 13px;
  background: linear-gradient(100deg, #fbf8f1, #fffdf9);
}

.modeling-progress-summary > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #49534e;
  font-size: 11px;
  font-weight: 700;
}

.modeling-progress-summary > div:first-child b { color: var(--math-cinnabar); font-size: 14px; }
.modeling-progress-summary small { display: block; margin-top: 7px; color: #8c867d; font-size: 9px; }

.modeling-progress-track {
  overflow: hidden;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e9e1d5;
}

.modeling-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--math-cinnabar), #bd7b3d 58%, var(--math-jade));
  box-shadow: 0 0 14px rgba(150, 59, 53, .22);
  transition: width .35s ease;
}

.modeling-workflow {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.workflow-step {
  position: relative;
  min-width: 0;
  padding: 11px 9px;
  border: 1px solid #e3dacc;
  border-radius: 12px;
  background: #fbf8f1;
}

.workflow-step > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-bottom: 8px;
  border-radius: 8px;
  color: #8c7e6c;
  background: #eee6d9;
  font: 700 9px Georgia, serif;
}

.workflow-step b,
.workflow-step small { display: block; }
.workflow-step b { overflow: hidden; color: #38423d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.workflow-step small { margin-top: 3px; color: #918b81; font-size: 8px; line-height: 1.5; }

.workflow-step.running {
  border-color: rgba(140, 47, 57, .35);
  background: rgba(140, 47, 57, .055);
  box-shadow: 0 6px 18px rgba(140, 47, 57, .08);
}

.workflow-step.running > span { color: #fff; background: var(--math-cinnabar); animation: pulseStep 1.1s infinite; }
.workflow-step.done { border-color: rgba(47, 93, 80, .24); background: rgba(47, 93, 80, .055); }
.workflow-step.done > span { color: #fff; background: var(--math-jade); }

@keyframes pulseStep {
  50% { box-shadow: 0 0 0 5px rgba(140, 47, 57, .1); }
}

.modeling-result-card {
  min-height: 360px;
}

.modeling-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ebe2d5;
}

.modeling-result-head span {
  color: var(--math-cinnabar);
  font: 700 10px Georgia, serif;
  letter-spacing: .1em;
}

.modeling-result-head h2 { margin: 5px 0 0; color: var(--math-ink); font-size: 20px; }
.modeling-result-head > b { padding: 6px 9px; border-radius: 999px; color: #765f36; background: #f5ead6; font-size: 9px; white-space: nowrap; }
.modeling-result-summary { margin: 0 0 13px; color: #6c706b; font-size: 12px; line-height: 1.8; }

.modeling-plan-sections {
  display: grid;
  gap: 7px;
}

.modeling-plan-sections article {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  padding: 12px;
  border: 1px solid #e8dfd2;
  border-radius: 12px;
  background: #fffdf9;
}

.modeling-plan-sections article > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--math-cinnabar);
  background: #f6eae4;
  font: 700 9px Georgia, serif;
}

.modeling-plan-sections h3,
.modeling-plan-sections p { margin: 0; }
.modeling-plan-sections h3 { color: #303b36; font-size: 12px; }
.modeling-plan-sections p { margin-top: 4px; color: #74766f; font-size: 10px; line-height: 1.7; }

.modeling-output-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.modeling-output-grid article {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e4dacb;
  border-radius: 11px;
  background: #fbf8f1;
}

.modeling-output-grid article > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #8b8173;
  background: #eee7dc;
  font-size: 11px;
  font-weight: 800;
}

.modeling-output-grid article.ready > span { color: #fff; background: var(--math-jade); }
.modeling-output-grid b,
.modeling-output-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modeling-output-grid b { color: #39433e; font-size: 10px; }
.modeling-output-grid small { margin-top: 3px; color: #8f897f; font-size: 8px; }

.output-actions {
  padding-top: 12px;
  border-top: 1px solid #ebe2d5;
}

.case-answer-delivery {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 200px;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(140, 47, 57, .2);
  border-radius: 14px;
  background: linear-gradient(120deg, #fbf3ea, #fffdf9);
}

.case-answer-delivery > div span,
.case-answer-delivery > div b,
.case-answer-delivery > div small { display: block; }
.case-answer-delivery > div span { color: var(--math-cinnabar); font: 700 9px Georgia, serif; letter-spacing: .1em; }
.case-answer-delivery > div b { margin-top: 4px; color: #3b413e; font-size: 12px; }
.case-answer-delivery > div small { margin-top: 3px; color: #8b847a; font-size: 9px; }
.case-answer-delivery label span { display: block; margin-bottom: 5px; color: #77746e; font-size: 9px; font-weight: 700; }
.case-answer-delivery select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #dcd2c2;
  border-radius: 10px;
  color: #39433e;
  background: #fff;
}

.case-answer-download-button {
  height: 38px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #a83d34, #7d2427);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.case-answer-download-button:disabled { cursor: not-allowed; opacity: .45; }

.function-explorer-card { padding: 24px; }
.function-helper { max-width: 760px; margin: -7px 0 17px; color: #75776f; font-size: 12px; line-height: 1.75; }
.plot-action-row { justify-content: flex-start; }
.plot-action-row .primary-button { min-width: 140px; }

.api-settings-panel {
  margin-top: 15px;
  border-color: rgba(140, 47, 57, .18);
  background: linear-gradient(145deg, #fffdf8, #f8f1e7);
}

.api-settings-panel[hidden] { display: none; }
.api-settings-panel > p { margin: -5px 0 14px; color: #79766f; font-size: 11px; }
.api-settings-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 10px; }

.modeling-api-security {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid rgba(47, 93, 80, .18);
  border-radius: 13px;
  background: rgba(47, 93, 80, .055);
}

.modeling-api-security > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  background: var(--math-jade);
  font-weight: 800;
}

.modeling-api-security b { color: #315b4f; font-size: 12px; }
.modeling-api-security p { margin: 4px 0 0; color: #747a75; font-size: 10px; line-height: 1.65; }

@media (max-width: 1280px) {
  .modeling-assistant-layout { grid-template-columns: 1fr; }
  .modeling-input-card { position: static; }
  .modeling-workflow { grid-template-columns: repeat(3, 1fr); }
  .modeling-output-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .modeling-capability-strip,
  .api-settings-grid { grid-template-columns: 1fr; }
  .math-tool-tabs-two { grid-template-columns: 1fr 1fr; }
  .modeling-upload-grid,
  .modeling-workflow,
  .modeling-output-grid { grid-template-columns: 1fr 1fr; }
  .modeling-action-row { flex-wrap: wrap; }
  .modeling-action-row button { flex: 1; min-width: 130px; }
  .modeling-intro-actions { width: 100%; min-width: 0; }
  .judge-demo-button { width: 100%; min-width: 0; }
  .case-answer-delivery { grid-template-columns: 1fr; align-items: stretch; }
  .learning-evidence-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .modeling-upload-grid,
  .modeling-workflow,
  .modeling-output-grid { grid-template-columns: 1fr; }
  .modeling-case-resource-links { grid-template-columns: 1fr; }
}
