/* Discovery, book information, and discussion for the web reader. */
:root {
  --wine: #6c253d;
  --wine-deep: #32151f;
  --wine-hover: #542036;
  --cream: #fcf8f1;
  --warm-white: #fffdf9;
  --soft-border: #e9dfd6;
  --text-ink: #30242a;
  --text-secondary: #695b63;
}
.site-header { background: #fbf6ee; border-color: var(--soft-border); padding-top: env(safe-area-inset-top); }
.wordmark { color: var(--wine-deep); }
.wordmark span { color: var(--wine); }
.site-nav a[aria-current] { background: #f0e4e9; color: var(--wine); }
.header-actions .studio-link { background: var(--wine); border-color: var(--wine); color: #fffaf5; }
.header-actions .studio-link:hover { background: var(--wine-hover); color: #fffaf5; }
.header-actions .studio-link[aria-current] { background: #f0e4e9; border-color: #f0e4e9; color: var(--wine); }
body:has(.book-discovery, .book-page, .library-page) { background: var(--cream); }
.book-discovery, .book-page, .library-page { color: var(--text-ink); --accent: var(--wine); --line: var(--soft-border); --card: var(--warm-white); --wash: #f2e7ec; }
:is(.book-discovery, .book-page, .library-page) .btn.primary { background: var(--wine); border-color: var(--wine); color: #fffaf5; }
:is(.book-discovery, .book-page, .library-page) .btn.primary:hover { background: var(--wine-hover); }
body:has(.studio-page, .account-page) {
  --paper: var(--cream);
  --card: var(--warm-white);
  --ink: var(--text-ink);
  --muted: var(--text-secondary);
  --line: var(--soft-border);
  --input-line: #b6a6ad;
  --terracotta: var(--wine);
  --accent: var(--wine);
  --accent-hover: var(--wine-hover);
  --wash: #f2e7ec;
  --radius: 14px;
  --control-radius: 9px;
  --shadow: 0 4px 14px #32151f08;
}
.book-discovery { max-width: none; }
.discovery-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-items: center;
  min-height: clamp(185px, 24vw, 284px);
  padding: clamp(26px, 3.7vw, 50px);
  border-radius: 18px;
  color: #fff6e9;
  background: #281018;
}
.discovery-hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  background: url("/after-dark.webp") 65% 54% / cover no-repeat;
}
.discovery-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, #2c121ce8 5%, #2c121cc9 42%, #30141e15 85%);
}
.discovery-eyebrow { font-size: .72rem; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: #efbbbe; }
.discovery-hero h1 { max-width: 13ch; font: 400 clamp(3.1rem, 6.2vw, 5.75rem)/.92 var(--serif); margin: 10px 0 0; letter-spacing: -.065em; text-wrap: balance; }
.discovery-hero h1 span { color: #efa6b2; }
.browse-search { margin: 24px 0 15px; }
.browse-search h1 { font: 400 clamp(2.7rem, 5vw, 4.3rem)/1.05 var(--serif); letter-spacing: -.045em; margin: 0 0 16px; }
.browse-search-form { max-width: 760px; gap: 6px; }
.browse-search-form input { border-color: #d5c5cc; border-radius: 9px; background: #fffdf9; }
.browse-search-form .btn { border-radius: 9px; padding-inline: clamp(15px, 4vw, 31px); }
.browse-search-tip { margin-top: 6px; }
#search-suggestions { position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 5; background: #fffdf9; border: 1px solid #e2d2d6; border-radius: 10px; box-shadow: 0 12px 25px #51243a19; overflow: hidden; }
#search-suggestions a { display: flex; gap: 5px 14px; flex-wrap: wrap; align-items: center; min-height: 46px; padding: 8px 14px; text-decoration: none; }
#search-suggestions a + a { border-top: 1px solid #f1e8e9; }
#search-suggestions a:is(:hover, [aria-selected="true"]) { background: #f3e8ee; }
#search-suggestions small { color: var(--text-secondary); }
.browse-chips, .browse-popular { display: flex; flex-wrap: wrap; gap: 6px; }
.browse-chips:not(:empty) { margin-top: 11px; }
.browse-chips .tag, .book-summary .tag { background: #f9eff1; border-color: #ead7df; color: #612c43; padding-inline: 11px; min-height: 38px; }
.browse-chips .active-filter { background: #6c253d; border-color: #6c253d; color: white; }
.browse-chips .tag-excluded, .tag-picker .tag-excluded { background: var(--warm-white); border-color: #ae8596; color: var(--wine); border-style: dashed; }
.browse-layout { display: grid; grid-template-columns: minmax(177px, 214px) minmax(0, 1fr); gap: clamp(18px, 4vw, 40px); align-items: start; }
.browse-layout:has(.browse-sidebar[hidden]) { grid-template-columns: 1fr; }
.browse-sidebar { border-top: 1px solid var(--soft-border); padding: 16px 12px 12px 0; }
.browse-sidebar h3 { font-family: var(--sans); font-size: .99rem; font-weight: 700; margin-bottom: 14px; }
.browse-filters { display: grid; gap: 12px; color: var(--text-ink); }
.browse-filters .field { font-size: .83rem; }
.browse-filters .field select, .browse-sort { border-radius: 7px; border-color: #d7c5cc; background: #fffdf9; min-height: 44px; font-size: .84rem; }
.browse-filters .tag-picker legend { font-size: .9rem; }
.browse-filters .tag-picker { --accent: var(--wine); --input-line: #b6a6ad; --wash: #f2e7ec; --card: var(--warm-white); }
.tag-filter-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.tag-filter-modes button[aria-pressed="true"] { background: var(--wine); border-color: var(--wine); color: white; }
.browse-alternatives { list-style: none; padding: 0; margin: 12px 0 0; max-width: 420px; }
.browse-alternatives a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; color: var(--wine); }
.browse-alternatives a:hover { background: var(--wash); }
.browse-alternatives li + li { margin-top: 5px; }
.browse-alternatives span { flex: 0 0 auto; color: var(--text-secondary); font-size: .79rem; }
.browse-results-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 10px; }
.browse-results-top h2 { font: 400 clamp(1.8rem, 3.6vw, 2.7rem)/1.08 var(--serif); letter-spacing: -.025em; }
.browse-result-count { color: var(--text-secondary); font-size: .84rem; margin-top: 3px; min-height: 1.25em; }
.browse-tools { display: flex; gap: 6px; }
.browse-sort { padding: 4px 8px; max-width: 100%; }
.browse-mobile-filters { display: none; }
.browse-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--soft-border); margin-bottom: 13px; }
.browse-tabs a { display: inline-flex; min-height: 44px; align-items: center; font-size: .88rem; text-decoration: none; color: var(--text-secondary); border-bottom: 2px solid transparent; }
.browse-tabs a[aria-current] { border-color: var(--wine); color: var(--wine); font-weight: 700; }
.book-discovery .catalogue-list { gap: 9px; }
.book-discovery .series-card, .book-page .series-card {
  padding: clamp(13px, 2.2vw, 19px); border-radius: 11px; gap: 15px; background: #fffdf9; border-color: #e9ded6;
}
.book-discovery .series-card:is(:hover, :focus-within), .book-page .series-card:is(:hover, :focus-within) { border-color: #b6a6ad; }
.book-discovery .series-card .cover, .book-page .series-card .cover { width: clamp(74px, 11vw, 104px); }
.fallback-cover { overflow: hidden; position: relative; isolation: isolate; display: grid; align-items: end; padding: 0; box-shadow: 0 5px 13px #3e243332; }
.fallback-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg,#200d17ed, #230c1570 43%, transparent 79%); z-index: -1; }
.fallback-cover > span { margin: 0 7% 9%; color: #fff4e8; text-align: center; text-wrap: balance; overflow-wrap: anywhere; font: 400 clamp(.65rem, 1.8vw, 1.03rem)/1.02 var(--serif); }
.book-discovery .card-title, .book-page .card-title { font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -.03em; }
.card-byline { color: #5d394c; font-size: .86rem; font-weight: 620; }
.card-metadata { color: var(--text-secondary); font-size: .78rem; }
.book-discovery .card-synopsis { line-height: 1.45; font-size: .91rem; margin-top: 7px; }
.book-discovery .series-card .tags { margin-top: 6px; }
.book-discovery .series-card .tag { background: #f8eff3; border-color: #eee1e7; border-radius: 6px; }
.browse-empty { padding: 19px; border: 1px solid #e9ded6; border-radius: 10px; background: #fffdf9; }
.browse-empty .btn { margin-top: 12px; }
.browse-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.browse-people { display: grid; gap: 8px; }
.browse-people > a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid #e9ded6; border-radius: 10px; background: #fffdf9; text-decoration: none; }
.browse-people small { display: block; color: var(--text-secondary); }

.discovery-mode .header-actions .studio-link:not([aria-current]) { color: var(--wine); background: transparent; border-color: var(--soft-border); }
.discovery-mode .header-actions .studio-link:not([aria-current]):hover { background: #f2e7ec; }
.book-discovery .discovery-hero { grid-template-columns: 1fr auto; gap: 18px; min-height: 0; padding: clamp(17px, 3.3vw, 35px); }
.book-discovery .discovery-hero h1 { margin: 0 0 5px; font-size: clamp(2.1rem, 5vw, 4.35rem); line-height: .98; }
.discovery-hero p { margin: 0; font-size: .86rem; color: #f5d3d7; }
.discovery-feature:not([hidden]) { display: flex; align-items: center; gap: 10px; background: #fbf3e8; border: 1px solid #dac0c6; border-radius: 9px; padding: 8px 12px 8px 8px; color: var(--wine); text-decoration: none; }
.discovery-feature:hover strong { text-decoration: underline; }
.discovery-feature .cover { width: 34px; }
.discovery-feature small, .discovery-feature strong { display: block; line-height: 1.15; }
.discovery-feature small { margin-bottom: 4px; font-size: .72rem; }
.discovery-feature strong { max-width: 18ch; overflow-wrap: anywhere; font-size: .9rem; }
.discovery-shelves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.discovery-shelves a { min-height: 42px; }
.discovery-shelves [aria-current] { color: #fffaf5; background: var(--wine); border-color: var(--wine); }
.saved-warning-indicator, .taste-note { margin: 5px 0 0; }
.saved-warning-indicator .btn { min-height: 40px; padding-inline: 0; }
.browse-spice, .browse-spice-bounds { display: grid; gap: 8px; min-width: 0; }
.browse-spice-bounds { padding-inline-start: 10px; border-inline-start: 2px solid var(--soft-border); }
.browse-avoid { padding: 8px; border: 1px solid var(--soft-border); border-radius: 7px; }
.browse-avoid summary { cursor: pointer; color: var(--wine); font-size: .87rem; font-weight: 650; }
.browse-avoid fieldset { padding: 6px 0; border: 0; margin: 7px 0 4px; }
.browse-avoid legend { font-size: .78rem; font-weight: 650; }
.browse-avoid .check-field { margin: 0; padding-block: 6px; font-size: .82rem; }
.series-card:has(.card-save) { position: relative; }
.series-card:has(.card-save) .card-copy { min-width: 0; }
.series-card .card-save { position: relative; flex: 0 0 auto; min-height: 44px; }
.series-card .card-save .reader-bookmark { width: 11px; height: 14px; }
.warning-summary { margin: 0 0 10px; color: var(--text-ink); padding: 8px 10px; border: 1px solid #e2c3cb; border-radius: 8px; background: #f8eef0; }
.warning-summary strong { color: var(--wine); font-size: .82rem; }
.warning-summary ul { display: flex; flex-wrap: wrap; gap: 3px 11px; margin: 4px 0 0; padding: 0; list-style: none; font-size: .84rem; }
.warning-summary li + li::before { content: "·"; margin-inline-end: 7px; }
.warning-summary.compact { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 5px 0; padding: 4px 8px; }
.warning-summary.compact ul { margin: 0; font-size: .78rem; }
.warning-status { color: var(--text-secondary); font-size: .8rem; margin-bottom: 7px; }
.book-summary .book-content-notes { margin-block: 4px 12px; }
.book-engage-actions { display: grid; gap: 6px; justify-items: start; }
.book-offline-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 5px; }
.book-engage-actions p, .book-offline-actions p { margin: 0; }
.book-taste { font-size: .85rem; }
.book-taste summary { cursor: pointer; color: var(--wine); padding-block: 8px; font-weight: 650; }
.book-signals > div { min-width: 0; }
.book-signals dt { text-align: center; overflow-wrap: anywhere; }
.jacket-pitch, .jacket-release { margin: 6px 0 0; line-height: 1.3; color: #fff1ef; }
.jacket-pitch { max-width: 44ch; font: 400 clamp(1rem, 2.4vw, 1.38rem)/1.28 var(--serif); }
.jacket-release { font-size: .79rem; }
.jacket-warnings { display: inline-block; color: #ffe0e7; font-size: .79rem; line-height: 1.4; margin: 6px 0 0; text-underline-offset: 2px; }
.jacket-warnings strong { margin-inline-end: 3px; }
.saved-stories-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0; }
.saved-stories-filter label:first-child { flex: 1; min-width: min(100%, 13rem); }
.saved-stories-filter .field { margin: 0; }
.saved-stories-filter .btn { min-height: 44px; }
.library-lists { display: grid; gap: 6px; }
.library-lists details { padding: 8px 12px; border: 1px solid var(--soft-border); border-radius: 9px; background: var(--warm-white); }
.library-lists summary { cursor: pointer; min-height: 32px; padding: 3px 0; font-weight: 650; }
.library-lists summary span { float: inline-end; color: var(--text-secondary); font-size: .85rem; }
.library-lists ul { margin: 0; padding: 0; list-style: none; }
.library-lists li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) {
  .book-info .book-summary { grid-row: 1; }
  .book-info .book-aside { grid-row: 2; grid-template-columns: 1fr; }
  #dialog .browse-filters :is(.browse-spice, .browse-avoid, .form-feedback) { grid-column: 1 / -1; }
}
@media (max-width: 430px) {
  .book-discovery .discovery-hero { grid-template-columns: 1fr; gap: 10px; }
  .discovery-feature:not([hidden]) { width: fit-content; padding: 5px 9px 5px 6px; }
  .discovery-feature .cover { width: 23px; }
  .discovery-shelves { flex-wrap: nowrap; overflow: auto; padding-bottom: 3px; }
  .discovery-shelves a { flex: none; }
  .series-card:has(.card-save) { display: grid; grid-template-columns: minmax(52px, 18vw) minmax(0, 1fr); }
  .series-card .card-save { grid-column: 2; justify-self: start; }
}

.book-page { width: min(100%, 920px); }
.book-page .back { color: var(--wine); }
.book-jacket {
  position: relative;
  overflow: hidden;
  display: grid; grid-template-columns: clamp(112px, 23vw, 188px) minmax(0, 1fr); align-items: center;
  gap: clamp(17px, 5vw, 48px); padding: clamp(19px, 4vw, 42px);
  border-radius: 14px; color: #fff7ed;
  background: radial-gradient(ellipse at 17% 50%, #683246 0, #44202f 40%, #2c1320 88%);
}
.book-jacket-art .cover { box-shadow: 0 11px 25px #12050ca6, 0 0 0 1px #ffede41f; }
.book-jacket .fallback-cover > span { font-size: clamp(1.13rem, 3vw, 1.8rem); }
.book-status { display: inline-flex; border: 1px solid #a96d86; color: #ffd7e1; border-radius: 5px; padding: 2px 8px; font-size: .72rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.book-jacket h1 { margin: 5px 0 9px; overflow-wrap: anywhere; text-wrap: balance; font: 400 clamp(2.75rem, 6.7vw, 5.4rem)/.96 var(--serif); letter-spacing: -.06em; }
.story-avatar, .thread-avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: #e9d5dd; color: #562a42; font: 650 .75rem/1 var(--sans); }
.book-author { display: flex; align-items: center; gap: 8px; color: #f4dfe8; font-size: .93rem; font-weight: 550; }
.book-author a { text-decoration: none; }
.book-author a:hover { text-decoration: underline; }
.book-author .story-avatar { width: 27px; height: 27px; background: #5c3749; color: #ffe8ec; }
.book-facts { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: #f4dfe8; font-size: .84rem; margin: 10px 0 0; }
.book-heat { font-size: .73rem; font-weight: 650; padding: 1px 7px; border-radius: 4px; background: #6d3e50; color: #ffe6ed; }
.book-section-bar {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 13px 0 17px;
  border-bottom: 1px solid var(--soft-border);
  background: var(--cream);
}
.book-section-nav { display: flex; gap: clamp(12px, 3vw, 26px); margin-right: auto; }
.book-section-nav > a { display: inline-flex; align-items: center; min-height: 52px; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 650; font-size: .87rem; }
.book-section-nav > a[aria-current] { color: var(--wine); border-bottom-color: var(--wine); }
.book-actions { display: flex; align-items: stretch; gap: 7px; padding-block: 4px; }
.book-actions .btn { min-height: 44px; border-radius: 9px; }
.book-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: clamp(17px, 4vw, 38px); align-items: start; margin-bottom: 28px; }
.book-summary, .book-chapters { scroll-margin-top: 62px; }
.book-hook { color: var(--wine); font: 400 clamp(1.5rem, 3.4vw, 2.2rem)/1.13 var(--serif); letter-spacing: -.02em; margin-bottom: 9px; overflow-wrap: anywhere; }
.book-description { max-width: 66ch; font: 400 clamp(1.06rem, 2.1vw, 1.22rem)/1.55 var(--serif); white-space: pre-line; overflow-wrap: anywhere; }
.book-content-notes { margin-top: 8px; }
.book-content-notes summary { color: var(--wine); }
.book-aside { display: grid; gap: 9px; }
.book-signals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; border: 1px solid var(--soft-border); border-radius: 9px; padding: 11px 6px; background: var(--warm-white); }
.book-signals > div { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; padding: 0 2px; }
.book-signals > div + div { border-left: 1px solid var(--soft-border); }
.book-signals dt { color: var(--text-secondary); font-size: .73rem; }
.book-signals dd { color: var(--wine); margin: 0; font: 650 1.06rem/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.book-signals-note { color: var(--text-secondary); font-size: .73rem; margin: 5px 0 0; }
.book-update { color: var(--text-secondary); font-size: .81rem; margin: 0; }
.book-update span { display: block; }
.book-follow { justify-self: start; min-height: 42px; }
.book-chapters-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.book-chapters-title h2, .book-page .story-related h2 { font-size: clamp(1.9rem, 4vw, 2.5rem); letter-spacing: -.025em; }
.book-chapters .contents-list { border-radius: 9px; }

.reader-mode[data-reader-theme="paper"] { --accent: #792d48; --terracotta: #792d48; --accent-hover: #572035; }
.reader-heading .reader-kicker { letter-spacing: .15em; }
.reader-comment-number { font-size: .71rem; font-weight: 650; font-variant-numeric: tabular-nums; }

#dialog.thread-drawer {
  inset: var(--thread-top, 0px) 0 auto auto; width: min(100%, 510px); height: var(--thread-height, 100dvh); max-height: var(--thread-height, 100dvh); margin: 0;
  border: 0; border-left: 1px solid var(--line); border-radius: 0; overflow: hidden;
}
#dialog.thread-drawer .dialog-content { height: 100%; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.thread-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: max(16px, env(safe-area-inset-top)) 20px 9px; }
.thread-heading h2 { margin: 0 0 4px; font: 400 clamp(1.75rem, 6vw, 2.15rem)/1.02 var(--serif); letter-spacing: -.035em; }
.thread-heading p { margin: 0; color: var(--muted); font-size: .83rem; }
.thread-heading-label, .thread-heading-actions { display: flex; align-items: flex-start; min-width: 0; }
.thread-heading-label { gap: 5px; overflow-wrap: anywhere; }
.thread-heading-label > button { flex: 0 0 auto; margin: -5px 0 0 -6px; }
.thread-heading-actions { flex: 0 0 auto; gap: 2px; margin: -5px -6px 0 0; }
.thread-heading .thread-close { font-size: 1.6rem; }
.thread-heading .thread-share { color: var(--accent); }
.thread-quote-wrap { margin: 0 20px; padding: 8px 11px; background: var(--wash); border-inline-start: 2px solid var(--accent); border-radius: 0 8px 8px 0; }
.thread-quote-wrap blockquote { max-height: min(92px, 15dvh); overflow: auto; margin: 0; white-space: pre-line; overflow-wrap: anywhere; font: 1.03rem/1.4 var(--serif); }
.thread-prompt { margin: 9px 20px 0; color: var(--muted); font: 1.04rem/1.35 var(--serif); }
.thread-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 20px; border-bottom: 1px solid var(--line); }
.thread-toolbar[hidden] { display: none; }
.thread-all[hidden] { display: none; }
.thread-all { min-height: 44px; color: var(--accent); }
.thread-total { color: var(--muted); font-size: .81rem; font-weight: 620; }
.thread-toolbar select { min-height: 44px; padding: 4px 22px 4px 8px; border: 0; background-color: transparent; color: var(--ink); font-size: .82rem; }
.thread-toolbar:has(select[hidden]) { min-height: 34px; }
.thread-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 7px 20px max(18px, env(safe-area-inset-bottom)); scroll-padding-block: 8px; }
.thread-compose { border-bottom: 1px solid var(--line); padding: 4px 0 6px; margin-bottom: 6px; }
.thread-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: start; }
.thread-input-row:where(:has(.thread-avatar)) { grid-template-columns: auto minmax(0, 1fr) auto; }
.thread-input-row textarea { min-height: 44px; max-height: 120px; resize: vertical; padding: 10px; width: 100%; border: 1px solid var(--input-line); border-radius: 7px; background: var(--paper); font: 400 1rem/1.4 var(--sans); }
.thread-input-row textarea { field-sizing: content; }
.thread-input-row .thread-avatar { margin-top: 5px; }
.thread-input-row .btn { min-height: 44px; border-radius: 7px; }
.thread-spoiler-check { display: inline-flex; align-items: center; min-height: 34px; gap: 4px; margin-left: 39px; color: var(--muted); font-size: .77rem; }
.thread-spoiler-check input { accent-color: var(--accent); }
.thread-composing-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .82rem; }
.thread-composing-label .thread-action { flex: 0 0 auto; white-space: nowrap; }
.thread-inline-compose { padding: 2px 0 4px; }
.thread-inline-compose .thread-spoiler-check { margin-inline-start: 0; }
.thread-inline-compose .thread-composing-label { margin: 0; color: var(--muted); }
.thread-avatar.avatar-tint-1 { background: #e7dbed; color: #503364; }
.thread-avatar.avatar-tint-2 { background: #e7dfd1; color: #593d24; }
.thread-avatar.avatar-tint-3 { background: #dce7dc; color: #2d523e; }
.thread-avatar.avatar-tint-4 { background: #dce5ef; color: #304b68; }
.thread-root + .thread-root { border-top: 1px solid var(--line); }
.thread-comment { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; padding: 10px 0 3px; overflow-wrap: anywhere; }
.thread-comment:focus { outline: none; }
.thread-comment:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; border-radius: 7px; }
.thread-comment header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; }
.thread-comment header :is(strong, a) { font-size: .87rem; font-weight: 690; color: var(--ink); }
.thread-comment time, .thread-edited { font-size: .72rem; color: var(--muted); }
.thread-author-label { background: var(--wash); color: var(--accent); padding: 1px 5px; border-radius: 4px; font-size: .67rem; }
.thread-text { margin-top: 4px; white-space: pre-wrap; font: .94rem/1.5 var(--sans); }
.thread-excerpt { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; width: 100%; min-height: 44px; margin-top: 5px; padding: 6px 8px; border: 0; border-inline-start: 2px solid var(--accent); border-radius: 0 6px 6px 0; background: var(--wash); color: var(--accent); text-align: start; font: 1rem/1.35 var(--serif); overflow-wrap: anywhere; }
.thread-actions { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 2px; margin: -1px -6px 0; }
.thread-actions .thread-like { justify-self: end; }
.thread-action, .thread-like { display: inline-flex; gap: 4px; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); font-size: .79rem; font-weight: 650; min-height: 40px; padding: 3px 6px; border-radius: 6px; }
.thread-like { min-width: 44px; }
.thread-like[aria-pressed="true"], .thread-action:hover { color: var(--accent); }
.thread-like:hover, .thread-action:hover { background: var(--wash); }
.chapter-like { border: 1px solid var(--line); padding-inline: 10px; }
.thread-menu-toggle { width: 44px; }
.thread-menu { grid-column: 1 / -1; justify-self: end; display: flex; justify-content: end; flex-wrap: wrap; gap: 4px; padding: 2px 4px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); }
.thread-menu[hidden] { display: none; }
.thread-menu button { min-height: 40px; border: 0; padding: 4px 10px; border-radius: 5px; background: transparent; font-size: .81rem; }
.thread-menu button:hover, .thread-menu-toggle[aria-expanded="true"] { background: var(--wash); }
.thread-replies { border-inline-start: 2px solid var(--line); margin: 0 0 8px 16px; padding-left: 11px; }
.thread-replies > summary, .thread-spoiler > summary { cursor: pointer; color: var(--accent); align-content: center; min-height: 41px; font-size: .82rem; font-weight: 640; }
.thread-highlight { padding-inline: 8px; border-radius: 7px; background: var(--wash); box-shadow: inset 2px 0 var(--accent); }
.thread-removed, .thread-empty { padding: 16px 3px; color: var(--muted); }
.thread-empty-state { display: grid; justify-items: center; gap: 12px; padding-block: 30px; text-align: center; font-size: .86rem; }
.thread-empty-state .reader-discuss-icon { color: var(--accent); }
.thread-more { margin-top: 14px; }
body:has(dialog.thread-drawer[open]) { overflow: hidden; }

@media (max-width: 740px) {
  .reader-comment-number { font-size: .73rem; }
  .reader-quick-position { gap: 4px; }
}
@media (max-width: 700px) {
  .book-discovery .browse-layout { grid-template-columns: 1fr; }
  .browse-sidebar { display: none; }
  .browse-mobile-filters { display: inline-flex; min-height: 44px; padding-inline: 9px; border-radius: 7px; }
  .book-info { grid-template-columns: 1fr; gap: 12px; }
  .book-aside { grid-template-columns: 1fr auto; align-items: center; }
  .book-engagement { grid-column: 1 / -1; }
  .book-update { font-size: .76rem; }
  .book-follow { padding-inline: 10px; }
  .book-jacket { grid-template-columns: clamp(79px, 24vw, 145px) minmax(0, 1fr); padding: 14px; gap: 15px; }
  .book-jacket h1 { font-size: clamp(2.13rem, 8vw, 3.5rem); text-wrap: wrap; }
  .book-actions {
    position: fixed;
    inset: auto 0 0;
    padding: 8px max(16px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--cream);
    border-top: 1px solid var(--soft-border);
  }
  .book-actions .primary { flex: 1; min-width: 0; }
  .book-mode .site-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .book-mode .toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .book-jacket .book-author { font-size: .81rem; gap: 5px; }
  .book-jacket .book-author .story-avatar { width: 23px; height: 23px; font-size: .62rem; }
}
@media (max-width: 560px) {
  .site-main:has(.book-discovery) { width: calc(100% - 28px); padding-top: 12px; }
  .discovery-hero { min-height: 161px; padding: 19px; border-radius: 12px; }
  .discovery-hero::before { background-position: 62% center; }
  .discovery-hero::after { background: linear-gradient(90deg,#2c121cf4 3%,#2c121cbf 63%,#2c121c2a); }
  .discovery-hero h1 { font-size: clamp(2.65rem, 11.5vw, 3.7rem); }
  .browse-search { margin-top: 16px; }
  .browse-results-top { align-items: center; }
  .browse-sort { max-width: 126px; }
  .browse-search-form input { padding-inline-start: 37px; }
  .book-discovery .series-card, .book-page .series-card { gap: 10px; padding: 10px; }
  .book-discovery .series-card .cover, .book-page .series-card .cover { width: 70px; }
  .book-discovery .series-card .tag:nth-child(n+4) { display: none; }
  .book-discovery .card-synopsis { -webkit-line-clamp: 2; font-size: .84rem; }
  .book-jacket .book-facts { font-size: .73rem; margin-top: 6px; }
  .book-section-bar { margin-bottom: 10px; }
  #dialog.thread-drawer { width: 100%; border-left: 0; }
  .thread-heading { padding-top: max(16px, env(safe-area-inset-top)); }
  .thread-heading, .thread-scroll, .thread-compose, .thread-toolbar { padding-inline: 13px; }
  .thread-quote-wrap { margin-inline: 13px; }
}

.continue-section { margin: 17px 0 22px; }
.continue-section h2 { font-size: clamp(1.75rem, 4vw, 2.3rem); }
.continue-section .shelf-list { background: #f9edf1; border-color: #ead8e1; border-radius: 10px; overflow: visible; }
.continue-item { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 12px; align-items: center; }
.continue-item .cover { width: 54px; }
.continue-item .fallback-cover > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: .59rem; overflow-wrap: normal; }
.continue-copy .shelf-title { font: 400 clamp(1.4rem, 4vw, 1.9rem)/1.13 var(--serif); }
.continue-copy progress { display: block; width: min(180px, 90%); height: 5px; margin: 7px 0; accent-color: var(--wine); }
.continue-copy .btn { min-height: 38px; margin-top: 3px; }
.shelf-overflow { align-self: start; position: relative; }
.shelf-overflow summary { min-width: 41px; min-height: 41px; display: grid; place-items: center; cursor: pointer; color: var(--wine); }
.shelf-overflow summary::-webkit-details-marker { display: none; }
.shelf-overflow .btn { position: absolute; right: 0; z-index: 2; background: var(--warm-white); border-color: var(--soft-border); color: var(--wine); }
.shelf-title .bookmark-excerpt { font: 400 .98rem/1.45 var(--serif); color: var(--muted); display: block; margin-top: 3px; }
.library-page .page-intro .btn { margin-top: 10px; }
@media (max-width: 650px) {
  .book-mode .site-nav { display: none; }
}

.card-engagement { color: var(--wine); font-size: .75rem; font-weight: 620; font-variant-numeric: tabular-nums; }
#dialog.thread-drawer { max-width: 100vw; }
.book-description-more { margin-top: 2px; }
.book-description-more > summary, .book-description-preview > summary { cursor: pointer; color: var(--wine); font: 650 .82rem/1.4 var(--sans); align-content: center; min-height: 41px; }
.book-description-preview { border-top: 1px solid var(--line); }
.book-description-preview .book-hook { margin-bottom: 4px; }
@media (max-width: 560px) {
  #dialog.thread-drawer { inset: 0; }
}
.age-entry {
  width: min(100%, 620px);
  margin: clamp(22px, 7vw, 72px) auto 0;
  background: linear-gradient(90deg,#2c121ff6,#2c121f8a), url("/after-dark.webp") 65% center / cover;
  color: #fff4ed;
  padding: clamp(23px, 5.5vw, 52px);
  border-radius: 14px;
}
.age-entry h1 { font-size: clamp(2.65rem, 6vw, 4.2rem); }
.age-entry p { margin: 8px 0 15px; color: #ffe6ed; }
.age-entry .primary { color: #3b1b2b; background: #fff4ed; border-color: #fff4ed; }
.age-entry .primary:hover { background: #ead2dc; border-color: #ead2dc; }
.age-entry .quiet { color: #fff4ed; }
.age-entry .quiet:hover { background: #622e47; }

.share-sheet { display: grid; gap: 9px; }
.share-sheet > p { color: var(--muted); }
.share-sheet .form-feedback:empty { display: none; }
.share-sheet input { font-size: .83rem; }
.share-destinations { display: flex; flex-wrap: wrap; gap: 6px; }
.share-destinations .btn { border-radius: 7px; }
.reader-thread-preview { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; padding: clamp(11px, 3vw, 18px); background: var(--card); scroll-margin-block-start: calc(75px + env(safe-area-inset-top)); }
.reader-thread-preview > header { margin-bottom: 8px; }
.reader-thread-preview h2 { font: 400 clamp(1.5rem, 5vw, 1.9rem)/1.04 var(--serif); scroll-margin-block: calc(75px + env(safe-area-inset-top)); }
.reader-thread-preview .thread-total { margin-top: 4px; }
.chapter-discussion-return[hidden], #chapter-thread-sort[hidden] { display: none; }
.chapter-discussion-return { color: var(--accent); }
.chapter-discussion-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#chapter-thread-sort { min-height: 44px; padding: 4px 22px 4px 8px; border: 0; background-color: transparent; color: var(--ink); font-size: .82rem; }
.reader-preview-prompt { margin-bottom: 6px; color: var(--muted); font: 1.05rem/1.35 var(--serif); }
.reader-preview-compose { margin: 3px 0 7px; }
.reader-preview-compose .thread-input-row .thread-avatar { display: none; }
.reader-preview-compose .thread-input-row { grid-template-columns: minmax(0, 1fr) auto; }
.reader-preview-compose .thread-spoiler-check { margin-inline-start: 0; }
.reader-thread-preview .thread-more { min-height: 44px; margin-top: 7px; }

.book-author { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .browse-popular > a:nth-child(n+5) { display: none; }
  .browse-chips .tag, .book-summary .tag { min-height: 40px; }
  #dialog .browse-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #dialog .browse-filters :is(.tag-picker, [data-tag-match], .inline-actions) { grid-column: 1 / -1; }
  #dialog .browse-filter-actions { position: sticky; bottom: 0; z-index: 1; padding-block: 7px; background: var(--card); }
  .thread-action, .thread-like { min-height: 44px; }
  .thread-inline-compose { margin-inline-start: -43px; }
  .thread-inline-compose .thread-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .thread-inline-compose .thread-input-row { display: contents; }
  .thread-inline-compose :is(.thread-composing-label, textarea, .form-feedback) { grid-column: 1 / -1; }
  .thread-inline-compose .thread-spoiler-check { grid-area: 3 / 1; min-height: 44px; }
  .thread-inline-compose button[type="submit"] { grid-area: 3 / 2; }
}
@media (max-width: 375px) {
  .browse-results-top { flex-wrap: wrap; align-items: start; }
  .browse-results-top > div:first-child { flex-basis: 100%; }
  .browse-tools { width: 100%; }
  .browse-sort { margin-left: auto; }
  .thread-heading { gap: 2px; }
  .thread-input-row .thread-avatar { display: none; }
  .thread-input-row { grid-template-columns: minmax(0, 1fr) auto; }
  .thread-spoiler-check { margin-left: 0; }
}
@media (max-height: 520px) {
  .thread-heading { padding-block: 10px 7px; }
  .thread-quote-wrap blockquote { max-height: 55px; }
  .reader-heading { padding-block: 22px 14px; }
  .reader-heading h1 { font-size: clamp(2.35rem, 6vw, 3.6rem); }
}

@media (orientation: landscape) and (pointer: coarse) {
  .header-inner, .site-main:has(.book-page, .book-discovery, .library-page) {
    width: min(var(--measure), calc(100% - 2 * max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right))));
  }
  .chapter-reader {
    width: min(100% - 2 * max(var(--reader-gutter), env(safe-area-inset-left), env(safe-area-inset-right)), var(--reading-width));
  }
  .reader-bar-inner {
    width: min(100% - 2 * max(16px, env(safe-area-inset-left), env(safe-area-inset-right)), 74rem);
  }
}

:is(.browse-filters .field select, .browse-sort, .thread-toolbar select, :where(#manuscript-source) select) {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding-inline-end: 25px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
@media (forced-colors: active) {
  :is(.browse-filters .field select, .browse-sort, .thread-toolbar select, :where(#manuscript-source) select) {
    appearance: auto;
    background-image: none;
  }
}

/* Community controls use the same spacing and text scale as the library and studio. */
.author-community-actions { flex-wrap: wrap; }
.community-inbox { margin-block: .75rem 1.25rem; }
.community-inbox-item { display: grid; gap: .5rem; }
.community-inbox-item p { margin: 0; }
.community-quote { white-space: pre-wrap; overflow-wrap: anywhere; }
.community-analytics { display: grid; gap: .65rem; margin-block: 1rem; }
.community-analytics :is(h3, h4, p) { margin: 0; }
.community-timeline { padding-inline-start: 0; list-style: none; }
.community-timeline li { display: grid; grid-template-columns: minmax(6.25rem, auto) minmax(2rem, 1fr) minmax(4rem, auto); align-items: center; gap: .45rem; padding-block: .2rem; font-size: .85rem; }
.community-timeline meter { width: 100%; }
.thread-identity { margin: .35rem 0; }
