:root {
  color-scheme: dark;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cinzel", "Trajan Pro", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 10px;
  --bg: #0d0b09;
  --panel: #1a1511;
  --panel-2: #211a14;
  --field: #1b1612;
  --input: var(--field);
  --surface: #211a14;
  --elevated: #2a2119;
  --modal: #2a211b;
  --chapter-bg: #211a14;
  --spotlight-start: #211a14;
  --spotlight-mid: #18130f;
  --spotlight-end: #0d0b09;
  --spotlight-wash: rgba(222, 186, 98, 0.1);
  --spotlight-art-start: #211a14;
  --spotlight-art-end: #18130f;
  --spotlight-art-wash: rgba(222, 186, 98, 0.12);
  --text: #f5f1e8;
  --muted: #d7cec1;
  --muted-2: #aa9e8e;
  --disabled: #81776c;
  --line: #463725;
  --line-hover: #5e4930;
  --line-active: #8a6b38;
  --accent: #ddb965;
  --accent-strong: #f0d487;
  --accent-pressed: #d1a64a;
  --accent-dark: #ae8832;
  --accent-muted: #947744;
  --accent-soft: rgba(221, 185, 101, 0.14);
  --accent-line: rgba(221, 185, 101, 0.34);
  --accent-2: #ddb965;
  --success: #4dbb7d;
  --warning: #d59a3a;
  --danger: #d45f5f;
  --error: #d45f5f;
  --info: #6299d2;
  --focus: #ddb965;
  --ink: #1a1612;
  --on-accent: #1a1612;
  --topbar-bg: rgba(13, 11, 9, 0.94);
  --overlay: rgba(8, 6, 4, 0.76);
  --soft-panel: rgba(221, 185, 101, 0.055);
  --cover-shelf: #18130f;
  --shadow: rgba(0, 0, 0, 0.35);
  --shadow-warm: rgba(221, 185, 101, 0.1);
  --shadow-lg: 0 28px 80px var(--shadow);
  font-family: var(--font-sans);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .spotlight-cover,
  .spotlight-cover::after,
  .spotlight-copy {
    animation: none !important;
  }
}

:root[data-theme="light"],
body.light-theme {
  color-scheme: light;
  --bg: #f7f0e2;
  --panel: #fff9ee;
  --panel-2: #f4ead7;
  --field: #fffaf2;
  --input: var(--field);
  --surface: #f4ead7;
  --elevated: #fffdf8;
  --modal: #fff9ee;
  --chapter-bg: #fffaf2;
  --spotlight-start: #f2e3c6;
  --spotlight-mid: #fff6e7;
  --spotlight-end: #f7f0e2;
  --spotlight-wash: rgba(155, 122, 43, 0.1);
  --spotlight-art-start: #efe0c8;
  --spotlight-art-end: #d8bf8a;
  --spotlight-art-wash: rgba(155, 122, 43, 0.12);
  --text: #241c13;
  --muted: #6f6253;
  --muted-2: #968b7b;
  --disabled: #8a7e70;
  --line: #d7c5a4;
  --line-hover: #b89d68;
  --line-active: #9b7a2b;
  --accent: #9b7a2b;
  --accent-strong: #7d5f1c;
  --accent-pressed: #78603a;
  --accent-dark: #6d5526;
  --accent-muted: #8a7447;
  --accent-soft: rgba(155, 122, 43, 0.12);
  --accent-line: rgba(155, 122, 43, 0.28);
  --accent-2: #9b7a2b;
  --success: #2f8558;
  --warning: #a66c18;
  --danger: #a33d3d;
  --error: #a33d3d;
  --info: #3f73a6;
  --focus: #9b7a2b;
  --ink: #15120e;
  --on-accent: #fff8e8;
  --topbar-bg: rgba(247, 240, 226, 0.94);
  --overlay: rgba(30, 24, 17, 0.42);
  --soft-panel: rgba(155, 122, 43, 0.06);
  --cover-shelf: #eadcc7;
  --shadow: rgba(52, 40, 24, 0.2);
  --shadow-warm: rgba(155, 122, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -12%, var(--spotlight-wash), transparent 34rem),
    linear-gradient(180deg, var(--spotlight-start) 0, var(--spotlight-mid) 34rem, var(--bg) 68rem);
  color: var(--text);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  transform: translateY(-180%);
  padding: 10px 14px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

main:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--field) inset;
  transition: background-color 9999s ease-in-out 0s;
}

button {
  cursor: pointer;
}

a,
button,
input,
select,
textarea {
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease,
    color 200ms ease,
    transform 200ms ease;
}

a {
  color: inherit;
}

a:hover {
  color: var(--accent-strong);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(220px, 720px) auto;
  gap: 14px;
  align-items: center;
  width: min(100% - clamp(24px, 4vw, 56px), 1320px);
  margin: 10px auto 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--accent));
  border-radius: var(--radius-lg);
  background: var(--topbar-bg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-strong);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent);
  box-shadow: 0 0 18px var(--shadow-warm);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

.brand-word {
  font-family: var(--font-display);
  font-size: clamp(0.98rem, 1.15vw, 1.2rem);
  font-weight: 600;
  letter-spacing: .18em;
  line-height: 1;
  text-transform: uppercase;
}

.search-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 46px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--field);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.search-wrap input:focus {
  border-color: var(--line-active);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-clear {
  position: absolute;
  top: 8px;
  right: 6px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 20;
  overflow: hidden;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  box-shadow: 0 18px 40px var(--shadow), 0 0 24px var(--shadow-warm);
}

.search-suggestions {
  display: grid;
}

.search-suggestions button,
.search-clear-recents,
.search-panel-state {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.search-suggestions button {
  display: grid;
  gap: 3px;
}

.search-suggestions button.active,
.search-suggestions button:hover,
.search-clear-recents:hover {
  background: var(--accent-soft);
}

.search-suggestions small,
.search-panel-state {
  color: var(--muted);
}

mark {
  border-radius: 3px;
  padding: 0 2px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.search-loading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.search-loading span {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.search-pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  color: var(--muted);
}

.search-pagination span {
  min-width: 110px;
  text-align: center;
}

.search-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.nav-actions .auth-button {
  max-width: min(190px, 32vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-wrap {
  position: relative;
  display: inline-flex;
}

.user-menu-wrap .auth-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: min(230px, 38vw);
  padding: 0 10px;
}

.account-avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  background-position: center;
  background-size: cover;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.avatar-fallback {
  position: relative;
  z-index: 1;
}

.avatar-photo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.has-image .avatar-fallback {
  color: transparent;
}

.account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-caret {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  width: min(240px, 78vw);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-lg);
  background: var(--elevated);
  box-shadow: var(--shadow-lg), 0 0 24px var(--shadow-warm);
}

.user-menu button,
.user-menu a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font-weight: 800;
}

.user-menu button:hover,
.user-menu button:focus-visible,
.user-menu a:hover,
.user-menu a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.user-menu button[data-user-menu-signout] {
  color: var(--danger);
}

#signOutButton {
  display: none !important;
}

#notificationButton {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--panel);
  border-radius: 999px;
  padding: 0 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .68rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button,
.close-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: #a99c89;
}

