/* Resolved note numerals; the original bracket marker stays in DOM textContent. */
button.study-footnote-ref {
  appearance: none;
  display: inline;
  position: relative;
  margin: 0;
  padding: 0 .12em;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--accent, #375847);
  font: inherit;
  font-size: .68em;
  line-height: 0;
  vertical-align: super;
  cursor: pointer;
  white-space: nowrap;
}
button.study-footnote-ref::after { content: attr(data-footnote-label); }
button.study-footnote-ref::before { content: ''; position: absolute; inset: -.6rem -.25rem; }
button.study-footnote-ref:hover { color: var(--ink, #273c35); text-decoration: underline; }
button.study-footnote-ref:focus-visible { outline: 2px solid var(--accent, #375847); outline-offset: 4px; }
.study-footnote-raw {
  /* Do not use display:none, hidden, absolute positioning or replacement text. */
  font-size: 0 !important;
  line-height: 0 !important;
  letter-spacing: 0 !important;
}
.study-footnote-popup {
  box-sizing: border-box;
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  width: min(28rem, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(32rem, calc(100dvh - 24px));
  overflow: hidden;
  border: 1px solid var(--line, #dedfd4);
  border-radius: 10px;
  background: var(--surface, #fffefa);
  color: var(--ink, #273c35);
  box-shadow: 0 12px 40px #142e2933;
  font: 15px/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: left;
  overscroll-behavior: contain;
}
.study-footnote-popup[hidden] { display: none !important; }
.study-footnote-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border-bottom: 1px solid var(--line, #dedfd4);
}
.study-footnote-title { font-size: 12px; font-weight: 650; letter-spacing: .02em; overflow-wrap: anywhere; }
.study-footnote-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: 25px/1 system-ui, sans-serif;
  cursor: pointer;
}
.study-footnote-close:hover { background: var(--soft, #e8eddf); }
.study-footnote-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px 18px 19px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 17px/1.65 var(--serif, Georgia, 'Times New Roman', serif);
  -webkit-overflow-scrolling: touch;
}
.study-footnote-source {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 18px 14px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent, #375847);
  font: 12px/1.5 system-ui, sans-serif;
  text-decoration: underline;
  cursor: pointer;
}
.study-footnote-popup button:focus-visible, .study-footnote-body:focus-visible {
  outline: 2px solid var(--accent, #375847);
  outline-offset: -3px;
}
@media (max-width: 480px) {
  .study-footnote-body { padding: 12px 15px 16px; font-size: 16px; }
  .study-footnote-header { padding-left: 15px; }
}
@media (forced-colors: active) {
  .study-footnote-popup { border: 1px solid CanvasText; }
  button.study-footnote-ref { color: LinkText; }
}
