.modeling-header {
  border-bottom: 1px solid rgba(128, 80, 39, 0.18);
  background:
    linear-gradient(90deg, rgba(250, 245, 233, 0.98) 0%, rgba(246, 239, 222, 0.92) 58%, rgba(23, 60, 97, 0.09) 100%),
    url("/generated/2G.png") center 58% / cover;
  background:
    linear-gradient(90deg, rgba(250, 245, 233, 0.98) 0%, rgba(246, 239, 222, 0.92) 58%, rgba(23, 60, 97, 0.09) 100%),
    image-set(
      url("/static/assets/optimized/2G-768.avif") type("image/avif") 1x,
      url("/static/assets/optimized/2G-1200.avif") type("image/avif") 2x,
      url("/static/assets/optimized/2G-768.webp") type("image/webp") 1x,
      url("/static/assets/optimized/2G-1200.webp") type("image/webp") 2x
    ) center 58% / cover;
}

.modeling-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
  min-height: 196px;
  align-items: center;
  padding-block: 32px;
  gap: 64px;
}

.modeling-header h1 {
  max-width: 720px;
  margin-bottom: 9px;
  color: var(--blue-deep);
  font-size: 34px;
}

.modeling-lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.task-context {
  display: grid;
  grid-template-columns: 52px 1fr;
  min-width: 0;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid rgba(183, 123, 41, 0.35);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 9px 30px rgba(49, 43, 33, 0.08);
  gap: 14px;
}

.task-context-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: white;
  background: var(--blue-deep);
  border: 2px solid var(--gold-bright);
  border-radius: 7px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 23px;
}

.task-context div:last-child {
  display: grid;
  min-width: 0;
}

.task-context small,
.task-context span {
  color: var(--ink-soft);
  font-size: 11px;
}

.task-context strong {
  overflow: hidden;
  margin: 2px 0;
  color: var(--blue-deep);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modeling-page {
  padding-block: 26px 68px;
}

.modeling-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 290px);
  align-items: end;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
  gap: 22px;
}

.filter-heading h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.segmented-field {
  display: flex;
  min-width: 0;
  padding: 0;
  border: 0;
}

.segmented-field legend,
.select-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.segmented-field legend {
  width: 100%;
}

.segmented-field label {
  position: relative;
  cursor: pointer;
}

.segmented-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-field span {
  display: grid;
  min-width: 82px;
  min-height: 38px;
  place-items: center;
  padding: 7px 12px;
  border: 1px solid #c9c4b9;
  border-right-width: 0;
  background: rgba(255, 253, 248, 0.8);
  font-size: 13px;
  font-weight: 700;
}

.segmented-field label:first-of-type span {
  border-radius: 6px 0 0 6px;
}

.segmented-field label:last-of-type span {
  border-right-width: 1px;
  border-radius: 0 6px 6px 0;
}