.nav-link-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.nav-link-button:hover,
.icon-button:hover,
.auth-button:hover {
  border-color: var(--line-hover);
  color: var(--accent-strong);
  background: var(--elevated);
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 56px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: center;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 44px) 34px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-strong);
}

.nav-create-account {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
}

.landing-route main {
  width: 100%;
  max-width: none;
  padding-top: 0;
}

.landing-page {
  color: var(--text);
}

.landing-page h1,
.landing-page h2,
.landing-page h3 {
  letter-spacing: 0;
}

.landing-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
  min-height: calc(100vh - 92px);
  padding: clamp(56px, 8vw, 112px) clamp(22px, 7vw, 112px);
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 42%, rgba(214, 177, 90, 0.12), transparent 34%),
    linear-gradient(180deg, #211a14 0%, #18130f 54%, #0d0b09 100%);
  color: #f5f1e8;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 20%, rgba(214, 177, 90, 0.08), transparent 28%),
    linear-gradient(90deg, rgba(13, 11, 9, 0.72), transparent 54%);
}

.landing-hero-copy,
.landing-cover-composition,
.landing-section,
.landing-final-cta {
  position: relative;
  z-index: 1;
}

.landing-hero-copy {
  max-width: 760px;
}

.landing-hero h1 {
  max-width: 760px;
  margin: 0;
  color: #fffaf0;
  font-size: clamp(3.1rem, 8vw, 7.8rem);
  line-height: 0.92;
}

.landing-hero-copy > p:not(.eyebrow) {
  max-width: 720px;
  margin: 24px 0 0;
  color: #d8cfc1;
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  line-height: 1.65;
}

.landing-hero .eyebrow {
  color: #d6b15a;
}

:root[data-theme="light"] .landing-hero,
body.light-theme .landing-hero {
  background:
    radial-gradient(circle at 72% 42%, rgba(214, 177, 90, 0.2), transparent 34%),
    linear-gradient(180deg, #2a2119 0%, #211a14 54%, #0d0b09 100%);
}

:root[data-theme="light"] .landing-hero::before,
body.light-theme .landing-hero::before {
  background:
    radial-gradient(circle at 18% 20%, rgba(214, 177, 90, 0.1), transparent 28%),
    linear-gradient(90deg, rgba(13, 11, 9, 0.84), rgba(13, 11, 9, 0.18) 58%, transparent 78%);
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.landing-actions .primary-button,
.landing-actions .secondary-button,
.landing-final-cta .primary-button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 10px;
}

.landing-cover-composition {
  min-height: 500px;
  perspective: 1000px;
}

.landing-glow {
  position: absolute;
  inset: 17% 4% 8% 8%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(214, 177, 90, 0.18), transparent 62%);
  filter: blur(24px);
}

.landing-cover {
  position: absolute;
  width: clamp(122px, 13vw, 190px);
  aspect-ratio: 2 / 3;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), 0 0 34px rgba(214, 177, 90, 0.08);
  transform-style: preserve-3d;
  transition: transform 260ms ease, filter 260ms ease;
  animation: landingFloat 7s ease-in-out infinite;
}

.landing-cover:hover,
.landing-cover:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-8px) rotateZ(0deg) scale(1.03);
}

.landing-cover-1 {
  left: 34%;
  top: 10%;
  z-index: 4;
}

.landing-cover-2 {
  left: 7%;
  top: 25%;
  z-index: 3;
  transform: rotateZ(-8deg);
  animation-delay: -1.5s;
}

.landing-cover-3 {
  right: 8%;
  top: 24%;
  z-index: 2;
  transform: rotateZ(8deg);
  animation-delay: -3s;
}

.landing-cover-4 {
  left: 24%;
  bottom: 6%;
  z-index: 1;
  transform: rotateZ(6deg);
  animation-delay: -4.5s;
}

.landing-cover-5 {
  right: 24%;
  bottom: 12%;
  z-index: 0;
  transform: rotateZ(-5deg);
  animation-delay: -2.2s;
}

.landing-cover-art,
.landing-discover-cover {
  width: 100%;
  height: 100%;
  margin: 0;
}

@keyframes landingFloat {
  0%, 100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -12px;
  }
}

.landing-section {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  padding: clamp(58px, 8vw, 104px) 0;
}

.landing-section > h2,
.landing-section-head h2,
.landing-final-cta h2 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
}

.landing-section > .eyebrow + h2 {
  margin-top: 10px;
}

.landing-section-copy {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--subtle);
  font-size: 1.05rem;
  line-height: 1.65;
}

.landing-statement {
  max-width: 980px;
  color: var(--muted);
  font-size: clamp(1.18rem, 2.1vw, 1.65rem);
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 30px;
}

.landing-feature-grid article,
.landing-stat,
.landing-steps article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.landing-feature-grid article {
  padding: 22px;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.landing-feature-grid article:hover {
  border-color: var(--line-hover);
  box-shadow: 0 20px 44px var(--shadow), 0 0 28px var(--shadow-warm);
  transform: translateY(-3px);
}

.landing-feature-grid span {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  padding-inline: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 900;
}

.landing-experience-grid article {
  min-height: 210px;
}

.landing-feature-grid h3,
.landing-steps h3,
.landing-book-card h3 {
  margin: 16px 0 8px;
}

.landing-feature-grid p,
.landing-book-card p,
.landing-muted {
  color: var(--muted);
}

.landing-section-head {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.landing-book-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.landing-book-card {
  min-width: 0;
}

.landing-book-card button {
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 0;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.landing-book-card button:hover,
.landing-book-card button:focus-visible {
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.36), 0 0 24px var(--shadow-warm);
  transform: translateY(-5px);
}

.landing-book-card h3 {
  font-size: 1rem;
}

.landing-book-card p {
  margin: 0;
}

.landing-book-card span {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 900;
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.landing-reading-demo {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(360px, 1.18fr);
  gap: 22px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, var(--accent-line));
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 28px);
  background:
    radial-gradient(circle at 50% -14%, rgba(214, 177, 90, 0.1), transparent 40%),
    linear-gradient(145deg, #2a2119, #211a14 62%, #1a1511);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), 0 0 36px var(--shadow-warm);
}

.landing-demo-main,
.landing-demo-discussion {
  min-height: 420px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, var(--accent-line));
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 32px);
  background: rgba(13, 11, 9, 0.38);
  box-shadow: inset 0 1px 0 rgba(245, 241, 232, 0.03);
}

.landing-demo-main h3 {
  max-width: 560px;
  margin: 10px 0 18px;
  color: #fffaf0;
  font-size: clamp(3rem, 6.2vw, 5rem);
  line-height: .95;
}

.landing-progress {
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(245, 241, 232, 0.12);
}

.landing-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-strong));
}

.landing-demo-meta {
  margin: 18px 0 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  color: #f5f1e8;
  font-weight: 900;
}

.landing-demo-rating {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
}

.landing-demo-rating span {
  color: #f5f1e8;
  font-weight: 900;
}

.landing-demo-rating strong {
  color: var(--accent);
  font-size: clamp(4.5rem, 9vw, 6.8rem);
  font-weight: 900;
  line-height: .85;
}

.landing-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.landing-reactions span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 82%, rgba(0, 0, 0, 0.16));
  font-size: 1.35rem;
}

