.practice-diagram .diagram-scroll > svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}
.practice-diagram .diagram-scroll.is-zoomed > svg { max-width: none; }
.diagram-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 14px;
  margin-top: 4px;
}
.diagram-tools button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #afc2d7;
  background: #eaf2fe;
  color: #214274;
  font-size: 14px;
}
.diagram-tools button[hidden] { display: none; }
.diagram-scroll [data-diagram-node] { cursor: pointer; }
.diagram-scroll [data-diagram-node]:is(:hover, :focus-visible, [aria-current]) rect.label-container {
  fill: #d7e8ff !important;
  stroke: #1d50a0 !important;
  stroke-width: 2.5px !important;
}
.diagram-notes { padding: 10px 12px; font-size: 15px; }
.diagram-notes section { padding-top: 6px; }
.diagram-notes section + section { border-top: 1px solid var(--line); }
.diagram-notes section:target { background: #eef4ff; }
.diagram-notes h3 { margin: 8px 0; font-size: 17px; }
.diagram-notes dl, .diagram-dialog dl { margin: 0; }
.diagram-notes dt, .diagram-dialog dt { color: #193958; font-weight: 700; }
.diagram-notes dd, .diagram-dialog dd { margin: 2px 0 12px; }
.diagram-dialog {
  width: min(calc(100% - 32px), 30rem);
  max-height: 78dvh;
  padding: 16px 18px 10px;
  border: 1px solid #b2c5db;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0 18px 55px #142b4b38;
}
.diagram-dialog::backdrop { background: #12243e70; }
.diagram-dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.diagram-dialog-heading h3 { margin: 6px 0 0; color: #172f49; font-size: 20px; line-height: 1.25; }
.diagram-dialog-heading form { margin: 0; padding: 0; border: 0; background: transparent; }
.diagram-dialog-heading button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: #eaf2fe;
  color: #214274;
  font-size: 22px;
}
.diagram-dialog:has([data-diagram-list]) .diagram-dialog-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
.diagram-dialog [data-diagram-list][hidden] { display: none; }
.diagram-dialog .diagram-index {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0 0 6px;
  list-style: none;
}
.diagram-index button, .diagram-index-back {
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid #c0cfe4;
  background: #eaf2fe;
  color: #214274;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
}
.diagram-index button { width: 100%; }
.diagram-index-back { margin-bottom: 12px; }
.diagram-settings {
  padding: 0 10px 8px;
  border-color: #c0cfe4;
  background: #f5f8fc;
}
.diagram-settings:not([open]) { padding-bottom: 0; }
.diagram-settings summary { min-height: 44px; padding-block: 10px; }
.diagram-settings p { margin: 0; }
.diagram-exercise { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }
body:has(.diagram-dialog[open]) { overflow: hidden; }
@media (max-width: 600px) {
  .diagram-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 16px 16px 0 0; }
}