.segmented-field input:checked + span {
  color: white;
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

.segmented-field input:focus-visible + span {
  outline: 3px solid rgba(22, 127, 192, 0.48);
  outline-offset: 3px;
}

.select-field select {
  width: 100%;
  min-height: 38px;
  padding: 6px 34px 6px 11px;
  border: 1px solid #c9c4b9;
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.filter-result {
  margin: 0;
  color: var(--success);
  font-size: 12px;
}

.filter-result.no-match {
  color: var(--warning);
}

.filter-output {
  display: grid;
  grid-column: 1 / -1;
  margin-top: -8px;
  gap: 8px;
}

.filter-match-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-match {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.filter-match.ready {
  color: var(--blue-deep);
  border-color: #aac4d4;
  background: #edf6fa;
}

.filter-match.ready:hover,
.filter-match.ready[aria-current="page"] {
  color: white;
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

.filter-match.pending {
  color: #716958;
  background: #f0ece3;
}

.modeling-steps {
  padding: 24px 0 27px;
}

.modeling-steps ol {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}

.modeling-steps li {
  position: relative;
  min-width: 0;
}

.modeling-steps li:not(:last-child)::after {
  position: absolute;
  top: 19px;
  right: -20%;
  left: 58%;
  height: 2px;
  content: "";
  background: #cfc7b8;
}

.modeling-steps li.complete:not(:last-child)::after {
  background: var(--success);
}

.modeling-steps button {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-width: 0;
  justify-items: center;
  padding: 0 6px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.modeling-steps button > span {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 7px;
  place-items: center;
  color: #6d6b63;
  background: var(--surface);
  border: 2px solid #cfc7b8;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
}

.modeling-steps strong {
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modeling-steps small {
  color: #858279;
  font-size: 10px;
}

.modeling-steps li.complete button {
  color: var(--success);
}

.modeling-steps li.complete button > span {
  color: white;
  border-color: var(--success);
  background: var(--success);
}

.modeling-steps li.current button {
  color: var(--blue-deep);
}

.modeling-steps li.current button > span {
  color: white;
  border-color: var(--gold-bright);
  background: var(--blue-deep);
  box-shadow: 0 0 0 5px rgba(22, 127, 192, 0.12);
}

.modeling-steps li.returned button > span {
  border-color: var(--danger);
  box-shadow: 0 0 0 5px rgba(179, 69, 63, 0.12);
}

.modeling-workspace {
  display: grid;
  grid-template-columns: 250px minmax(550px, 1fr) 278px;
  align-items: start;
  gap: 15px;
}

.workspace-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 8px 25px rgba(50, 42, 28, 0.06);
}

.fragment-panel,
.feedback-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.fragment-count,
.feedback-state {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--blue-deep);
  background: #e8f1f6;
  font-size: 10px;
  font-weight: 800;
}

.feedback-state[data-tone="error"] {
  color: var(--danger);
  background: #f8e8e5;
}

.feedback-state[data-tone="success"] {
  color: var(--success);
  background: #e4f1ea;
}

.feedback-state[data-tone="saving"] {
  color: #19547b;
  background: #e5f2f8;
}

.panel-instruction,
.selection-help {
  margin: 10px 0 13px;
  color: var(--ink-soft);
  font-size: 11px;
}

.mobile-instruction {
  display: none;
}

.fragment-list {
  display: grid;
  gap: 9px;
}

.fragment {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 78px;
  align-content: center;
  padding: 11px 12px;
  border: 1px solid #d9d2c5;
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-strong);
  cursor: grab;
  text-align: left;
  touch-action: manipulation;
}

.fragment:hover {
  border-color: #b9a885;
  background: #fffaf0;
}

.fragment[aria-pressed="true"] {
  border-color: var(--blue);
  border-left-color: var(--blue);
  background: #eaf5fa;
  box-shadow: 0 0 0 3px rgba(22, 127, 192, 0.12);
}

.fragment.placed {
  border-left-color: var(--success);
}

.fragment.conflict {
  border-color: var(--danger);
  border-left-color: var(--danger);
  background: #fff0ee;
}

.fragment:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.fragment-type {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
}

.fragment strong {
  margin: 2px 0;
  font-size: 12px;
  line-height: 1.45;
}

.fragment-location {
  color: var(--ink-soft);
  font-size: 9px;
}

.selection-help {
  padding-top: 12px;
  margin-bottom: 8px;
  border-top: 1px dashed var(--line);
}

.selection-status {
  padding: 7px 9px;
  color: var(--blue-deep);
  background: #eef5f8;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.canvas-panel {
  overflow: hidden;
}

.canvas-heading {
  min-height: 72px;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbf7ef;
}

.reset-button {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #c9c4b9;
  border-radius: 5px;
  color: var(--blue-deep);
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.reset-button:hover {
  border-color: var(--blue);
  background: #eef5f8;
}

.reset-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.model-canvas {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 94px 136px 116px 116px 116px;
  min-height: 682px;
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(rgba(22, 127, 192, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 127, 192, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #fdfbf5, #f2eee4);
  background-size: 24px 24px, 24px 24px, auto;
  gap: 12px 18px;
}

.model-canvas::before {
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 300px;
  height: 300px;
  content: "";
  border: 1px solid rgba(22, 127, 192, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(22, 127, 192, 0.025), 0 0 0 80px rgba(183, 123, 41, 0.02);
}

.model-connectors {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.model-connectors path {
  fill: none;
  stroke: #9cb3bf;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
  stroke-width: 2;
}

.model-connectors path.connected {
  stroke: var(--success);
  stroke-dasharray: none;
}

.model-node {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  align-items: center;
  border: 1px solid #c8c4b9;
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 5px 16px rgba(44, 46, 42, 0.07);
}

.context-node {
  grid-column: 2 / 4;
  grid-row: 1;
  grid-template-columns: 36px 1fr;
  align-self: center;
  min-height: 70px;
  padding: 12px 14px;
  color: white;
  border-color: var(--blue-deep);
  background: var(--blue-deep);
  gap: 11px;
}

.context-node small {
  display: block;
  color: #cfe4f1;
  font-size: 9px;
}

.context-node strong {
  display: block;
  font-size: 13px;
}

.node-number {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--blue-deep);
  border: 1px solid #b9cad5;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
}

.context-node .node-number {
  color: var(--paper);
  border-color: var(--gold-bright);
}

.drop-zone {
  grid-template-columns: 34px minmax(72px, auto) minmax(88px, 1fr);
  min-height: 102px;
  padding: 10px;
  cursor: pointer;
  gap: 8px;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--blue);
  background: #f3fafc;
}

.drop-zone.drag-over {
  box-shadow: inset 0 0 0 2px rgba(22, 127, 192, 0.28);
}

.drop-zone.filled {
  border-color: #8eb49f;
  background: #f5fbf7;
}

.drop-zone.conflict {
  border-color: var(--danger);
  background: #fff0ee;
  box-shadow: 0 0 0 3px rgba(179, 69, 63, 0.1);
}

.drop-zone.disabled {
  cursor: default;
}

.known-node {
  grid-column: 1 / 3;
  grid-row: 2;
}

.unknown-node {
  grid-column: 3 / 5;
  grid-row: 2;
}

.relation-node {
  grid-column: 2 / 4;
  grid-row: 3;
}

.model-node-main {
  grid-column: 2 / 4;
  grid-row: 4;
}

.interpretation-node {
  grid-column: 2 / 4;
  grid-row: 5;
}

.node-copy {
  display: grid;
  align-content: center;
}

.node-copy > small {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
}

.node-copy > strong {
  color: var(--blue-deep);
  font-size: 12px;
}

.node-hint {
  max-width: 110px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.35;
}

.node-content {
  display: grid;
  min-height: 44px;
  align-content: center;
  padding-left: 8px;
  border-left: 1px dashed #c8c4b9;
  gap: 5px;
}

.placed-chip {
  display: block;
  padding: 5px 7px;
  border: 1px solid #b8d4c5;
  border-radius: 4px;
  color: #245940;
  background: #e6f3ec;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}

.placed-chip.conflict {
  color: #8e322e;
  border-color: #dda29e;
  background: #fbe2df;
}

.empty-slot {
  color: #8a877f;
  font-size: 9px;
  font-style: normal;
}

.feedback-panel {
  position: sticky;
  top: 125px;
}

.feedback-summary {
  display: grid;
  grid-template-columns: 39px 1fr;
  align-items: start;
  padding: 16px 0;
  margin-top: 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.feedback-symbol {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: white;
  background: var(--blue-deep);
  border: 2px solid var(--gold-bright);
  border-radius: 6px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 17px;
}

.feedback-summary strong {
  color: var(--blue-deep);
  font-size: 12px;
}

.feedback-summary p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.feedback-summary.error .feedback-symbol {
  background: var(--danger);
  border-color: #e2a19d;
}

.feedback-summary.success .feedback-symbol {
  background: var(--success);
  border-color: #93c9ac;
}

.logic-checklist {
  display: grid;
  padding: 16px 0;
  margin: 0;
  list-style: none;
  gap: 11px;
}

.logic-checklist li {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
}

.logic-checklist li > span {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #aaa69e;
  border-radius: 50%;
}

.logic-checklist li.done > span {
  border-color: var(--success);
  background: var(--success);
}

.logic-checklist li.done > span::after {
  color: white;
  content: "✓";
  font-size: 10px;
  font-weight: 800;
}

.logic-checklist strong,
.logic-checklist small {
  display: block;
}

.logic-checklist strong {
  color: var(--blue-deep);
  font-size: 11px;
}

.logic-checklist small {
  color: var(--ink-soft);
  font-size: 9px;
}

.relation-note {
  padding: 11px;
  margin-bottom: 15px;
  color: #75511f;
  border-left: 3px solid var(--gold);
  background: #fbf1dc;
}

.relation-note strong {
  font-size: 10px;
}

.relation-note p {
  margin: 3px 0 0;
  font-size: 9px;
}

.validate-button {
  width: 100%;
}

.submit-note {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 9px;
  text-align: center;
}

.model-success {
  display: grid;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  gap: 6px;
}

.model-success > span {
  justify-self: center;
  padding: 3px 8px;
  color: var(--success);
  border: 1px solid #9fcbb4;
  border-radius: 4px;
  background: #e8f4ed;
  font-size: 9px;
  font-weight: 800;
}

.model-success strong {
  color: var(--blue-deep);
}

.model-success p {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.noscript-message {
  padding: 15px;
  color: var(--danger);
  border: 1px solid #d8a09c;
  background: #fff0ee;
}

.modeling-unavailable {
  display: grid;
  grid-template-columns: 74px minmax(0, 650px);
  min-height: 360px;
  align-content: center;
  justify-content: center;
  padding: 42px;
  border-bottom: 1px solid var(--line);
  gap: 22px;
}

.modeling-locked {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 410px);
  min-height: 470px;
  align-items: center;
  padding: 42px;
  border-bottom: 1px solid var(--line);
  gap: clamp(28px, 5vw, 72px);
}

.locked-main {
  min-width: 0;
}

.locked-heading {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.unavailable-mark,
.locked-mark {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: white;
  border: 3px solid var(--gold-bright);
  border-radius: 7px;
  background: var(--blue-deep);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 28px;
}

.modeling-unavailable h2,
.modeling-locked h2 {
  color: var(--blue-deep);
}

.modeling-unavailable p:not(.eyebrow),
.modeling-locked p:not(.eyebrow) {
  color: var(--ink-soft);
}

.modeling-unavailable .button,
.modeling-locked .button {
  margin: 8px 7px 0 0;
}

.locked-prerequisite-list {
  padding: 0;
  margin: 26px 0 10px 96px;
  list-style: none;
  border-top: 1px solid var(--line);
}

.locked-prerequisite-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 74px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  gap: 13px;
}

.locked-step-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--blue-deep);
  border: 1px solid #9fb3bf;
  border-radius: 50%;
  background: #f7fbfc;
  font-weight: 800;
}

.locked-prerequisite-list [data-status="complete"] .locked-step-index {
  color: #245f47;
  border-color: #86ab9b;
  background: #edf6f1;
}

.locked-prerequisite-list strong,
.locked-prerequisite-list small {
  display: block;
}

.locked-prerequisite-list strong {
  color: var(--blue-deep);
  font-size: 16px;
}

.locked-prerequisite-list small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.locked-prerequisite-list a,
.locked-step-status {
  min-width: 66px;
  color: var(--blue-deep);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.locked-prerequisite-list a {
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.locked-step-status {
  color: #356f57;
}

.locked-prerequisite-list [data-status="pending"] .locked-step-status {
  color: #875714;
}

.locked-prerequisite-list [data-status="blocked"] .locked-step-status {
  color: #6a6d68;
}

.locked-actions {
  margin-left: 96px;
}

.locked-context-art {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #c8b992;
  border-radius: 6px;
  background: #e9e2d2;
}

.locked-task-art {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #dce4e3;
}

.locked-task-art img,
.locked-task-art.asset-unavailable {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--asset-focus-x, 50%) var(--asset-focus-y, 50%);
}

.locked-context-art figcaption {
  display: grid;
  padding: 14px 16px 16px;
  background: rgba(255, 253, 247, 0.96);
  gap: 3px;
}

.locked-context-art figcaption span,
.locked-context-art figcaption small {
  color: var(--ink-soft);
  font-size: 14px;
}

.locked-context-art figcaption strong {
  color: var(--blue-deep);
  font-size: 17px;
}

@media (max-width: 1180px) {
  .modeling-workspace {
    grid-template-columns: 238px minmax(510px, 1fr);
    grid-template-areas:
      "fragments canvas"
      "feedback canvas";
  }

  .fragment-panel { grid-area: fragments; }
  .canvas-panel { grid-area: canvas; }
  .feedback-panel {
    position: static;
    grid-area: feedback;
  }

  .modeling-filters {
    grid-template-columns: minmax(210px, 1fr) auto minmax(205px, 250px);
  }
}

@media (max-width: 860px) {
  .modeling-header-inner {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-block: 25px;
    gap: 18px;
  }

  .modeling-header h1 {
    font-size: 28px;
  }

  .task-context {
    max-width: 500px;
  }

  .modeling-locked {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 30px 24px 38px;
    gap: 30px;
  }

  .locked-context-art {
    width: min(100%, 560px);
  }

  .modeling-filters {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 15px;
  }

  .filter-result {
    margin-top: -2px;
  }

  .segmented-field span {
    min-width: 0;
    min-height: 44px;
  }

  .select-field select,
  .filter-match.ready {
    min-height: 44px;
  }

  .segmented-field label {
    flex: 1;
  }

  .modeling-steps {
    padding: 20px 0 22px;
  }

  .modeling-steps ol {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 18px;
  }

  .modeling-steps li:nth-child(3)::after,
  .modeling-steps li:nth-child(6)::after {
    display: none;
  }

  .modeling-steps li:not(:last-child)::after {
    right: -16%;
    left: 62%;
  }

  .modeling-workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "fragments"
      "canvas"
      "feedback";
  }

  .desktop-instruction,
  .selection-help {
    display: none;
  }

  .mobile-instruction {
    display: block;
  }

  .fragment-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fragment {
    min-height: 86px;
    cursor: pointer;
  }

  .model-canvas {
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding: 16px;
    gap: 13px;
  }

  .model-connectors {
    display: none;
  }

  .model-node {
    width: 100%;
    flex: 0 0 auto;
  }

  .context-node {
    min-height: 72px;
  }

  .drop-zone {
    min-height: 108px;
    grid-template-columns: 34px minmax(82px, 118px) 1fr;
  }

  .feedback-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .locked-heading {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
  }

  .locked-mark {
    width: 54px;
    height: 54px;
    font-size: 23px;
  }

  .locked-prerequisite-list,
  .locked-actions {
    margin-left: 0;
  }

  .locked-prerequisite-list li {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .locked-prerequisite-list a,
  .locked-step-status {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    text-align: left;
  }

  .locked-actions .button {
    width: 100%;
    margin-right: 0;
  }
}

@media (max-width: 520px) {
  .modeling-page {
    padding-block: 20px 44px;
  }

  .modeling-header h1 {
    font-size: 25px;
  }

  .modeling-lead {
    font-size: 14px;
  }

  .task-context {
    grid-template-columns: 42px 1fr;
    padding: 13px;
  }

  .task-context-mark {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .modeling-steps strong {
    font-size: 14px;
    white-space: normal;
  }

  .modeling-steps small {
    display: none;
  }

  .modeling-steps li:not(:last-child)::after {
    right: -13%;
    left: 67%;
  }

  .fragment-panel,
  .feedback-panel {
    padding: 15px;
  }

  .fragment-list {
    grid-template-columns: 1fr;
  }

  .fragment {
    min-height: 74px;
  }

  .canvas-heading {
    min-height: 68px;
    padding: 13px 14px;
  }

  .canvas-heading h2 {
    font-size: 17px;
  }

  .model-canvas {
    padding: 13px;
  }

  .drop-zone {
    grid-template-columns: 30px 92px 1fr;
    padding: 9px;
    gap: 6px;
  }

  .node-number {
    width: 28px;
    height: 28px;
  }

  .node-hint {
    max-width: 92px;
  }

  .modeling-unavailable,
  .modeling-locked {
    grid-template-columns: 1fr;
    min-height: 390px;
    padding: 28px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .model-connectors path {
    stroke-dasharray: none;
  }
}

/* Round-two disclosure controls and inline validation result. */
.modeling-filters {
  display: block;
}

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

.modeling-filter-controls {
  display: grid;
  grid-template-columns: auto minmax(205px, 250px) minmax(260px, 1fr);
  align-items: end;
  gap: 20px;
}

.modeling-filter-controls .filter-output {
  grid-column: auto;
  margin-top: 0;
}

.modeling-disclosure-toggle,
.modeling-steps-toggle,
.placed-fragments-toggle {
  display: none;
  min-height: 44px;
  color: var(--blue-deep);
  border: 1px solid #b9c9d2;
  border-radius: 5px;
  background: #eef5f8;
  cursor: pointer;
  font-weight: 800;
}

.modeling-inline-feedback {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid #b9cbd4;
  background: #eef5f8;
  gap: 12px;
}

.modeling-inline-feedback[data-tone="error"] {
  background: #fff0ee;
  border-color: #d9a29e;
}

.modeling-inline-feedback[data-tone="success"] {
  background: #edf6f0;
  border-color: #afd0bd;
}

.inline-feedback-symbol {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--blue-deep);
  border-radius: 6px;
  font-family: "STKaiti", "KaiTi", serif;
}

.modeling-inline-feedback[data-tone="error"] .inline-feedback-symbol { background: var(--danger); }
.modeling-inline-feedback[data-tone="success"] .inline-feedback-symbol { background: var(--success); }

.modeling-inline-feedback strong {
  color: var(--blue-deep);
}

.modeling-inline-feedback p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.model-node.is-current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 127, 192, .12);
}

@media (max-width: 860px) {
  .modeling-disclosure-toggle,
  .modeling-steps-toggle,
  .placed-fragments-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
  }

  .modeling-filter-controls {
    grid-template-columns: 1fr;
  }

  .modeling-filter-controls[hidden] {
    display: none;
  }

  .modeling-steps {
    padding: 16px 0;
  }

  .modeling-steps-toggle {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    text-align: left;
    gap: 10px;
  }

  .modeling-steps-toggle span {
    color: var(--ink-soft);
    font-size: 12px;
  }

  .modeling-steps-toggle strong {
    color: var(--blue-deep);
    font-size: 14px;
  }

  .modeling-inline-feedback p,
  .fragment strong,
  .node-copy > strong,
  .node-hint {
    font-size: 14px;
  }

  .modeling-steps ol {
    display: none;
    margin-top: 16px;
  }

  .modeling-steps ol.expanded {
    display: grid;
  }

  .placed-fragments-toggle {
    width: 100%;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .placed-fragments-toggle:disabled {
    cursor: default;
    opacity: .55;
  }

  .fragment-list:not(.show-placed) .fragment.placed:not(.conflict) {
    display: none;
  }

  .logic-checklist,
  .relation-note {
    display: none;
  }

  .modeling-inline-feedback {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .modeling-inline-feedback .button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .filter-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .modeling-inline-feedback {
    padding: 12px;
  }
}

.structured-modeling {
  display: grid;
  margin-top: 24px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 34px rgba(49, 43, 33, 0.08);
  gap: 24px;
}

.structured-modeling-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.structured-modeling-head h2 {
  margin: 2px 0 6px;
  color: var(--blue-deep);
  font-size: 24px;
}

.structured-modeling-head p:last-child {
  margin: 0;
  color: var(--ink-soft);
}

.structured-modeling-progress {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 8px 12px;
  border: 1px solid rgba(22, 127, 192, 0.28);
  border-radius: 6px;
  color: var(--blue-deep);
  background: rgba(22, 127, 192, 0.07);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.structured-modeling-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 8px;
}

.structured-modeling-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 52px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: #fff;
  gap: 8px;
}

.structured-modeling-steps li > span {
  display: grid;
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #b9c3cb;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.structured-modeling-steps li > strong {
  font-size: 13px;
  line-height: 1.35;
}

.structured-modeling-steps li > small {
  color: #686b65;
  font-size: 11px;
  line-height: 1.35;
}

.structured-modeling-steps li.current {
  color: var(--blue-deep);
  border-color: var(--blue);
  background: rgba(22, 127, 192, 0.07);
}

.structured-modeling-steps li.current > span {
  color: #fff;
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

.structured-modeling-steps li.review,
.structured-modeling-steps li.complete {
  color: #245f45;
  border-color: rgba(36, 95, 69, 0.35);
  background: rgba(36, 95, 69, 0.07);
}

.structured-modeling-steps li.complete {
  border-color: rgba(36, 95, 69, 0.55);
  background: rgba(36, 95, 69, 0.12);
}

.structured-modeling-steps li.locked {
  color: #60635e;
  border-style: dashed;
  background: #f5f3ed;
}

.structured-modeling-stage {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: clamp(18px, 2.5vw, 28px);
  border: 1px solid rgba(23, 60, 97, 0.2);
  border-radius: 7px;
  background: #fff;
  gap: 14px;
}

.structured-modeling-stage legend {
  padding: 0 8px;
  color: var(--blue-deep);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 21px;
  font-weight: 800;
}

.structured-modeling-stage > p,
.structured-stage-detail > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.structured-stage-detail > label,
.structured-field-grid > label {
  display: grid;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
}

.structured-stage-detail > label:has(input[type="checkbox"]),
.structured-stage-detail > label:has(input[type="radio"]) {
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 48px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #c9c4b9;
  border-radius: 6px;
  background: #fffdfa;
  cursor: pointer;
}

.structured-modeling-stage input[type="checkbox"],
.structured-modeling-stage input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue-deep);
}

.structured-modeling-stage input:not([type="checkbox"]):not([type="radio"]),
.structured-modeling-stage select,
.structured-modeling-stage textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #aaa69d;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.structured-modeling-stage textarea {
  min-height: 92px;
  resize: vertical;
}

.structured-modeling-stage input:focus-visible,
.structured-modeling-stage select:focus-visible,
.structured-modeling-stage textarea:focus-visible {
  outline: 3px solid rgba(22, 127, 192, 0.22);
  outline-offset: 1px;
  border-color: var(--blue);
}

.structured-stage-status {
  padding: 10px 12px;
  border-left: 3px solid #8b969b;
  background: #f2f4f4;
}

.structured-modeling-stage[data-stage-state="current"] .structured-stage-status {
  color: var(--blue-deep);
  border-left-color: var(--blue);
  background: rgba(22, 127, 192, 0.07);
}

.structured-modeling-stage[data-stage-state="review"] .structured-stage-status,
.structured-modeling-stage[data-stage-state="complete"] .structured-stage-status {
  color: #245f45;
  border-left-color: #2d7655;
  background: rgba(45, 118, 85, 0.08);
}

.structured-modeling-stage[data-stage-state="locked"] {
  border-style: dashed;
  background: #f8f6f0;
}

.structured-stage-detail {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.structured-stage-detail[hidden],
.structured-stage-actions[hidden] {
  display: none;
}

.structured-modeling-stage[data-stage-state="review"] input,
.structured-modeling-stage[data-stage-state="review"] select,
.structured-modeling-stage[data-stage-state="review"] textarea,
.structured-modeling-stage[data-stage-state="complete"] input,
.structured-modeling-stage[data-stage-state="complete"] select,
.structured-modeling-stage[data-stage-state="complete"] textarea {
  color: #4b554f;
  background: #f3f5f2;
  opacity: 1;
}

.structured-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.structured-field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.structured-stage-actions {
  display: flex;
  align-items: center;
  margin-top: 4px;
  gap: 14px;
}

.structured-stage-actions > span {
  color: var(--ink-soft);
  font-size: 12px;
}

.structured-modeling-feedback {
  display: grid;
  padding: 16px 18px;
  border-left: 4px solid var(--blue);
  border-radius: 4px;
  background: rgba(22, 127, 192, 0.07);
  gap: 6px;
}

.structured-modeling-feedback[hidden] {
  display: none;
}

.structured-modeling-feedback[data-tone="success"] {
  border-left-color: #2d7655;
  background: rgba(45, 118, 85, 0.08);
}

.structured-modeling-feedback[data-tone="warning"] {
  border-left-color: #9a5f12;
  background: rgba(154, 95, 18, 0.09);
}

.structured-modeling-feedback[data-tone="error"] {
  border-left-color: #a53a32;
  background: rgba(165, 58, 50, 0.08);
}

.structured-modeling-feedback strong {
  color: var(--blue-deep);
}

.structured-modeling-feedback p {
  margin: 0;
  color: var(--ink-soft);
}

.structured-modeling-feedback .button {
  width: fit-content;
  margin-top: 8px;
}

@media (max-width: 820px) {
  .structured-modeling {
    margin-top: 16px;
    padding: 16px;
    gap: 18px;
  }

  .structured-modeling-head {
    gap: 12px;
  }

  .structured-modeling-head h2 {
    font-size: 21px;
  }

  .structured-modeling-steps {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .structured-modeling-steps li {
    flex: 0 0 min(190px, 70vw);
    scroll-snap-align: start;
  }

  .structured-field-grid,
  .structured-field-grid.three,
  .structured-field-grid.four {
    grid-template-columns: 1fr;
  }

  .structured-stage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .structured-stage-actions .button,
  .structured-modeling-feedback .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .structured-modeling-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .structured-modeling-progress {
    min-width: 64px;
  }

  .structured-modeling-stage {
    padding: 16px 12px;
  }
}