.landing-demo-discussion blockquote {
  margin: 12px 0;
  border: 1px solid color-mix(in srgb, var(--line) 74%, var(--accent-line));
  border-radius: var(--radius);
  padding: 15px 18px;
  background: rgba(13, 11, 9, 0.34);
  color: #f5f1e8;
  font-weight: 800;
  font-style: normal;
}

.landing-locked-chapters {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.landing-locked-chapters span {
  display: flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 74%, var(--accent-line));
  border-radius: var(--radius);
  padding: 0 14px;
  color: #d8cfc1;
  background: rgba(13, 11, 9, 0.28);
  font-weight: 900;
}

.landing-locked-chapters small {
  color: #c9c1b5;
  font-weight: 800;
}

.landing-stat {
  padding: 22px 16px;
  text-align: center;
}

.landing-stat strong {
  display: block;
  color: var(--accent);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
}

.landing-stat span {
  color: var(--subtle);
  font-weight: 800;
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.landing-steps article {
  position: relative;
  padding: 28px;
}

.landing-steps strong {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1612;
}

.landing-final-cta {
  width: min(980px, calc(100% - 44px));
  margin: 0 auto clamp(58px, 8vw, 104px);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  padding: clamp(44px, 8vw, 80px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 177, 90, 0.12), transparent 52%),
    var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), 0 0 36px var(--shadow-warm);
}

.landing-final-cta p {
  max-width: 620px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.landing-final-cta .primary-button {
  margin-top: 24px;
}

@media (max-width: 980px) {
  .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .landing-cover-composition {
    min-height: 430px;
  }

  .landing-feature-grid,
  .landing-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-book-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .landing-steps {
    grid-template-columns: 1fr;
  }

  .landing-reading-demo {
    grid-template-columns: 1fr;
  }

  .landing-demo-main,
  .landing-demo-discussion {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .landing-hero {
    padding: 42px 18px 58px;
  }

  .landing-hero h1 {
    font-size: clamp(2.6rem, 16vw, 4.2rem);
  }

  .landing-cover-composition {
    min-height: 330px;
  }

  .landing-cover {
    width: clamp(104px, 34vw, 148px);
  }

  .landing-cover-1 {
    left: 34%;
    top: 2%;
  }

  .landing-cover-2 {
    left: 2%;
    top: 24%;
  }

  .landing-cover-3 {
    right: 2%;
    top: 28%;
  }

  .landing-cover-4,
  .landing-cover-5 {
    display: none;
  }

  .landing-section,
  .landing-final-cta {
    width: min(100% - 28px, 1180px);
  }

  .landing-section-head {
    align-items: start;
    flex-direction: column;
  }

  .landing-feature-grid,
  .landing-stats,
  .landing-book-grid {
    grid-template-columns: 1fr;
  }

  .landing-reading-demo,
  .landing-demo-main,
  .landing-demo-discussion {
    padding: 16px;
  }

  .landing-demo-rating {
    align-items: start;
    flex-direction: column;
  }

  .landing-demo-rating {
    grid-template-columns: 1fr;
  }

  .landing-reactions span {
    width: 42px;
    height: 42px;
  }
}

.spotlight {
  display: grid;
  grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 36% 38%, var(--spotlight-wash), transparent 34%),
    linear-gradient(180deg, var(--spotlight-start), var(--spotlight-mid) 48%, var(--spotlight-end));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2), 0 0 34px var(--shadow-warm);
}

.spotlight-art {
  position: relative;
  display: grid;
  min-height: 320px;
  place-items: center;
  background:
    radial-gradient(circle at 52% 40%, var(--spotlight-art-wash), transparent 32%),
    linear-gradient(160deg, var(--spotlight-art-start), var(--spotlight-art-end));
  perspective: 1100px;
}

.real-cover-art {
  background:
    radial-gradient(circle at 54% 28%, var(--spotlight-wash), transparent 30%),
    linear-gradient(135deg, var(--elevated), var(--surface));
}

.spotlight-cover {
  position: relative;
  display: block;
  width: min(210px, 58%);
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  box-shadow: 0 26px 52px var(--shadow), 0 0 28px var(--shadow-warm);
  transform-origin: left center;
  transform-style: preserve-3d;
  animation: spotlightBookFlip 760ms cubic-bezier(.2, .72, .18, 1) both;
  will-change: transform, opacity;
}

.spotlight-cover-button {
  display: grid;
  width: min(210px, 58%);
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.spotlight-cover-button .spotlight-cover {
  width: 100%;
}

.spotlight-cover-button:hover .spotlight-cover,
.spotlight-cover-button:focus-visible .spotlight-cover {
  box-shadow: 0 28px 58px var(--shadow), 0 0 34px var(--shadow-warm);
  transform: translateY(-2px);
}

.spotlight-cover::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .26), transparent 22%),
    linear-gradient(110deg, transparent 42%, rgba(245, 241, 232, .12), transparent 58%);
  content: "";
  opacity: 0;
  animation: spotlightBookSheen 760ms ease both;
}

.spotlight-cover .cover-title-text {
  font-size: clamp(1.5rem, 4vw, 2.6rem);
}

.book-stack {
  position: absolute;
  inset: 36px 32px;
}

.cover {
  position: absolute;
  display: block;
  width: min(190px, 48vw);
  aspect-ratio: 0.68;
  border-radius: 6px;
  box-shadow: 0 24px 50px var(--shadow), 0 0 24px var(--shadow-warm);
  transform-origin: bottom center;
}

.cover-one {
  left: 20%;
  top: 8%;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 12%, transparent 12%),
    linear-gradient(145deg, #6f4d27, #2a1e14 58%, #15110d);
}

.cover-two {
  left: 38%;
  top: 16%;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 12%, transparent 12%),
    linear-gradient(145deg, #947744, #46301c 58%, #18130f);
  transform: rotate(8deg);
}

.cover-three {
  left: 4%;
  top: 22%;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 12%, transparent 12%),
    linear-gradient(145deg, #d7c89b, #60452b 58%, #211a14);
  transform: rotate(-10deg);
}

.spotlight-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 6vw, 72px);
  animation: spotlightCopyReveal 520ms ease both;
}

@keyframes spotlightBookFlip {
  0% {
    opacity: 0;
    transform: translateX(-14px) rotateY(-72deg) scale(.96);
  }

  62% {
    opacity: 1;
    transform: translateX(3px) rotateY(8deg) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0) scale(1);
  }
}

@keyframes spotlightBookSheen {
  0%,
  18% {
    opacity: .28;
    transform: translateX(-28%);
  }

  70% {
    opacity: .12;
    transform: translateX(18%);
  }

  100% {
    opacity: 0;
    transform: translateX(34%);
  }
}

@keyframes spotlightCopyReveal {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.spotlight-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.spotlight-switcher button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 900;
}

.spotlight-switcher button:hover,
.spotlight-switcher button:focus-visible {
  border-color: var(--line-hover);
  color: var(--accent-strong);
}

