.reader-wrap {
  width: min(calc(100% - 2rem), 72rem);
  margin-inline: auto;
}

.reader-hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(2rem, 5vw, 4rem);
}

.reader-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--header) var(--header-gradient);
  clip-path: ellipse(170% 100% at 50% 0);
  content: "";
}

.reader-hero h1 {
  margin: 0;
  font-size: clamp(2.65rem, 6vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.reader-hero-copy > p {
  margin-block: .75rem 1.25rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.reader-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  color: var(--muted);
  font-size: .9rem;
}

.reader-hero-button {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
  padding-inline: 1rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  background: color-mix(in srgb, var(--accent) 86%, var(--header));
  color: var(--background);
  font: inherit;
  font-weight: 700;
}

.reader-hero-button small {
  border-radius: .35rem;
  padding: .125rem .4rem;
  background: color-mix(in srgb, currentColor 13%, transparent);
  font-weight: 650;
}

.reader-catalog {
  button { font: inherit; cursor: pointer; }
  h1, h2, h3, p { margin: 0; }
  .art { position: relative; display: grid; overflow: hidden; place-items: center; background: var(--cover); color: #24354b; }
  .art img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
  .art b { font-size: 1.4rem; padding: 10px; text-align: center; }
  .meta { display: block; font-size: .84rem; color: var(--muted); }
  section { margin: 20px 0 26px; scroll-margin-top: 18px; }
  .section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
  .section-head h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); letter-spacing: -.025em; }
  .section-head p { margin-top: 3px; color: var(--muted); }
  .shelf { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 10px; }
  .series-card { display: block; min-width: 0; color: var(--text) !important; text-decoration: none; }
  .series-card[hidden] { display: none; }
  .series-card[role="button"] { cursor: pointer; }
  .series-card:hover h3 { text-decoration: underline; text-underline-offset: .16em; }
  .series-card .art { aspect-ratio: 10 / 13; border-radius: 6px; }
  .card-copy { padding-top: 5px; }
  .card-copy h3 { font-size: 1rem; line-height: 1.3; margin-bottom: 2px; }
  #filters { margin-bottom: 6px; }
  .filters { display: flex; flex-wrap: wrap; gap: 6px; }
  .filters button { border: 0; border-radius: 30px; background: var(--accent-soft); color: var(--accent); padding: 7px 12px; }
  .filters button[aria-pressed="true"] { background: var(--accent); color: var(--background); }
  .catalog-note { margin-block: 1.5rem 2rem; color: var(--muted); font-size: .88rem; }
  @media (max-width: 760px) { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (max-width: 560px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } .section-head { align-items: start; } }
  .card-copy .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 390px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .novel-cover { --cover: var(--accent-soft); }
  .novel-cover b { color: var(--accent); font-size: 1rem; overflow-wrap: anywhere; }
  .novel-cover img { object-position: center 35%; }
  .novel-card .meta { white-space: normal; }
  .novel-card h3 { overflow-wrap: anywhere; }
  .novel-search { display: grid; gap: .25rem; max-width: 24rem; margin-block-end: .75rem; }
  .novel-search span { color: var(--muted); font-size: .9rem; }
  .novel-search input {
    min-width: 0;
    padding: .5rem .7rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
  }
  .novel-count { margin-block: .65rem; color: var(--muted); font-size: .9rem; }
  .card-copy .language-note { white-space: normal; }

  .scrolling-shelf {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 40px) / 4.5);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
  }
  .scrolling-shelf > .series-card { scroll-snap-align: start; }
  .scrolling-shelf > .series-card:focus-visible { outline-offset: -1px; }
  .shelf-controls { display: flex; gap: 6px; flex: 0 0 auto; }
  .shelf-controls button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text);
    background: var(--surface);
  }
  .shelf-controls button::before {
    content: "";
    width: 8px;
    height: 12px;
    background: currentColor;
    clip-path: polygon(0 0, 34% 0, 100% 50%, 34% 100%, 0 100%, 66% 50%);
  }
  .shelf-controls button:first-child::before { transform: scaleX(-1); }
  @media (hover: hover) {
    .shelf-controls button:hover:not([aria-disabled="true"]) { background: var(--surface-hover); }
  }
  .shelf-controls button[aria-disabled="true"] { opacity: .4; cursor: default; }
  @media (max-width: 760px) {
    .scrolling-shelf { grid-auto-columns: calc((100% - 30px) / 3.5); }
  }
  @media (max-width: 560px) and (pointer: coarse) {
    .shelf-controls { display: none; }
  }
  @media (max-width: 560px) {
    .scrolling-shelf { grid-auto-columns: calc((100% - 14px) / 2.4); }
  }
}

  [dir=rtl] .shelf-controls button::before { transform: scaleX(-1); }
  [dir=rtl] .shelf-controls button:first-child::before { transform: none; }
