::highlight(essay-review-notes) {
  background: rgba(211, 164, 45, 0.3);
  text-decoration: underline;
  text-decoration-color: rgba(122, 23, 5, 0.42);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

[data-theme="dark"] ::highlight(essay-review-notes) {
  background: rgba(184, 135, 50, 0.28);
  text-decoration-color: rgba(120, 166, 194, 0.82);
}

.review-ui,
.review-ui * {
  box-sizing: border-box;
  font-family: var(--ui-font);
  letter-spacing: 0;
}

.review-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, var(--ink));
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(20, 19, 15, 0.2);
  color: var(--paper);
  cursor: pointer;
  font-size: 22px;
}

.review-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--paper);
  border-radius: 10px;
  background: #305d5a;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
}

.review-selection {
  position: fixed;
  z-index: 120;
  transform: translateX(-50%);
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(20, 19, 15, 0.18);
  color: var(--paper);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 11px;
}

.footnote-dialog__card:has(.review-selection) { position: relative; }
.review-selection.is-in-note-dialog { position: absolute; }

.review-selection[hidden],
.review-count[hidden] { display: none; }

.review-backdrop {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: none;
  border: 0;
  background: rgba(20, 19, 15, 0.22);
  cursor: default;
}

.review-backdrop.is-open { display: block; }

.review-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 110;
  display: none;
  width: min(410px, calc(100vw - 24px));
  height: 100vh;
  flex-direction: column;
  border-left: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: -18px 0 45px rgba(20, 19, 15, 0.13);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.review-drawer.is-open { display: flex; }

.review-head {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
}

.review-head strong {
  display: block;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
}

.review-head span {
  display: block;
  margin-top: 1px;
  color: var(--ink-faint);
  font-size: 11px;
}

.review-icon-button,
.review-delete {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.review-actions,
.review-export-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
}

.review-actions button,
.review-export-actions button {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 11px;
}

.review-actions .review-primary,
.review-export-actions .review-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
}

.review-clear { margin-left: auto; }
.review-copy { min-width: 140px; }
.review-list { overflow-y: auto; padding: 4px 18px 30px; }

.review-empty {
  margin: 28px 4px;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
}

.review-empty strong { font-family: inherit; font-weight: 700; }

.review-note {
  padding: 17px 0;
  border-bottom: 1px solid var(--rule);
}

.review-note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.review-delete {
  width: 26px;
  height: 26px;
  color: var(--ink-faint);
  font-size: 18px;
}

.review-quote {
  display: block;
  width: 100%;
  max-height: 96px;
  overflow: hidden;
  margin: 5px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--content-font);
  font-size: 15px;
  font-style: italic;
  line-height: 1.45;
  text-align: left;
}

.review-note textarea,
.review-export textarea {
  display: block;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 10px;
}

.review-note textarea:focus,
.review-export textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 15%, transparent);
}

.review-export {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(20, 19, 15, 0.25);
}

.review-export::backdrop { background: rgba(20, 19, 15, 0.42); }
.review-export-inner { margin: 0; }
.review-export textarea { height: min(55vh, 480px); border: 0; border-radius: 0; padding: 18px; resize: none; }
.review-export-actions { justify-content: flex-end; border-top: 1px solid var(--rule); border-bottom: 0; }

@media (max-width: 600px) {
  .review-toggle { right: 14px; bottom: 14px; }
  .review-drawer { width: 100vw; }
  .review-backdrop.is-open { display: none; }
  .review-selection { max-width: calc(100vw - 24px); }
}