.spotlight-switcher button.active,
.spotlight-switcher button[aria-selected="true"] {
  border-color: var(--line-active);
  background: var(--accent-soft);
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.spotlight-meta,
.spotlight-description,
.book-author,
.book-tags,
.chapter-meta,
.comment-meta {
  color: var(--muted);
}

.spotlight-description {
  max-width: 52rem;
  margin: 10px 0 0;
}

.rating-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 24px 0;
}

.rating-score {
  color: var(--accent);
  font-size: 2rem;
  font-weight: 900;
}

.rating-stars {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.rating-summary {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 900;
}

.spotlight-actions,
.chapter-actions,
.comment-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.auth-button,
.text-button,
.segmented button,
.genre-list button,
.comment-form button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--text);
}

.primary-button {
  padding: 0 18px;
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-button:active {
  background: var(--accent-pressed);
  transform: translateY(1px);
}

.secondary-button,
.auth-button,
.text-button,
.comment-form button {
  padding: 0 16px;
  background: var(--surface);
}

.secondary-button:hover,
.secondary-button:focus-visible,
.auth-button:hover,
.auth-button:focus-visible,
.text-button:hover,
.text-button:focus-visible,
.comment-form button:hover,
.comment-form button:focus-visible {
  border-color: var(--line-hover);
  background: var(--elevated);
  color: var(--accent-strong);
}

.auth-button.signed-in {
  border-color: var(--line-active);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
}

.hidden {
  display: none !important;
}

.global-status {
  position: sticky;
  top: 71px;
  z-index: 9;
  margin: 0;
  padding: 10px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--elevated);
  color: var(--text);
  font-weight: 800;
}

.global-status.error {
  background: color-mix(in srgb, var(--danger) 20%, var(--panel));
  color: var(--text);
}

.global-status.success {
  background: color-mix(in srgb, var(--success) 20%, var(--panel));
}

.state-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.state-card strong {
  color: var(--text);
}

.state-card.error {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}

.state-card.success {
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
}

.loading-block {
  display: grid;
  gap: 10px;
}

.loading-line {
  min-height: 18px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface), var(--elevated), var(--surface));
  background-size: 220% 100%;
  animation: shimmer 1.1s ease-in-out infinite;
}

.loading-line.short {
  width: 48%;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.content-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  margin-top: 24px;
}

.home-sections {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.home-section {
  display: grid;
  gap: 14px;
}

.home-section-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.home-section-heading h2,
.home-state h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.home-section-heading p:not(.eyebrow),
.home-state p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
}

.home-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.home-book-card {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 132px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transform-origin: center;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.home-book-card:hover,
.home-book-card:focus-within {
  z-index: 2;
  border-color: var(--line-hover);
  background: var(--elevated);
  box-shadow: 0 18px 42px var(--shadow), 0 0 24px var(--shadow-warm);
  transform: scale(1.045);
}

.home-rank-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0 8px;
  background: var(--elevated);
  color: var(--text);
  font-size: .7rem;
  font-weight: 900;
  box-shadow: 0 8px 18px var(--shadow);
}

.home-rank-badge span {
  color: var(--accent-strong);
  font-size: .82rem;
}

.home-rank-badge strong {
  color: var(--text);
}

.crown-bronze .home-rank-badge {
  border-color: rgba(183, 114, 56, .55);
}

.crown-bronze .home-rank-badge span {
  color: #c98754;
}

.crown-silver .home-rank-badge {
  border-color: rgba(202, 206, 211, .58);
}

.crown-silver .home-rank-badge span {
  color: #9fa7b2;
}

.crown-gold .home-rank-badge {
  border-color: rgba(221, 185, 101, .62);
}

.crown-gold .home-rank-badge span {
  color: var(--accent-strong);
}

.home-cover-button {
  display: grid;
  width: 70px;
  height: 106px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 22%, var(--spotlight-wash), transparent 48%),
    var(--cover-shelf);
}

.home-book-cover {
  position: relative;
  display: block;
  width: 58px;
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: 5px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 18px var(--shadow), 0 0 18px var(--shadow-warm);
}

.home-book-cover .cover-genre,
.home-book-cover .cover-title-text,
.home-book-cover .cover-author-text {
  display: none;
}

.home-book-copy h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.home-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.home-state.error {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--line));
}

.profile-section,
.author-section,
.route-section {
  margin-top: 24px;
}

.route-page {
  display: grid;
  gap: 16px;
}

.route-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.route-cover {
  position: relative;
  display: block;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 36px var(--shadow), 0 0 24px var(--shadow-warm);
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.reading-status-control {
  display: inline-grid;
  gap: 4px;
  min-width: 160px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.reading-status-control select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
}

.route-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.route-panel h3 {
  margin-top: 0;
}

.legal-page {
  gap: 16px;
}

.legal-intro {
  max-width: 860px;
  color: var(--muted);
}

.legal-review-note {
  margin-top: 16px;
}

.legal-section-list article {
  display: grid;
  gap: 8px;
}

.legal-section-list p + p {
  margin-top: 2px;
}

.route-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.diagnostics-list {
  display: grid;
  gap: 10px;
}

.diagnostics-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.diagnostics-card strong {
  font-size: 0.95rem;
}

.diagnostics-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.diagnostics-card code {
  max-width: 100%;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.book-page {
  gap: 18px;
}

.book-page-hero {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 36px);
  align-items: start;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, var(--accent-soft), transparent 42%),
    var(--panel);
}

.book-page-cover-wrap {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
}

.book-page-cover {
  position: relative;
  display: block;
  width: min(220px, 100%);
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: 7px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 24px 48px var(--shadow);
}

.book-page-cover .cover-title-text {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.book-page-copy {
  min-width: 0;
}

.book-subtitle {
  max-width: 820px;
  margin: 8px 0 0;
  color: var(--accent-strong);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 800;
}

.book-description {
  max-width: 920px;
  color: var(--muted);
  line-height: 1.6;
}

.book-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.book-stat-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.book-stat-grid strong {
  display: block;
  color: var(--accent);
  font-size: 1.45rem;
  line-height: 1;
}

.book-stat-grid span {
  color: var(--muted);
  font-size: 0.88rem;
}

.book-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.metadata-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.metadata-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.metadata-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metadata-list dt {
  color: var(--muted);
  font-weight: 800;
}

.metadata-list dd {
  margin: 0;
  color: var(--text);
}

.rating-distribution {
  display: grid;
  gap: 8px;
}

.rating-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.rating-row > span {
  color: var(--text);
  font-weight: 900;
}

.rating-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
}

.rating-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0 0 4px;
}

.spoiler-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 800;
}

