.ds-learning-demo {
  border: 1px solid rgba(52, 104, 90, 0.28);
  border-radius: 12px;
  margin: 1.5rem 0;
  padding: 1rem;
}

.ds-learning-demo__title {
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.ds-learning-demo__lead {
  margin: 0 0 1rem;
}

.ds-learning-demo__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.ds-learning-demo__button {
  background: transparent;
  border: 1px solid #4a776b;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0.5rem 0.85rem;
}

.ds-learning-demo__button[aria-pressed="true"] {
  background: #4a776b;
  color: #fff;
  font-weight: 700;
}

[data-ds-layer-demo] .ds-learning-demo__button:disabled,
[data-ds-causal-demo] .ds-learning-demo__button:disabled {
  opacity: 0.5;
  cursor: default;
}

.ds-layer-demo__flow {
  align-items: stretch;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  margin: 1rem 0;
}

.ds-layer-demo__box {
  border: 1px solid rgba(52, 104, 90, 0.25);
  border-radius: 10px;
  padding: 0.8rem 0.45rem;
  text-align: center;
}

.ds-layer-demo__box.is-focus {
  background: rgba(52, 104, 90, 0.1);
  border-color: #4a776b;
}

.ds-layer-demo__arrow {
  align-self: center;
  font-size: 1.35rem;
  opacity: 0.6;
}

.ds-layer-demo__role {
  display: block;
  font-size: 0.82rem;
  margin-top: 0.3rem;
  opacity: 0.75;
}

.ds-layer-demo__result {
  background: rgba(52, 104, 90, 0.07);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.ds-causal-demo__diagram {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr auto 1fr;
  margin: 1rem 0;
}

.ds-causal-demo__node {
  align-items: center;
  border: 1px solid rgba(52, 104, 90, 0.25);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  min-height: 4.3rem;
  padding: 0.7rem;
  text-align: center;
}

.ds-causal-demo__node.is-source {
  background: rgba(52, 104, 90, 0.08);
  border-color: #4a776b;
}

.ds-causal-demo__arrow {
  align-self: center;
  font-size: 1.4rem;
  opacity: 0.65;
}

.ds-causal-demo__third {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 18rem;
  width: 70%;
}

.ds-causal-demo__result {
  background: rgba(52, 104, 90, 0.07);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.ds-causal-demo__verdict {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.ds-learning-demo__hint {
  font-size: 0.92em;
  margin: 0.8rem 0 0;
  opacity: 0.82;
}

@media (max-width: 560px) {
  .ds-learning-demo__controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ds-learning-demo__button {
    width: 100%;
  }

  .ds-layer-demo__flow,
  .ds-causal-demo__diagram {
    grid-template-columns: 1fr;
  }

  .ds-layer-demo__arrow,
  .ds-causal-demo__arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .ds-causal-demo__third {
    grid-column: auto;
    width: 100%;
  }
}

/* DS: threshold, confusion matrix, precision and recall */
.ds-threshold-demo__slider { display: block; width: 100%; min-height: 44px; accent-color: #4a776b; }
.ds-threshold-demo__samples { display: grid; gap: 0.5rem; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ds-threshold-demo__sample { border: 1px solid rgba(52, 104, 90, 0.3); border-radius: 8px; padding: 0.6rem; font-size: 0.88em; overflow-wrap: anywhere; }
.ds-threshold-demo__sample span { display: block; margin-top: 0.3rem; }
.ds-threshold-demo__sample.is-error { border: 2px dashed #a04418; background: rgba(160, 68, 24, 0.06); }
.ds-threshold-demo__matrix { width: 100%; table-layout: fixed; margin: 1rem 0; border-collapse: collapse; }
.ds-threshold-demo__matrix th, .ds-threshold-demo__matrix td { padding: 0.5rem; border: 1px solid rgba(52, 104, 90, 0.3); overflow-wrap: anywhere; }
.ds-threshold-demo__matrix caption { text-align: left; font-weight: 700; margin-bottom: 0.5rem; }
.ds-threshold-demo__metrics { display: grid; gap: 0.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ds-threshold-demo__metrics p { background: rgba(52, 104, 90, 0.07); border-radius: 8px; padding: 0.75rem; margin: 0; overflow-wrap: anywhere; }
.ds-threshold-demo .ds-learning-demo__button { min-height: 44px; }
.ds-threshold-demo .ds-learning-demo__button:disabled { opacity: 0.5; cursor: default; }
.ds-threshold-demo .ds-learning-demo__button:focus-visible, .ds-threshold-demo__slider:focus-visible { outline: 2px solid #4a776b; outline-offset: 3px; }
@media (max-width: 760px) {
  .ds-threshold-demo__samples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .ds-threshold-demo__metrics { grid-template-columns: 1fr; }
  .ds-threshold-demo__matrix th, .ds-threshold-demo__matrix td { padding: 0.3rem; font-size: 0.88em; }
}
