/* Feedback overlay — shared by index.html and docs/html/spec.html.
   Variables (--bg, --surface, --text, --muted, --border, --accent, --ok, --radius)
   are defined in the host page's :root and inherited here. */

.fb-hint {
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 6px 10px; border-radius: var(--radius);
  font-size: 0.8rem; margin: 0 0 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.fb-hint > :first-child { flex: 1; }
.fb-draft-indicator {
  display: inline-block;
  color: var(--accent); text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
}
.fb-draft-indicator:hover { text-decoration: none; }

/* Static CTA buttons in the hint bar (always visible, JS attaches handlers) */
.fb-signin-cta, .fb-view-cta {
  display: inline-flex; align-items: center;
  padding: 5px 11px; min-height: 32px;
  border-radius: var(--radius);
  font: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  border: 1px solid var(--accent);
  background: var(--accent); color: #fff;
}
.fb-signin-cta:hover, .fb-view-cta:hover { filter: brightness(0.92); }
.fb-view-cta {
  background: var(--surface); color: var(--accent);
}
.fb-view-cta:hover { background: var(--accent); color: #fff; }

/* "💬 comment" button that appears next to a selection */
.fb-trigger {
  position: absolute; z-index: 1000; display: none;
  background: var(--surface); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 999px;
  padding: 5px 11px; min-height: 32px; min-width: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font: 600 0.8rem -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer; user-select: none;
}
.fb-trigger.visible { display: inline-flex; align-items: center; gap: 4px; }
.fb-trigger:hover, .fb-trigger:active { background: var(--accent); color: #fff; }

/* Modal */
.fb-backdrop {
  position: fixed; inset: 0; z-index: 2000; display: none;
  background: rgba(0, 0, 0, 0.45);
  align-items: center; justify-content: center;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.fb-backdrop.visible { display: flex; }

.fb-modal {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.fb-modal header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border);
}
.fb-modal header .fb-title { font-weight: 600; font-size: 0.95rem; }
.fb-modal header .fb-spacer { flex: 1; }
.fb-modal header .fb-x {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.4rem; line-height: 1;
  padding: 0 0.4rem; min-height: 32px; min-width: 32px;
  border-radius: 4px;
}
.fb-modal header .fb-x:hover { background: var(--surface-2, var(--bg)); color: var(--text); }

.fb-ctx {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem; color: var(--muted);
}
.fb-loc { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.fb-loc a { color: var(--accent); text-decoration: none; }
.fb-loc a:hover { text-decoration: underline; }
.fb-quote {
  margin-top: 0.4rem;
  padding: 6px 10px;
  background: var(--bg);
  border-left: 3px solid var(--border);
  color: var(--text);
  max-height: 6rem; overflow-y: auto;
  white-space: pre-wrap;
  font-size: 0.83rem;
  line-height: 1.4;
}

.fb-modal textarea.fb-note {
  display: block;
  width: 100%;
  min-height: 100px; max-height: 30vh;
  padding: 0.55rem 0.9rem;
  border: none; outline: none;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.92rem; line-height: 1.5;
  resize: vertical;
  border-bottom: 1px solid var(--border);
}
.fb-modal .fb-label {
  display: block;
  padding: 0.5rem 0.9rem 0.25rem;
  color: var(--muted); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.fb-modal .fb-hint-inline {
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.fb-stage { display: block; }
.fb-meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.78rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.fb-badge {
  display: inline-block;
  padding: 1px 7px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.02em;
  background: var(--surface-2, var(--bg)); color: var(--muted);
  border: 1px solid var(--border);
}
.fb-badge.ok { background: var(--ok-bg, transparent); color: var(--ok); border-color: var(--ok); }
.fb-badge a { color: inherit; text-decoration: underline; }

.fb-actions {
  display: flex; gap: 0.4rem; padding: 0.6rem 0.9rem;
  align-items: center; flex-wrap: wrap;
}
.fb-actions .fb-spacer { flex: 1; }
.fb-actions button {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 6px 12px; min-height: 36px;
  border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 0.85rem;
}
.fb-actions button:hover { border-color: var(--accent); color: var(--accent); }
.fb-actions button[data-primary] {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.fb-actions button[data-primary]:hover {
  filter: brightness(0.9);
  color: #fff;
}
.fb-actions button:disabled { opacity: 0.55; cursor: not-allowed; }

/* List stage */
.fb-list-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem; color: var(--muted);
}
.fb-list-header button {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 4px 9px;
  border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 0.78rem;
}
.fb-list-header button:hover { border-color: var(--accent); color: var(--accent); }
.fb-list {
  max-height: 50vh; overflow-y: auto;
}
.fb-list-item {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.fb-list-item:hover { background: var(--accent-bg); }
.fb-list-item:last-child { border-bottom: none; }
.fb-list-item-head {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.fb-list-page { color: var(--muted); }
.fb-list-anchor { color: var(--accent); margin-left: 0.25rem; }
.fb-list-time { color: var(--muted); }
.fb-list-preview {
  font-size: 0.88rem; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.fb-list-meta { display: flex; gap: 0.4rem; }
.fb-list-empty {
  padding: 1.5rem 0.9rem; text-align: center;
  color: var(--muted); font-size: 0.85rem;
}

/* Public comments */
.fb-public-indicator {
  display: inline-block;
  color: var(--accent); text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 0.6rem;
}
.fb-public-indicator:hover { text-decoration: none; }
.fb-public-list { padding: 0; }
.fb-public-item {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.fb-public-item:last-child { border-bottom: none; }
.fb-public-item .fb-list-item-head {
  margin-bottom: 0.4rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.fb-public-user a { color: var(--text); font-weight: 600; text-decoration: none; }
.fb-public-user a:hover { color: var(--accent); text-decoration: underline; }
.fb-public-item .fb-list-page {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--muted); text-decoration: none;
}
.fb-public-item .fb-list-page:hover { color: var(--accent); }
.fb-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
}
.fb-public-item .fb-quote {
  font-size: 0.83rem;
  margin: 0 0 0.4rem;
  padding: 4px 9px;
  background: var(--bg); border-left: 3px solid var(--border);
  max-height: 5rem; overflow-y: auto;
  white-space: pre-wrap; line-height: 1.4;
}
.fb-public-note {
  font-size: 0.92rem; line-height: 1.5;
  margin-bottom: 0.4rem;
  white-space: pre-wrap;
}
.fb-public-link {
  font-size: 0.78rem; color: var(--muted);
  text-decoration: none;
}
.fb-public-link:hover { color: var(--accent); text-decoration: underline; }

/* Auth */
.fb-auth-indicator {
  display: inline-block;
  color: var(--accent); text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 0.6rem;
}
.fb-auth-indicator:hover { text-decoration: none; }

/* PAT input on sign-in stage */
.fb-modal .fb-pat-input {
  display: block;
  width: calc(100% - 1.8rem);
  margin: 0.4rem 0.9rem 0.6rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font: inherit; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
.fb-modal .fb-pat-input:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.fb-stage-signin .fb-ctx { font-size: 0.85rem; }
.fb-stage-signin .fb-ctx p { margin-bottom: 0.4rem; }
.fb-stage-signin .fb-ctx a { color: var(--accent); }

/* Claude-fix toggle in the compose stage */
.fb-claude-row {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.5rem 0.9rem 0.6rem;
  font-size: 0.84rem; line-height: 1.4;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg);
}
.fb-claude-row:hover { background: var(--accent-bg); }
.fb-claude-row input[type="checkbox"] {
  margin-top: 3px; flex-shrink: 0;
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.fb-claude-row code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2, var(--bg));
  padding: 0 4px; border-radius: 3px;
}

/* claude-fix badge on comments */
.fb-badge.claude {
  background: var(--accent-bg); color: var(--accent); border-color: var(--accent);
}
.fb-public-item.fb-claude-fix {
  border-left: 3px solid var(--accent);
  padding-left: calc(0.9rem - 3px);
}

/* Inline highlights (Hypothes.is-style: comments wrap the quoted text) */
.fb-inline-cmt {
  background: var(--accent-bg);
  border-bottom: 2px solid var(--accent);
  cursor: pointer;
  border-radius: 2px;
  padding: 0 1px;
  transition: background 100ms ease;
}
.fb-inline-cmt:hover { filter: brightness(0.94); }
.fb-inline-cmt.fb-claude-fix {
  border-bottom-style: dashed;
  border-bottom-width: 2.5px;
}

/* Inline popover */
.fb-inline-popover {
  position: absolute; z-index: 1500;
  width: 320px; max-height: 360px; overflow-y: auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
}
.fb-pop-comment {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.fb-pop-comment:last-child { border-bottom: none; }
.fb-pop-head {
  display: flex; align-items: center; gap: 0.3rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}
.fb-pop-head img {
  border-radius: 50%;
  flex-shrink: 0;
}
.fb-pop-time { color: var(--muted); }
.fb-pop-note {
  font-size: 0.88rem; line-height: 1.45;
  margin-bottom: 0.3rem;
  white-space: pre-wrap;
}
.fb-pop-note.fb-pop-empty { color: var(--muted); font-style: italic; }
.fb-pop-meta a {
  color: var(--accent);
  font-size: 0.78rem;
  text-decoration: none;
}
.fb-pop-meta a:hover { text-decoration: underline; }

@media print {
  .fb-inline-cmt { background: transparent !important; border: none !important; }
  .fb-inline-popover { display: none !important; }
}

.fb-status {
  font-size: 0.78rem; color: var(--muted);
  padding: 0 0.9rem 0.7rem;
  min-height: 1.2rem;
}
.fb-status.ok { color: var(--ok); }
.fb-status.err { color: var(--bad, #b91c1c); }
.fb-status a { color: inherit; text-decoration: underline; }

@media print {
  .fb-trigger, .fb-backdrop, .fb-hint { display: none !important; }
}
