.context-feedback-existing {
  border: 0;
  background: transparent;
  color: inherit;
  padding: .25rem .1rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 650;
  opacity: .72;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 28%, transparent);
  text-underline-offset: .18em;
}
.context-feedback-existing:hover,
.context-feedback-existing:focus-visible { opacity: 1; }

.heading-contribution-marker {
  margin-left: .6rem;
  padding: 6px 9px;
  min-height: 32px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 999px;
  background: transparent;
  color: #315b64;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  vertical-align: middle;
  opacity: 0;
  cursor: pointer;
  transition: opacity .15s ease, background .15s ease, border-color .15s ease;
}
.markdown-document h2:hover > .heading-contribution-marker,
.markdown-document h3:hover > .heading-contribution-marker,
.markdown-document h2:focus-within > .heading-contribution-marker,
.markdown-document h3:focus-within > .heading-contribution-marker,
.heading-contribution-marker:focus-visible,
.heading-contribution-marker.has-feedback,
.heading-contribution-marker.has-response { opacity: 1; }
.heading-contribution-marker.has-response { background: color-mix(in srgb, currentColor 8%, transparent); }

.heading-contribution-preview {
  display: grid;
  gap: .2rem;
  width: min(100%, 44rem);
  margin: .35rem 0 .85rem;
  padding: .42rem .62rem;
  border: 0;
  border-left: 2px solid rgb(100 116 139 / .32);
  border-radius: 0 .45rem .45rem 0;
  background: rgb(100 116 139 / .045);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  opacity: .72;
}
.heading-contribution-preview:hover,
.heading-contribution-preview:focus-visible { opacity: 1; background: rgb(100 116 139 / .07); }
.heading-contribution-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: .8rem;
  line-height: 1.35;
}
.heading-contribution-preview-meta { color: rgb(100 116 139); font-size: 13px; font-weight: 650; }

.contextual-feedback-layer { position: fixed; inset: 0; z-index: 1200; display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 32rem); }
.contextual-feedback-backdrop { grid-column: 1 / -1; grid-row: 1; border: 0; background: rgb(9 15 24 / .36); cursor: default; }
.contextual-feedback-sheet { grid-column: 2; grid-row: 1; position: relative; z-index: 1; height: 100dvh; overflow: auto; background: var(--surface, #fff); color: var(--text, #17202b); box-shadow: -18px 0 42px rgb(0 0 0 / .18); padding: 1.25rem; }
.contextual-feedback-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgb(100 116 139 / .18); }
.contextual-feedback-header h2 { margin: .15rem 0 .3rem; font-size: 1.28rem; }
.contextual-feedback-header p { margin: 0; }
.contextual-feedback-header > button { border: 0; background: transparent; font-size: 1.7rem; line-height: 1; cursor: pointer; }
.contextual-feedback-form { display: grid; gap: .65rem; padding: 1rem 0 1.15rem; }
.contextual-feedback-form label { font-weight: 700; }
.contextual-feedback-form textarea { width: 100%; resize: vertical; min-height: 7.5rem; box-sizing: border-box; border: 1px solid rgb(100 116 139 / .35); border-radius: .7rem; background: transparent; color: inherit; padding: .8rem; font: inherit; }
.contextual-feedback-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; }
.contextual-feedback-form-actions button { border: 1px solid #111827; border-radius: .65rem; padding: .65rem .9rem; background: #17202b; color: #fff; font-weight: 700; cursor: pointer; }
.contextual-feedback-form-actions button:hover { background: #111827; }
.contextual-feedback-form-actions button:focus-visible { outline: 3px solid rgb(59 130 246 / .45); outline-offset: 2px; }
.contextual-feedback-form-actions button:disabled { opacity: .55; cursor: wait; }
.contextual-feedback-receipt { margin-top: 1rem; padding: .85rem; border: 1px solid rgb(34 197 94 / .35); border-radius: .75rem; background: rgb(34 197 94 / .06); }
.contextual-feedback-receipt > div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.contextual-feedback-receipt p { margin: .35rem 0 0; font-size: .86rem; }
.contextual-feedback-error { padding: .7rem .8rem; border-radius: .65rem; background: rgb(220 38 38 / .08); color: #b91c1c; }
.contextual-feedback-history { border-top: 1px solid rgb(100 116 139 / .18); padding-top: 1rem; scroll-margin-top: .5rem; }
.contextual-feedback-history:focus { outline: none; }
.contextual-feedback-history-title { display: flex; align-items: center; justify-content: space-between; }
.contextual-feedback-history-title h3 { margin: 0 0 .75rem; font-size: 1rem; }
.contextual-feedback-history-title span { min-width: 1.5rem; text-align: center; font-size: .75rem; border: 1px solid rgb(100 116 139 / .25); border-radius: 999px; }
.contextual-feedback-empty { color: rgb(100 116 139); font-size: .88rem; }
.contextual-contribution-card { padding: .85rem 0; border-top: 1px solid rgb(100 116 139 / .15); }
.contextual-contribution-card:first-of-type { border-top: 0; }
.contextual-contribution-card > p { margin: .45rem 0; white-space: pre-wrap; }
.contextual-contribution-card > small { color: rgb(100 116 139); }
.contextual-contribution-meta, .contextual-response-meta { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .72rem; font-weight: 700; text-transform: none; }
.contextual-external-responses { margin-top: .75rem; display: grid; gap: .55rem; }
.contextual-external-response { border-left: 3px solid currentColor; background: rgb(100 116 139 / .06); border-radius: 0 .55rem .55rem 0; padding: .7rem .75rem; }
.contextual-external-response p { margin: .45rem 0; white-space: pre-wrap; }
.contextual-external-response small { color: rgb(100 116 139); }

@media (max-width: 760px) {
  .context-feedback-existing { font-size: .72rem; }
  .heading-contribution-marker { opacity: 1; font-size: 13px; min-height: 44px; }
  .heading-contribution-preview { margin: .3rem 0 .7rem; padding: .38rem .55rem; }
  .heading-contribution-preview-text { font-size: .76rem; }
  .contextual-feedback-layer { display: block; }
  .contextual-feedback-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
  .contextual-feedback-sheet { position: absolute; inset: auto 0 0; width: 100%; height: min(88dvh, 48rem); box-sizing: border-box; border-radius: 1rem 1rem 0 0; box-shadow: 0 -14px 36px rgb(0 0 0 / .2); padding: 1rem; }
  .contextual-feedback-form-actions { align-items: flex-end; }
}

@media (hover: none) { .heading-contribution-marker { opacity: 1; min-height: 44px; } }
