:root {
  --ot-annotation-ink: #1f2937;
  --ot-annotation-muted: #6b7280;
  --ot-annotation-paper: #fff;
  --ot-annotation-panel: #eee;
  --ot-annotation-border: #d1d5db;
  --ot-annotation-accent: #b03333;
  --ot-annotation-accent-strong: #8f2828;
  --ot-annotation-highlight: #ffe58a;
  --ot-annotation-highlight-hover: #ffd95a;
  --ot-annotation-danger: #8a2f2f;
  --ot-annotation-shadow: 0 18px 55px rgb(24 31 27 / 20%);
}

mark.ot-annotation-highlight {
  background: linear-gradient(transparent 8%, var(--ot-annotation-highlight) 8%, var(--ot-annotation-highlight) 92%, transparent 92%);
  color: inherit;
  cursor: pointer;
  border-radius: 0.12em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  outline: none;
  padding: 0 0.05em;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

mark.ot-annotation-highlight[data-has-comment="true"] {
  box-shadow: inset 0 -2px 0 var(--ot-annotation-accent);
}

mark.ot-annotation-highlight:hover,
mark.ot-annotation-highlight:focus-visible,
mark.ot-annotation-highlight[data-active="true"] {
  background: var(--ot-annotation-highlight-hover);
  box-shadow: inset 0 -3px 0 var(--ot-annotation-accent-strong);
}

#ot-annotator-root,
#ot-annotator-root * {
  box-sizing: border-box;
  font-family: "Fira Sans", sans-serif;
}

#ot-annotator-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  color: var(--ot-annotation-ink);
  pointer-events: none;
  font-size: 14px;
  line-height: 1.45;
}

#ot-annotator-root button,
#ot-annotator-root textarea,
#ot-annotator-root input,
#ot-annotator-root select {
  font: inherit;
}

#ot-annotator-root button {
  cursor: pointer;
}

.ot-annotator-toggle {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--ot-annotation-accent-strong);
  border-radius: 999px;
  background: var(--ot-annotation-accent);
  color: #fff;
  box-shadow: 0 8px 26px rgb(24 31 27 / 22%);
  pointer-events: auto;
}

.ot-annotator-toggle:hover,
.ot-annotator-toggle:focus-visible {
  background: var(--ot-annotation-accent-strong);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ot-annotator-count {
  min-width: 21px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 18%);
  text-align: center;
}

.ot-annotator-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(390px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ot-annotation-border);
  border-radius: 12px;
  background: var(--ot-annotation-paper);
  box-shadow: var(--ot-annotation-shadow);
  pointer-events: auto;
}

.ot-annotator-panel[hidden],
.ot-annotator-editor[hidden],
.ot-annotator-selection[hidden],
.ot-annotator-toast[hidden] {
  display: none;
}

.ot-annotator-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--ot-annotation-border);
  background: var(--ot-annotation-panel);
}

.ot-annotator-title {
  margin: 0;
  color: var(--ot-annotation-ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
}

.ot-annotator-icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ot-annotation-ink);
}

.ot-annotator-icon-button:hover,
.ot-annotator-icon-button:focus-visible {
  border-color: var(--ot-annotation-border);
  background: var(--ot-annotation-paper);
  outline: none;
}

.ot-annotator-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--ot-annotation-border);
  background: var(--ot-annotation-paper);
}

.ot-annotator-bulk {
  padding: 11px 12px;
  border-bottom: 1px solid var(--ot-annotation-border);
  background: var(--ot-annotation-paper);
}

.ot-annotator-bulk-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.ot-annotator-button {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--ot-annotation-border);
  border-radius: 6px;
  background: var(--ot-annotation-paper);
  color: var(--ot-annotation-ink);
}

.ot-annotator-button:hover,
.ot-annotator-button:focus-visible {
  border-color: var(--ot-annotation-accent);
  color: var(--ot-annotation-accent-strong);
  outline: none;
}

.ot-annotator-button--primary {
  border-color: var(--ot-annotation-accent);
  background: var(--ot-annotation-accent);
  color: #fff;
}

.ot-annotator-button--primary:hover,
.ot-annotator-button--primary:focus-visible {
  background: var(--ot-annotation-accent-strong);
  color: #fff;
}

.ot-annotator-button--danger {
  color: var(--ot-annotation-danger);
}

.ot-annotator-button--danger:hover,
.ot-annotator-button--danger:focus-visible {
  border-color: var(--ot-annotation-danger);
  color: var(--ot-annotation-danger);
}

.ot-annotator-button:disabled {
  border-color: var(--ot-annotation-border);
  background: var(--ot-annotation-panel);
  color: #999b96;
  cursor: not-allowed;
}

.ot-annotator-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ot-annotator-editor {
  padding: 16px;
  border-bottom: 1px solid var(--ot-annotation-border);
  background: var(--ot-annotation-panel);
}

.ot-annotator-editor-title {
  margin: 0 0 9px;
  color: var(--ot-annotation-ink);
  font-size: 13px;
  letter-spacing: normal;
  line-height: 1.4;
  text-align: left;
  text-transform: none;
}

