.gk-learning-demo {
  border: 1px solid rgba(75, 94, 128, 0.28);
  border-radius: 12px;
  margin: 1.5rem 0;
  padding: 1rem;
}

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

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

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

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

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

[data-gk-activation-demo] .gk-learning-demo__button:disabled,
[data-gk-activation-demo] .gk-activation-demo__slider:disabled,
[data-gk-softmax-demo] .gk-activation-demo__slider:disabled {
  opacity: 0.5;
  cursor: default;
}

.gk-activation-demo__chart {
  border: 1px solid rgba(75, 94, 128, 0.18);
  border-radius: 10px;
  display: block;
  height: auto;
  margin: 0.8rem 0;
  max-width: 100%;
  width: 100%;
}

.gk-activation-demo__axis {
  stroke: currentColor;
  stroke-opacity: 0.28;
  stroke-width: 1;
}

.gk-activation-demo__curve {
  fill: none;
  stroke: #526987;
  stroke-width: 3;
}

.gk-activation-demo__point {
  fill: #526987;
}

.gk-activation-demo__slider {
  width: 100%;
}

.gk-activation-demo__readout {
  background: rgba(75, 94, 128, 0.07);
  border-radius: 10px;
  margin: 0.7rem 0;
  padding: 0.75rem 0.9rem;
}

.gk-activation-demo__softmax {
  border-top: 1px solid rgba(75, 94, 128, 0.18);
  margin-top: 1rem;
  padding-top: 1rem;
}

.gk-activation-demo__bar-row {
  align-items: center;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 4rem 1fr 4rem;
  margin: 0.45rem 0;
}

.gk-activation-demo__bar-track {
  background: rgba(75, 94, 128, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.gk-activation-demo__bar {
  background: #526987;
  height: 0.7rem;
  transition: width 0.2s ease;
}

.gk-pooling-demo__stage {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.62fr);
  margin: 1rem 0;
}

.gk-pooling-demo__grid {
  display: grid;
  gap: 0.28rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gk-pooling-demo__grid.is-output {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gk-pooling-demo__cell {
  align-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(75, 94, 128, 0.24);
  border-radius: 7px;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding: 0.25rem;
  text-align: center;
}

.gk-pooling-demo__cell[data-block="a"],
.gk-pooling-demo__cell[data-block="d"] {
  background: rgba(75, 94, 128, 0.08);
}

.gk-pooling-demo__cell.is-result {
  border-color: #526987;
  font-weight: 700;
}

.gk-pooling-demo__arrow {
  font-size: 1.4rem;
  opacity: 0.6;
}

.gk-pooling-demo__summary {
  background: rgba(75, 94, 128, 0.07);
  border-radius: 10px;
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
}

.gk-conv-demo__stage {
  align-items: start;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr auto 0.7fr;
  margin: 1rem 0;
}

.gk-conv-demo__grid {
  display: grid;
  gap: 0.25rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gk-conv-demo__grid.is-kernel,
.gk-conv-demo__grid.is-output {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gk-conv-demo__cell {
  align-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(75, 94, 128, 0.24);
  border-radius: 7px;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding: 0.2rem;
  text-align: center;
}

.gk-conv-demo__cell.is-window {
  background: rgba(75, 94, 128, 0.12);
  border-color: #526987;
  font-weight: 700;
}

.gk-conv-demo__cell.is-output-current {
  background: rgba(75, 94, 128, 0.14);
  border-color: #526987;
  font-weight: 700;
}

.gk-conv-demo__kernel-wrap {
  min-width: 7rem;
}

.gk-conv-demo__formula,
.gk-confusion-demo__summary {
  background: rgba(75, 94, 128, 0.07);
  border-radius: 10px;
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
}

.gk-confusion-demo__matrix {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.gk-confusion-demo__cell {
  border: 1px solid rgba(75, 94, 128, 0.24);
  border-radius: 9px;
  padding: 0.8rem 0.5rem;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.gk-confusion-demo__cell strong {
  display: block;
  font-size: 1.15rem;
}

.gk-confusion-demo__cell.is-focus {
  background: rgba(75, 94, 128, 0.13);
  border-color: #526987;
}

.gk-confusion-demo__cell.is-error {
  outline: 2px solid rgba(75, 94, 128, 0.22);
  outline-offset: 1px;
}

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

@media (max-width: 520px) {
  .gk-learning-demo__controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .gk-learning-demo__button {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .gk-pooling-demo__stage,
  .gk-conv-demo__stage {
    grid-template-columns: 1fr;
  }

  .gk-pooling-demo__arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .gk-conv-demo__kernel-wrap {
    max-width: 8rem;
  }
}

/* GK: learning rate and gradient descent */
.gk-gradient-demo__chart {
  display: block;
  width: 100%;
  height: auto;
  margin: 1rem 0;
  border: 1px solid rgba(75, 94, 128, 0.28);
  border-radius: 10px;
}
.gk-gradient-demo__axis { fill: none; stroke: currentColor; stroke-opacity: 0.35; }
.gk-gradient-demo__curve { fill: none; stroke: #526987; stroke-width: 3; }
.gk-gradient-demo__trail { fill: none; stroke: #a04418; stroke-width: 2; stroke-dasharray: 6 4; }
.gk-gradient-demo__point { fill: #a04418; stroke: white; stroke-width: 2; }
.gk-gradient-demo__labels { fill: currentColor; font-size: 20px; }
.gk-gradient-demo .gk-learning-demo__button { min-height: 44px; }
.gk-gradient-demo .gk-learning-demo__button:disabled { opacity: 0.5; cursor: default; }
.gk-gradient-demo .gk-learning-demo__button:focus-visible { outline: 2px solid #526987; outline-offset: 3px; }
.gk-gradient-demo .gk-activation-demo__readout { overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .gk-gradient-demo .gk-learning-demo__controls { grid-template-columns: 1fr; }
}
