:root {
  --bg: #0c0c0e;
  --bg-2: #141418;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);
  --text: #fafafa;
  --text-2: rgba(250,250,250,0.66);
  --text-3: rgba(250,250,250,0.44);
  --text-4: rgba(250,250,250,0.28);
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,0.15);
  --accent-hover: #5457e0;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  letter-spacing: -0.005em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 720px; margin: 0 auto; padding: 28px 24px 48px; }

/* Header */
header.brand {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 20px;
  text-align: center;
}
.logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand h1 {
  font-size: 22px; margin: 0; font-weight: 600;
  letter-spacing: -0.015em;
}
.brand .sep, .brand .brand-sub { display: none; }

/* Title block */
h2.page-title {
  font-size: 28px; font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  line-height: 1.2;
  word-wrap: break-word;
  text-align: center;
}
.meta {
  color: var(--text-3); font-size: 13px;
  margin: 0;
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.meta .sep { color: var(--text-4); }
.meta .source-link {
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s;
  text-decoration: none;
}
.meta .source-link:hover { color: var(--text); text-decoration: none; }
.meta .source-link .arrow {
  color: var(--text-4);
  font-size: 11px;
  transform: translateY(-1px);
  transition: color 0.12s, transform 0.12s;
}
.meta .source-link:hover .arrow { color: var(--accent); transform: translate(1px, -2px); }

/* CTAs */
.cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); border: 1px solid var(--accent);
  color: #fff;
  border-radius: 999px; padding: 9px 18px;
  font: inherit; font-weight: 500; font-size: 13px;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: background 0.15s, transform 0.06s;
  text-decoration: none;
}
.cta:hover { background: var(--accent-hover); text-decoration: none; }
.cta:active { transform: scale(0.98); }
.cta-secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.cta-secondary:hover { background: var(--surface-2); }
.cta-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Meta + CTAs stack centered */
.meta-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.meta-bar .meta { margin: 0; }
.meta-bar .cta-row { justify-content: center; }
.meta-bar .cta { padding: 7px 14px; font-size: 12px; }

/* Quote cards */
.cards { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px 14px 22px;
  position: relative;
  overflow: hidden;
}
.card .swatch {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 4px;
}

/* The actual highlighted-text passage.
   Uses box-decoration-break so the background wraps cleanly across
   line breaks (no per-line gaps). */
.card .quote {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 400;
  display: inline;
  padding: 2px 6px;
  margin: 0 -2px;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.card .chip-row {
  display: flex; gap: 5px; flex-wrap: wrap;
  margin-top: 10px;
}
.card .chip {
  font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.06);
  color: var(--text-2);
  padding: 2px 9px; border-radius: 999px;
  letter-spacing: -0.005em;
}
/* Sender's note — visually prominent but compact */
.card .note {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(99,102,241,0.10);
  border: 1px solid rgba(99,102,241,0.32);
  border-left-width: 3px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.card .note-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.5;
}
.card .note-text {
  color: var(--text);
  white-space: pre-wrap;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

/* ---------- viewer comments ---------- */
.comments-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
}
.comments-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.comments-list:empty { display: none; }
.comment {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.comment .c-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
}
.comment .c-author {
  font-weight: 600; color: var(--text);
  font-size: 12px;
}
.comment .c-when { color: var(--text-4); font-size: 11px; font-feature-settings: "tnum"; }
.comment .c-text { color: var(--text-2); white-space: pre-wrap; word-wrap: break-word; }

.add-comment-btn {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.add-comment-btn:hover {
  background: rgba(99,102,241,0.08);
  color: var(--text);
  border-color: var(--accent);
  border-style: solid;
}

.comment-form {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.comment-form input.cf-author {
  width: 100%; box-sizing: border-box;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit; font-size: 12px;
  margin-bottom: 6px;
  outline: none;
}
.comment-form input.cf-author:focus { border-color: var(--accent); }
.comment-form textarea.cf-text {
  width: 100%; box-sizing: border-box;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit; font-size: 13px; line-height: 1.5;
  resize: vertical; min-height: 60px;
  outline: none;
}
.comment-form textarea.cf-text:focus { border-color: var(--accent); }
.comment-form .cf-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  margin-top: 6px;
}
.comment-form .cf-actions button {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 12px;
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.comment-form .cf-actions button:hover { background: rgba(255,255,255,0.04); }
.comment-form .cf-actions .cf-post {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.comment-form .cf-actions .cf-post:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.comment-form .cf-actions .cf-post:disabled { opacity: 0.6; cursor: default; }

.section-lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-4); margin: 28px 0 8px; font-weight: 600;
}

footer.foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-4); font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

/* Landing-page bits */
.lede {
  font-size: 18px;
  color: var(--text-2);
  max-width: 56ch;
  line-height: 1.55;
  margin-bottom: 28px;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.features .card { padding: 18px; border-radius: 12px; }
.features .card h3 {
  font-size: 14px; margin: 0 0 4px; font-weight: 600;
  letter-spacing: -0.005em;
}
.features .card p { margin: 0; color: var(--text-3); font-size: 13px; line-height: 1.55; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty h2 { color: var(--text-2); font-weight: 500; margin: 0 0 6px; font-size: 18px; }

/* Install banner — sticky at top of shared gallery, hidden when extension is detected */
.install-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(120deg, rgba(99,102,241,0.18), rgba(236,72,153,0.14));
  border-bottom: 1px solid rgba(99,102,241,0.32);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
}
.install-banner .ib-inner {
  max-width: 920px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
}
.install-banner .ib-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.install-banner .ib-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
  font-size: 13px; line-height: 1.4;
  letter-spacing: -0.005em;
}
.install-banner .ib-text strong {
  color: var(--text); font-weight: 600;
  display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.install-banner .ib-text span {
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.install-banner .ib-cta {
  background: #fff;
  color: #1c1c20;
  padding: 7px 14px;
  border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 12px;
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.005em;
  transition: transform 0.06s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(255,255,255,0.12);
}
.install-banner .ib-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255,255,255,0.18); text-decoration: none; }
.install-banner .ib-cta:active { transform: scale(0.97); }
.install-banner .ib-close {
  background: transparent; border: none;
  color: rgba(255,255,255,0.55);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.install-banner .ib-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Hide whenever the extension is present (the content script sets this) */
html[data-hl-extension="installed"] .install-banner { display: none !important; }

@media (max-width: 640px) {
  .install-banner .ib-text span { display: none; }
  .install-banner .ib-inner { padding: 8px 12px; gap: 10px; }
}

/* Bottom install hint on the share page */
.install-hint {
  margin-top: 18px;
  padding: 12px 16px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.install-hint strong { color: var(--text); display: block; margin-bottom: 2px; font-size: 13px; }
