.protein-bonds-interactive {
  width: 100%;
  max-width: 920px;
  min-width: 0;
  margin: 0 auto;
  padding: 0;
  --interactive-highlight: rgba(17, 17, 17, 0.06);
  --interactive-highlight-strong: rgba(17, 17, 17, 0.1);
  --interactive-highlight-outline: rgba(17, 17, 17, 0.18);
  container-type: inline-size;
}

.protein-bonds-interactive,
.protein-bonds-interactive * {
  box-sizing: border-box;
}

[data-md-color-scheme="slate"] .protein-bonds-interactive {
  --interactive-highlight: rgba(245, 245, 243, 0.08);
  --interactive-highlight-strong: rgba(245, 245, 243, 0.14);
  --interactive-highlight-outline: rgba(245, 245, 243, 0.22);
}

.protein-bonds-interactive .viz-card {
  background: var(--wiki-surface);
  border: 1px solid var(--wiki-line);
  border-radius: var(--wiki-radius-lg);
  box-shadow: var(--wiki-shadow);
  padding: 1.25rem;
}

.protein-bonds-interactive .controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.protein-bonds-interactive .controls {
  display: flex;
  gap: 0.5rem;
  background: var(--wiki-surface-soft);
  padding: 0.5rem;
  border-radius: var(--wiki-radius-md);
  border: 1px solid var(--wiki-line);
  width: fit-content;
}

.protein-bonds-interactive .controls button {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--wiki-radius-sm);
  color: var(--wiki-text-muted);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.protein-bonds-interactive .controls button.active {
  background: var(--wiki-surface);
  color: var(--wiki-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--wiki-line);
}

[data-md-color-scheme="slate"] .protein-bonds-interactive .controls button.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.protein-bonds-interactive .minimal-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--wiki-text-muted);
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  border-radius: var(--wiki-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.protein-bonds-interactive .minimal-btn:hover {
  color: var(--wiki-text);
  background: var(--wiki-highlight);
}

.protein-bonds-interactive .diagram-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--wiki-surface-soft);
  border-radius: var(--wiki-radius-md);
  border: 1px solid var(--wiki-line);
  overflow-x: auto;
  position: relative;
  margin-bottom: 1rem;
}

.protein-bonds-interactive svg {
  width: 100%;
  height: 100%;
  display: block;
}

.protein-bonds-interactive .svg-background {
  cursor: pointer;
}

.protein-bonds-interactive .diagram-container[data-mode="single"] {
  aspect-ratio: 4 / 3;
  max-height: 420px;
}