.spoiler-toggle input {
  accent-color: var(--accent);
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-shell {
  display: grid;
  gap: 14px;
}

.review-tools,
.review-form-footer,
.review-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.review-tools label,
.review-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.review-tools select,
.review-form input,
.review-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

.review-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.review-form textarea {
  min-height: 130px;
  resize: vertical;
}

.review-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.review-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.review-card-head > div:first-child {
  display: grid;
  gap: 3px;
}

.review-meta-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.review-body {
  margin-top: 10px;
}

.review-card p,
.review-body p {
  margin: 8px 0 0;
  color: var(--muted);
}

.review-card.spoiler-hidden {
  border-style: dashed;
}

.empty-state.compact {
  padding: 18px;
}

.mini-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mini-book-card {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

button.mini-book-card {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

button.mini-book-card:hover,
button.mini-book-card:focus-visible {
  border-color: var(--accent);
}

.mini-book-card span,
.mini-book-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-book-card span {
  font-weight: 800;
}

.mini-book-card small {
  grid-column: 2;
  color: var(--muted);
}

.profile-book-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-cover-button {
  display: grid;
  width: 60px;
  height: 90px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--panel-2);
}

.mini-book-cover {
  position: relative;
  display: block;
  width: 52px;
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: 4px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 18px var(--shadow);
}

.mini-book-cover .cover-genre,
.mini-book-cover .cover-title-text,
.mini-book-cover .cover-author-text {
  display: none;
}

.mini-book-card h4 {
  margin: 0 0 4px;
}

.author-hero {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, var(--accent-soft), transparent 44%),
    var(--panel);
}

.author-avatar {
  position: relative;
  display: grid;
  width: 84px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 2.4rem;
  font-weight: 900;
}

.author-avatar.has-image {
  background-position: center;
  background-size: cover;
  color: transparent;
}

.author-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.author-actions {
  margin-top: 12px;
}

.author-copy {
  min-width: 0;
}

.author-copy h3 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
}

.author-copy p {
  max-width: 820px;
  color: var(--muted);
}

.author-website {
  color: var(--accent);
  font-weight: 800;
}

.author-summary {
  margin-bottom: 16px;
}

.author-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.author-book-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.author-book-cover {
  width: 62px;
}

.author-book-card h4 {
  margin: 0;
}

.library-panel {
  margin-bottom: 16px;
}

.library-list-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.library-form,
.library-inline-form,
.library-note-form {
  display: grid;
  gap: 12px;
}

.library-form {
  max-width: 720px;
}

.library-inline-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
  margin: 12px 0;
}

.library-note-form {
  grid-column: 1 / -1;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  width: 100%;
}

.library-form label,
.library-inline-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.library-form input,
.library-form textarea,
.library-inline-form input,
.library-inline-form select,
.library-note-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
}

