/* nustreads: readers screens (Readers like you, a reader's compare page, Messages, a conversation).
   Loads after app.css. Every class is rd-*, so the old .reader/.cmp/.chat rules in app.css don't reach it.
   Goodreads look: flat white page, 1 px #cfccc9 rules, serif names, sans meta, dense rows, round photos,
   small-radius buttons (never pills). */

/* ---------- shared bits ---------- */
.rd-av { flex: none; display: inline-grid; place-items: center; object-fit: cover; background: var(--cover-ph-4); color: var(--ink-soft); font-family: var(--font-serif); font-weight: 400; border-radius: 50%; }
.rd-av-sm { width: 32px; height: 32px; font-size: 14px; }
.rd-av-md { width: 48px; height: 48px; font-size: 20px; }
.rd-av-lg { width: 64px; height: 64px; font-size: 26px; }

.rd-h2 { margin: 24px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--divider); font: 400 20px/28px var(--font-serif); color: var(--ink); }

.rd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--btn-h); padding: 0 20px; border-radius: var(--r-ctl); border: 0; font: var(--w-sans-bold) 16px var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .2s ease-in-out, border-color .2s ease-in-out; }
.rd-btn:hover { text-decoration: none; }
.rd-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rd-btn-sm { height: 32px; padding: 0 14px; font-size: 14px; }
.rd-btn-1 { background: var(--ink); color: #fff; }
.rd-btn-1:hover { background: var(--ink-hover); color: #fff; }
.rd-btn-1:active { background: var(--ink-pressed); }
.rd-btn-1:disabled { background: #ababb0; cursor: default; }
.rd-btn-2 { background: transparent; color: var(--ink); border: 1px solid var(--line-field); }
.rd-btn-2:hover { background: var(--bg-hover); color: var(--ink); }
.rd-btn-2:active { border-color: var(--disabled); }
.rd-btn-green { background: transparent; color: var(--ink); border: 1px solid var(--green-line); }
.rd-btn-green:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.rd-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.rd-empty { margin: 16px 0; font-size: 16px; color: var(--ink-soft); }
.rd-blank { padding: 0 0 8px; }
.rd-blank p { margin: 12px 0 16px; max-width: 56ch; font-size: 16px; line-height: 22px; color: var(--ink); }

/* plain Goodreads text links: ink, underline on hover */
.rd a:not(.rd-btn):not(.crumb) { color: var(--ink); text-decoration: none; }
.rd a:not(.rd-btn):not(.crumb):hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Readers like you: flat friends-list rows ---------- */
.rd-list .rd-h2 { margin-top: 8px; }
.rd-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.rd-row > a { display: block; line-height: 0; }
.rd-row h3 { margin: 0; font: var(--w-serif-bold) 17px/22px var(--font-serif); color: var(--ink); }
.rd-meta { margin: 2px 0 0; font-size: 14px; line-height: 18px; color: var(--subdued); }
.rd-links { margin: 6px 0 0; font-size: 14px; line-height: 18px; color: var(--subdued); }
.rd .rd-links a { font-weight: 600; }
.rd-pct { margin: 0; padding-top: 1px; white-space: nowrap; text-align: right; font-size: 14px; line-height: 22px; color: var(--subdued); }
.rd-pct b { font: 600 18px/22px var(--font-sans); color: var(--green-text); }

/* sidebar: Goodreads' plain sidebar sections, no box */
.rd-side .kicker { font: 400 20px/28px var(--font-serif); }
.rd-how { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; }
.rd-how-venn { display: block; width: 84px; height: auto; }
.rd-how-both { fill: rgba(64, 153, 112, .35); stroke: none; }
.rd-how .summary { font-size: 14px; line-height: 20px; }
.rd-how-list { margin: 10px 0 0; padding: 0 0 0 18px; font-size: 14px; line-height: 20px; color: var(--ink); }
.rd-how-list li + li { margin-top: 6px; }
.rd-how-foot { margin: 10px 0 0; font-size: 13px; line-height: 18px; color: var(--subdued); }

/* ---------- Reader page: short header + compact compare ---------- */
.rd-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 4px 0 0; }
.rd-head-main { min-width: 0; }
.rd-head-main h1 { margin: 0; font: var(--w-serif-bold) 26px/32px var(--font-serif); color: var(--ink); overflow-wrap: anywhere; }
.rd-head-name { color: inherit; text-decoration: none; }
.rd-head-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd-head > a { display: block; line-height: 0; border-radius: 50%; }
.rd-head-meta { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--subdued); }
.rd-head-about { display: block; color: var(--ink-soft); overflow-wrap: anywhere; }

.rd-sec { margin-top: 0; }
.rd-cmp-top { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: center; margin: 16px 0 8px; }
.rd-venn-wrap { width: 180px; }
.rd-venn { display: block; width: 100%; height: auto; cursor: pointer; user-select: none; }
.rd-vc { stroke-width: 1.25; }
.rd-vc.a { fill: rgba(64, 153, 112, .12); stroke: var(--green-line); }
.rd-vc.b { fill: rgba(112, 112, 112, .08); stroke: var(--subdued); }
.rd-vn { font: var(--w-serif-bold) 19px var(--font-serif); fill: var(--ink); text-anchor: middle; }
.rd-vl { opacity: .55; transition: opacity .15s; }
.rd-vl.on { opacity: 1; }
.rd-venn:hover .rd-vl:not(.on) { opacity: .8; }

/* the Venn's legend: three lines in Goodreads' words, each switches the list */
.rd-stats { list-style: none; margin: 0; padding: 0; }
.rd-stats button { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 3px 0; border: 0; background: none; text-align: left; font: 15px/21px var(--font-sans); color: var(--ink-soft); cursor: pointer; }
.rd-stats button:hover span { text-decoration: underline; text-underline-offset: 2px; }
.rd-stats button.on { color: var(--ink); }
.rd-stats button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 2px; }
.rd-stats b { font-weight: 600; color: var(--ink); }
.rd-sw { flex: none; width: 10px; height: 10px; border-radius: 2px; transform: translateY(1px); }
.rd-sw.a { background: rgba(64, 153, 112, .25); border: 1px solid var(--green-line); }
.rd-sw.b { background: rgba(112, 112, 112, .15); border: 1px solid var(--subdued); }
.rd-sw.ab { background: linear-gradient(90deg, rgba(64, 153, 112, .3) 50%, rgba(112, 112, 112, .25) 50%); border: 1px solid var(--ink-soft); }
.rd-sum { margin: 4px 0 12px; font: 400 17px/24px var(--font-serif); color: var(--ink); }
.rd-sum b { font-weight: 600; }

