.topbar { background: var(--surface); }
.brand { color: var(--ink); font-size: 1.35rem; font-weight: 750; letter-spacing: -.035em; }
.brand-symbol { color: var(--accent-ink); background: var(--tint); box-shadow: none; }
.nav-link { color: var(--muted); font-weight: 650; }
.nav-link.current, .nav-link:hover { color: var(--accent-ink); }
:is(.site-navigation, .library-tabs) .nav-link.current { box-shadow: inset 0 -2px var(--accent); }
.install { color: var(--muted); background: var(--subtle); border-color: var(--line); }
.install:hover { border-color: var(--control-line); }
.install strong { color: var(--ink); font-weight: 650; }
.install-icon { width: 26px; height: 26px; background: var(--tint); }
.reader-layout .topbar-inner, .header-search { position: relative; }
.search-box {
  position: absolute;
  z-index: 4;
  inset-block-start: 0;
  inset-inline-end: calc(100% + 8px);
  width: clamp(200px, 23vw, 300px);
}
.search-box input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--field-line);
  background: var(--subtle);
  color: var(--ink);
  font-size: 1rem;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus-visible { outline: none; border-bottom-color: var(--accent); box-shadow: inset 0 -1px var(--accent); }
.top-actions .icon-button { width: 44px; min-height: 44px; }
.top-actions .user-link { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.user-link:hover, .user-link[aria-current='page'] { color: var(--accent-ink); }
.top-actions .icon-button { color: var(--ink); }
.top-actions .icon-button:hover { color: var(--accent-ink); }
.top-actions .search-trigger:hover { background: transparent; }
.top-actions morph-icon { display: inline-flex; }
.reader-layout .content { padding-block-start: 24px; }
:where(.reader-layout, .studio-layout) :is(h1, h2, h3) { color: var(--ink); }
.reader-layout :is(.page-heading h1, .detail-summary h1) {
  font: 740 clamp(1.65rem, 2.7vw, 2.5rem)/1.15 var(--sans);
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.reader-layout .page-heading { margin-bottom: 16px; }
.feed-resume { margin-bottom: 20px; }
.feed-resume h2 { margin-bottom: 8px; font-size: 1rem; font-weight: 700; }
.feed-resume .history-row { background: var(--tint); border-color: transparent; }
.feed-resume .history-info h3 { margin-block: 0; }
.feed-resume .history-row .secondary { min-height: 44px; color: var(--accent-ink); }
.feed-filters { gap: 8px; margin-bottom: 10px; }
.feed-filters .chip { min-height: 44px; font-weight: 650; }
.library-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.library-panel > .auth-callout:not(:first-child) { margin-block: 12px 0; }
.library-panel > #following-authors { margin-top: 0; }
.book-feed { min-width: 0; margin: 0; padding: 0; list-style: none; }
.book-feed-row {
  position: relative;
  display: grid;
  grid-template-columns: clamp(66px, 11vw, 96px) minmax(0, 1fr) 44px;
  column-gap: 16px;
  align-items: start;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}
.feed-cover-link { display: block; }
.feed-cover { box-shadow: none; }
.feed-cover::after { display: none; }
.feed-book-copy { min-width: 0; padding-block: 1px; }
.feed-book-copy h2 { font-size: clamp(1.03rem, 2vw, 1.32rem); font-weight: 740; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.feed-title { display: inline-flex; align-items: center; min-height: 24px; }
.feed-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.feed-byline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; margin-top: 2px; color: var(--muted); font-size: .89rem; line-height: 1.4; overflow-wrap: anywhere; }
.feed-byline .author-byline { display: inline-flex; align-items: center; min-height: 24px; max-width: 100%; }
.feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 7px; color: var(--muted); font-size: .78rem; }
.feed-meta .badge, .detail-meta .badge { font-weight: 700; }
.feed-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: 62ch;
  margin-top: 5px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.feed-save { width: 44px; min-height: 44px; color: var(--muted); }
.feed-save.is-saved { color: var(--accent-ink); }
.cover-save { min-width: 44px; min-height: 44px; }
.select-label { max-width: 100%; }
.catalog-filters .select-label select { min-height: 44px; }
.catalog-filter .dropdown-trigger { min-height: 44px; }
.catalog-browse { margin-top: 8px; }
.catalog-browse summary { display: list-item; width: fit-content; align-content: center; min-height: 44px; color: var(--accent-ink); font-size: .88rem; font-weight: 650; cursor: pointer; }
.catalog-browse .category-nav { margin-top: 4px; }
.book-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -8px 0 8px; }
.book-detail { grid-template-columns: minmax(100px, 176px) minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; gap: 12px 24px; padding: 0; border: 0; }
.book-detail > .cover { grid-row: 1 / 3; width: 100%; box-shadow: none; }
.book-detail > .cover::after { display: none; }
.detail-summary, .detail-copy { min-width: 0; }
.detail-summary .community-line { flex-wrap: wrap; }
.detail-actions .button, .detail-actions .icon-button { min-height: 44px; }
.detail-copy .synopsis { max-width: 65ch; margin-bottom: 12px; }
.detail-tags .chip { min-height: 44px; }
.book-detail + .chapters { max-width: none; }