.library-form textarea {
  min-height: 88px;
  resize: vertical;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none;
  gap: 10px;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

.library-custom-lists {
  display: grid;
  gap: 16px;
}

.library-book-card .activity-actions {
  flex-wrap: wrap;
}

.social-profile-list {
  display: grid;
  gap: 10px;
}

.social-profile-chip {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.social-profile-chip span,
.social-profile-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-profile-chip small {
  grid-column: 2;
  color: var(--muted);
}

.social-avatar {
  position: relative;
  grid-row: 1 / span 2;
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 900;
}

.social-avatar.has-image {
  background-position: center;
  background-size: cover;
  color: transparent;
}

.activity-preferences {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.notification-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.notification-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.notification-card.unread {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.notification-title {
  margin: 0 0 4px;
  font-weight: 900;
}

.notification-copy {
  min-width: 0;
}

.notification-preferences {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.admin-dashboard .profile-summary {
  margin-top: 16px;
}

.admin-filterbar {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) minmax(220px, 1.3fr);
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.admin-note {
  margin-bottom: 12px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-card.compact {
  grid-template-columns: 1fr;
}

.admin-card h4 {
  margin: 0 0 4px;
  text-transform: capitalize;
}

.admin-card p {
  margin: 6px 0 0;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 280px;
}

.admin-actions .secondary-button {
  min-height: 34px;
  padding-inline: 10px;
}

.admin-cover-manager {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.admin-cover-preview {
  width: 72px;
  height: 108px;
  margin: 0;
}

.secondary-button.danger {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  color: var(--danger);
}

.author-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 800;
}

.author-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.author-link.inline {
  min-height: auto;
  color: var(--accent-strong);
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.profile-avatar {
  position: relative;
  width: 112px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 2.4rem;
  font-weight: 800;
  background-size: cover;
  background-position: center;
}

.profile-avatar.has-image {
  color: transparent;
}

.settings-avatar {
  width: 84px;
}

.profile-avatar-upload {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.profile-hero-copy h1,
.profile-hero-copy h2 {
  margin: 0 0 6px;
}

.profile-hero-copy p {
  margin: 0 0 10px;
}

.profile-stat,
.profile-panel,
.activity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profile-stat {
  padding: 16px;
}

.profile-stat strong {
  display: block;
  color: var(--accent);
  font-size: 1.8rem;
  line-height: 1;
}

.profile-stat span,
.activity-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 16px;
}

.profile-panel {
  padding: 16px;
}

.profile-settings-form textarea {
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--field);
  color: var(--text);
}

.profile-export {
  margin-top: 16px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
  color: var(--text);
}

.profile-panel h3 {
  margin: 0 0 12px;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 12px;
  content-visibility: auto;
  contain-intrinsic-size: 120px 420px;
}

.activity-card-text {
  grid-template-columns: 1fr;
}

.reading-dashboard-hero {
  grid-template-columns: minmax(0, 1fr);
}

.reading-dashboard-layout {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.activity-cover {
  position: relative;
  display: block;
  width: 46px;
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: 4px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 18px var(--shadow);
}

.activity-cover .cover-genre,
.activity-cover .cover-title-text,
.activity-cover .cover-author-text {
  display: none;
}

.activity-copy {
  min-width: 0;
}

.activity-card h4 {
  margin: 0;
  font-size: 1rem;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters {
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter-drawer-heading {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.filters h2 {
  margin: 20px 0 10px;
  font-size: 0.95rem;
}

.filters h2:first-child {
  margin-top: 0;
}

.filter-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.filter-field select,
.filter-field input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--field);
  color: var(--text);
}

.filter-field select:focus,
.filter-field input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented,
.genre-list {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button,
.genre-list button {
  padding: 0 10px;
  background: var(--surface);
}

.segmented button.active,
.genre-list button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.range-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.active-filter-chips p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.active-filter-chips button {
  min-height: 32px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.filter-clear-button {
  width: 100%;
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.catalog-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.filter-toggle,
.filter-drawer-heading {
  display: none;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
}

.section-heading p:last-child {
  color: var(--muted);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.book-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  content-visibility: auto;
  contain-intrinsic-size: 360px 320px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.book-card:hover,
.book-card:focus-within {
  border-color: var(--line-hover);
  background: color-mix(in srgb, var(--surface) 84%, var(--elevated));
  box-shadow: 0 16px 34px var(--shadow), 0 0 28px var(--shadow-warm);
  transform: translateY(-2px);
}

.cover-button {
  width: 100%;
  height: 230px;
  border: 0;
  background:
    radial-gradient(circle at 50% 18%, var(--spotlight-wash), transparent 50%),
    var(--cover-shelf);
}

.book-cover {
  position: relative;
  display: block;
  width: 112px;
  height: 170px;
  margin: 30px auto;
  overflow: hidden;
  border-radius: 6px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 36px var(--shadow), 0 0 24px var(--shadow-warm);
}

.designed-cover {
  isolation: isolate;
}

.has-cover-image {
  background-color: var(--cover-shelf);
  background-image:
    linear-gradient(90deg, transparent, rgba(214, 177, 90, 0.08), transparent),
    var(--cover-shelf);
  background-size: 180% 100%, cover;
  animation: cover-skeleton 1.4s ease-in-out infinite;
}

.designed-cover::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.28), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 42%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0 14%, transparent 14%);
  content: "";
}

.cover-spine {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 14%;
  background: rgba(0, 0, 0, 0.26);
}

.cover-photo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@keyframes cover-skeleton {
  0% {
    background-position: 120% 0, center;
  }

  100% {
    background-position: -120% 0, center;
  }
}

.cover-failed {
  display: grid;
  place-items: end center;
  padding: 10px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.26) 0 13%, transparent 13%),
    linear-gradient(145deg, var(--accent-soft), var(--panel-2));
}

.cover-failed::after {
  position: relative;
  z-index: 2;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  content: "Cover unavailable";
}

.cover-genre,
.cover-title-text,
.cover-author-text {
  position: relative;
  z-index: 1;
  display: block;
  margin-left: 18%;
  margin-right: 9%;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

.cover-genre {
  margin-top: 14%;
  font-size: 0.44rem;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.cover-title-text {
  margin-top: 24%;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.02;
}

.cover-author-text {
  position: absolute;
  right: 0;
  bottom: 8%;
  left: 0;
  font-size: 0.48rem;
  font-weight: 800;
  line-height: 1.12;
}

.has-cover-image .cover-spine,
.has-cover-image .cover-genre,
.has-cover-image .cover-title-text,
.has-cover-image .cover-author-text {
  display: none;
}

.book-card-body {
  padding: 14px;
}

.card-title-row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.card-title-row h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.25;
}

.score-pill {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 900;
}

.book-author,
.book-tags {
  margin: 8px 0;
  font-size: 0.92rem;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent-line) 70%, var(--line));
  border-radius: 999px;
  padding: 2px 9px;
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

button.tag-chip {
  appearance: none;
  cursor: pointer;
  font: inherit;
  line-height: 1.1;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

button.tag-chip:hover,
button.tag-chip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: 0;
  transform: translateY(-1px);
}

.detail-tags {
  margin: 14px 0 4px;
}

.text-button {
  width: 100%;
  margin-top: 8px;
}

.read-toggle {
  width: 100%;
  margin-top: 8px;
}

.read-toggle.is-read {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.book-dialog {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--modal);
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 30px var(--shadow-warm);
}

.book-dialog::backdrop {
  background: var(--overlay);
}

.auth-dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--modal);
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 30px var(--shadow-warm);
}

.auth-dialog::backdrop {
  background: var(--overlay);
}

.rating-dialog {
  width: min(430px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--modal);
  color: var(--text);
  box-shadow: 0 28px 80px var(--shadow), 0 0 30px var(--shadow-warm);
}

.rating-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}

.rating-shell {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px;
}

.rating-shell h2 {
  margin: -8px 36px 0 0;
  font-size: 1.45rem;
}

.rating-help {
  margin: -8px 0 0;
  color: var(--muted);
}

.rating-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.rating-field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--field);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
  outline: none;
}

.rating-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.rating-range-field input {
  padding: 0;
  accent-color: var(--accent);
}

.rating-stepper,
.rating-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rating-stepper .secondary-button {
  flex: 1 1 120px;
}

.rating-presets button {
  min-width: 42px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
}

.rating-presets button:hover,
.rating-presets button:focus,
.rating-presets button.active {
  border-color: var(--line-active);
  outline: 0;
  color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.rating-preview {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
}

.rating-preview span:first-child {
  color: var(--accent);
  font-size: 3rem;
  font-weight: 900;
}

.rating-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.auth-shell {
  position: relative;
  padding: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 36px 0 18px;
}

.auth-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.auth-tabs button.active {
  border-color: var(--line-active);
  color: var(--accent);
  background: var(--accent-soft);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form.hidden {
  display: none;
}

.auth-form h2 {
  margin: 0 0 4px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--field);
  color: var(--text);
}

.auth-form .auth-checkbox {
  grid-template-columns: 18px 1fr;
  align-items: start;
  color: var(--text);
}

.auth-form .auth-checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.auth-inline-link {
  width: fit-content;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.auth-inline-link:hover,
.auth-inline-link:focus-visible {
  color: var(--accent-strong);
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.success {
  color: var(--accent-2);
}

.dialog-shell {
  position: relative;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  font-size: 1.5rem;
}

.book-detail {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  padding: 28px;
}

.detail-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.68;
  overflow: hidden;
  border-radius: 6px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.42);
}

.detail-cover .cover-genre {
  font-size: 0.72rem;
}

.detail-cover .cover-title-text {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.detail-cover .cover-author-text {
  font-size: 0.82rem;
}

.detail-title {
  margin: 0 52px 8px 0;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
}

.chapter-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.chapter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chapter-bg);
}

.chapter-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.chapter-summary h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.chapter-score {
  display: grid;
  min-width: 64px;
  height: 44px;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}

.discussion {
  display: none;
  padding: 0 14px 14px;
}

.chapter.open .discussion {
  display: block;
}

.detail-poster {
  align-self: start;
}

.detail-poster-meta {
  margin-top: 14px;
}

.rating-line.compact {
  gap: 8px;
  margin: 0 0 12px;
}

.rating-line.compact .rating-score {
  font-size: 1.1rem;
}

.chapter-board {
  margin-top: 24px;
}

.chapter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
}

.chapter-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.chapter-grid-head {
  display: grid;
  grid-template-columns: 44px 92px minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.chapter {
  border: 0;
  background: transparent;
}

.chapter-summary {
  display: grid;
  width: 100%;
  grid-template-columns: 44px 92px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.chapter-index {
  display: grid;
  place-items: center;
  min-height: 54px;
  color: var(--muted);
  font-weight: 900;
}

.chapter-score {
  width: 92px;
  min-width: 0;
  height: 54px;
  font-size: 1.55rem;
  letter-spacing: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.chapter-copy {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chapter-copy h3 {
  margin: 0 0 2px;
  font-size: 0.98rem;
}

.chapter.open .chapter-copy,
.chapter-summary:hover .chapter-copy {
  border-color: var(--line-hover);
  background: var(--elevated);
}

.chapter.open .chapter-score {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.chapter .discussion {
  margin: 8px 0 4px 146px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--soft-panel) 72%, var(--surface));
}

.rating-awesome {
  background: #2f8f5a;
  color: #f5f1e8;
}

.rating-great {
  background: #3fa66b;
  color: #102015;
}

.rating-good {
  background: #d6b15a;
  color: #1a1612;
}

.rating-regular {
  background: #c98d2b;
  color: #1a1612;
}

.rating-bad {
  background: #c44d4d;
  color: #fff4f0;
}

.rating-garbage {
  background: #7f2e2e;
  color: #fff4f0;
}

.chapter-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--modal);
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 30px var(--shadow-warm);
}

.chapter-dialog::backdrop {
  background: var(--overlay);
}

.chapter-tile-grid {
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 16px 22px;
  margin-top: 18px;
}

.chapter-tile-row {
  display: grid;
  grid-template-columns: 34px minmax(94px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.chapter-tile-row .chapter-index {
  min-height: 72px;
  place-items: center;
  color: var(--muted);
}

.chapter-tile {
  display: grid;
  width: 100%;
  min-height: 72px;
  place-items: center;
  align-content: center;
  border: 0;
  border-radius: var(--radius);
  padding: 8px 10px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.chapter-tile:hover {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 0 18px var(--shadow-warm);
}

.chapter-score-number {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.chapter-tile-name {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-detail {
  padding: 28px;
}

.chapter-detail-head {
  display: grid;
  grid-template-columns: 46px 120px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-right: 34px;
}

.chapter-detail-head .chapter-tile {
  min-height: 82px;
}

.chapter-index.large {
  min-height: 82px;
  font-size: 1rem;
}

.chapter-detail h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.chapter-comments {
  margin-top: 18px;
}

.chapter-comments h3 {
  margin: 0 0 10px;
}

.chapter-discussion-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--soft-panel) 72%, var(--surface));
}

.chapter-discussion-summary {
  min-width: 0;
}

.chapter-discussion-summary strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.chapter-discussion-summary p {
  margin: 0;
}

.chapter-discussion-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}

.chapter-discussion-toolbar label,
.comment-sort-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.chapter-discussion-toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--field);
  color: var(--text);
}

.chapter-discussion-toolbar .spoiler-toggle {
  min-height: 34px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
}

.compact-control {
  min-height: 34px;
  padding-inline: 12px;
}

.comments {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.comment {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-muted);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.comment-avatar-wrap {
  min-width: 0;
}

.comment-avatar {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: .9rem;
  font-weight: 900;
}

button.comment-avatar {
  cursor: pointer;
}

button.comment-avatar:hover,
button.comment-avatar:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-body {
  min-width: 0;
}

.comment.reply {
  margin-left: 0;
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--surface) 86%, var(--elevated));
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.comment-head strong {
  font-size: .95rem;
  line-height: 1.2;
}

.comment-author-link {
  display: inline-flex;
  width: auto;
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: .95rem;
  font-weight: 900;
  line-height: 1.2;
}

.comment-author-link:hover,
.comment-author-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

.comment-head .tag-chip {
  min-height: 20px;
  padding-inline: 7px;
  font-size: .72rem;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 10px;
}

.comment-action {
  display: inline-flex;
  width: auto;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

.comment-action:hover,
.comment-action:focus-visible {
  background: var(--surface);
  color: var(--text);
}

.comment-action-primary {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.comment-action-primary:hover,
.comment-action-primary:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
}

.comment-action.danger {
  color: var(--danger);
}

.comment-action-menu {
  position: relative;
}

.comment-action-menu summary {
  display: inline-flex;
  min-height: 28px;
  cursor: pointer;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
  list-style: none;
}

.comment-action-menu summary::-webkit-details-marker {
  display: none;
}

.comment-action-menu summary:hover,
.comment-action-menu summary:focus-visible {
  background: var(--surface);
  color: var(--text);
}

.comment-action-menu-content {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + 4px);
  display: grid;
  min-width: 132px;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 30px var(--shadow);
}

.comment-action-menu-content .comment-action {
  justify-content: flex-start;
}

.comment-replies {
  display: grid;
  gap: 10px;
  margin-left: 18px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.route-panel,
.profile-panel,
.profile-stat,
.activity-card,
.review-card,
.review-shell,
.notification-card,
.admin-card,
.home-book-card,
.author-book-card,
.mini-book-card,
.rating-distribution,
.chapter-discussion-toolbar,
.library-book-card,
.list-card,
.state-card {
  border-color: var(--line);
  background-color: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.route-panel:hover,
.profile-panel:hover,
.activity-card:hover,
.review-card:hover,
.notification-card:hover,
.home-book-card:hover,
.author-book-card:hover,
button.mini-book-card:hover,
.library-book-card:hover,
.list-card:hover {
  border-color: var(--line-hover);
  box-shadow: 0 16px 34px var(--shadow), 0 0 24px var(--shadow-warm);
}

input,
select,
textarea,
.review-tools select,
.review-form input,
.review-form textarea,
.library-form input,
.library-inline-form input,
.library-inline-form select,
.library-note-form input,
.filter-field select,
.filter-field input,
.chapter-discussion-toolbar select {
  border-color: var(--line);
  border-radius: var(--radius);
  background-color: var(--field);
  color: var(--text);
}

input:hover,
select:hover,
textarea:hover,
.review-tools select:hover,
.review-form input:hover,
.review-form textarea:hover,
.library-form input:hover,
.library-inline-form input:hover,
.library-inline-form select:hover,
.library-note-form input:hover,
.filter-field select:hover,
.filter-field input:hover,
.chapter-discussion-toolbar select:hover {
  border-color: var(--line-hover);
}

input:focus,
select:focus,
textarea:focus,
.review-tools select:focus,
.review-form input:focus,
.review-form textarea:focus,
.library-form input:focus,
.library-inline-form input:focus,
.library-inline-form select:focus,
.library-note-form input:focus,
.filter-field select:focus,
.filter-field input:focus,
.chapter-discussion-toolbar select:focus {
  border-color: var(--line-active);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  color: var(--disabled);
  cursor: not-allowed;
  opacity: .62;
}

.comment p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.comment-form.compact {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.comment-form.compact textarea {
  min-height: 64px;
}

.comment-form.compact button {
  min-height: 34px;
  padding-inline: 12px;
}

.moderation-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.comment-form textarea {
  flex: 1 1 260px;
  min-height: 42px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--field);
  color: var(--text);
}

:root[data-theme="dark"] .chapter-dialog {
  border-color: #6a5235;
  background: #2a211b;
  color: #fffaf0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62), 0 0 38px rgba(214, 177, 90, 0.14);
}

:root[data-theme="dark"] .chapter-dialog::backdrop {
  background: rgba(8, 6, 4, 0.82);
}

:root[data-theme="dark"] .chapter-detail {
  background:
    radial-gradient(circle at 10% 0%, rgba(214, 177, 90, 0.08), transparent 34%),
    #2a211b;
}

:root[data-theme="dark"] .chapter-detail h2,
:root[data-theme="dark"] .chapter-discussion-summary strong,
:root[data-theme="dark"] .chapter-dialog .comment p,
:root[data-theme="dark"] .chapter-dialog .comment-author-link {
  color: #fffaf0;
}

:root[data-theme="dark"] .chapter-detail .eyebrow {
  color: #e8c977;
}

:root[data-theme="dark"] .chapter-detail-head p,
:root[data-theme="dark"] .chapter-discussion-summary p,
:root[data-theme="dark"] .chapter-dialog .comment-head time,
:root[data-theme="dark"] .chapter-dialog .comment-meta {
  color: #d8cfc1;
}

:root[data-theme="dark"] .chapter-dialog .chapter-discussion-toolbar {
  border-color: #6a5235;
  background-color: #33281f;
}

:root[data-theme="dark"] .chapter-dialog .comment {
  border-color: #5b462f;
  border-left-color: #d6b15a;
  background-color: #1a1511;
  color: #fffaf0;
}

:root[data-theme="dark"] .chapter-dialog .comment.reply {
  background-color: #18130f;
}

:root[data-theme="dark"] .chapter-discussion-toolbar label,
:root[data-theme="dark"] .comment-sort-control {
  color: #e8ddcd;
}

:root[data-theme="dark"] .chapter-discussion-toolbar select,
:root[data-theme="dark"] .chapter-discussion-toolbar .spoiler-toggle,
:root[data-theme="dark"] .chapter-dialog .comment-form textarea {
  border-color: #6a5235;
  background: #1a1511;
  color: #fffaf0;
}

:root[data-theme="dark"] .chapter-dialog .comment-form textarea::placeholder {
  color: #a99c89;
}

:root[data-theme="dark"] .chapter-dialog .comment-form button,
:root[data-theme="dark"] .chapter-dialog .compact-control,
:root[data-theme="dark"] .chapter-dialog .text-button,
:root[data-theme="dark"] .chapter-dialog .secondary-button {
  border-color: #6a5235;
  background: #1a1511;
  color: #fffaf0;
}

:root[data-theme="dark"] .chapter-dialog .comment-form button:hover,
:root[data-theme="dark"] .chapter-dialog .comment-form button:focus-visible,
:root[data-theme="dark"] .chapter-dialog .compact-control:hover,
:root[data-theme="dark"] .chapter-dialog .compact-control:focus-visible,
:root[data-theme="dark"] .chapter-dialog .text-button:hover,
:root[data-theme="dark"] .chapter-dialog .text-button:focus-visible,
:root[data-theme="dark"] .chapter-dialog .secondary-button:hover,
:root[data-theme="dark"] .chapter-dialog .secondary-button:focus-visible {
  border-color: #d6b15a;
  background: rgba(214, 177, 90, 0.14);
  color: #fffaf0;
}

:root[data-theme="dark"] .chapter-dialog .comment-action-menu-content {
  border-color: #6a5235;
  background: #1a1511;
}

.login-required {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--soft-panel);
}

.guideline-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.guideline-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft-panel);
}