/* tabs: Goodreads' text tabs with an ink underline on the current one */
.rd-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--divider); overflow-x: auto; scrollbar-width: none; }
.rd-tabs::-webkit-scrollbar { display: none; }
.rd-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; margin-bottom: -1px; padding: 0 2px; border: 0; border-bottom: 3px solid transparent; background: none; font: var(--w-sans-bold) 15px var(--font-sans); color: var(--subdued); cursor: pointer; white-space: nowrap; }
.rd-tabs button:hover { color: var(--ink); }
.rd-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.rd-tabs button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); border-radius: 3px; }
.rd-tab-n { font-weight: 400; color: var(--subdued); }

/* the compare table: dense like Goodreads (small covers, tight rows), rows still open */
.rd-table { margin-top: 0; }
.rd-thead, .rd-cmp summary { display: grid; grid-template-columns: 34px minmax(0, 1fr) 96px 96px 14px; gap: 12px; align-items: center; }
.rd-thead { padding: 8px 0 6px; border-bottom: 1px solid var(--divider); font-size: 13px; line-height: 16px; font-weight: 600; color: var(--ink-soft); }
.rd-thead span:first-child { grid-column: 1 / span 2; }
.rd-thead span:last-child { grid-column: 4 / span 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-cmp { border-bottom: 1px solid var(--line-soft); }
.rd-cmp summary { padding: 6px 0; cursor: pointer; list-style: none; }
.rd-cmp summary::-webkit-details-marker { display: none; }
.rd-cmp summary:hover .rd-cmp-t { text-decoration: underline; }
.rd-cmp summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 2px; }
.rd-cmp .cv { width: 34px; }
.rd-cmp .ph b { font-size: 5px; }
.rd-cmp-book { display: flex; flex-direction: column; min-width: 0; }
.rd-cmp-t { font: var(--w-serif-bold) 15px/19px var(--font-serif); color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rd-cmp-au { font-size: 13px; line-height: 17px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-rate { display: flex; align-items: center; min-width: 0; }
.rd-rate-who { display: none; }
.rd-rate-none { font-size: 13px; color: var(--subdued); }
.rd-stars { display: inline-flex; margin-left: -1px; }
.rd-stars svg { width: 17px; height: 17px; padding: 1px; fill: var(--star-empty); }
.rd-stars svg.on { fill: var(--star); }
.rd-stars path { stroke-linejoin: round; }
.rd-chev { width: 7px; height: 7px; border: solid var(--ink-soft); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); justify-self: center; margin-top: -4px; transition: transform .15s; }
.rd-cmp[open] .rd-chev { transform: rotate(-135deg); margin-top: 4px; }
.rd-cmp-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 0 0 10px 46px; }
.rd-cmp-body .rd-acts { gap: 6px; }
.rd-where { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; line-height: 18px; color: var(--ink); }
.rd-more-row { margin: 12px 0 4px; text-align: center; }
.rd-more { border: 0; background: none; padding: 8px 0; font: var(--w-sans-bold) 15px var(--font-sans); color: var(--ink); cursor: pointer; }
.rd-more:hover { text-decoration: underline; }
.rd-more:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }

