/* === Compair — refined theme === */

:root {
  --bg:        #f6f4ef;
  --card:      #ffffff;
  --fg:        #1a1a1c;
  --muted:     #6e6e76;
  --soft:      #ecebe6;
  --border:    #e1ddd4;
  --accent:    #1c3d6b;
  --accent-fg: #ffffff;
  /* Voting tokens are intentionally neutral — slate vs taupe — so the UI
     doesn't suggest a "good vs bad" reading on either side. */
  --left:      #6b7280;
  --right:     #92867a;
  --neutral:   #cfcdc6;
  /* Destructive / error UI keeps a clear red signal. */
  --danger:    #b54040;
  --shadow:    0 1px 0 rgba(0,0,0,0.03), 0 8px 24px -16px rgba(20,20,30,0.08);
  --shadow-lift: 0 1px 0 rgba(0,0,0,0.04), 0 12px 28px -16px rgba(20,20,30,0.16);
  --max:       640px;
  --serif:     "Charter", "Iowan Old Style", "Source Serif Pro", "Georgia", serif;
  --sans:      -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"], :root[data-theme="dark"] {
  --bg:        #0f1116;
  --card:      #161924;
  --fg:        #ecebe6;
  --muted:     #93939e;
  --soft:      #1c1f2a;
  --border:    #565b71;
  --accent:    #7da7ee;
  --accent-fg: #0f1116;
  --left:      #9aa1a8;
  --right:     #b3a89a;
  --neutral:   #303341;
  --danger:    #d96c6c;
  --shadow:    0 1px 0 rgba(0,0,0,0.3), 0 8px 24px -16px rgba(0,0,0,0.5);
  --shadow-lift: 0 1px 0 rgba(0,0,0,0.4), 0 14px 30px -16px rgba(0,0,0,0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0f1116;
    --card:      #161924;
    --fg:        #ecebe6;
    --muted:     #93939e;
    --soft:      #1c1f2a;
    --border:    #565b71;
    --accent:    #7da7ee;
    --accent-fg: #0f1116;
    --left:      #9aa1a8;
    --right:     #b3a89a;
    --neutral:   #303341;
    --danger:    #d96c6c;
    --shadow:    0 1px 0 rgba(0,0,0,0.3), 0 8px 24px -16px rgba(0,0,0,0.5);
    --shadow-lift: 0 1px 0 rgba(0,0,0,0.4), 0 14px 30px -16px rgba(0,0,0,0.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
img { display: block; max-width: 100%; }

/* Layout */
.layout { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 12px 18px;
}
.brand {
  font-family: "Optima", "Optima Nova", "Palatino", "Palatino Linotype", "Iowan Old Style", "Charter", serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  text-rendering: optimizeLegibility;
}
.brand .b1, .brand .b2 { color: inherit; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions .me-handle { color: var(--muted); font-size: 13px; }

/* Buttons — 5px radius, classier */
.btn {
  background: var(--accent); color: var(--accent-fg);
  border-radius: 5px;
  padding: 8px 16px;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.btn:hover  { box-shadow: 0 2px 0 rgba(0,0,0,0.08); }
.btn:active { transform: translateY(1px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; transform: none; }
.btn.ghost {
  background: transparent; color: var(--fg);
  border-color: var(--border);
}
.btn.ghost:hover { background: var(--soft); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.iconbtn {
  width: 34px; height: 34px; padding: 0; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--fg); border-color: var(--border);
}
.btn.iconbtn:hover { background: var(--soft); }
.btn.iconbtn svg { width: 16px; height: 16px; }

/* Main + tabbar */
main {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding: 22px 18px 78px;
}
main.full-width { max-width: none; padding: 22px 28px 78px; }
/* Login route renders no header sections — pull the card up tight. */
main:has(> .login-card) { padding-top: 6px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 5px env(safe-area-inset-right) calc(5px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
}
.tabbar a {
  flex: 1 1 0;
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 8px; color: var(--muted);
  border-radius: 5px;
  text-decoration: none;
}
.tabbar a svg { width: 20px; height: 20px; }
.tabbar a .tab-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}
.tabbar a:hover { color: var(--fg); }
.tabbar a.active { color: var(--fg); }
.tabbar a.active svg { stroke-width: 2; }

/* === FAB compose button === */
.fab-compose {
  position: fixed;
  right: 22px;
  bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 48px; height: 48px;
  padding: 0;
  border-radius: 5px;
  background: #16a34a; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px -10px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.1);
  text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease;
  border: 0;
}
.fab-compose:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -10px rgba(0,0,0,0.55), 0 2px 4px rgba(0,0,0,0.12); }
.fab-compose:active { transform: translateY(0); }
.fab-compose svg { width: 24px; height: 24px; }

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  /* Prevent dragging on the vote slider (or anywhere else on the card) from
     selecting article titles/extracts. Inputs inside the card opt back in
     below so search/login fields stay editable. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.card input, .card textarea {
  -webkit-user-select: text; user-select: text;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; gap: 6px; }
.card-head .author-block { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.card-head .author { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13.5px; min-width: 0; }
.card-head .author .handle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head .avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--soft); object-fit: cover; flex: 0 0 auto; }
.card-head .ts { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.cat-match {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--accent);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; flex: 0 0 auto;
}
.cat-match::before { content: '++'; opacity: 0.75; margin-right: 4px; letter-spacing: -0.06em; }
.follow-btn {
  flex: 0 0 auto;
  padding: 2px 9px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  border: 1px solid var(--fg);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  line-height: 1.4;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.follow-btn:hover  { background: color-mix(in srgb, var(--fg) 88%, transparent); }
.follow-btn.following {
  background: transparent; color: var(--muted); border-color: var(--border);
}
.follow-btn.following:hover {
  color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.pair {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: stretch;
}
.side {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 10px 34px;
  min-height: 176px;
  background: var(--card);
  transition: border-color .12s ease;
}
.side:hover { border-color: color-mix(in srgb, var(--fg) 25%, var(--border)); }
.side .side-link { display: flex; flex-direction: column; gap: 20px; color: inherit; }
.side .detail { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.side-create-btn {
  position: absolute; bottom: 8px; right: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 7px;
  background: #16a34a; color: #fff;
  border: 0; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity .12s ease, transform .08s ease, filter .12s ease;
}
.side:hover .side-create-btn { opacity: 1; }
.side-create-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.side-create-btn:focus-visible,
.save-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Save button — sits inside the side panel at top-right, anchored over the
   thumb image so it reads as a "save this article" affordance on the visual. */
.save-btn {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 0;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  z-index: 4; cursor: pointer;
  transition: color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.save-btn svg { width: 14px; height: 14px; }
.save-btn .ic-filled { display: none; }
.save-btn:hover { color: var(--fg); transform: translateY(-1px); box-shadow: 0 6px 14px -3px rgba(0,0,0,0.14); }
.save-btn.saved {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.save-btn.saved .ic-outline { display: none; }
.save-btn.saved .ic-filled  { display: inline; }

/* Card-level Detail toggle — lives inside .card-head, top-right of card. */
.card-detail-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.card-detail-btn:hover { background: var(--soft); color: var(--fg); }
.card-detail-btn svg { width: 9px; height: 9px; transition: transform .15s ease; }
.card-detail-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.card-detail-btn[aria-expanded="true"] { color: var(--fg); }
.side .thumb {
  position: relative;
  aspect-ratio: 4/3; border-radius: 6px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
/* Cohort percentage badge — pinned at the bottom edge of each side's thumb,
   straddling the border so half the pill sits above and half below the photo.
   The leading side gets a green background; the trailing side gets mustard.
   White text, same size for both, with a subtle shadow to help legibility. */
.side .my-vote-pct {
  position: absolute;
  bottom: -14px;
  left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 6px;
  background: #c08e10; color: #fff;
  font-size: 22px; font-weight: 800; line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 2;
}
.side .my-vote-pct.lead { background: #16a34a; }
.side .my-vote-pct.tied {
  background: rgba(0,0,0,0.55);
  font-style: italic; font-weight: 700;
}
.side .title {
  font-family: var(--serif); font-weight: 700;
  font-size: 18px; line-height: 1.25;
  margin: 0; letter-spacing: -0.005em;
}
.side .category {
  font-family: var(--serif); font-style: italic;
  font-size: 11.5px; color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: -2px;
}
.side .extract { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }
.vs {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--serif); font-style: italic;
  font-size: 13px; padding: 0 6px;
}

/* Vote */
.vote-wrap { margin: 8px 4px 6px; }
.vote-slider { display: flex; flex-direction: column; gap: 6px; }
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: linear-gradient(90deg, var(--left), var(--neutral) 50%, var(--right));
  border-radius: 999px; outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: grab;
}
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: grab;
}
.slider-axis {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); margin-top: 4px;
  font-family: var(--serif); font-style: italic;
}
.vote-row {
  display: flex; align-items: center; justify-content: flex-end;
  margin-top: 8px;
}
.submit-vote {
  padding: 5px 12px; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vote-summary {
  display: flex; flex-direction: column; gap: 8px;
  padding: 4px 0 0;
}
.vote-summary-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
/* === Cohort toggle (My Vote / Global / My Network) === */
.cohort-row {
  display: flex; flex-wrap: nowrap; gap: 4px; align-items: center;
  background: var(--soft);
  border-radius: 5px;
  padding: 3px 6px 3px 3px;
}
.cohort-row .cohort-stats-icon {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  margin-left: 4px;
}
.cohort-row .cohort-stats-icon svg { width: 14px; height: 14px; }
.cohort-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 4px;
  border: 0; background: transparent;
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s ease, color .12s ease;
}
.cohort-btn:hover:not(:disabled):not(.active) { color: var(--fg); }
.cohort-btn.active {
  background: var(--card); color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.cohort-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cohort-btn .cohort-count {
  display: inline; margin-left: 4px;
  font-weight: 600; font-size: 11px;
  color: var(--muted); opacity: 0.85;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.cohort-btn.active .cohort-count { color: var(--fg); opacity: 0.6; }
@media (max-width: 360px) {
  .cohort-btn { font-size: 11px; padding: 6px 2px; }
  .cohort-btn .cohort-count { font-size: 10px; margin-left: 2px; }
}
/* Legacy ad-card path still uses .my-vote-text — keep it readable. */
.vote-summary .my-vote-text { text-align: center; font-size: 14px; padding: 6px 0; }
.vote-summary .my-vote-text b { font-family: var(--serif); font-weight: 700; }

/* Stats bar */
.stats { margin-top: 8px; }
.bar {
  display: flex; height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--soft);
}
.bar-l { background: var(--left); }
.bar-n { background: var(--neutral); }
.bar-r { background: var(--right); }
.stat-row {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 6px;
}
.stat-row .avg { font-family: var(--serif); font-style: italic; }

/* === Reactions row ===
   Always one line. Buttons share the row width equally (flex: 1) and shrink
   below their natural width; padding/gap shrink first, then glyph & count
   font-sizes, before any clipping is allowed. */
.reactions-row {
  display: flex; flex-wrap: nowrap; gap: 4px;
  margin-top: 6px;
  width: 100%;
}
.emoji-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: background .12s ease, transform .08s ease, border-color .12s ease;
}
.emoji-btn:hover { background: var(--soft); transform: translateY(-1px); }
.emoji-btn.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.emoji-btn .emoji-glyph {
  font-size: 18px;
  line-height: 1;
  /* Force the OS color-emoji font when available */
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", "EmojiOne Color", sans-serif;
}
.emoji-btn .emoji-count {
  font-size: 11px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--sans);
}
.emoji-btn.active .emoji-count { color: var(--accent); }
/* Narrow viewports: drop padding/gap further, then size down the glyph. */
@media (max-width: 380px) {
  .reactions-row { gap: 2px; }
  .emoji-btn { padding: 3px 3px; gap: 2px; }
  .emoji-btn .emoji-glyph { font-size: 16px; }
  .emoji-btn .emoji-count { font-size: 10px; }
}
@media (max-width: 330px) {
  .emoji-btn .emoji-glyph { font-size: 14px; }
}

.card-foot {
  display: flex; gap: 12px; align-items: center;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.card-foot-icons {
  display: flex; flex: 1 1 auto;
  align-items: center; justify-content: space-between;
  min-width: 0;
}
.card-foot .like-btn, .card-foot .dislike-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border);
  cursor: pointer; line-height: 1;
  transition: background .12s ease, border-color .12s ease;
}
.card-foot .like-btn:hover, .card-foot .dislike-btn:hover { background: var(--soft); }
.card-foot .like-btn.active {
  background: color-mix(in srgb, #16a34a 15%, transparent);
  border-color: color-mix(in srgb, #16a34a 45%, var(--border));
}
.card-foot .dislike-btn.active {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}
.card-foot .like-glyph { font-size: 14px; line-height: 1; }
.card-foot .like-count {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.card-foot .repost-btn {
  display: inline-flex; align-items: center; gap: 4px;
}
.card-foot .repost-btn .ic-repost {
  width: 16px; height: 16px;
  transition: transform .18s ease, color .12s ease;
}
.card-foot .repost-btn:hover .ic-repost { color: #17a34a; transform: rotate(20deg); }
.card-foot .repost-btn.active .ic-repost { color: #17a34a; }
.card-foot .repost-btn.active { color: #17a34a; }
/* Reposted-by hat: small, slate-grey, shown above the card header in the feed
   when a followee reposted the post. Mirrors Twitter's "X reposted" affordance. */
.reposted-hat {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 0;
  font-size: 12.5px; color: var(--muted);
  font-weight: 500;
}
.reposted-hat svg { width: 14px; height: 14px; color: #17a34a; }
.reposted-hat .reposted-by-text { line-height: 1.3; }
.reposted-hat .reposted-by-link {
  color: var(--fg); text-decoration: none; font-weight: 600;
}
.reposted-hat .reposted-by-link:hover { text-decoration: underline; }
.card.has-repost-hat .card-head { padding-top: 4px; }
.card-foot button {
  color: var(--muted); font-size: 13px;
  padding: 6px 10px; border-radius: 5px;
}
.card-foot .foot-change-vote {
  margin-left: 6px;
  padding: 4px 10px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: #fff;
  background: #c08e10;
  border: 1px solid #a07908;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.card-foot .foot-change-vote:hover { background: #a07908; color: #fff; }
.card-foot button:hover { background: var(--soft); color: var(--fg); }
.card-foot button.active { color: var(--right); }
/* Footer icon-only buttons: watch (eye-pair) + delete (bin). Borderless,
   transparent, sized to match the repost icon next to them. */
.card-foot .foot-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  padding: 0; border-radius: 5px;
  background: transparent; border: 0;
  color: var(--muted);
}
.card-foot .foot-icon-btn svg { width: 16px; height: 16px; }
.card-foot .foot-icon-btn:hover { background: var(--soft); color: var(--fg); }
/* Watch (binoculars) — green when active, like the repost icon. */
.card-foot .watch-btn.watching,
.card-foot .watch-btn.watching:hover { color: #17a34a; background: transparent; }
/* Delete bin — red on hover only; muted at rest like a passive action. */
.card-foot .delete-btn { color: var(--muted); }
.card-foot .delete-btn:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

/* Disowned (deleted-by-author) author chip — greyed; non-clickable for outsiders.
   Self-view keeps the chip clickable so the author can navigate to their own
   profile from a disowned card surfaced via "Show deleted". */
.card-head .author.disowned { color: var(--muted); }
.card-head .author.disowned .handle { font-style: italic; }
.card-head .author.disowned .avatar { opacity: 0.55; filter: grayscale(1); }
/* Watch (binoculars) button — top-right of card-head */
.watch-btn {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: color .12s ease, background .12s ease, border-color .12s ease, transform .08s ease;
  flex: 0 0 auto;
}
.watch-btn svg { width: 12px; height: 12px; }
.watch-btn:hover { color: var(--fg); background: var(--soft); }
.watch-btn.watching {
  color: var(--accent-fg); background: var(--accent); border-color: var(--accent);
}

.card-head .deleted-badge {
  margin-left: auto;
  padding: 1px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
}

/* Profile self-view tool row: Show hidden / Show deleted toggles */
.profile-tools { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.profile-toggle.active {
  background: var(--soft); color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.hidden-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 8px 0 -2px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 6px;
  font-size: 12.5px; color: var(--accent);
}
.hidden-banner .hb-unhide {
  background: transparent; border: 0; color: inherit;
  font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  font-size: 11px; cursor: pointer; padding: 2px 4px;
}

/* === Compose === */
.compose-page { max-width: var(--max); margin: 0 auto; }
.compose-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin: 0 0 14px;
}
.compose-intro { flex: 1; min-width: 0; }
.compose-title {
  font-family: var(--serif); font-weight: 700;
  letter-spacing: -0.01em; margin: 0 0 8px;
}
.compose-modes {
  list-style: none; padding: 0; margin: 0;
  color: var(--muted); font-size: 13px; line-height: 1.55;
}
.compose-modes b { color: var(--fg); font-weight: 700; }
.compose-add {
  flex: none; align-self: flex-start;
  background: #2563eb; color: #fff; border-color: #2563eb;
  font-weight: 700;
}
.compose-add:hover { background: #1d4ed8; border-color: #1d4ed8; }
.compose-add:disabled, .compose-add[hidden] { opacity: 0; pointer-events: none; }
.compose-help {
  color: var(--muted); font-size: 13px; margin: 0 0 14px; font-style: italic;
}
@media (max-width: 520px) {
  .compose-header { flex-wrap: wrap; }
  .compose-add { width: 100%; }
}

/* The pair container mirrors the card pair so the compose preview reads like a real card. */
.compose-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px; align-items: stretch;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.compose-side {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 240px;
  background: var(--card);
}
.compose-side.filled { border-style: solid; }

.compose-side .picker-area { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.compose-side .picker-tabs { display: inline-flex; gap: 0; align-self: flex-start; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.compose-side .picker-tab {
  padding: 6px 14px; font: inherit; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--muted); border: 0; cursor: pointer;
  letter-spacing: 0.04em; text-transform: uppercase;
  transition: background .12s ease, color .12s ease;
}
.compose-side .picker-tab + .picker-tab { border-left: 1px solid var(--border); }
.compose-side .picker-tab:hover:not(.active) { color: var(--fg); }
.compose-side .picker-tab.active { background: var(--fg); color: var(--bg); }
.compose-side .picker-pane { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.compose-side .picker-pane[hidden] { display: none; }
/* Legacy alias kept so old selectors still apply during transition */
.compose-side .search-area { display: flex; flex-direction: column; gap: 6px; flex: 1; }

/* === Saved-articles picker modal (used from Compose) === */
.saved-picker-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: curate-overlay-fade 0.14s ease-out;
}
.saved-picker-modal {
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 920px;
  height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -10px rgba(0,0,0,0.45);
}
.saved-picker-modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.saved-picker-modal-head h3 {
  margin: 0; font-family: var(--serif); font-weight: 700; font-size: 16px;
}
.saved-picker-close {
  margin-left: auto;
  background: transparent; border: 0; cursor: pointer;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  border-radius: 6px;
}
.saved-picker-close:hover { background: var(--soft); color: var(--fg); }
.saved-picker-pills-wrap {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.saved-picker-pills-wrap .saved-pills { margin: 0; }
.saved-picker-grid-wrap {
  flex: 1; overflow-y: auto;
  padding: 14px 18px;
  -webkit-overflow-scrolling: touch;
}
.saved-picker-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 6px;
}
.saved-picker-tile {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden;
  transition: border-color .12s ease, transform .08s ease;
}
.saved-picker-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.saved-picker-tile .saved-tile-link {
  display: flex; flex-direction: column;
  background: transparent; color: inherit;
  border: 0; padding: 0; width: 100%;
  text-align: left; cursor: pointer; font: inherit;
  text-decoration: none;
}
.saved-picker-tile .saved-tile-thumb {
  aspect-ratio: 1/1; background-color: var(--soft);
  background-size: cover; background-position: center top;
}
.saved-picker-tile .saved-tile-title {
  padding: 3px 5px;
  font-size: 10.5px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.saved-picker-empty { padding: 24px 8px; font-size: 13px; color: var(--muted); text-align: center; }

@media (max-width: 600px) {
  .saved-picker-overlay { padding: 0; align-items: stretch; }
  .saved-picker-modal {
    max-width: none;
    height: 100vh; height: 100dvh;
    border-radius: 0; border-width: 0;
  }
  .saved-picker-modal-head { padding: 10px 12px; }
  .saved-picker-modal-head h3 { font-size: 15px; }
  .saved-picker-pills-wrap { padding: 8px 12px; }
  .saved-picker-pills-wrap .saved-pills {
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .saved-picker-pills-wrap .saved-pill { flex: 0 0 auto; }
  .saved-picker-grid-wrap { padding: 10px 12px env(safe-area-inset-bottom); }
  .saved-picker-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; }
  .saved-picker-tile .saved-tile-title { font-size: 10px; padding: 3px 4px; }
}
.compose-side .search-input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
  transition: border-color .12s ease;
}
.compose-side .search-input:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}
.compose-side .search-results {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  max-height: 260px; overflow-y: auto; box-shadow: var(--shadow);
}
.search-result {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: var(--soft); }
.search-result img {
  width: 40px; height: 40px; object-fit: cover; object-position: top center;
  border-radius: 4px; background: var(--soft);
}
.search-result .sr-title { font-weight: 600; font-size: 14px; }
.search-result .sr-desc  { font-size: 12px; color: var(--muted); }

/* Picked preview — styled to match the finished card's .side */
.compose-side .picked {
  display: flex; flex-direction: column; gap: 8px; flex: 1;
}
.compose-side .picked .thumb {
  aspect-ratio: 4/3; border-radius: 6px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.compose-side .picked .title {
  font-family: var(--serif); font-weight: 700;
  font-size: 18px; line-height: 1.25;
  margin: 0; letter-spacing: -0.005em;
}
.compose-side .picked .extract {
  font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45;
}
.compose-side .picked .change-pick {
  align-self: flex-start; margin-top: auto;
}

.compose-vs {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--serif); font-style: italic;
  font-size: 13px; padding: 0 6px;
}

.compose-foot {
  display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px;
  align-items: center;
}
.compose-warn {
  font-size: 12px; color: var(--danger);
  margin-right: auto;
}

@media (max-width: 480px) {
  .compose-pair { grid-template-columns: 1fr 1fr; padding: 10px; gap: 6px; }
  .compose-vs { display: none; }
  .compose-side { padding: 10px; min-height: 220px; }
  .compose-side .picked .title { font-size: 16px; }
}

/* Profile */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.profile-head .avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--soft); object-fit: cover; }
.profile-head h2 { margin: 0 0 2px; font-family: var(--serif); letter-spacing: -0.01em; }
.profile-head .stats-row { display: flex; gap: 18px; color: var(--muted); font-size: 13px; margin-top: 4px; align-items: center; }
.profile-head .stats-row b { color: var(--fg); }
.profile-stat {
  background: transparent; border: 0; color: var(--muted); padding: 0;
  font: inherit; cursor: pointer; letter-spacing: inherit;
}
.profile-stat:hover { color: var(--fg); text-decoration: underline; }

/* User-list overlay (followers / following lists) — 3 compact pills per row. */
.user-list-card { max-width: 520px; }
.user-list-body {
  margin-top: 8px; max-height: 60vh; overflow-y: auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.user-list-body .user-row {
  padding: 5px 8px;
  gap: 8px;
  border-radius: 999px;
  min-width: 0;
}
.user-list-body .ur-avatar { width: 24px; height: 24px; }
.user-list-body .ur-handle { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-list-body .ur-name { display: none; }
@media (max-width: 480px) {
  .user-list-body { grid-template-columns: repeat(2, 1fr); }
}

.empty {
  color: var(--muted); text-align: center; padding: 36px 12px;
  font-family: var(--serif); font-style: italic;
}
.feed-sentinel {
  text-align: center; padding: 22px 12px;
  color: var(--muted); font-size: 12px;
  font-family: var(--serif); font-style: italic;
  letter-spacing: 0.04em;
}
.feed-sentinel.done { color: transparent; padding: 6px; }
.explore-sentinel { padding: 14px 12px; }
.feed-empty {
  text-align: center; padding: 48px 18px;
  border: 1px dashed var(--border); border-radius: 12px;
  background: var(--card); margin-top: 8px;
}
.feed-empty .fe-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 22px; letter-spacing: -0.01em; margin-bottom: 8px;
}
.feed-empty p {
  color: var(--muted); font-size: 14px; margin: 0 auto 18px; max-width: 420px;
}
.feed-empty p a { color: var(--accent); }
.feed-empty .fe-actions { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.toast {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 8px 14px; border-radius: 5px;
  font-size: 13px; opacity: 0;
  transition: opacity .2s; pointer-events: none; z-index: 100;
  box-shadow: var(--shadow-lift);
  display: inline-flex; align-items: center; gap: 14px;
  max-width: 90vw;
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast-action {
  color: inherit; background: transparent; border: 0;
  font-weight: 700; font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 2px 4px; cursor: pointer;
}

.login-card {
  max-width: 400px; margin: 0 auto 24px; padding: 22px 26px 24px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); text-align: center;
  box-shadow: var(--shadow);
}
.login-note {
  margin: -8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--serif); font-style: italic;
  letter-spacing: 0.01em;
}
.login-or {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
  margin: 4px 0 2px;
}
.login-or::before, .login-or::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: var(--border);
}
.login-google-row { display: flex; }
.login-google-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; border-radius: 8px;
  padding: 9px 14px; font-weight: 600; text-decoration: none;
}
.login-google-btn:hover { background: #f8f9fa; }
[data-theme="dark"] .login-google-btn { background: #fff; color: #1f1f1f; }
.login-google-btn .g-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #4285F4 0%, #34A853 35%, #FBBC05 65%, #EA4335 100%);
  color: #fff; font-weight: 800; font-size: 13px; line-height: 1;
}
.login-testing-notice {
  margin: 18px 0 0;
  padding: 12px 14px 12px 16px;
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  border: 1px dashed color-mix(in srgb, #f59e0b 55%, var(--border));
  border-radius: 8px;
  text-align: left;
  position: relative;
}
.ltn-tag {
  display: inline-block;
  background: #f59e0b; color: #422006;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
  margin-bottom: 8px;
}
.login-note-list {
  list-style: disc;
  margin: 0;
  padding: 0 0 0 22px;
  color: #6b3a05;
  font-size: 13px;
  font-family: var(--serif); font-style: italic;
}
[data-theme="dark"] .login-note-list { color: #fde68a; }
.login-note-list li { margin: 2px 0; line-height: 1.45; }
.login-features {
  list-style: none; padding: 0;
  margin: 22px 0 0;
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.login-features li {
  display: flex; align-items: flex-start; gap: 10px;
  padding-left: 6px;
}
.login-copyright {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.login-features li::before {
  content: '';
  flex: 0 0 auto;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
  margin-top: 8px;
}
.login-card .brand-large {
  font-family: "Optima", "Optima Nova", "Palatino", "Palatino Linotype", "Iowan Old Style", "Charter", serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 6px;
}
.login-card .brand-large .b1,
.login-card .brand-large .b2 { color: inherit; }
.login-card p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card .login-actions {
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
}
.login-card .login-row {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  flex-wrap: wrap;
}
.login-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
}
.login-success {
  margin-top: 6px;
  color: #15803d;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 10px;
  background: color-mix(in srgb, #16a34a 10%, transparent);
  border: 1px solid color-mix(in srgb, #16a34a 35%, var(--border));
  border-radius: 6px;
}
.login-demo-row {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-direction: column; gap: 6px;
}
.login-demo-or { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }

/* === Sign-in tip toast — "click on any title to see the Wikipedia page" === */
.tip-toast {
  position: fixed;
  left: 50%; top: calc(72px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  width: min(560px, calc(100vw - 24px));
  background: #000; color: #fff;
  border: 1px solid #000;
  border-radius: 5px;
  box-shadow: 0 14px 32px -8px rgba(0,0,0,0.4);
  font-size: 13px; font-weight: 600;
  animation: tip-pop 0.22s ease-out;
}
.tip-toast.out { opacity: 0; transform: translate(-50%, -6px); transition: opacity .18s ease, transform .18s ease; }
.tip-toast .tip-bulb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  color: #fbbf24;
  flex: 0 0 auto;
}
.tip-toast .tip-bulb svg { width: 18px; height: 18px; }
.tip-toast .tip-text { line-height: 1.3; flex: 1; }
.tip-toast .tip-close {
  background: transparent; border: 0; cursor: pointer;
  color: #fff; font-size: 18px; line-height: 1;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: background .12s ease;
  flex: 0 0 auto;
}
.tip-toast .tip-close:hover { background: rgba(255,255,255,0.18); }
@keyframes tip-pop {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 480px) {
  .tip-toast { font-size: 12px; padding: 8px 10px 8px 12px; }
}

/* === Demo-mode banner === */
.demo-banner {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #422006;
  padding: 6px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; font-weight: 600;
  border-bottom: 1px solid color-mix(in srgb, #92400e 40%, transparent);
}
.demo-banner-text { flex: 1; min-width: 0; }
.demo-banner button {
  background: #422006; color: #fef3c7;
  border: 0; border-radius: 4px;
  padding: 5px 10px; font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.demo-banner button:hover { background: #1c1917; }
.login-card input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--fg);
  min-width: 200px;
  font-family: inherit; font-size: 14px;
}
.login-card .login-handle-row { flex-wrap: nowrap; }
.login-card .login-handle-row input { min-width: 0; flex: 1; max-width: 200px; }
.login-card .login-handle-row .btn { flex-shrink: 0; padding: 7px 11px; font-size: 13px; }
.login-status {
  font-size: 12.5px; margin-top: -4px;
  color: var(--muted);
}
.login-status.good { color: #2f7a3a; }
.login-status.bad  { color: var(--danger); }
.login-status.warn { color: var(--muted); }

/* === Wikipedia iframe overlay === */
.wiki-overlay {
  position: fixed;
  top: 5vh; right: 5vw; bottom: 5vh; left: 5vw;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,0.45), 0 4px 8px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 200;
  opacity: 0; transform: translateY(8px);
  transition: opacity .18s ease, transform .22s ease,
              top .25s ease, right .25s ease, bottom .25s ease, left .25s ease,
              width .25s ease, height .25s ease, border-radius .2s ease;
  pointer-events: none;
}
.wiki-overlay.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.wiki-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
  background: #000;
  color: #fff;
  border-bottom: 1px solid #000;
  flex: 0 0 auto;
}
.wiki-brand {
  font-family: "Optima", "Optima Nova", "Palatino", "Palatino Linotype", "Iowan Old Style", "Charter", serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  padding: 2px 8px;
  text-decoration: none;
  flex: 0 0 auto;
}
.wiki-brand .b1, .wiki-brand .b2 { color: inherit; }
.wiki-close-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.5);
  background: transparent; color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .12s ease, border-color .12s ease;
}
.wiki-close-btn svg { width: 14px; height: 14px; }
.wiki-close-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.8); }
.wiki-iframe {
  flex: 1 1 auto;
  width: 100%; min-height: 0;
  border: 0;
  background: #fff;
}

@media (max-width: 480px) {
  .wiki-overlay { top: 0; right: 0; bottom: 0; left: 0; border-radius: 0; }
}

/* === Stats overlay === */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--bg) 50%, rgba(0,0,0,0.55));
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .14s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  width: 100%; max-width: 560px;
  max-height: 92vh; overflow: auto;
  padding: 22px 22px 18px;
}
.overlay-card header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 18px;
}
.overlay-card .o-title {
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  letter-spacing: -0.005em; line-height: 1.25; margin: 0;
}
.overlay-card .o-sub { color: var(--muted); font-size: 12px; margin-top: 4px; font-family: var(--serif); font-style: italic; }
.overlay-card .close {
  width: 32px; height: 32px; border-radius: 5px;
  border: 1px solid var(--border); background: transparent; color: var(--fg);
  font-size: 18px; line-height: 1; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.overlay-card .close:hover { background: var(--soft); }

.chart-wrap {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
}
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-axis-label { fill: var(--muted); font-size: 10.5px; font-family: var(--serif); font-style: italic; }
.chart-bg-title {
  fill: var(--fg);
  fill-opacity: 0.18;
  font-family: var(--serif);
  font-weight: 800;
  letter-spacing: -0.01em;
  pointer-events: none;
}
[data-theme="dark"] .chart-bg-title { fill-opacity: 0.20; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.followers { stroke: #d29245; stroke-width: 2; stroke-dasharray: 4 4; }
[data-theme="dark"] .chart-line.followers { stroke: #e7b06a; }
.chart-area-pos { fill: var(--right); opacity: 0.10; }
.chart-area-neg { fill: var(--left);  opacity: 0.10; }
.chart-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.chart-dot.followers { stroke: #d29245; }
[data-theme="dark"] .chart-dot.followers { stroke: #e7b06a; }

.chart-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 10px; padding: 0 4px;
  font-size: 12px; color: var(--muted);
}
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg-swatch {
  display: inline-block; width: 18px; height: 3px; border-radius: 2px;
}
.chart-legend .lg-global    { background: var(--accent); }
.chart-legend .lg-followers {
  background-image: linear-gradient(to right, #d29245 0 4px, transparent 4px 8px,
    #d29245 8px 12px, transparent 12px 16px, #d29245 16px 18px);
}
[data-theme="dark"] .chart-legend .lg-followers {
  background-image: linear-gradient(to right, #e7b06a 0 4px, transparent 4px 8px,
    #e7b06a 8px 12px, transparent 12px 16px, #e7b06a 16px 18px);
}
.chart-empty {
  text-align: center; color: var(--muted);
  font-family: var(--serif); font-style: italic;
  padding: 40px 10px;
}

/* === Stats: full-width card; separate Global / Your-followers blocks === */
.overlay-card.stats-overlay-card {
  max-width: none;
  width: calc(100vw - 36px);
  position: relative;
  padding-top: 14px;
}
.overlay-card.stats-overlay-card .stats-close {
  position: absolute; top: 8px; right: 8px;
  background: transparent; border: 0;
  font-size: 24px; line-height: 1;
  color: var(--muted); cursor: pointer;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  z-index: 2;
}
.overlay-card.stats-overlay-card .stats-close:hover { background: var(--soft); color: var(--fg); }
.stats-cohorts { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.stats-cohort {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 14px;
}
.stats-cohort-label {
  margin: 0 0 10px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.stats-section-empty {
  color: var(--muted);
  font-family: var(--serif); font-style: italic;
  font-size: 13px;
}

/* === Stats overlay: two-photo cohort view === */
.stats-photos-view { display: flex; flex-direction: column; gap: 12px; }
.stats-photo-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stats-photo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stats-photo-img {
  position: relative;
  aspect-ratio: 4/3; border-radius: 10px;
  background: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  overflow: hidden;
}
.stats-photo-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 800;
  font-size: clamp(28px, 8vw, 56px);
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.45) 100%);
  transition: background .18s ease, font-size .18s ease;
}
.stats-photo-pct.lead {
  background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.65) 100%);
  font-size: clamp(32px, 10vw, 64px);
}
.stats-photo-pct.tied { font-style: italic; }
.stats-photo-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 13px; line-height: 1.25; letter-spacing: -0.005em;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg);
}
.stats-cohort-meta {
  text-align: center; color: var(--muted);
  font-family: var(--serif); font-style: italic;
  font-size: 13px;
  min-height: 1.2em;
}
.stats-cohort-toggle {
  display: flex; align-self: center;
  background: var(--soft);
  border-radius: 8px;
  padding: 3px; gap: 2px;
}
.stats-cohort-toggle .seg-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  border-radius: 6px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.stats-cohort-toggle .seg-btn:hover:not(:disabled) { color: var(--fg); }
.stats-cohort-toggle .seg-btn.active {
  background: var(--card); color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.stats-cohort-toggle .seg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Stats share-bar layout ===
   One horizontal split bar per cohort. Width of each segment reflects the
   cohort's average preference share for that side. Labels above and below
   reinforce the split, plus a row of count pills for raw lean tallies. */
.stats-total {
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
  font-family: var(--serif); font-style: italic;
}
.share-bar {
  display: flex; width: 100%;
  height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.share-fill { height: 100%; transition: width .2s ease; }
.share-fill.share-left  { background: var(--left,  #6b7280); }
.share-fill.share-right { background: var(--right, #92867a); }
.share-labels {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-family: var(--serif);
}
.share-label {
  display: inline-flex; align-items: baseline; gap: 6px; min-width: 0;
  font-size: 13px; line-height: 1.25;
  color: var(--muted);
}
.share-label.share-label-right { justify-content: flex-end; text-align: right; }
.share-label.lead { color: var(--fg); }
.share-label.lead .share-pct { font-weight: 800; font-size: 16px; }
.share-label .share-pct {
  font-family: var(--sans); font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 14px; color: var(--fg);
}
.share-label .share-name {
  font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 0 1 auto;
}
.lean-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  font-size: 11.5px;
}
.lean-pill {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  color: var(--muted);
}
.lean-pill b { color: var(--fg); font-weight: 700; font-variant-numeric: tabular-nums; }
.lean-pill.lean-tied { background: transparent; border: 1px dashed var(--border); }

/* === My-vote summary line === */
.my-vote-text .pct {
  font-weight: 800; color: var(--fg);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
.my-vote-text .pct-other,
.my-vote-text .pct-pair {
  color: var(--muted);
  font-weight: 500;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .share-label { font-size: 12px; }
  .share-label.lead .share-pct { font-size: 15px; }
  .my-vote-text .pct-other { display: block; margin-left: 0; margin-top: 2px; }
}

.overlay-meta {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--muted);
  margin-top: 12px;
}
.overlay-meta .meta-strong { color: var(--fg); font-weight: 600; }

/* === Share sheet (overlay modal) === */
.share-card { max-width: 460px; }
.share-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-top: 4px;
}
.share-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px;
  background: var(--soft); border: 1px solid var(--border);
  color: var(--fg); border-radius: 9px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  cursor: pointer; text-align: center;
  transition: transform .14s ease, background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.share-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 14px -8px rgba(0,0,0,0.25); }
.share-tile:active { transform: translateY(0); }
.share-ico-wrap {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  transition: background .14s ease, border-color .14s ease;
}
.share-ico-wrap svg { width: 20px; height: 20px; }

/* Brand colors on hover */
.share-tile.sh-whatsapp:hover  { background: #25D36622; border-color: #25D36655; color: #128C56; }
.share-tile.sh-whatsapp:hover .share-ico-wrap { background: #25D366; border-color: #25D366; color: #fff; }
.share-tile.sh-instagram:hover { background: #E134711a; border-color: #E1347155; color: #C21F66; }
.share-tile.sh-instagram:hover .share-ico-wrap {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  border-color: transparent; color: #fff;
}
.share-tile.sh-x:hover         { background: #00000018; border-color: #00000044; color: #000; }
[data-theme="dark"] .share-tile.sh-x:hover { background: #ffffff18; border-color: #ffffff44; color: #fff; }
.share-tile.sh-x:hover .share-ico-wrap { background: #000; border-color: #000; color: #fff; }
[data-theme="dark"] .share-tile.sh-x:hover .share-ico-wrap { background: #fff; border-color: #fff; color: #000; }
.share-tile.sh-facebook:hover  { background: #1877F222; border-color: #1877F255; color: #1456a8; }
.share-tile.sh-facebook:hover .share-ico-wrap { background: #1877F2; border-color: #1877F2; color: #fff; }
.share-tile.sh-telegram:hover  { background: #229ED922; border-color: #229ED955; color: #1a7aae; }
.share-tile.sh-telegram:hover .share-ico-wrap { background: #229ED9; border-color: #229ED9; color: #fff; }
.share-tile.sh-linkedin:hover  { background: #0A66C222; border-color: #0A66C255; color: #084d92; }
.share-tile.sh-linkedin:hover .share-ico-wrap { background: #0A66C2; border-color: #0A66C2; color: #fff; }
.share-tile.sh-email:hover     { background: var(--soft); border-color: var(--border); color: var(--fg); }
.share-tile.sh-email:hover .share-ico-wrap { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.share-tile.sh-link:hover      { background: var(--soft); border-color: var(--border); color: var(--fg); }
.share-tile.sh-link:hover .share-ico-wrap { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.share-link {
  margin-top: 16px; padding: 10px 12px;
  background: var(--soft); border: 1px solid var(--border); border-radius: 7px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* === Interest picker === */
.interests-card { max-width: 480px; }
.interest-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 4px;
}
.interest-chip {
  padding: 7px 14px; border-radius: 999px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .08s ease;
}
.interest-chip:hover { background: var(--soft); }
.interest-chip.active {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.interest-chip:active { transform: translateY(1px); }

/* === Explore category filter === */
.cat-filter {
  margin: 4px 0 8px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card);
}
.cat-filter > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--fg);
  display: flex; align-items: center; gap: 6px;
}
.cat-filter > summary::-webkit-details-marker { display: none; }
.cat-filter > summary .cat-summary-label::before {
  content: '▸'; font-size: 11px; color: var(--muted);
  margin-right: 6px;
  display: inline-block;
  transition: transform .12s ease;
}
.cat-filter[open] > summary .cat-summary-label::before { transform: rotate(90deg); }
.cat-filter > summary .cat-summary-label { display: inline-flex; align-items: center; gap: 6px; }
.cat-close {
  margin-left: auto;
  width: 26px; height: 26px;
  display: none; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--muted); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0;
}
.cat-filter[open] > summary .cat-close { display: inline-flex; }
.cat-close:hover { background: var(--soft); color: var(--fg); }
.cat-filter .cat-count {
  background: var(--accent); color: var(--accent-fg);
  border-radius: 999px; padding: 1px 8px;
  font-size: 11px; font-weight: 600;
}
.cat-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 12px 10px;
}
.cat-chip {
  padding: 5px 10px; border-radius: 999px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.cat-chip:hover { background: var(--soft); }
.cat-chip.active {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.cat-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 0 12px 10px;
}

/* === Confirm dialog === */
.confirm-card {
  max-width: 380px; padding: 22px 22px 18px;
}
.confirm-title {
  font-family: var(--serif); font-size: 18px; font-weight: 700;
  letter-spacing: -0.005em; margin: 0 0 8px; line-height: 1.25;
}
.confirm-message {
  margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5;
}
.confirm-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}
.btn.danger-solid {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn.danger-solid:hover  { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn.danger-solid:active { background: color-mix(in srgb, var(--danger) 78%, #000); }

/* Handle edit dialog */
.handle-input-row {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); padding: 0 4px 0 12px;
  transition: border-color .12s ease;
}
.handle-input-row:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.handle-input-row.invalid,
.handle-input.invalid { border-color: var(--danger); }
.handle-input-row .handle-prefix {
  font-family: var(--serif); color: var(--muted); font-size: 16px; font-weight: 600;
}
.handle-input-row .handle-input {
  flex: 1; border: 0; background: transparent;
  padding: 10px 8px; font-size: 15px; color: var(--fg);
  font-family: inherit;
}
.handle-input-row .handle-input:focus { outline: none; }
.handle-input.invalid { /* fallback if .handle-input-row.invalid not used */ }
.handle-input-row:has(.handle-input.invalid) { border-color: var(--danger); }
.handle-error {
  margin-top: 8px;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

/* === Stats / Change vote button accents === */
/* Stats: mustard (warm amber) */
.stats-btn {
  color: #a07410;
  border-color: color-mix(in srgb, #d29245 30%, var(--border));
}
.stats-btn:hover {
  background: color-mix(in srgb, #d29245 14%, transparent);
  border-color: color-mix(in srgb, #d29245 55%, var(--border));
  color: #7a5708;
}
[data-theme="dark"] .stats-btn { color: #e5b14a; border-color: color-mix(in srgb, #e5b14a 30%, var(--border)); }
[data-theme="dark"] .stats-btn:hover { background: color-mix(in srgb, #e5b14a 18%, transparent); color: #f3c977; }

/* Change vote: green */
.change-vote {
  color: #1f6b48;
  border-color: color-mix(in srgb, var(--right) 35%, var(--border));
}
.change-vote:hover {
  background: color-mix(in srgb, var(--right) 14%, transparent);
  border-color: color-mix(in srgb, var(--right) 55%, var(--border));
  color: #14502f;
}
[data-theme="dark"] .change-vote { color: #5fbf95; border-color: color-mix(in srgb, var(--right) 35%, var(--border)); }
[data-theme="dark"] .change-vote:hover { background: color-mix(in srgb, var(--right) 22%, transparent); color: #88e3b5; }
/* Footer variant of change-vote keeps its mustard background + white text in
   dark mode. The generic .change-vote rules above target the standalone
   variant used elsewhere; this override pins the foot-button colour. */
[data-theme="dark"] .card-foot .foot-change-vote,
[data-theme="dark"] .card-foot .foot-change-vote:hover { color: #fff; }

/* === Explore grid (Instagram-style) === */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
@media (max-width: 480px) {
  .explore-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
}

.explore-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--border);
  display: block;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.explore-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -10px rgba(0,0,0,0.28);
  border-color: color-mix(in srgb, var(--fg) 30%, var(--border));
  z-index: 2;
}

.et-split {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.et-half { position: relative; overflow: hidden; }
.et-half:first-child::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 2px;
  background: rgba(255,255,255,0.55);
}
[data-theme="dark"] .et-half:first-child::after { background: rgba(0,0,0,0.55); }

.et-img {
  position: absolute; inset: 0;
  background-size: contain;
  background-position: center;
  background-color: var(--soft);
  background-repeat: no-repeat;
  transition: transform .35s ease;
}
.explore-tile:hover .et-img { transform: scale(1.04); }

.et-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 8px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.45) 60%, transparent 100%);
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.18;
  letter-spacing: -0.005em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.et-vs {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.62);
  color: #fff;
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: 11px; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.7);
  z-index: 3;
  backdrop-filter: blur(2px);
}

.et-meta,
.et-author {
  position: absolute; top: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 3;
  max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.et-meta   { right: 6px; }
.et-author { left:  6px; backdrop-filter: blur(2px); }

/* === Search === */
.search-page { max-width: 600px; margin: 0 auto; }
.search-box {
  position: relative;
  display: flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color .12s ease;
}
.search-box:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.search-mag {
  width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto;
}
.search-box .search-input {
  flex: 1; border: 0; background: transparent;
  padding: 12px 10px;
  font-size: 15px; color: var(--fg);
  font-family: inherit;
}
.search-box .search-input:focus { outline: none; }

.search-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.search-page .explore-grid { margin-top: 14px; }
.search-page .search-list:not([hidden]) + .explore-grid { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Explore: persistent search at the top, user results between, sort, grid below. */
.explore-page { display: flex; flex-direction: column; gap: 12px; }
.explore-search { margin-bottom: 0; }
.explore-page .search-list:not([hidden]) {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.explore-sort { align-self: center; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--fg); transition: background .12s ease, border-color .12s ease;
}
.user-row:hover { background: var(--soft); border-color: color-mix(in srgb, var(--fg) 18%, var(--border)); }
.ur-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--soft); flex: 0 0 auto; }
.ur-text { flex: 1; min-width: 0; }
.ur-handle { font-weight: 600; font-size: 14px; }
.ur-name { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* === Ads === */
.ad-card .card-head .ad-tag {
  margin-left: 4px; padding: 2px 7px; border-radius: 4px;
  background: var(--fg); color: var(--bg);
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ad-pair {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 8px; align-items: stretch;
}
.ad-side {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; min-height: 200px;
  background: var(--card);
}
.ad-side .ad-side-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 18px; line-height: 1.25; letter-spacing: -0.005em;
  margin: 4px 0 0;
}
.ad-side .ad-side-subtitle {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: var(--accent); margin: -2px 0 0;
}
.ad-side .ad-side-desc {
  font-size: 13px; color: var(--muted); line-height: 1.5;
  margin: 4px 0 0; white-space: pre-wrap;
}

/* Carousel */
.ad-carousel {
  display: flex; flex-direction: row; overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
  scrollbar-width: none;
}
.ad-carousel::-webkit-scrollbar { display: none; }
.ad-carousel.empty { display: none; }
.ad-slide {
  flex: 0 0 100%;
  aspect-ratio: 4/3;
  scroll-snap-align: center;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.ad-dots {
  display: flex; justify-content: center; gap: 5px; margin-top: 6px;
}
.ad-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); border: 0; padding: 0; cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.ad-dot.active { background: var(--fg); transform: scale(1.3); }

/* Compose Ad */
.ad-compose-side { gap: 8px; }
.ad-input {
  width: 100%; padding: 9px 12px; font-size: 14px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit;
  transition: border-color .12s ease;
}
.ad-input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.ad-input.ad-title {
  font-family: var(--serif); font-weight: 700; font-size: 16px;
}
.ad-input.ad-description { resize: vertical; min-height: 80px; }
.ad-images { display: flex; flex-direction: column; gap: 6px; }
.ad-images .ad-image { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }

@media (max-width: 480px) {
  .ad-pair { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ad-pair .vs { display: none; }
  .ad-side { padding: 10px; min-height: 180px; }
  .ad-side .ad-side-title { font-size: 16px; }
}

/* === Saved articles === */
.saved-page { max-width: 600px; margin: 0 auto; }
.saved-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 14px;
}
.saved-pill {
  padding: 3px 8px; border-radius: 4px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.saved-pill:hover { background: var(--soft); }
.saved-pill.active {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.saved-pill .pill-count {
  font-size: 10px; opacity: 0.85;
  padding: 0 4px; border-radius: 3px;
  background: color-mix(in srgb, currentColor 15%, transparent);
}
.saved-item-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.saved-item-tag {
  font-size: 10.5px; color: var(--muted);
  padding: 1px 7px; border-radius: 999px;
  background: var(--soft); border: 1px solid var(--border);
}

/* === Watched cards list === */
.watched-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.watched-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px;
}
.watched-link {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1; min-width: 0; color: var(--fg); text-decoration: none;
}
.watched-pair {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center;
}
.watched-half {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.watched-thumb {
  width: 38px; height: 38px; border-radius: 5px; flex: 0 0 auto;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.watched-title {
  font-family: var(--serif); font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.watched-vs {
  font-family: var(--serif); font-style: italic; color: var(--muted);
  font-size: 12px;
}
.watched-meta { color: var(--muted); font-size: 12px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 5px;
  color: var(--muted);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 12px;
  transition: background .12s ease, color .12s ease;
}
.back-link:hover { background: var(--soft); color: var(--fg); }
.back-link svg { width: 14px; height: 14px; }
.saved-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.saved-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.saved-thumb {
  width: 48px; height: 48px; flex: 0 0 auto;
  border-radius: 6px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.saved-body { flex: 1; min-width: 0; }
.saved-title {
  font-family: var(--serif); font-weight: 700; font-size: 15px;
  color: var(--fg); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis;
}
.saved-title[href]:hover { text-decoration: underline; }

/* === Compact list-page title (Saved, Watchlist, etc.) — matches the
       Feed subtitle treatment so all three list views share a heading style. */
.list-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: inherit; font-weight: 500;
  font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}
.list-title .list-title-count {
  color: var(--muted); font-weight: 500; font-size: 12px;
  margin-left: 4px; letter-spacing: 0.04em;
}

.saved-more-wrap { display: flex; justify-content: center; margin: 14px 0 8px; }
.saved-more-btn { min-width: 120px; }

.admin-demo-note { color: var(--muted); font-size: 12px; }

.feed-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* === Sign-up accordion below a single shared post === */
.singlepost-signup {
  margin: 18px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.singlepost-signup-summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 14px;
  user-select: none;
  background: #2563eb; color: #fff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background .12s ease;
}
.singlepost-signup-summary:hover { background: #1d4ed8; }
.singlepost-signup-summary::-webkit-details-marker { display: none; }
.singlepost-signup-summary .sps-label {
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  color: #fff;
}
.singlepost-signup-summary .sps-sub { display: none; }
.singlepost-signup-summary .sps-toggle {
  color: #fff; transition: transform 0.18s ease;
}
.singlepost-signup[open] > .singlepost-signup-summary {
  border-bottom: 1px solid var(--border);
}
.singlepost-signup[open] > .singlepost-signup-summary .sps-toggle {
  transform: rotate(180deg);
}
.singlepost-signup-body { padding: 8px 14px 16px; }
/* Tighter padding for the embedded login card so it doesn't double up. */
.singlepost-signup-body .login-card {
  padding-top: 6px;
  border: 0; box-shadow: none; background: transparent;
}
@media (max-width: 480px) {
  .singlepost-signup-summary .sps-sub { display: none; }
}

.feed-sentinel .more-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 140px;
}

/* === Saved 3-column tile grid === */
.saved-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.saved-tile {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 6px 28px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.saved-tile-link {
  display: flex; flex-direction: column; gap: 4px;
  color: inherit; text-decoration: none;
  min-width: 0;
}
.saved-tile-thumb {
  aspect-ratio: 4/3;
  border-radius: 5px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.saved-tile-title {
  font-family: var(--serif); font-weight: 700; font-size: 11.5px;
  line-height: 1.2; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.saved-tile-link:hover .saved-tile-title { text-decoration: underline; }
.saved-tile-actions {
  position: absolute; right: 4px; bottom: 4px;
  display: flex; gap: 4px; align-items: center;
}
.saved-create-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px;
  background: #16a34a; color: #fff;
  border: 0; border-radius: 4px;
  font: inherit; font-size: 9px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; text-decoration: none;
  transition: filter .12s ease, transform .08s ease;
}
.saved-create-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.saved-create-btn:active { transform: translateY(0); }
.saved-remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 0; border-radius: 5px;
  cursor: pointer;
  opacity: 0; transition: opacity .12s ease, background .12s ease;
}
.saved-tile:hover .saved-remove-btn,
.saved-remove-btn:focus-visible { opacity: 1; }
.saved-remove-btn:hover { background: var(--danger); }
.saved-remove-btn svg { width: 12px; height: 12px; }
@media (hover: none) {
  .saved-remove-btn { opacity: 1; }
}

/* Sign-in-to-vote pill (replaces Submit when not signed in) */
/* Sign-in-to-vote inherits sizing/colour from .submit-vote so it matches the
   Vote button visually for signed-out viewers. No extra rules needed. */

/* === Admin === */
.admin-page { max-width: 960px; margin: 0 auto; }
.admin-title { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
.admin-sub   { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.admin-stats {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  margin-bottom: 18px;
}
.astat {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 10px; text-align: center;
}
.astat .av { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.astat .al { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; margin-top: 2px; }

.admin-section {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 14px;
}
.admin-section h3 {
  margin: 0 0 12px; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.admin-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-pending .apc-count {
  display: inline-block; margin-left: 6px;
  background: var(--accent); color: var(--accent-fg);
  border-radius: 999px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; vertical-align: middle;
}
.admin-pending-list { list-style: none; padding: 0; margin: 8px 0 0; }
.apc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.apc-row:last-child { border-bottom: 0; }
.apc-body { flex: 1; min-width: 0; }
.apc-handle { font-family: var(--serif); font-weight: 700; font-size: 14px; }
.apc-meta { color: var(--muted); font-size: 12px; }

/* Untagged-articles admin list */
.untagged-list { display: flex; flex-direction: column; gap: 12px; }
.untagged-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
}
.untagged-thumb {
  width: 64px; height: 64px; border-radius: 6px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.untagged-title {
  font-family: var(--serif); font-weight: 700; font-size: 16px;
  margin-bottom: 6px;
}
.untagged-tags .interest-chip { font-size: 11.5px; padding: 4px 10px; }
@media (max-width: 720px) {
  .untagged-row { grid-template-columns: 48px 1fr; }
  .untagged-row .save-tags { grid-column: 1 / -1; justify-self: end; }
  .untagged-thumb { width: 48px; height: 48px; }
}

.admin-grid { padding: 0; background: transparent; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.admin-grid > div { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.admin-list li:last-child { border-bottom: 0; }
.admin-list .al-title { font-family: var(--serif); font-weight: 700; font-size: 14px; }
.admin-list .al-title em { font-style: italic; color: var(--muted); font-weight: 400; padding: 0 4px; }
.admin-list .al-meta { color: var(--muted); font-size: 12px; }

.curate-search { position: relative; margin: 0 0 14px; }
.curate-search .search-input {
  width: 100%;
  padding: 10px 12px; font: inherit; font-size: 14px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
}
.curate-search .search-input:focus { outline: none; border-color: var(--accent); }
.curate-search .search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 360px; overflow-y: auto;
  z-index: 20;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.25);
}

/* === Admin: handle picker overlay (Create post → which @account?) === */
.curate-handle-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: curate-overlay-fade 0.14s ease-out;
}
@keyframes curate-overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.curate-handle-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 16px;
  max-width: 560px; width: 100%;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.4);
  animation: curate-pop 0.18s ease-out;
}
.curate-handle-modal h3 {
  margin: 0 0 4px;
  font-family: var(--serif); font-weight: 700; font-size: 18px;
}
.curate-handle-pair {
  margin: 0 0 14px;
  font-family: var(--serif); font-style: italic;
  color: var(--muted); font-size: 13px;
}
.curate-handle-pair .vs { padding: 0 6px; opacity: 0.7; }
.curate-handle-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .curate-handle-grid { grid-template-columns: repeat(2, 1fr); }
}
.curate-handle-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color .12s ease, transform .08s ease, background .12s ease;
}
.curate-handle-box:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
}
.curate-handle-box:disabled { opacity: 0.55; cursor: default; }
.curate-handle-box.busy { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.curate-handle-at {
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  color: var(--accent);
}
.curate-handle-label {
  font-family: var(--serif); font-size: 12px; color: var(--muted);
}
.curate-handle-cancel { margin-left: auto; display: block; }

/* === Admin: curate a post === */
.curate-page { max-width: 1100px; }
.curate-controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 8px 0 18px;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.curate-controls label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.curate-controls select {
  padding: 7px 10px; font-size: 13px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
}
.curate-count {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}
.curate-section { margin-bottom: 18px; }
.curate-section-title {
  font-family: var(--serif); font-weight: 700; font-size: 14px;
  letter-spacing: 0.02em; text-transform: uppercase;
  margin: 0 0 8px;
  color: var(--muted);
}
.curate-section-count {
  display: inline-block; margin-left: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--muted); opacity: 0.8;
}
.curate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.curate-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px; min-width: 0;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 6px;
  text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color .12s ease, transform .08s ease, box-shadow .12s ease;
}
.curate-card:hover { border-color: color-mix(in srgb, var(--fg) 25%, var(--border)); transform: translateY(-1px); }
.curate-card { position: relative; }
.curate-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
/* Cards "related" to the most recently selected one — same coarse subtype
   (the suggestion engine's pairing rule). Mustard border + tint so the
   admin sees at a glance which boxes are sensible second-picks. */
.curate-card.related {
  border-color: #c08e10;
  background: color-mix(in srgb, #c08e10 14%, var(--card));
  box-shadow: 0 0 0 2px color-mix(in srgb, #c08e10 35%, transparent);
}
.curate-card.related .curate-title { color: #6b4f00; }
.curate-create-inline {
  position: absolute;
  bottom: 8px; right: 8px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  background: #16a34a; color: #fff;
  border: 0; border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.25);
  z-index: 3;
  animation: curate-pop 0.18s ease-out;
}
@keyframes curate-pop {
  from { transform: translateY(4px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
/* Curate page is text-only by request — thumbs are hidden in both the
   candidate grid and the suggestions panel so the admin can scan titles
   quickly without image distraction. */
.curate-card .curate-thumb { display: none; }
.curate-sug-thumb { display: none; }
.curate-card .curate-thumb.empty::after {
  content: ''; display: block; width: 100%; height: 100%;
  background: repeating-linear-gradient(45deg, var(--soft), var(--soft) 6px, color-mix(in srgb, var(--fg) 4%, transparent) 6px, color-mix(in srgb, var(--fg) 4%, transparent) 12px);
}
.curate-card .curate-meta { padding: 0 2px 2px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.curate-card .curate-title {
  font-family: var(--serif); font-weight: 700; font-size: 12px; line-height: 1.2;
  color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  position: relative;
}
.curate-card .curate-desc {
  color: var(--muted); font-size: 10.5px; font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.curate-fresh-tag {
  display: inline-block; margin-left: 4px;
  background: var(--accent); color: var(--accent-fg);
  font-family: var(--sans); font-size: 8.5px; font-weight: 800;
  letter-spacing: 0.06em; padding: 1px 4px;
  border-radius: 3px; vertical-align: 2px;
}
.curate-create-inline {
  padding: 4px 9px; font-size: 11px;
  bottom: 4px; right: 4px;
}

/* Admin: paginated all-articles list */
.admin-sort-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 6px 0 14px; gap: 12px;
}
.admin-sort-row label { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.admin-sort-row select {
  padding: 6px 10px; font-size: 13px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
}
.admin-articles-total { color: var(--muted); font-size: 12px; }
.admin-articles-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.admin-article-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-article-row .aar-thumb {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 5px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.admin-article-row .aar-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.admin-article-row .aar-title { font-family: var(--serif); font-weight: 700; font-size: 14px; color: var(--fg); }
.admin-article-row .aar-meta { color: var(--muted); font-size: 12px; }

/* === Compair Labs === */
.labs-page { max-width: 760px; }
.labs-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.labs-sides {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 12px;
}
.labs-side-wrap { position: relative; min-width: 0; }
.labs-side-remove {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 0; border-radius: 4px;
  font-size: 16px; line-height: 1;
  cursor: pointer; z-index: 2;
}
.labs-side-remove:hover { background: var(--danger); }
.labs-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 18px;
}
.labs-results { margin-top: 12px; }
.labs-out { display: flex; flex-direction: column; gap: 14px; }
.lo-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.lo-section h3 {
  margin: 0 0 10px;
  font-family: var(--serif); font-weight: 700;
  font-size: 16px; letter-spacing: -0.005em;
}
.lo-section h3 .lo-hint {
  color: var(--muted); font-style: italic;
  font-size: 12px; font-weight: 400;
  margin-left: 6px;
}
.lo-list { list-style: none; padding: 0; margin: 0; }
.lo-articles li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.lo-articles li:last-child { border-bottom: 0; }
.lo-articles .lo-title { font-weight: 700; font-family: var(--serif); }
.lo-articles .lo-meta { color: var(--muted); font-size: 12px; }
.lo-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.lo-row:last-child { border-bottom: 0; }
.lo-row .lo-name { font-weight: 600; color: var(--fg); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lo-row a.lo-name:hover { text-decoration: underline; }
.lo-row .lo-count {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted);
  font-size: 12px;
}
.lo-row.lo-all { background: color-mix(in srgb, #16a34a 10%, transparent); border-radius: 6px; padding: 6px 8px; }
.lo-row.lo-all .lo-count { color: #15803d; }
.lo-row .lo-srcs {
  display: flex; flex-wrap: wrap; gap: 4px;
  font-size: 11px;
}
.lo-row .lo-src {
  background: var(--soft); color: var(--muted);
  padding: 1px 6px; border-radius: 999px;
  white-space: nowrap;
}
.lo-foot { margin-top: 10px; display: flex; justify-content: flex-end; }
.lo-warn {
  margin-top: 8px;
  font-size: 12px; color: var(--danger); font-style: italic;
}
@media (max-width: 540px) {
  .labs-sides { grid-template-columns: 1fr; }
  .lo-row { grid-template-columns: 1fr auto; }
  .lo-row .lo-srcs { grid-column: 1 / -1; }
}

/* Labs toolbar (Today's Summary entry point on the main labs page). */
.labs-toolbar { display: flex; gap: 8px; margin-bottom: 14px; }

/* === Today's Summary === */
.labs-today-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.labs-today-title { margin: 0; }
.labs-today-nav {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 12px 0 14px;
}
.labs-today-nav input[type="date"] {
  padding: 6px 10px; font-size: 13px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit;
}
.labs-today-nav button:disabled { opacity: 0.45; cursor: not-allowed; }

/* === Labs: Cards carousel === */
.labs-cards-wrap { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.labs-cards-stage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  min-height: 280px;
}
.lc-card { display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none; }
.lc-card .lc-thumb {
  width: 100%; aspect-ratio: 16/9;
  border-radius: 10px;
  background-color: var(--soft);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.lc-card .lc-body { display: flex; flex-direction: column; gap: 6px; }
.lc-card .lc-title {
  font-family: var(--serif); font-weight: 700; font-size: 22px; line-height: 1.2;
  letter-spacing: -0.01em; color: var(--fg);
}
.lc-card .lc-desc { color: var(--muted); font-size: 13px; font-style: italic; }
.lc-card .lc-extract { margin: 0; color: var(--fg); font-size: 14px; line-height: 1.55; }
.lc-card:hover .lc-title { text-decoration: underline; }
.labs-cards-nav {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap;
}
.labs-cards-nav .lc-pos {
  font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px;
  padding: 0 6px;
}
.labs-cards-nav button:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Labs: Random day === */
.random-day-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 0 14px;
}
.rd-potd {
  display: grid; grid-template-columns: minmax(200px, 1fr) 1.5fr; gap: 14px;
  align-items: start;
}
.rd-potd-img {
  width: 100%; max-height: 360px;
  border-radius: 8px; border: 1px solid var(--border);
  object-fit: contain; background: var(--soft);
}
.rd-potd-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rd-potd-links {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.rd-potd-links-label {
  font-size: 11.5px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 0;
}
@media (max-width: 540px) {
  .rd-potd { grid-template-columns: 1fr; }
}

/* === Labs save-button overlay (admin only) ===
   Same affordance as the .save-btn on the main compair card: a translucent
   bookmark icon at the top-right of the card; turns accent-colored when the
   article is in the user's Saved collection. */
.lt-card-wrap, .lc-card-wrap { position: relative; min-width: 0; }
.labs-save-btn,
.lc-save-btn {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 0; border-radius: 5px;
  cursor: pointer;
  z-index: 2;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.lc-save-btn { width: 32px; height: 32px; top: 14px; right: 14px; border-radius: 6px; }
.labs-save-btn:hover, .lc-save-btn:hover { transform: translateY(-1px); }
.labs-save-btn .ic-filled, .lc-save-btn .ic-filled { display: none; }
.labs-save-btn[aria-pressed="true"], .lc-save-btn[aria-pressed="true"],
.labs-save-btn.saved, .lc-save-btn.saved {
  background: var(--accent); color: var(--accent-fg);
}
.labs-save-btn[aria-pressed="true"] .ic-outline, .lc-save-btn[aria-pressed="true"] .ic-outline,
.labs-save-btn.saved .ic-outline, .lc-save-btn.saved .ic-outline { display: none; }
.labs-save-btn[aria-pressed="true"] .ic-filled, .lc-save-btn[aria-pressed="true"] .ic-filled,
.labs-save-btn.saved .ic-filled, .lc-save-btn.saved .ic-filled { display: inline; }
.labs-save-btn svg { width: 13px; height: 13px; }
.lc-save-btn svg { width: 16px; height: 16px; }
.lo-date { color: var(--muted); font-size: 13px; font-style: italic; margin-bottom: 8px; }
.lt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lt-tfa { grid-template-columns: 1fr; }
.lt-card {
  display: flex; gap: 10px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: inherit; text-decoration: none;
  min-width: 0;
}
.lt-card:hover { background: var(--card); border-color: color-mix(in srgb, var(--fg) 25%, var(--border)); }
.lt-card .lt-thumb {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 6px;
  background-color: var(--card);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
.lt-card .lt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lt-card .lt-title { font-family: var(--serif); font-weight: 700; font-size: 14px; line-height: 1.25; color: var(--fg); }
.lt-card .lt-desc { color: var(--muted); font-size: 12px; font-style: italic; }
.lt-card .lt-extract { margin: 4px 0 0; font-size: 12px; line-height: 1.45; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.lt-tfa .lt-card .lt-thumb { width: 110px; height: 110px; }
.lt-tfa .lt-card .lt-extract { -webkit-line-clamp: 6; }

.lt-news, .lt-anniv {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.lt-news:last-child, .lt-anniv:last-child { border-bottom: 0; }
.lt-news-story { margin: 0; font-size: 13px; line-height: 1.45; color: var(--fg); }
.lt-news-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lt-news-link {
  background: var(--soft); color: var(--fg);
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  text-decoration: none;
}
.lt-news-link:hover { background: var(--card); border: 1px solid var(--border); padding: 1px 8px; }
.lt-anniv { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.lt-year { font-family: var(--serif); font-weight: 700; font-size: 16px; color: var(--accent); align-self: start; padding-top: 1px; min-width: 50px; }
.lt-anniv p { margin: 0; font-size: 13px; color: var(--fg); line-height: 1.45; }
.lt-potd { display: flex; gap: 12px; }
.lt-potd img { max-width: 50%; height: auto; border-radius: 8px; border: 1px solid var(--border); object-fit: contain; }
.lt-potd-meta { flex: 1; min-width: 0; }
@media (max-width: 540px) {
  .lt-grid { grid-template-columns: 1fr; }
  .lt-potd { flex-direction: column; }
  .lt-potd img { max-width: 100%; }
}

#admin-graph-wrap { width: 100%; }
#admin-graph { width: 100%; height: 580px; display: block; cursor: grab; }
#admin-graph:active { cursor: grabbing; }
.admin-graph-label {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  fill: var(--fg); pointer-events: none;
}
[data-theme="dark"] #admin-graph line { stroke: var(--border); }
.graph-reset { user-select: none; }
.graph-reset-label {
  fill: var(--fg); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--sans);
}
.graph-reset:hover rect { fill: var(--soft); }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.admin-table th, .admin-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table th {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.admin-table td a { color: var(--accent); }
.admin-table tbody tr:hover { background: var(--soft); }

@media (max-width: 720px) {
  .admin-stats { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

/* === Settings === */
.settings-page { max-width: 600px; margin: 0 auto; }
.settings-title {
  font-family: var(--serif); font-weight: 700;
  letter-spacing: -0.01em; margin: 0 0 18px;
}
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.settings-section h3 {
  margin: 0 0 12px; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.settings-section .bin-count {
  background: var(--soft); color: var(--fg);
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; letter-spacing: 0;
  text-transform: none; font-weight: 600;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.settings-cell { flex: 1 1 0; min-width: 0; }
.settings-label { font-size: 14px; font-weight: 500; color: var(--fg); }
.settings-value { font-size: 13px; color: var(--fg); margin-top: 2px; }
.settings-value.muted { color: var(--muted); }

/* Segmented control */
.seg {
  display: inline-flex; gap: 4px;
  background: var(--soft); border: 1px solid var(--border);
  border-radius: 7px; padding: 3px;
}
.seg-btn {
  background: transparent; border: 0; color: var(--muted);
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  border-radius: 5px; cursor: pointer; letter-spacing: 0.02em;
  transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--fg); }
.seg-btn.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* Bin */
.bin-list { list-style: none; padding: 0; margin: 0; }
.bin-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.bin-item:last-child { border-bottom: 0; }
.bin-title { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.bin-empty {
  color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 13.5px;
  padding: 4px 0;
}

.btn.danger { color: var(--danger); border-color: var(--border); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

@media (max-width: 480px) {
  .settings-row { flex-direction: column; align-items: stretch; }
  .settings-row .seg { align-self: flex-start; }
  .pair { grid-template-columns: 1fr 1fr; gap: 6px; }
  .vs { display: none; }
  .compose-grid { grid-template-columns: 1fr; }
  main { padding: 18px 14px 78px; }
}

/* ----- Censorship admin page ----- */
.cens-page .cens-form {
  display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px;
}
.cens-page .cens-form input,
.cens-page .cens-form textarea,
.cens-page .cens-form select {
  width: 100%; padding: 9px 12px;
  border: 1px solid #cbd0dd; border-radius: 8px;
  background: #fff; font: inherit;
}
.cens-page .cens-form textarea { resize: vertical; min-height: 80px; }
.cens-page .cens-form button { justify-self: start; }
.cens-list { list-style: none; padding: 0; margin: 8px 0 0; }
.cens-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed rgba(15,23,42,.1);
}
.cens-row:last-child { border-bottom: 0; }
.cens-row .cens-body { flex: 1; min-width: 0; }
.cens-row .cens-title { font-weight: 600; }
.cens-row .cens-vs { color: #888; padding: 0 4px; }
.cens-row .cens-reason { font-size: 12px; color: #5a6280; margin-top: 2px; }
.cens-row .cens-meta { font-size: 11px; color: #8a90a5; margin-top: 2px; }
.cens-pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; letter-spacing: .3px;
  background: #eef0f6; color: #5a6280; flex: 0 0 auto;
}
.cens-pill.lvl-1 { background: rgba(255,180,84,.18); color: #a06c15; }
.cens-pill.lvl-2 { background: rgba(220,80,80,.16); color: #b22a2a; }
.cens-pill.lvl-3 { background: rgba(120,30,30,.95); color: #fff; }
.cens-count {
  display: inline-block; margin-left: 6px;
  background: #eef0f6; color: #5a6280;
  font-size: 12px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
}
.cens-log { list-style: none; padding: 0; margin: 8px 0 0; }
.cens-log-row {
  padding: 8px 0; border-bottom: 1px dashed rgba(15,23,42,.08); font-size: 13px;
}
.cens-log-row:last-child { border-bottom: 0; }
.cens-log-row .cens-log-meta { font-size: 11px; color: #8a90a5; margin-top: 2px; }
.cens-log-row .cens-log-reason { font-size: 12px; color: #5a6280; margin-top: 2px; font-style: italic; }
@media (min-width: 700px) {
  .cens-page .cens-form { grid-template-columns: 2fr 1.2fr 2fr auto; align-items: start; }
  .cens-page .cens-form textarea { grid-column: 1 / -1; }
}

/* ---------- Multi-article compose (stack: active on top, strip below) ----
   The newest slot lives in .compose-active at full size. Older slots collapse
   into the .compose-strip beneath, mirroring how rank cards display tiles. */
.compose-active {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.compose-active .compose-slot-wrap { display: flex; min-width: 0; }
.compose-active .compose-slot-wrap .compose-side { flex: 1; min-width: 0; }
/* Strip always fits in one row — never scrolls horizontally, never wraps.
   Up to 4 minimized cards (the active slot is the 5th); each card flexes to
   share the available width equally and is allowed to shrink below its
   "natural" size. */
.compose-strip {
  margin-top: 10px;
  display: flex; flex-wrap: nowrap; overflow: hidden;
  gap: clamp(4px, 1.2vw, 8px);
  padding: 4px 2px;
  width: 100%;
}
.compose-strip[hidden] { display: none; }
.compose-strip .compose-slot-wrap.minimized {
  flex: 1 1 0;        /* equal share of the row */
  min-width: 0;       /* allow shrinking inside flex; otherwise text overflow forces scroll */
  cursor: pointer;
}
.compose-strip .compose-slot-wrap.minimized .compose-side {
  position: relative;
  min-height: auto; padding: clamp(4px, 1.2vw, 8px); gap: 4px; border-style: solid;
  min-width: 0;
  overflow: hidden;
}
.compose-slot-wrap.minimized .picker-area,
.compose-slot-wrap.minimized .picked .extract,
.compose-slot-wrap.minimized .picked .change-pick { display: none; }
.compose-slot-wrap.minimized .picked {
  display: flex !important; flex-direction: column; gap: 4px; align-items: stretch;
  min-width: 0;
}
.compose-slot-wrap.minimized .picked .thumb {
  width: 100%; aspect-ratio: 1 / 1; height: auto;
  background-size: cover; background-position: center;
  border-radius: 6px;
}
.compose-slot-wrap.minimized .picked .title {
  font-size: clamp(9px, 1.8vw, 11px); line-height: 1.2; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.compose-slot-wrap.minimized .compose-remove-slot {
  position: absolute; top: 2px; right: 2px;
  padding: 2px 6px; font-size: 10px;
  background: rgba(0,0,0,0.55); color: #fff; border-color: rgba(0,0,0,0.55);
}
.compose-remove-slot { align-self: flex-end; margin-bottom: 6px; }

/* ---------- Compose: Standard / Quiz mode tabs ---------- */
.compose-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 0 0 6px;
}
.compose-modetabs {
  display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden;
}
.compose-mode-btn {
  padding: 6px 14px; background: transparent; border: 0; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.compose-mode-btn.active { background: var(--fg); color: var(--bg); }

/* ---------- Quiz composer ---------- */
.compose-quiz {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.quiz-type-tabs {
  display: inline-flex; gap: 0; align-self: flex-start;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.quiz-type-btn {
  padding: 6px 12px; background: transparent; border: 0; border-right: 1px solid var(--border);
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted);
}
.quiz-type-btn:last-child { border-right: 0; }
.quiz-type-btn.active { background: var(--fg); color: var(--bg); }
.quiz-question-text {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px;
  font-family: var(--sans); font-size: 14px; line-height: 1.4;
  border: 1px solid var(--border); border-radius: 8px;
  resize: vertical;
}
.quiz-fields-list, .quiz-fields-mcq {
  display: flex; flex-direction: column; gap: 10px;
}
.quiz-section-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 8px 0 0;
}
/* Inline slot stack — vertical list of composeSideHtml pickers, each with
   an optional letter badge + remove button + role-specific extras
   (reveal_name / reveal_image / is_correct). Mirrors the regular
   pair-creation slot layout so authors see the same picker. */
.quiz-slots { display: flex; flex-direction: column; gap: 10px; }
.quiz-slot { display: flex; flex-direction: column; gap: 6px; }
.quiz-slot-head { display: flex; align-items: center; gap: 8px; }
.quiz-slot-letter {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 800; font-size: 14px;
}
.quiz-slot-remove { margin-left: auto; }
.quiz-slot-extras {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
/* Live preview on the picked card (reveal toggles): masked thumb shows a
   serif "?" glyph, hidden name strikes through the title. */
.compose-side .picked .thumb.masked {
  background: #1f2937 !important;
  display: flex; align-items: center; justify-content: center;
}
.compose-side .picked .thumb.masked .quiz-mask-glyph {
  font-family: var(--serif); font-weight: 800; color: #94a3b8;
  font-size: 36px; line-height: 1;
}
.compose-side .picked .title.hidden-name {
  text-decoration: line-through;
  color: var(--muted);
  opacity: 0.6;
}
.quiz-tile {
  position: relative;
  width: 130px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px;
}
.quiz-tile-thumb {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.quiz-tile-thumb.masked { background: #1f2937; color: #94a3b8; }
.quiz-tile-thumb.masked .quiz-mask-glyph {
  font-family: var(--serif); font-weight: 800; color: #94a3b8;
  font-size: clamp(28px, 7vw, 48px); line-height: 1;
}
.quiz-tile-title.hidden-name {
  text-decoration: line-through;
  color: var(--muted);
  opacity: 0.6;
}
.quiz-tile-title {
  font-family: var(--serif); font-size: 12px; font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.4em;
}
.quiz-tile-toggle {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--muted);
}
.quiz-tile-letter {
  position: absolute; top: 4px; left: 4px;
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 800; font-size: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.quiz-tile-remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.55); color: #fff; border: 0; border-radius: 999px;
  font-size: 13px; line-height: 1; cursor: pointer;
}
.quiz-add-wrap { display: flex; }
.quiz-add { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 700; font-size: 12px; padding: 4px 10px; }
.quiz-add:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* Pick-modal — overlay used by the quiz composer. Two tabs (Search / Pick
   from saved) so quiz authors get the same flow as the regular compose page.*/
.quiz-pick-modal { width: min(560px, 92vw); max-height: 82vh; display: flex; flex-direction: column; }
.quiz-pick-modal .quiz-pick-tabs { display: inline-flex; align-self: flex-start;
  margin: 8px 14px 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.quiz-pick-modal .picker-tab {
  padding: 6px 14px; background: transparent; border: 0; border-right: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.quiz-pick-modal .picker-tab:last-child { border-right: 0; }
.quiz-pick-modal .picker-tab.active { background: var(--fg); color: var(--bg); }
.quiz-pick-modal .quiz-pick-pane { display: flex; flex-direction: column; min-height: 0; }
.quiz-pick-modal .quiz-pick-pane[hidden] { display: none; }
.quiz-pick-modal .quiz-pick-input { margin: 8px 14px; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; }
.quiz-pick-modal .quiz-pick-results { padding: 0 14px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.quiz-pick-modal .quiz-pick-saved-loading,
.quiz-pick-modal .quiz-pick-saved-empty { padding: 14px; color: var(--muted); font-size: 13px; }
.quiz-pick-modal .quiz-pick-saved-grid {
  list-style: none; padding: 0 14px 14px; margin: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px;
}
.quiz-pick-modal .search-result {
  display: flex; gap: 10px; align-items: center; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; cursor: pointer;
}
.quiz-pick-modal .search-result:hover { border-color: var(--fg); }
.quiz-pick-modal .search-result .thumb { width: 40px; height: 40px; flex: 0 0 auto;
  background: #eef0f6 center/cover no-repeat; border-radius: 6px; }
.quiz-pick-modal .result-title  { font-family: var(--serif); font-weight: 700; font-size: 13px; line-height: 1.2; }
.quiz-pick-modal .result-extract { font-size: 11px; color: var(--muted); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Quiz cards (kind='quiz') ---------- */
.card-quiz .card-quiz-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.quiz-pending-banner {
  margin: 8px 14px 0; padding: 6px 10px;
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 50%, var(--border));
  border-radius: 8px;
  color: #92400e; font-size: 12px; font-weight: 600;
}
.quiz-question {
  font-family: var(--serif); font-size: 17px; line-height: 1.35; font-weight: 600;
  margin: 0;
}
.quiz-result {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.quiz-result-score { font-size: 14px; font-weight: 700; }
.quiz-result h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 4px 0 0; }
.quiz-canonical { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.quiz-canonical li {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--fg);
}
.quiz-canonical li.hit { background: color-mix(in srgb, #16a34a 18%, transparent); border-color: #16a34a; }
.quiz-canonical li.miss { background: color-mix(in srgb, #dc2626 12%, transparent); border-color: color-mix(in srgb, #dc2626 50%, var(--border)); color: #b91c1c; }
.quiz-preview-actions { margin-top: 4px; }

/* List quiz */
/* Standard-quiz question articles labeled A, B, C…  Always render in a single
   row so the letters can be referenced inline in the question text. */
/* Question articles always render in ONE row, even on phones. minmax(0,1fr)
   lets the tiles shrink past their natural width so they never wrap or
   overflow the card; padding / fonts / badges scale via clamp() so content
   stays readable. */
.quiz-list-qarticles {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: clamp(4px, 1.2vw, 8px); grid-auto-rows: 1fr;
  width: 100%; overflow: hidden;
}
.quiz-list-qarticles[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.quiz-list-qarticles[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-list-qarticles[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quiz-list-qarticles[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quiz-list-qarticles[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.quiz-list-qart {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: clamp(4px, 1.2vw, 8px);
  min-width: 0; overflow: hidden;
}
.quiz-list-qart-letter {
  position: absolute; top: 6px; left: 6px;
  width: clamp(24px, 6vw, 32px); height: clamp(24px, 6vw, 32px);
  border-radius: 999px;
  background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 800;
  font-size: clamp(13px, 3vw, 17px);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  z-index: 1;
}
.quiz-list-qart-thumb {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.quiz-list-qart-thumb.masked { background: #1f2937; color: #94a3b8; }
.quiz-list-qart-thumb .quiz-mask-glyph {
  font-family: var(--serif); font-weight: 800; color: #94a3b8;
  font-size: clamp(28px, 7vw, 48px); line-height: 1;
}
.quiz-list-qart-title {
  font-family: var(--serif); font-size: clamp(10px, 2.2vw, 12px);
  font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}

.quiz-list-input { position: relative; display: flex; flex-direction: column; gap: 0; }
.quiz-list-search { padding: 8px 10px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; }
.quiz-list-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  max-height: 280px; overflow-y: auto; margin-top: 4px;
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
}
.quiz-list-results .search-result {
  display: flex; gap: 8px; align-items: center; text-align: left;
  padding: 6px; background: var(--card); border: 0; cursor: pointer; border-radius: 6px;
}
.quiz-list-results .search-result:hover { background: var(--soft); }
.quiz-list-results .search-result .thumb {
  width: 32px; height: 32px; flex: 0 0 auto;
  background: #eef0f6 center/cover no-repeat; border-radius: 4px;
}
.quiz-list-results .result-title { font-size: 13px; font-weight: 600; }
.quiz-list-guesses {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.quiz-list-guesses li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px; background: var(--soft); border-radius: 999px;
  font-size: 12px;
}
.qg-remove { background: transparent; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }
.qg-remove:hover { color: var(--fg); }

/* Connection quiz — always one row even on phones (same recipe as the rank
   tiles). Tiles shrink past their natural width via minmax(0, 1fr); padding
   / mask glyph / title font scale via clamp() so the row never wraps or
   triggers horizontal scroll. */
.quiz-conn-tiles {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: clamp(4px, 1.2vw, 8px); grid-auto-rows: 1fr;
  width: 100%; overflow: hidden;
}
.quiz-conn-tiles[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-conn-tiles[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quiz-conn-tiles[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quiz-conn-tiles[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.quiz-conn-tile {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: clamp(4px, 1.2vw, 8px);
  min-width: 0; overflow: hidden;
}
.quiz-conn-thumb {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.quiz-conn-thumb.masked { background: #1f2937; color: #94a3b8; }
.quiz-mask-glyph {
  font-family: var(--serif); font-weight: 800; color: #94a3b8;
  font-size: clamp(28px, 7vw, 48px); line-height: 1;
}
.quiz-conn-title {
  font-family: var(--serif); font-weight: 700; line-height: 1.2;
  font-size: clamp(10px, 2.2vw, 12px);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.4em;
  word-break: break-word;
}
.quiz-mask-text { color: var(--muted); font-style: italic; }

.quiz-conn-input { position: relative; display: flex; flex-direction: column; gap: 6px; }
.quiz-conn-search { padding: 8px 10px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; }
.quiz-conn-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  max-height: 280px; overflow-y: auto; margin-top: 4px;
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
}
.quiz-conn-results .search-result {
  display: flex; gap: 8px; align-items: center; text-align: left;
  padding: 6px; background: var(--card); border: 0; cursor: pointer; border-radius: 6px;
}
.quiz-conn-results .search-result:hover { background: var(--soft); }
.quiz-conn-results .search-result .thumb {
  width: 32px; height: 32px; flex: 0 0 auto;
  background: #eef0f6 center/cover no-repeat; border-radius: 4px;
}
.quiz-conn-pick { font-size: 12px; color: var(--muted); }

/* MCQ quiz */
/* MCQ options always render in ONE row regardless of viewport width. Same
   recipe as rank/conn tiles: minmax(0,1fr) cols, hidden overflow, fluid
   gap/padding/font sizes via clamp(). */
.quiz-mcq-options {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: clamp(4px, 1.2vw, 8px); grid-auto-rows: 1fr;
  width: 100%; overflow: hidden;
}
.quiz-mcq-options[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quiz-mcq-options[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quiz-mcq-options[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.quiz-mcq-btn {
  width: 100%;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: clamp(4px, 1.2vw, 8px); cursor: pointer; text-align: left;
  min-width: 0; overflow: hidden;
}
.quiz-mcq-btn:hover { border-color: var(--fg); }
.quiz-mcq-option.picked .quiz-mcq-btn { box-shadow: 0 0 0 1px var(--fg) inset; border-color: var(--fg); }
.quiz-mcq-option.locked .quiz-mcq-btn { cursor: default; }
.quiz-mcq-option.correct .quiz-mcq-btn { border-color: #16a34a; box-shadow: 0 0 0 1px #16a34a inset; }
.quiz-mcq-option.picked.correct .quiz-mcq-btn { background: color-mix(in srgb, #16a34a 14%, var(--card)); }
.quiz-mcq-option.picked:not(.correct).locked .quiz-mcq-btn { background: color-mix(in srgb, #dc2626 12%, var(--card)); border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626 inset; }
.quiz-mcq-thumb {
  position: relative;
  width: 100%; aspect-ratio: 1 / 1;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.quiz-mcq-thumb.masked { background: #1f2937; color: #94a3b8; }
.quiz-mcq-thumb.masked .quiz-mask-glyph {
  font-family: var(--serif); font-weight: 800; color: #94a3b8;
  font-size: clamp(28px, 7vw, 48px); line-height: 1;
}
.quiz-mcq-title {
  font-family: var(--serif); font-weight: 700; line-height: 1.2;
  font-size: clamp(10px, 2.2vw, 13px);
  min-height: 2.4em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.quiz-mcq-share { color: var(--muted); font-size: clamp(9px, 1.8vw, 11px); }
.quiz-mcq-hint {
  font-size: 12px; color: var(--muted); font-style: italic;
}

/* Compact attempts · avg-score chip rendered in the card foot, mirroring the
   pair-card count-chip style (no verbose labels). */
.card-foot-stats {
  color: var(--muted); font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 6px;
}

/* Clue (Standard quiz) — composer + voter card. */
.quiz-clue-block { display: flex; flex-direction: column; gap: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border); }
.quiz-clue-text {
  width: 100%; box-sizing: border-box;
  padding: 6px 8px; font-family: var(--sans); font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px;
}
.quiz-add-clue { align-self: flex-start; }

.quiz-clue-row {
  margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.quiz-clue-row .quiz-show-clue {
  align-self: flex-start;
  background: #f59e0b; color: #fff; border-color: #d97706;
  font-weight: 700;
}
.quiz-clue-row .quiz-show-clue:hover { background: #d97706; border-color: #b45309; color: #fff; }
.quiz-clue { display: flex; flex-direction: column; gap: 6px; }
.quiz-clue.hidden { display: none; }
.quiz-clue .quiz-clue-text {
  border: 0; padding: 0; background: transparent; color: var(--fg);
  font-family: var(--serif); font-size: 14px; font-weight: 600; margin: 0;
}

/* ---------- Admin pending-quizzes ---------- */
.admin-quiz-pending-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
.aqp-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.aqp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.aqp-type {
  padding: 1px 8px; background: var(--soft); border-radius: 999px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; color: var(--fg);
}
.aqp-author { color: var(--fg); font-weight: 600; text-decoration: none; }
.aqp-author:hover { text-decoration: underline; }
.aqp-question { font-family: var(--serif); font-size: 14px; font-weight: 600; line-height: 1.35; }
.aqp-articles { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.aqp-art { font-size: 12px; color: var(--fg); }
.aqp-role {
  display: inline-block; padding: 0 6px; margin-right: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--soft); border-radius: 999px; color: var(--muted);
}
.aqp-correct { color: #16a34a; font-weight: 700; }
.aqp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aqp-broadcast { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

/* Admin: Quiz Reserves panel — bulk-upload TSV per handle, set cadence,
   release one manually. */
.admin-quiz-reserves .admin-sub-small { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.aqr-handles { display: flex; flex-direction: column; gap: 8px; }
.aqr-handle {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.aqr-handle-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.aqr-handle-name { font-weight: 700; color: var(--fg); text-decoration: none; }
.aqr-handle-name:hover { text-decoration: underline; }
.aqr-handle-counts { font-size: 13px; color: var(--muted); }
.aqr-handle-counts b { color: var(--fg); }
.aqr-handle-meta { font-size: 12px; color: var(--muted); margin-left: auto; }
.aqr-handle-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.aqr-cadence { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.aqr-cadence-input { width: 56px; padding: 4px 6px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; }
.aqr-upload { cursor: pointer; }
.aqr-result {
  margin-top: 10px; padding: 10px; background: var(--soft);
  border-radius: 8px; font-size: 13px;
}
.aqr-rejected { margin-top: 4px; }
.aqr-rejected summary { cursor: pointer; color: var(--muted); }
.aqr-rejected ul { list-style: disc; padding-left: 20px; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.aqr-pending-block { margin-top: 6px; }
.aqr-pending-block summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.aqr-pending-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; }
.aqr-pending-row {
  display: grid; grid-template-columns: 1fr; gap: 4px;
  background: var(--soft); border-radius: 8px; padding: 8px 10px;
  font-size: 13px;
}
.aqr-pending-q { line-height: 1.35; }
.aqr-pending-a { color: var(--muted); font-size: 12px; }
.aqr-pending-a b { color: var(--fg); }
.aqr-pending-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.aqr-preview-modal {
  width: min(720px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
}
.aqr-preview-modal .aqr-preview-body { padding: 12px 14px 16px; overflow-y: auto; }

/* Edit modal for a pending reserve. Reuses overlay/overlay-card chrome. */
.aqr-edit-modal { width: min(560px, 96vw); display: flex; flex-direction: column; }
.aqr-edit-form { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.aqr-edit-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.aqr-edit-field span { color: var(--muted); }
.aqr-edit-field input,
.aqr-edit-field textarea {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: var(--bg); color: var(--fg);
}
.aqr-edit-field textarea { resize: vertical; min-height: 64px; }
.aqr-edit-hint { font-size: 12px; color: var(--muted); margin: 0; }
.aqr-edit-error {
  font-size: 13px; color: #b42318;
  background: #fef3f2; border: 1px solid #fecdca; border-radius: 6px;
  padding: 6px 8px;
}
.aqr-edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* Upload result panel: dismiss header + accepted-review block. */
.aqr-result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aqr-accepted-head { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.aqr-accepted-list { margin-top: 0; }

/* Admin accordion — collapses the graph + accounts table below the fold. */
.admin-accordion {
  margin: 12px 0; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.admin-accordion > summary {
  cursor: pointer; list-style: none;
  font-weight: 700; color: var(--fg);
  padding: 4px 0;
}
.admin-accordion > summary::-webkit-details-marker { display: none; }
.admin-accordion > summary::before {
  content: '▸'; display: inline-block; width: 1em; transition: transform .15s ease;
  color: var(--muted);
}
.admin-accordion[open] > summary::before { transform: rotate(90deg); }
.admin-accordion > summary > h3 { display: inline-block; margin: 0; }

/* Standard quiz: optional non-article question image (uploaded via reserves
   admin). Renders centered above the question text. */
.quiz-question-image {
  display: block; margin: 0 auto 8px;
  max-width: 100%;
}
.quiz-question-image img {
  display: block; max-width: 100%; height: auto;
  border-radius: 10px;
}

/* ---------- Rate card (kind='rate') ----------
   Two panes (My vote / Aggregate) toggled in-place, mirroring the rank card.
   Each pane reserves the same vertical footprint so flipping between views
   doesn't make the page jump. */
.card-rate .card-rate-body { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
.rate-article {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit;
}
.rate-thumb {
  width: 100%; aspect-ratio: 16 / 9;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 10px;
}
.rate-title { font-family: var(--serif); font-weight: 700; font-size: 18px; line-height: 1.25; margin: 0; }
.rate-extract { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0; }
.rate-view-row { display: flex; align-items: center; gap: 10px; border-top: 1px dashed var(--border); padding-top: 12px; }
.rate-status { flex: 1; color: var(--muted); font-size: 13px; }
/* The toggle reuses the pair-card .cohort-row + .cohort-btn styling — see
   that block above for the visual rules. We don't add overrides here. */

.rate-pane { display: flex; flex-direction: column; gap: 10px; min-height: 220px; }
.rate-bignum {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--serif);
}
.rate-bignum-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.rate-bignum-num   {
  font-size: 56px; line-height: 1; font-weight: 800; letter-spacing: -0.02em;
  color: var(--fg); margin-left: auto;
}
.rate-bignum-suffix { color: var(--muted); font-size: 14px; }

.rate-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.rate-slider { width: 100%; }
.rate-row { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }

.rate-hist { display: grid; grid-template-columns: 1fr; gap: 6px; }
.rate-hist-row {
  display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.rate-hist-label { font-variant-numeric: tabular-nums; }
.rate-hist-bar {
  display: block; height: 10px; background: #eef0f6; border-radius: 999px; overflow: hidden;
}
.rate-hist-fill {
  display: block; height: 100%;
  background: var(--fg);
  border-radius: 999px;
  transition: width 200ms ease;
}
.rate-hist-count { text-align: right; font-variant-numeric: tabular-nums; }
.rate-mine-mark { color: var(--muted); font-size: 12px; padding-top: 2px; }

/* (rate/rank cards now reuse the pair .card-foot layout) */

/* Just-voted feedback: a brief green pulse around the freshly-rendered card
   plus a "✓ Saved" state on the submit button. */
.foot-change-vote.saved,
.submit-vote.saved {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #fff !important;
}
@keyframes just-voted-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(22,163,74, 0.55); }
  60%  { box-shadow: 0 0 0 14px rgba(22,163,74, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(22,163,74, 0);    }
}
.card.just-voted { animation: just-voted-pulse 1.2s ease-out; }

/* ---------- Rank card (kind='rank') ----------
   Top row: drag-to-reorder tiles. The position in the row IS the rank
   (1 = leftmost / best, N = rightmost / worst). A big serif medallion
   shows the rank prominently in the center of each thumbnail.
   Heights are locked across tiles + the detail box so that clicking
   between tiles doesn't make the page jump up and down. */
.card-rank .card-rank-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.rank-view-row { display: flex; align-items: center; gap: 10px; }
.rank-view-row .rank-status { flex: 1; color: var(--muted); font-size: 13px; }
/* Cohort toggle reuses .cohort-row + .cohort-btn styles defined above. */
.rank-tiles {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
  grid-auto-rows: 1fr;          /* every row stretches to tallest tile */
  align-items: stretch;
}
.rank-tiles[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rank-tiles[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rank-tiles[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* Always one row — even on phones. Tiles scale via minmax(0,1fr) and the
   medallion + title use fluid clamp() sizes below so the row never wraps. */
@media (max-width: 600px) {
  .rank-tiles { gap: 4px; }
}
.rank-tile {
  position: relative;
  touch-action: none;             /* let pointer events drive drag, not scroll */
  cursor: grab;
  user-select: none;
}
.rank-tile.dragging { cursor: grabbing; z-index: 5; opacity: 0.92; transform-origin: center; }
.rank-tiles.rank-dragging .rank-tile:not(.dragging) {
  transition: transform 160ms ease;
}
.rank-tile-inner {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: clamp(4px, 1.2vw, 8px); height: 100%;
  min-width: 0;
}
.rank-tile:hover .rank-tile-inner { border-color: color-mix(in srgb, var(--fg) 25%, var(--border)); }
.rank-tile.active .rank-tile-inner { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg) inset; }
.rank-thumb {
  position: relative;             /* anchors medallion + drag-hint */
  width: 100%; aspect-ratio: 1 / 1;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 8px;
}
.rank-medallion {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(closest-side, rgba(0,0,0,0.55), rgba(0,0,0,0.25) 70%, rgba(0,0,0,0));
  border-radius: 8px;
  pointer-events: none;
}
.rank-medallion-num {
  font-family: var(--serif);
  /* Fluid: ~22px on a narrow ~70px-wide tile, up to 56px on desktop. Keeps
     the rank number prominent at every viewport without overflow. */
  font-size: clamp(22px, 9vw, 56px);
  line-height: 1; font-weight: 800;
  color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.45);
  letter-spacing: -0.02em;
}
.rank-drag-hint {
  position: absolute; top: 4px; right: 5px;
  color: rgba(255,255,255,0.85); text-shadow: 0 1px 2px rgba(0,0,0,.35);
  font-size: clamp(10px, 2vw, 14px); letter-spacing: -2px; line-height: 1;
  pointer-events: none; user-select: none;
}
.rank-tile-title {
  font-family: var(--serif);
  font-size: clamp(10px, 2.2vw, 13px);
  font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.4em;              /* reserves 2 lines so heights match across tiles */
  word-break: break-word;
}
.rank-tile-stat {
  color: var(--muted); font-size: clamp(9px, 1.8vw, 11px);
  min-height: 1.2em;              /* reserves space even when hidden */
}
.rank-tile-stat[hidden] { display: block !important; visibility: hidden; }
.rank-detail {
  display: flex; gap: 12px;
  background: #f7f8fc; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px;
  min-height: 140px;              /* prevents jumping when tiles are clicked */
}
.rank-detail-thumb {
  width: 96px; height: 96px; flex: none;
  background: #eef0f6 center/cover no-repeat;
  border-radius: 8px;
}
.rank-detail-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; color: #000; }
.rank-detail-title { font-family: var(--serif); font-size: 16px; font-weight: 700; margin: 0; color: #000; }
.rank-detail-extract { font-size: 13px; line-height: 1.45; margin: 0; color: #000;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rank-detail-link { font-size: 12px; color: #000; text-decoration: underline; align-self: flex-start; }
.rank-detail-link:hover { color: #000; }
.rank-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.rank-stats { color: var(--muted); font-size: 12px; }