.guideline-list h3 {
  margin: 0 0 6px;
}

.guideline-list p {
  margin: 0;
  color: var(--muted);
}

.login-required button {
  margin-left: 8px;
}

.empty-state {
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
    width: min(100% - 24px, 760px);
    margin-top: 8px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    order: 3;
  }

  .nav-actions {
    flex-wrap: wrap;
    justify-content: end;
  }

  .spotlight,
  .content-grid,
  .book-detail,
  .book-page-hero,
  .book-detail-grid,
  .route-hero,
  .profile-layout,
  .profile-summary,
  .author-hero {
    grid-template-columns: 1fr;
  }

  .spotlight-art {
    min-height: 260px;
  }

  .home-section-heading {
    align-items: start;
    flex-direction: column;
  }

  .book-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-inline-form,
  .library-list-header,
  .notification-heading,
  .admin-filterbar,
  .admin-card {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .admin-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .panel-heading,
  .review-card div {
    align-items: start;
    flex-direction: column;
  }

  .chapter-discussion-toolbar {
    grid-template-columns: 1fr;
  }

  .chapter-discussion-controls {
    justify-content: flex-start;
  }

  .filter-toggle {
    display: inline-flex;
  }

  .filter-drawer-heading {
    display: flex;
  }

  body.filters-open {
    overflow: hidden;
  }

  body.filters-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(0, 0, 0, 0.58);
  }

  .filters {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(360px, calc(100vw - 28px));
    max-width: 100%;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0 8px 8px 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 22px 0 60px var(--shadow);
  }

  .filters.open {
    transform: translateX(0);
  }
}