/* ---------- Messages: soft inbox rows ---------- */
.rd-inbox { list-style: none; margin: 8px 0 0; padding: 0; }
.rd-inbox li + li { border-top: 1px solid var(--line-soft); }
.rd .rd-inbox a { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 2px -10px; padding: 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.rd .rd-inbox a:hover { background: var(--bg-hover); text-decoration: none; }
.rd-inbox a:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.rd-ib-main { display: block; min-width: 0; }
.rd-ib-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rd-ib-top b { font: var(--w-serif-bold) 16px/22px var(--font-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-ib-top time { flex: none; font-size: 12px; color: var(--subdued); }
.rd-ib-snip { display: block; margin-top: 2px; font-size: 14px; line-height: 18px; color: var(--subdued); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-inbox a.unread .rd-ib-snip { color: var(--ink); font-weight: 600; }
.rd-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--wtr); color: #fff; font: 600 12px/20px var(--font-sans); text-align: center; }

/* ---------- A conversation: rounded bubbles, theirs left, yours right ---------- */
.rd-chat { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100dvh - 190px); min-height: 440px; }
.rd-chat > .crumb { align-self: flex-start; }
.rd-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.rd .rd-chat-who { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none; }
.rd .rd-chat-who:hover { text-decoration: none; }
.rd-chat-who:hover b { text-decoration: underline; }
.rd-chat-who > span { min-width: 0; }
.rd-chat-who b { display: block; font: var(--w-serif-bold) 20px/26px var(--font-serif); }
.rd-chat-about { display: block; font-size: 14px; line-height: 18px; color: var(--subdued); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-chat-empty { margin: 32px 0 0; text-align: center; font-size: 14px; color: var(--subdued); }
.rd-msgs { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 8px 0 16px; }
.rd-msgs li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: end; padding-top: 14px; }
.rd-msgs li.cont { padding-top: 3px; }
.rd-msgs li.me { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.rd-m-main { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(78%, 560px); }
.rd-msgs li.me .rd-m-main { align-items: flex-end; }
.rd-m-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 3px; }
.rd-m-head b { font: 600 13px/18px var(--font-sans); color: var(--ink); }
.rd-m-head time { font-size: 12px; color: var(--subdued); }
.rd-msgs p { margin: 0; padding: 8px 14px; border-radius: 14px; background: var(--bg-hover); font-size: 16px; line-height: 22px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.rd-msgs li.them:not(.cont) p { border-bottom-left-radius: 4px; }
.rd-msgs li.me p { background: #e3efe8; }
.rd-msgs li.me:not(.cont) p { border-bottom-right-radius: 4px; }
.rd-composer { display: flex; align-items: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rd-composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; overflow-y: hidden; padding: 11px 14px; border: 1px solid var(--line-input); border-radius: var(--r-input); background: #fff; color: var(--ink); font: 16px/20px var(--font-sans); }
.rd-composer textarea:focus { outline: none; border-color: var(--ink); }
.rd-chat-note { margin: 6px 0 0; font-size: 12px; color: var(--subdued); }
.rd-chat-note.bad { color: var(--danger); }

/* ---------- phone ---------- */
@media (max-width: 700px) {
  .rd-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; }
  .rd-row .rd-av-md { width: 44px; height: 44px; font-size: 18px; }
  .rd-row h3 { font-size: 16px; line-height: 21px; }
  .rd-meta, .rd-links { font-size: 13px; }
  .rd-pct span { display: block; font-size: 12px; line-height: 14px; }

  .rd-head { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; }
  .rd-head .rd-av-lg { width: 52px; height: 52px; font-size: 22px; }
  .rd-head-main h1 { font-size: 21px; line-height: 27px; }

  .rd-cmp-top { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; margin-top: 12px; }
  .rd-venn-wrap { width: 112px; }
  .rd-vn { font-size: 21px; }
  .rd-stats button { font-size: 13px; line-height: 18px; gap: 6px; padding: 2px 0; }
  .rd-sum { font-size: 15px; line-height: 21px; }

  .rd-tabs { gap: 18px; }
  .rd-tabs button { font-size: 14px; }
  .rd-thead { display: none; }
  .rd-cmp summary { grid-template-columns: 34px minmax(0, 1fr) 12px; grid-template-areas: "cv book chev" "cv rates chev"; gap: 1px 10px; align-items: start; }
  .rd-cmp .cv { grid-area: cv; }
  .rd-cmp-book { grid-area: book; }
  .rd-cmp .rd-c-you { grid-area: rates; }
  .rd-cmp .rd-c-them { grid-area: rates; justify-self: end; }
  .rd-chev { grid-area: chev; align-self: center; }
  .rd-rate-who { display: inline-block; max-width: 64px; margin-right: 4px; flex: none; font-size: 12px; color: var(--subdued); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rd-stars svg { width: 14px; height: 14px; }
  .rd-rate-none { font-size: 12px; }
  .rd-cmp-body { padding-left: 44px; }

  .rd-chat { height: calc(100dvh - 160px); }
  .rd-chat-head .rd-btn { display: none; }
  .rd-m-main { max-width: 85%; }
}

/* ---------- chat requests ---------- */
.rd-reqs { margin-bottom: 28px; }
.rd-req { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.rd .rd-inbox a.rd-req-who { flex: 1; min-width: 0; grid-template-columns: 48px minmax(0, 1fr); margin: 0 -10px; }
.rd-req-acts { display: flex; gap: 8px; }
.rd-req > .rd-chat-note { flex-basis: 100%; margin: 0; }
.rd-chat-gated { height: auto; min-height: 0; }
.rd-gate { max-width: 520px; margin: 40px auto 0; text-align: center; }
.rd-gate .rd-h2 { margin: 0 0 8px; padding: 0; border: 0; }
.rd-gate p { margin: 0 0 16px; color: var(--subdued); font-size: 15px; line-height: 22px; }
.rd-gate-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 14px; background: var(--bg-hover); color: var(--ink); font-size: 16px; line-height: 22px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.rd-gate-form textarea { width: 100%; box-sizing: border-box; min-height: 88px; resize: vertical; padding: 11px 14px; border: 1px solid var(--line-input); border-radius: var(--r-input); background: #fff; color: var(--ink); font: 16px/22px var(--font-sans); }
.rd-gate-acts { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.rd-gate .rd-chat-note { margin-top: 8px; }
@media (max-width: 700px) {
  .rd-gate { margin-top: 24px; }
  .rd .rd-inbox a.rd-req-who { flex-basis: 100%; }
  .rd-req { gap: 4px 12px; }
  .rd-req-acts { margin-left: 62px; }
}