.protein-bonds-interactive .diagram-scroll-hint {
  display: none;
  margin: 0 0 1rem;
  color: var(--wiki-text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.protein-bonds-interactive [hidden] {
  display: none !important;
}

.protein-bonds-interactive :focus-visible {
  outline: 2px solid var(--wiki-text);
  outline-offset: 3px;
}

.protein-bonds-interactive .atom {
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  fill: var(--wiki-text);
  text-anchor: middle;
  dominant-baseline: middle;
  transition: fill 0.3s;
}

.protein-bonds-interactive .atom-muted {
  fill: var(--wiki-text-muted);
  font-weight: 500;
  font-size: 16px;
}

.protein-bonds-interactive .peptide-label,
.protein-bonds-interactive .water-subtitle {
  font-size: 11px;
}

.protein-bonds-interactive .water-title {
  font-size: 14px;
}

.protein-bonds-interactive .bond {
  stroke: var(--wiki-text);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: all 0.3s;
}

.protein-bonds-interactive .bond-muted {
  stroke: var(--wiki-text-muted);
  stroke-width: 2;
}

.protein-bonds-interactive .r-group-outline {
  stroke: var(--wiki-text-muted);
  stroke-dasharray: 4;
  fill: transparent;
  stroke-width: 1.5;
  pointer-events: none;
}

.protein-bonds-interactive .water-pill {
  fill: var(--wiki-surface);
  stroke: var(--wiki-line);
  stroke-width: 1;
}

.protein-bonds-interactive .no-transitions * {
  transition: none !important;
}

.protein-bonds-interactive .aa-group {
  transition: transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.protein-bonds-interactive .leaving-group {
  transition: opacity 0.4s ease;
}

.protein-bonds-interactive .peptide-bond-group {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.protein-bonds-interactive .water-group {
  opacity: 0;
  transform: translateY(0);
  transition: all 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.protein-bonds-interactive .view-single .aa1-group {
  transform: translateX(150px);
}

.protein-bonds-interactive .view-single .aa2-group {
  transform: translateX(150px);
  opacity: 0;
  pointer-events: none;
}

.protein-bonds-interactive .view-single .leaving-group {
  opacity: 1;
}

.protein-bonds-interactive .view-single .peptide-bond-group,
.protein-bonds-interactive .view-single .water-group {
  opacity: 0;
  pointer-events: none;
}

@container (max-width: 640px) {
  .protein-bonds-interactive .diagram-container:not([data-mode="single"]) {
    aspect-ratio: auto;
    height: 405px;
  }

  .protein-bonds-interactive .view-reaction {
    width: 720px;
    max-width: none;
    height: 405px;
  }

  .protein-bonds-interactive .diagram-scroll-hint {
    display: block;
  }
}

.protein-bonds-interactive .view-reaction.state-separated .aa1-group {
  transform: translateX(-60px);
}

.protein-bonds-interactive .view-reaction.state-separated .aa2-group {
  transform: translateX(60px);
  opacity: 1;
}

.protein-bonds-interactive .view-reaction.state-separated .leaving-group {
  opacity: 1;
  transition-delay: 0.3s;
}

.protein-bonds-interactive .view-reaction.state-separated .peptide-bond-group {
  opacity: 0;
  transition-delay: 0s;
}

.protein-bonds-interactive .view-reaction.state-separated .water-group {
  opacity: 0;
  transform: translateY(0);
  transition: all 0.4s ease;
}

.protein-bonds-interactive .view-reaction.state-joined .aa1-group {
  transform: translateX(45px);
}

.protein-bonds-interactive .view-reaction.state-joined .aa2-group {
  transform: translateX(-45px);
  opacity: 1;
}

.protein-bonds-interactive .view-reaction.state-joined .leaving-group {
  opacity: 0;
}

.protein-bonds-interactive .view-reaction.state-joined .peptide-bond-group {
  opacity: 1;
  transition-delay: 0.4s;
}

.protein-bonds-interactive .view-reaction.state-joined .water-group {
  opacity: 1;
  transform: translateY(110px);
}

.protein-bonds-interactive .interactive-region {
  cursor: pointer;
}

.protein-bonds-interactive .interactive-region:hover .highlight-box-bg {
  fill: var(--interactive-highlight-strong) !important;
  stroke: var(--interactive-highlight-outline);
}

.protein-bonds-interactive .highlight-label {
  fill: var(--wiki-text-muted);
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  opacity: 0;
  transition: opacity 0.3s;
}

.protein-bonds-interactive .view-single .highlight-label {
  opacity: 1;
}

.protein-bonds-interactive .view-single .highlight-box-bg {
  fill: var(--interactive-highlight);
  stroke: transparent;
  stroke-width: 1.5;
  transition: fill 0.2s, stroke 0.2s;
}

.protein-bonds-interactive .view-reaction .interactive-region[data-target="amino-group"],
.protein-bonds-interactive .view-reaction .interactive-region[data-target="carboxyl-group"],
.protein-bonds-interactive .view-reaction .interactive-region[data-target="r-group"] {
  pointer-events: none;
  opacity: 0;
}

.protein-bonds-interactive svg.mode-condensation .text-hydrolysis {
  opacity: 0;
}

.protein-bonds-interactive svg.mode-hydrolysis .text-condensation {
  opacity: 0;
}

.protein-bonds-interactive svg.active-amino-group .h-amino-group {
  fill: var(--interactive-highlight-strong) !important;
  stroke: var(--interactive-highlight-outline);
}

.protein-bonds-interactive svg.active-carboxyl-group .h-carboxyl-group {
  fill: var(--interactive-highlight-strong) !important;
  stroke: var(--interactive-highlight-outline);
}

.protein-bonds-interactive svg.active-r-group .h-r-group {
  fill: var(--interactive-highlight-strong) !important;
  stroke: var(--interactive-highlight-outline);
}

.protein-bonds-interactive svg.active-peptide-bond .h-peptide-bond {
  stroke: var(--wiki-text);
  stroke-width: 4;
}

.protein-bonds-interactive svg.active-peptide-bond .h-peptide-bond-text {
  fill: var(--wiki-text);
  font-weight: 800;
}

.protein-bonds-interactive svg.active-reaction .leaving-group .atom {
  fill: var(--wiki-text);
  font-weight: 800;
}

.protein-bonds-interactive svg.active-reaction .leaving-group .bond {
  stroke: var(--wiki-text);
  stroke-width: 4;
}

.protein-bonds-interactive svg.active-reaction .h-water .water-pill {
  stroke: var(--wiki-text);
  stroke-width: 2;
}

.protein-bonds-interactive .feature-list {
  display: none;
}

.protein-bonds-interactive .detail-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--wiki-line);
  border-radius: var(--wiki-radius-sm);
  background: var(--wiki-surface);
  transition: all 0.2s ease;
}

.protein-bonds-interactive .detail-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.protein-bonds-interactive .feature-bullet {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wiki-line);
  color: var(--wiki-text);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.protein-bonds-interactive .feature-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wiki-text);
}

.protein-bonds-interactive .detail-card-body {
  margin-left: calc(20px + 0.75rem);
  margin-top: 0.35rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--wiki-text);
}

@container (max-width: 760px) {
  .protein-bonds-interactive .viz-card {
    padding: 1rem;
  }

  .protein-bonds-interactive .controls-header {
    flex-direction: column;
    align-items: stretch;
  }

  .protein-bonds-interactive .controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .protein-bonds-interactive .controls button {
    flex: 1 1 140px;
  }

  .protein-bonds-interactive .diagram-container {
    aspect-ratio: 16 / 11;
  }
}