.ot-annotator-editor-quote {
  max-height: 110px;
  margin: 0 0 12px;
  padding: 9px 10px;
  overflow-y: auto;
  border-left: 3px solid var(--ot-annotation-highlight-hover);
  background: var(--ot-annotation-paper);
  color: var(--ot-annotation-ink);
  font-size: 12px;
  text-align: left;
  white-space: pre-wrap;
}

.ot-annotator-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ot-annotation-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ot-annotator-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--ot-annotation-border);
  border-radius: 6px;
  background: var(--ot-annotation-paper);
  color: var(--ot-annotation-ink);
}

.ot-annotator-textarea:focus {
  border-color: var(--ot-annotation-accent);
  outline: 2px solid rgb(176 51 51 / 18%);
}

.ot-annotator-codex {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--ot-annotation-border);
}

.ot-annotator-codex-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.ot-annotator-select {
  width: 100%;
  min-height: 34px;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--ot-annotation-border);
  border-radius: 6px;
  background: var(--ot-annotation-paper);
  color: var(--ot-annotation-ink);
}

.ot-annotator-select:focus {
  border-color: var(--ot-annotation-accent);
  outline: 2px solid rgb(176 51 51 / 18%);
}

.ot-annotator-help {
  margin: 7px 0 0;
  color: var(--ot-annotation-muted);
  font-size: 10px;
  text-align: left;
}

.ot-annotator-help code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.ot-annotator-codex-response {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--ot-annotation-border);
  border-left: 3px solid var(--ot-annotation-accent);
  background: var(--ot-annotation-paper);
  color: var(--ot-annotation-ink);
  font-size: 11px;
}

.ot-annotator-codex-response pre {
  max-height: 240px;
  margin: 7px 0 9px;
  overflow: auto;
  color: var(--ot-annotation-ink);
  font: inherit;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

.ot-annotator-codex-response .ot-annotator-codex-diff {
  max-height: 320px;
  padding: 8px;
  border: 1px solid var(--ot-annotation-border);
  background: #f6f3eb;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre;
  word-break: normal;
}

.ot-annotator-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.ot-annotator-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ot-annotator-list-item {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #e4dfd4;
}

.ot-annotator-card {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-left: 4px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
}

.ot-annotator-card:hover,
.ot-annotator-card:focus-visible,
.ot-annotator-card[data-active="true"] {
  border-left-color: var(--ot-annotation-accent);
  background: #f8f4e9;
  outline: none;
}

.ot-annotator-card-section {
  display: block;
  margin-bottom: 5px;
  color: var(--ot-annotation-accent-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ot-annotator-card-quote,
.ot-annotator-card-comment,
.ot-annotator-card-meta {
  display: block;
}

.ot-annotator-card-quote {
  margin-bottom: 7px;
  color: #303430;
  font-size: 12px;
  line-height: 1.45;
}

.ot-annotator-card-comment {
  color: var(--ot-annotation-muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.ot-annotator-card-comment[data-empty="true"] {
  font-style: italic;
}

.ot-annotator-card-meta {
  margin-top: 7px;
  color: #8a8e89;
  font-size: 10px;
}

.ot-annotator-orphaned {
  color: var(--ot-annotation-danger);
  font-weight: 700;
}

.ot-annotator-empty {
  margin: 0;
  padding: 34px 25px;
  color: var(--ot-annotation-muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

.ot-annotator-footer {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--ot-annotation-border);
  background: var(--ot-annotation-panel);
  color: var(--ot-annotation-muted);
  font-size: 10px;
  text-align: center;
}

.ot-annotator-selection {
  position: absolute;
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--ot-annotation-border);
  border-radius: 8px;
  background: var(--ot-annotation-paper);
  box-shadow: 0 8px 26px rgb(24 31 27 / 22%);
  pointer-events: auto;
}

.ot-annotator-selection .ot-annotator-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.ot-annotator-toast {
  position: absolute;
  left: 50%;
  bottom: 22px;
  max-width: min(480px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 10px 13px;
  border-radius: 7px;
  background: var(--ot-annotation-ink);
  color: #fff;
  box-shadow: 0 8px 26px rgb(24 31 27 / 22%);
  pointer-events: none;
  text-align: center;
}

@media (max-width: 640px) {
  .ot-annotator-panel {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .ot-annotator-toggle {
    right: 14px;
    bottom: 14px;
  }

  .ot-annotator-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  #ot-annotator-root {
    display: none !important;
  }

  mark.ot-annotation-highlight {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  mark.ot-annotation-highlight {
    transition: none;
  }
}

html.dark { --ot-annotation-ink: #e5e5e5; --ot-annotation-muted: #b8aaa0; --ot-annotation-paper: #3d2f26; --ot-annotation-panel: #2a1f18; --ot-annotation-border: #5b493e; --ot-annotation-accent: #b03333; --ot-annotation-accent-strong: #8f2828; }
