.nn-workspace {
  grid-template-columns: minmax(560px, 1.25fr) minmax(360px, 0.8fr);
  align-items: start;
}

.nn-interpret-workspace {
  grid-template-columns: minmax(280px, 360px) minmax(520px, 1fr) minmax(360px, 0.78fr);
  align-items: start;
}

.nn-control-panel {
  display: grid;
  gap: 14px;
}

.nn-note,
.nn-mini-panel,
.nn-calc-panel,
.nn-step-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.nn-note h2,
.nn-mini-panel h2,
.nn-calc-panel h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 1rem;
}

.nn-note p,
.nn-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.nn-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nn-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--selected);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.nn-weight-table {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) repeat(3, minmax(62px, 74px));
  align-items: center;
  gap: 8px;
}

.nn-output-weight-table {
  padding-top: 4px;
}

.nn-weight-table label {
  color: var(--accent-strong);
  font-size: 0.8rem;
  text-transform: none;
}

.nn-weight-table input {
  width: 100%;
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.nn-weight-head {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.nn-builder-diagram {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.nn-builder-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.nn-builder-heading {
  fill: #1f2522;
  font-size: 24px;
  font-weight: 850;
  text-decoration: underline;
}

.nn-builder-svg-edge {
  stroke: #1f2522;
  stroke-linecap: round;
  stroke-width: 3;
  opacity: 0.82;
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.nn-builder-arrowhead {
  fill: #1f2522;
}

.nn-builder-svg-node {
  stroke: #1f2522;
  stroke-width: 2;
}

.nn-builder-svg-node.input {
  fill: #dfeedd;
  stroke: #9fb79f;
}

.nn-builder-svg-node.hidden {
  fill: #2f7ee6;
  stroke: #1c4b8f;
}

.nn-builder-svg-node.accept {
  fill: #43a047;
  stroke: #449446;
}

.nn-builder-svg-node.reject {
  fill: #ef5b5b;
  stroke: #d74848;
}

.nn-builder-svg-label {
  font-size: 19px;
  font-weight: 850;
  text-anchor: middle;
}

.nn-builder-svg-label.input {
  fill: #1f2522;
}

.nn-builder-svg-label.hidden,
.nn-builder-svg-label.accept,
.nn-builder-svg-label.reject {
  fill: #ffffff;
}

.nn-builder-svg-value {
  fill: #1f2522;
  font-size: 15px;
  font-weight: 750;
  text-anchor: middle;
}

.nn-builder-svg-value.hidden {
  fill: #1c4b8f;
}

.nn-builder-svg-value.accept {
  fill: #24714a;
}

.nn-builder-svg-value.reject {
  fill: #9b3d31;
}

.nn-svg-edit {
  box-sizing: border-box;
  display: grid;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(22, 31, 29, 0.11);
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.nn-svg-edit label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.nn-svg-edit input[type="number"] {
  box-sizing: border-box;
  width: 100%;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  text-align: center;
}

.nn-svg-edit input[type="number"]:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(17, 106, 108, 0.20);
}

.nn-basics-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1.25fr) minmax(360px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.nn-basics-main {
  display: grid;
  gap: 14px;
}

.nn-training-layout {
  grid-template-columns: minmax(900px, 1.45fr) minmax(340px, 0.55fr);
}

.nn-training-workbench-grid {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.nn-training-controls-column,
.nn-training-network-column {
  min-width: 0;
}

.nn-training-controls-column {
  display: grid;
  gap: 12px;
}

.nn-training-controls-column .field-row,
.nn-training-workbench .nn-training-summary {
  grid-template-columns: 1fr;
}

.nn-training-controls-column .field {
  margin-bottom: 0;
}

.nn-training-workbench .nn-training-summary {
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.nn-training-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.nn-training-subhead h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.98rem;
}

.nn-training-workbench .nn-basic-svg {
  min-width: 660px;
}

.nn-training-intro-panel,
.nn-training-extra-model {
  margin-top: 16px;
}

.nn-training-extra-model .nn-basic-svg {
  min-width: 760px;
}

.nn-interpret-diagram {
  border: 0;
  border-radius: 0;
}

.nn-basic-svg.nn-interpret-svg {
  min-width: 0;
  min-height: 0;
  aspect-ratio: 900 / 610;
  background: #ffffff;
}

.nn-interpret-svg .nn-basic-input-toggle {
  cursor: default;
}

.nn-interpret-weight-label,
.nn-interpret-bias-label {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  text-anchor: middle;
}

.nn-interpret-weight-label {
  font-size: 13px;
}

.nn-interpret-bias-label {
  font-size: 12px;
}

.nn-rule-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.nn-basic-diagram {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.nn-basic-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.nn-basic-heading {
  fill: #1f2522;
  font-size: 28px;
  font-weight: 850;
  text-decoration: underline;
}

.nn-basic-edge {
  fill: none;
  stroke: #1f2522;
  stroke-linecap: round;
  stroke-width: 3.5;
  opacity: 0.82;
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.nn-basic-arrowhead {
  fill: context-stroke;
}

.nn-basic-box,
.nn-basic-node {
  stroke: #1f2522;
  stroke-width: 1.5;
}

.nn-basic-box.input {
  fill: #eef4ee;
  stroke: #9fb79f;
}

.nn-basic-input-toggle {
  cursor: pointer;
  outline: none;
}

.nn-basic-input-toggle .nn-basic-box.input {
  transition: fill 140ms ease, filter 100ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.nn-basic-input-toggle.active .nn-basic-box.input {
  fill: #99e6ae;
  stroke: #7aaa88;
  stroke-width: 1.5;
}

.nn-basic-input-toggle.active .nn-basic-box-label {
  fill: #0b5134;
}

.nn-basic-input-toggle:active .nn-basic-box.input {
  filter: drop-shadow(0 0 6px rgba(17, 106, 108, 0.34));
  stroke: var(--accent);
  stroke-width: 2.5;
}

.nn-basic-input-toggle:focus-visible .nn-basic-box.input {
  stroke: var(--accent);
  stroke-dasharray: 5 4;
  stroke-width: 2.5;
}

.nn-basic-box.accept {
  fill: #43a047;
  stroke: #3f8d42;
}

.nn-basic-box.reject {
  fill: #ef5b5b;
  stroke: #d74848;
}

.nn-basic-output .nn-basic-box {
  transition: filter 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.nn-basic-output.winner .nn-basic-box {
  filter: drop-shadow(0 0 8px rgba(247, 201, 72, 0.7));
  stroke: #f7c948;
  stroke-width: 4;
}

.nn-basic-node.hidden {
  fill: #2f7ee6;
  stroke: #1c4b8f;
}

.nn-basic-box-label,
.nn-basic-output-label,
.nn-basic-node-label {
  font-size: 22px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: middle;
}

.nn-basic-box-label {
  fill: #1f2522;
}

.nn-basic-output-label,
.nn-basic-node-label {
  fill: #ffffff;
}

.nn-basic-value {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-anchor: middle;
}

.nn-basic-winner-check {
  opacity: 0;
  transition: opacity 140ms ease;
}

.nn-basic-winner-check circle {
  fill: #2f9e44;
  stroke: #ffffff;
  stroke-width: 2;
}

.nn-basic-winner-check path {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.nn-basic-output.winner .nn-basic-winner-check {
  opacity: 1;
}

.nn-basic-edit {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: #1f2522;
  appearance: textfield;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
}

.nn-basic-edit::-webkit-outer-spin-button,
.nn-basic-edit::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.nn-basic-edit:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(17, 106, 108, 0.20);
}

.nn-basic-edit::placeholder {
  color: #1f2522;
  opacity: 0.52;
}

.nn-basic-calculation {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.nn-builder-lines {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  pointer-events: none;
}

.nn-builder-lines path {
  fill: none;
  stroke: #7d8d85;
  stroke-linecap: round;
  stroke-width: 3;
  opacity: 0.86;
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.nn-builder-lines marker path {
  fill: #1f2522;
}

.nn-builder-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 94px;
  min-height: 62px;
  padding: 8px;
  border: 2px solid #1f2522;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(22, 31, 29, 0.10);
  text-align: center;
}

.nn-builder-node strong {
  color: inherit;
  font-size: 0.88rem;
  line-height: 1.05;
}

.nn-builder-node span {
  color: inherit;
  opacity: 0.86;
  font-size: 0.7rem;
  font-weight: 800;
}

.nn-builder-input {
  width: 128px;
  min-height: 48px;
  border-color: #9fb79f;
  border-radius: 2px;
  background: #dfeedd;
  color: #1f2522;
}

.nn-builder-hidden {
  width: 62px;
  min-height: 62px;
  border-color: #1c4b8f;
  background: #2f7ee6;
  color: #ffffff;
}

.nn-builder-output {
  width: 118px;
  min-height: 48px;
  border-color: #449446;
  border-radius: 2px;
  background: #43a047;
  color: #ffffff;
}

.nn-builder-reject {
  border-color: #d74848;
  background: #ef5b5b;
}

.nn-node-a {
  top: 92px;
  left: 16px;
}

.nn-node-i {
  top: 244px;
  left: 16px;
}

.nn-node-h1 {
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
}

.nn-node-h2 {
  top: 232px;
  left: 50%;
  transform: translateX(-50%);
}

.nn-node-out {
  top: 86px;
  right: 16px;
  transform: none;
}

.nn-node-reject {
  top: 244px;
  right: 16px;
  transform: none;
}

.nn-edge-box,
.nn-bias-box {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 4px;
  width: 78px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(22, 31, 29, 0.11);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
}

.nn-edge-box input,
.nn-bias-box input {
  width: 100%;
  height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.82rem;
  text-align: center;
}

.nn-edge-box input:focus,
.nn-bias-box input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(17, 106, 108, 0.20);
}

.nn-edge-a-h1 {
  top: 50px;
  left: 31%;
}

.nn-edge-a-h2 {
  top: 167px;
  left: 31%;
}

.nn-edge-i-h1 {
  top: 158px;
  left: 31%;
}

.nn-edge-i-h2 {
  top: 308px;
  left: 31%;
}

.nn-edge-h1-out {
  top: 54px;
  right: 30%;
}

.nn-edge-h2-out {
  top: 156px;
  right: 30%;
}

.nn-edge-h1-reject {
  top: 170px;
  right: 30%;
}

.nn-edge-h2-reject {
  top: 294px;
  right: 30%;
}

.nn-bias-h1 {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
}

.nn-bias-h2 {
  top: 300px;
  left: 50%;
  transform: translateX(-50%);
}

.nn-bias-out {
  top: 36px;
  right: 34px;
}

.nn-bias-reject {
  top: 202px;
  right: 34px;
}

.nn-button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.nn-table-wrap {
  overflow-x: auto;
}

.nn-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.nn-data-table th,
.nn-data-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.nn-data-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.nn-data-table tr.selected-row td {
  background: var(--selected);
}

.nn-data-table button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

.nn-data-table button:hover {
  border-color: var(--accent);
}

.nn-prediction-label {
  color: var(--accent-strong);
  font-weight: 850;
}

.nn-match-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
}

.nn-match-icon.match {
  background: #2f9e44;
}

.nn-match-icon.miss {
  background: #c0392b;
}

.nn-pass {
  color: #24714a;
  font-weight: 850;
}

.nn-fail {
  color: #9b3d31;
  font-weight: 850;
}

.nn-calc-lines {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.45;
}

.nn-training-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.nn-training-summary div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.nn-training-summary strong {
  color: var(--accent-strong);
  font-size: 1.25rem;
}

.nn-card-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.nn-prob-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece8;
}

.nn-prob-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.nn-weight-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.nn-step-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nn-step-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--accent-strong);
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.nn-step-button.active {
  border-color: var(--accent);
  background: var(--selected);
}

.nn-step-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.nn-question-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.4;
}

.nn-hidden-answer {
  padding: 10px;
  border-radius: 8px;
  background: var(--selected);
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1.45;
}

.nn-hidden-answer p {
  margin: 0 0 8px;
}

.nn-hidden-answer p:last-child {
  margin-bottom: 0;
}

.nn-network-panel {
  overflow: hidden;
}

.nn-network-svg {
  display: block;
  width: 100%;
  min-height: 510px;
  background: #fbfcfa;
}

.nn-edge {
  stroke-linecap: round;
  opacity: 0.55;
}

.nn-edge.active {
  opacity: 1;
}

.nn-edge-label {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 750;
}

.nn-node-ring {
  stroke: #1f2522;
  stroke-width: 2;
}

.nn-node-label {
  fill: #1f2522;
  font-size: 18px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: middle;
}

.nn-node-value {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  text-anchor: middle;
}

.nn-signal-explanation {
  min-height: 82px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
}

.nn-signal-explanation strong {
  color: var(--accent-strong);
}

@media (max-width: 1180px) {
  .nn-workspace,
  .nn-basics-layout,
  .nn-interpret-workspace {
    grid-template-columns: 1fr;
  }

  .nn-network-svg {
    min-height: 430px;
  }
}

@media (max-width: 980px) {
  .nn-training-workbench-grid {
    grid-template-columns: 1fr;
  }

  .nn-training-controls-column .field-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nn-builder-diagram {
    min-height: 0;
  }

  .nn-builder-node {
    width: 86px;
    min-height: 56px;
  }

  .nn-edge-box,
  .nn-bias-box {
    width: 70px;
  }

  .nn-node-h1,
  .nn-node-h2 {
    left: 47%;
  }

  .nn-builder-input,
  .nn-builder-output {
    width: 104px;
  }

  .nn-edge-box,
  .nn-bias-box {
    font-size: 0.58rem;
  }

  .nn-edge-a-h1,
  .nn-edge-a-h2,
  .nn-edge-i-h1,
  .nn-edge-i-h2 {
    left: 28%;
  }

  .nn-edge-h1-out,
  .nn-edge-h2-out,
  .nn-edge-h1-reject,
  .nn-edge-h2-reject {
    right: 25%;
  }
}

@media (max-width: 620px) {
  .nn-weight-table {
    grid-template-columns: 1fr repeat(3, minmax(54px, 1fr));
  }

  .nn-weight-head,
  .nn-data-table th,
  .nn-data-table td {
    font-size: 0.74rem;
  }

  .nn-training-controls-column .field-row,
  .nn-training-summary,
  .nn-weight-summary {
    grid-template-columns: 1fr;
  }
}
