.exr-host {
  --exr-accent: #0a84ff;
  --exr-point: #0a84ff;
  --exr-area: #d946ef;
  --exr-panel: #1c1c1e;
  --exr-panel-raised: #2c2c2e;
  --exr-text: #f5f5f7;
  --exr-muted: #aeaeb2;
  --exr-line: rgb(255 255 255 / 14%);
}

.exr-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.exr-overlay,
.exr-overlay * {
  box-sizing: border-box;
}

.exr-overlay[hidden],
.exr-panel[hidden],
.exr-comment-form[hidden],
.exr-notice[hidden],
.exr-draft[hidden] {
  display: none;
}

.exr-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.exr-marker,
.exr-draft {
  position: absolute;
  left: calc(var(--exr-x) * 100%);
  top: calc(var(--exr-y) * 100%);
  width: calc(var(--exr-width) * 100%);
  height: calc(var(--exr-height) * 100%);
}

.exr-draft-label {
  position: absolute;
  top: -15px;
  left: -15px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--exr-area);
  color: #fff;
  box-shadow: 0 4px 16px rgb(0 0 0 / 34%);
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.exr-marker {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--exr-point);
  color: #fff;
  box-shadow: 0 4px 18px rgb(0 0 0 / 38%);
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.exr-marker.is-rect {
  min-width: 34px;
  min-height: 34px;
  place-items: start;
  padding: 7px;
  border-radius: 5px;
  border: 2px dashed var(--exr-area);
  background: rgb(217 70 239 / 10%);
  outline: 0;
  outline-offset: -2px;
  transform: none;
}

.exr-marker-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--exr-point);
  color: #fff;
  box-shadow: 0 4px 16px rgb(0 0 0 / 34%);
}

.exr-marker.is-rect .exr-marker-badge {
  margin: -20px 0 0 -20px;
  background: var(--exr-area);
}

.exr-marker.is-resolved {
  --exr-accent: #8e8e93;
  opacity: .74;
}

.exr-marker.is-rejected {
  --exr-accent: #8e8e93;
  opacity: .62;
}

.exr-marker.is-stale {
  --exr-accent: #d89a1d;
  border-style: dashed;
}

.exr-marker.is-selected {
  box-shadow: 0 0 0 5px rgb(10 132 255 / 25%), 0 5px 20px rgb(0 0 0 / 44%);
}

.exr-marker.is-rect.is-selected {
  box-shadow: 0 0 0 5px rgb(217 70 239 / 22%), 0 5px 20px rgb(0 0 0 / 44%);
}

.exr-draft {
  z-index: 2;
  border: 2px dashed var(--exr-area);
  border-radius: 5px;
  background: rgb(217 70 239 / 10%);
  pointer-events: none;
}

.exr-draft.is-point {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-color: #fff;
  background: var(--exr-point);
}