@media (max-width: 560px) {
  main {
    padding-inline: 12px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    width: calc(100% - 20px);
    padding: 9px 10px;
  }

  .brand span:last-child {
    display: none;
  }

  .nav-actions {
    gap: 6px;
    justify-content: flex-end;
  }

  .icon-button,
  .close-button {
    width: 40px;
    height: 40px;
  }

  .nav-link-button,
  .auth-button {
    min-height: 40px;
    padding-inline: 10px;
  }

  .nav-actions .auth-button {
    max-width: min(150px, 42vw);
  }

  .user-menu-wrap .auth-button {
    max-width: 48px;
    padding-inline: 8px;
  }

  .account-name,
  .account-caret {
    display: none;
  }

  .user-menu {
    right: 0;
    width: min(230px, calc(100vw - 24px));
  }

  .section-heading,
  .catalog-heading-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalog-heading-actions {
    width: 100%;
  }

  .filter-toggle {
    width: 100%;
    justify-content: center;
  }

  .spotlight-copy,
  .book-detail {
    padding: 18px;
  }

  .book-page-cover-wrap {
    padding: 12px;
  }

  .book-stat-grid,
  .metadata-list div,
  .rating-row,
  .mini-book-grid,
  .library-note-form,
  .notification-card,
  .admin-filterbar,
  .admin-card {
    grid-template-columns: 1fr;
  }

  .rating-row {
    gap: 4px;
  }

  .spotlight-cover {
    width: min(170px, 56%);
  }

  .home-shelf-grid,
  .home-book-card {
    grid-template-columns: 1fr;
  }

  .home-book-card {
    align-items: start;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .book-card,
  .profile-panel,
  .route-panel {
    min-width: 0;
  }

  .profile-hero,
  .author-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .profile-avatar,
  .author-avatar {
    width: min(112px, 32vw);
  }

  .book-dialog,
  .auth-dialog,
  .rating-dialog,
  .chapter-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .rating-shell,
  .auth-shell {
    padding: 20px;
  }

  .rating-actions,
  .spotlight-actions,
  .route-actions,
  .activity-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rating-actions button,
  .spotlight-actions button,
  .route-actions button,
  .activity-actions button {
    width: 100%;
  }

  .chapter-summary {
    grid-template-columns: 38px 78px minmax(0, 1fr);
  }

  .chapter-grid-head {
    grid-template-columns: 38px 78px minmax(0, 1fr);
  }

  .chapter-score {
    width: 78px;
    font-size: 1.25rem;
  }

  .chapter .discussion {
    margin-left: 0;
  }

  .chapter-tile-grid {
    grid-template-columns: 1fr;
  }

  .chapter-detail-head {
    grid-template-columns: 38px 92px minmax(0, 1fr);
    margin-right: 28px;
  }

  .chapter-detail {
    padding: 20px;
  }

  .chapter-discussion-toolbar {
    padding: 12px;
  }

  .chapter-discussion-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .chapter-discussion-toolbar select,
  .chapter-discussion-toolbar .spoiler-toggle,
  .compact-control {
    width: 100%;
  }

  .comment {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px;
  }

  .comment-avatar {
    width: 32px;
    height: 32px;
    font-size: .8rem;
  }

  .comment-actions {
    gap: 2px;
  }

  .comment-action,
  .comment-action-menu summary {
    min-height: 32px;
    padding-inline: 8px;
  }

  .comment-replies {
    margin-left: 8px;
    padding-left: 10px;
  }

  .comment-action-menu-content {
    right: auto;
    left: 0;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .book-dialog,
  .auth-dialog,
  .rating-dialog,
  .chapter-dialog {
    max-height: calc(100dvh - 12px);
  }

  .dialog-shell,
  .chapter-detail,
  .auth-shell,
  .rating-shell {
    max-height: calc(100dvh - 14px);
    overflow-y: auto;
  }
}