@media (min-width: 801px) and (max-width: 1050px) {
  .site-navigation-inner { gap: 8px; }
  .site-navigation .nav-link { gap: 8px; padding-inline: 8px; }
  .site-navigation .install { width: 44px; justify-content: center; padding: 0; }
  .site-navigation .install strong { display: none; }
}

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .reader-layout .topbar-inner { min-height: calc(56px + var(--safe-top)); column-gap: 4px; }
  .reader-layout .top-actions { gap: 1px; }
  .reader-layout .header-search { position: static; }
  .reader-layout .search-box {
    inset-block-start: calc(100% + 4px);
    inset-inline: max(var(--gutter), var(--safe-left)) max(var(--gutter), var(--safe-right));
    width: auto;
    box-shadow: 0 6px 16px var(--shade);
  }
  .site-navigation .nav-link { gap: 3px; padding-inline: 2px; }
  .reader-layout .nav-link { font-size: .78rem; }
  .reader-layout .desktop-author { display: none; }
  .reader-layout .content { padding-block-start: 16px; }
  .reader-layout .site-brand .brand { gap: 6px; min-height: 44px; font-size: 1.1rem; }
  .reader-layout .user-link { padding-inline: 0 2px; font-size: .8rem; }
  .catalog-filter select, .form-panel select, .reader-options select { font-size: 16px; }
  .book-feed-row { grid-template-columns: clamp(62px, 18vw, 78px) minmax(0, 1fr) 40px; column-gap: 10px; padding-block: 13px; }
  .feed-save { justify-self: end; margin-inline-end: -4px; }
  .feed-resume .history-row { padding: 10px; }
}

@media (max-width: 570px) {
  .library-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
  .library-tabs .nav-link { min-width: 0; min-height: 58px; font-size: .75rem; text-align: center; }
  .library-tabs .nav-narrow { min-height: 2.5em; align-content: center; line-height: 1.25; }
  .feed-filters { flex-wrap: wrap; gap: 6px; overflow: visible; margin-inline: 0; padding: 0; }
  .feed-filters .chip { padding-inline: 10px; font-size: .79rem; }
  .book-feed-row { grid-template-columns: clamp(60px, 18vw, 76px) minmax(0, 1fr) 36px; row-gap: 3px; }
  .feed-description { -webkit-line-clamp: 2; font-size: .81rem; }
  .feed-byline { font-size: .8rem; }
  .feed-meta { gap: 3px 7px; font-size: .78rem; }
  .feed-meta .badge { font-size: .78rem; }
  .catalog-filters .catalog-filter:last-child { grid-column: 1 / -1; }
  .book-detail { grid-template-columns: clamp(78px, 24vw, 121px) minmax(0, 1fr); grid-template-rows: auto auto; gap: 12px; }
  .book-detail > .cover { grid-row: 1; }
  .detail-copy { grid-column: 1 / -1; }
  .reader-layout .detail-summary h1 { font-size: clamp(1.35rem, 5.9vw, 1.85rem); }
  .detail-summary .community-line { margin-block: 4px 0; }
  .detail-meta { margin-bottom: 5px; gap: 5px 7px; }
  .detail-meta .text-link { font-size: .81rem; }
}

@media (max-width: 380px) {
  .reader-layout .site-brand .brand { font-size: 1rem; }
  .reader-layout .topbar-inner:has(.notice-trigger) .brand-name { display: none; }
}

@media (max-width: 340px) {
  .reader-layout .site-brand .brand { gap: 4px; }
  .reader-layout .site-brand .brand-symbol { width: 26px; height: 26px; }
}