.exr-draft.is-point .exr-draft-label {
  inset: -2px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.exr-panel {
  position: fixed;
  top: 76px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  width: min(390px, calc(100vw - 32px));
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--exr-line);
  border-radius: 10px;
  background: rgb(28 28 30 / 96%);
  color: var(--exr-text);
  box-shadow: 0 18px 54px rgb(0 0 0 / 44%);
  backdrop-filter: blur(24px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.exr-header,
.exr-footer,
.exr-file-actions,
.exr-item-heading,
.exr-item-actions,
.exr-form-actions,
.exr-tools {
  display: flex;
  align-items: center;
}

.exr-header,
.exr-footer {
  justify-content: space-between;
  gap: 12px;
}

.exr-heading {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.exr-heading strong {
  font-size: 16px;
}

.exr-heading span,
.exr-save-state {
  color: var(--exr-muted);
  font-size: 11px;
}

.exr-close,
.exr-tool,
.exr-secondary,
.exr-primary,
.exr-item-actions button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--exr-line);
  border-radius: 5px;
  background: rgb(255 255 255 / 7%);
  color: inherit;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.exr-close {
  position: relative;
  width: 34px;
  padding: 0;
  font-size: 0;
}

.exr-close::before,
.exr-close::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
}

.exr-close::after {
  transform: rotate(-45deg);
}

.exr-tools {
  gap: 5px;
}

.exr-tool {
  min-width: 0;
  flex: 1;
  padding-inline: 7px;
}

.exr-tool.is-active,
.exr-primary {
  border-color: var(--exr-accent);
  background: var(--exr-accent);
  color: #fff;
}

.exr-tool:hover,
.exr-secondary:hover,
.exr-item-actions button:hover {
  border-color: rgb(10 132 255 / 58%);
  background: rgb(10 132 255 / 15%);
}

.exr-panel button:focus-visible,
.exr-panel textarea:focus-visible {
  outline: 3px solid rgb(10 132 255 / 32%);
  outline-offset: 2px;
}

.exr-hint,
.exr-notice,
.exr-empty {
  margin: 0;
  color: var(--exr-muted);
  font-size: 12px;
  line-height: 1.4;
}

.exr-notice {
  padding: 9px 10px;
  border: 1px solid rgb(10 132 255 / 36%);
  border-radius: 5px;
  background: rgb(10 132 255 / 9%);
  color: var(--exr-text);
}

.exr-comment-form {
  padding: 11px;
  display: grid;
  gap: 9px;
  border: 1px solid var(--exr-line);
  border-radius: 7px;
  background: var(--exr-panel-raised);
}

.exr-comment-form label:not(.exr-capture-option) {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.exr-comment-form textarea {
  width: 100%;
  min-height: 84px;
  max-height: 180px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--exr-line);
  border-radius: 5px;
  background: #161618;
  color: var(--exr-text);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.exr-capture-option {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--exr-muted);
  font-size: 11px;
}

.exr-form-actions,
.exr-file-actions {
  justify-content: flex-end;
  gap: 6px;
}

.exr-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  overscroll-behavior: contain;
}

.exr-item {
  padding: 10px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--exr-line);
  border-radius: 7px;
  background: rgb(255 255 255 / 5%);
}

.exr-item.is-selected {
  border-color: rgb(10 132 255 / 65%);
}

.exr-item.is-resolved,
.exr-item.is-rejected {
  opacity: .7;
}

.exr-item.is-stale {
  border-style: dashed;
  border-color: #d89a1d;
}

.exr-item-heading {
  width: 100%;
  padding: 0;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.exr-item-heading strong {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--exr-point);
  color: #fff;
  font-size: 11px;
}

.exr-item-heading strong.is-rect {
  border-radius: 7px;
  background: var(--exr-area);
}

.exr-item-heading span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.exr-item-heading small {
  color: var(--exr-muted);
  font-size: 10px;
}

.exr-item p {
  margin: 0;
  color: var(--exr-text);
  font-size: 13px;
  line-height: 1.4;
}

.exr-item-actions {
  gap: 5px;
}

.exr-item-actions button {
  min-height: 28px;
  padding: 4px 7px;
  color: var(--exr-muted);
  font-size: 10px;
}

.exr-footer {
  padding-top: 12px;
  align-items: stretch;
  flex-direction: column;
  border-top: 1px solid var(--exr-line);
}

.exr-file-actions {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto minmax(120px, 1fr);
}

.exr-footer .exr-primary,
.exr-footer .exr-secondary {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11px;
}

.exr-panel button:disabled {
  cursor: default;
  opacity: .38;
}

@media (max-width: 760px) {
  .exr-panel {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: min(64vh, 560px);
    padding: 12px;
    border-radius: 9px;
  }

  .exr-footer {
    align-items: stretch;
  }

  .exr-file-actions {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .exr-file-actions button {
    min-width: 0;
    flex: 1;
  }

  .exr-file-actions .exr-primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .exr-tool {
    font-size: 11px;
  }

  .exr-save-state {
    display: none;
  }

  .exr-file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .exr-file-actions .exr-primary {
    grid-column: 1 / -1;
  }
}
