.pdf-annotation-toolbar {
  font-size: 0.875rem;
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(31, 131, 121, 0.35);
  border-radius: 12px;
  background: rgba(248, 250, 249, 0.97);
  box-shadow: 0 10px 24px rgba(4, 15, 48, 0.14);
  backdrop-filter: blur(12px);
}

.pdf-annotation-tool,
.pdf-annotation-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(49, 73, 90, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #1d3446;
  padding: 8px;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.pdf-button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pdf-annotation-tools {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.pdf-annotation-download {
  flex: 0 0 auto;
}

.pdf-annotation-resource-actions {
  position: relative;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.pdf-annotation-download-toggle::after {
  content: "▾";
  margin-left: 8px;
  font-size: 0.8em;
}

.pdf-annotation-download-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  display: grid;
  width: max-content;
  min-width: 220px;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(49, 73, 90, 0.24);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(4, 15, 48, 0.2);
}

.pdf-annotation-download-menu[hidden] {
  display: none;
}

.pdf-annotation-menu-item {
  width: 100%;
  justify-content: flex-start;
}

.pdf-annotation-tool[aria-pressed="true"] {
  border-color: #1f8379;
  background: #dff3ef;
  color: #12685f;
  box-shadow: inset 0 0 0 1px #1f8379;
}

.pdf-annotation-toolbar button:hover:not(:disabled),
.pdf-annotation-toolbar button:focus-visible,
.pdf-annotation-toolbar a.pdf-annotation-action:hover:not([aria-disabled="true"]),
.pdf-annotation-toolbar a.pdf-annotation-action:focus-visible,
.pdf-annotation-color input:focus-visible {
  outline: 3px solid rgba(31, 131, 121, 0.22);
  outline-offset: 2px;
}

.pdf-annotation-toolbar button:disabled,
.pdf-annotation-download[aria-disabled="true"],
.pdf-annotation-color input:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.pdf-annotation-color {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(49, 73, 90, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #1d3446;
  padding: 6px 9px;
  font-weight: 800;
}

.pdf-annotation-color input {
  width: 31px;
  height: 27px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.pdf-annotation-clear {
  color: #a13c47;
}

.pdf-annotation-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  margin: 0;
  color: #526574;
  font-size: 0.86rem;
  line-height: 1.35;
}

.topic-summary-pdf-page {
  position: relative;
}

.pdf-page-navigation {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  color: #1d3446;
}

.pdf-page-navigation button {
  min-height: 44px;
}

.pdf-page-navigation button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.pdf-page-navigation button:focus-visible {
  outline: 3px solid #1f8379;
  outline-offset: 2px;
}

.pdf-page-counter {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

@container (max-width: 260px) {
  .pdf-page-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-page-counter {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

.topic-summary-pdf-pages.pdf-paginated {
  height: clamp(320px, 72svh, 900px);
  container-type: size;
  display: grid;
  place-items: start center;
  overflow: auto;
  gap: 0;
}

.pdf-paginated .topic-summary-pdf-page {
  width: 100%;
}

.pdf-paginated .topic-summary-pdf-page[hidden] {
  display: none;
}

@media print {
  .pdf-page-navigation,
  .pdf-annotation-toolbar {
    display: none;
  }

  .topic-summary-pdf-pages.pdf-paginated {
    height: auto;
    container-type: normal;
    overflow: visible;
  }

  .pdf-paginated .topic-summary-pdf-page,
  .pdf-paginated .topic-summary-pdf-page[hidden] {
    display: block;
    width: 100%;
    break-inside: avoid;
  }
}

.pdf-annotation-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: auto;
}

.annotation-enabled .pdf-annotation-canvas {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.annotation-enabled[data-annotation-tool="eraser"] .pdf-annotation-canvas {
  cursor: cell;
}

@media (max-width: 760px) {
  .topic-summary-pdf {
    container-type: inline-size;
  }

  .topic-summary-pdf-pages.pdf-paginated {
    height: min(72svh, 141.42cqw);
  }

  .pdf-page-navigation {
    gap: 6px;
    width: 100%;
    padding: 0;
  }

  .pdf-page-navigation button {
    padding: 8px;
    font-size: 14px;
  }

  .pdf-page-counter {
    font-size: 14px;
  }

  .pdf-annotation-toolbar {
    top: 6px;
    gap: 8px;
    overflow: visible;
    padding: 9px;
  }

  .pdf-annotation-tools {
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 2px;
  }

  .pdf-annotation-tool,
  .pdf-annotation-action,
  .pdf-annotation-color {
    flex: 0 0 auto;
  }

  .pdf-annotation-resource-actions {
    width: 100%;
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-annotation-resource-actions > .pdf-annotation-action {
    width: 100%;
  }

  .pdf-annotation-download-menu {
    top: calc(100% + 6px);
    width: min(260px, 100%);
  }

  .pdf-annotation-status {
    font-size: 0.8rem;
  }
}
