:root {
  --paper: #f8f6f0;
  --ink: #223a32;
  --muted: #777c70;
  --line: #dfdfd3;
  --green: #385b48;
  --accent: #d4ea98;
  --white: #fffef9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 14px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #a2b878;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: clamp(36px, 3.6vw, 58px);
  line-height: 1.12;
  letter-spacing: -1.8px;
  margin-bottom: 20px;
}
h1 em {
  font-weight: 400;
  color: #55725a;
}
h2 {
  font-size: 32px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.9px;
  font-weight: bold;
  margin-bottom: 22px;
}
.muted,
.fine {
  color: var(--muted);
  line-height: 1.7;
}
.fine {
  font-size: 12px;
}
.lead {
  color: #727b6d;
  line-height: 1.8;
  font-size: 15px;
}
.brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  font:
    italic 35px Georgia,
    serif;
  white-space: nowrap;
}
.brand > span:last-child {
  font:
    20px Georgia,
    serif;
  letter-spacing: -0.6px;
  margin-left: 16px;
}
.brand-lines {
  font: 30px Georgia;
  color: #89a36a;
  margin: 0 -3px;
}
.topbar {
  height: 95px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  background: var(--paper);
}
.edition-label {
  letter-spacing: 2px;
  font-size: 9px;
  color: var(--muted);
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 10px;
}
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  max-width: 1680px;
  margin: auto;
  padding: 0 4vw;
  gap: 40px;
}
aside {
  padding-top: 43px;
  border-right: 1px solid var(--line);
  padding-right: 24px;
  min-height: calc(100vh - 95px);
  display: flex;
  flex-direction: column;
}
aside > .eyebrow {
  color: var(--muted);
  font-size: 9px;
}
aside > nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-button {
  border: 0;
  background: none;
  text-align: left;
  color: var(--muted);
  padding: 14px 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 5px;
  font-size: 17px;
}
.nav-button span {
  font-size: 12px;
}
.nav-button.active {
  background: #e8eddf;
  color: var(--ink);
}
.taste {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.taste .eyebrow {
  font-size: 9px;
  line-height: 1.8;
}
.tag {
  display: inline-block;
  border: 1px solid #dce1d2;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 10px;
  margin: 0 5px 6px 0;
  color: #65735f;
}
.taste .tag {
  background: #eef0e6;
}
.aside-footer {
  margin-top: auto;
  padding: 70px 0 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}
.aside-footer a {
  text-decoration: none;
}
.aside-footer p {
  margin-top: 18px;
}
.main-content {
  padding: 43px 0 20px;
  min-width: 0;
}
.hero {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 30px;
}
.hero .eyebrow {
  color: #62734b;
}
.hero .lead {
  max-width: 680px;
  font-size: 13px;
}
.progress-card {
  border: 1px solid var(--line);
  padding: 22px;
  background: #f0f1e7;
  width: 176px;
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: 6px;
}
.progress-card strong {
  font: 40px Georgia;
  display: block;
}
.progress-card > span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin: 6px 0 18px;
}
.progress-card small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
  display: block;
}
.progress-dots {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.progress-dots i {
  display: block;
  flex: 1;
  height: 4px;
  background: #d8decd;
}
.progress-dots i.on {
  background: var(--green);
}
.toolbar {
  display: flex;
  gap: 12px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 14px;
}
.search-wrap > span {
  font-size: 26px;
  color: #7e8a73;
}
.search-wrap input {
  width: 100%;
  padding: 14px 0;
  background: none;
  border: 0;
  outline: none;
  font-size: 12px;
  color: var(--ink);
}
select,
.secondary {
  background: transparent;
  border: 1px solid var(--line);
  padding: 12px 16px;
  color: var(--ink);
  border-radius: 5px;
  font-size: 12px;
}
.results-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  margin: 22px 0;
}
.results-line > span:last-child {
  font-size: 9px;
  letter-spacing: 1.5px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.book-card {
  background: var(--white);
  border: 1px solid #e5e4d9;
  border-radius: 5px;
  padding: 17px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}
.book-card:hover {
  box-shadow: 0 7px 22px #2339220a;
}
.book-top {
  display: flex;
  gap: 14px;
  min-height: 128px;
  margin-bottom: 13px;
}
.cover {
  border: 0;
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 119px;
  padding: 11px 9px 10px 12px;
  text-align: left;
  border-radius: 1px 3px 3px 1px;
  box-shadow: 3px 4px 6px #0002;
  color: #fcf7dc;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cover::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  height: 100%;
  border-left: 1px solid #ffffff40;
}
.cover::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border: 1px solid #ffffff30;
  border-radius: 50%;
  bottom: -28px;
  right: -25px;
}
.cover span {
  font:
    12px/1.25 Georgia,
    serif;
}
.cover small {
  font-size: 7px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.palette-0 {
  background: #44624f;
}
.palette-1 {
  background: #9b503d;
}
.palette-2 {
  background: #c3a364;
  color: #302f24;
}
.palette-3 {
  background: #3d5368;
}
.palette-4 {
  background: #70647e;
}
.palette-5 {
  background: #727455;
}
.book-meta {
  min-width: 0;
}
.book-title {
  border: 0;
  background: transparent;
  text-align: left;
  font: 18px/1.3 Georgia;
  color: var(--ink);
  padding: 2px 0 8px;
}
.book-author {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 10px;
}
.book-meta .tag {
  font-size: 9px;
  padding: 4px 7px;
}
.rating-label {
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 9px;
}
.rating-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.rate {
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: #667260;
  font-size: 10px;
}
.rate:hover,
.rate.selected {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.rating-scale {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: #93988d;
  margin: 6px 0 12px;
}
.card-actions {
  border-top: 1px solid #eeede5;
  padding-top: 10px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.card-actions button {
  padding: 5px 0;
  background: none;
  border: 0;
  color: #7b846f;
  font-size: 10px;
}
.card-actions button.saved {
  color: #3e674a;
  font-weight: bold;
}
.reason {
  font-size: 11px;
  line-height: 1.7;
  color: #687559;
  background: #f2f4e9;
  padding: 11px;
  margin: 0 0 12px;
  border-radius: 3px;
}
.reason strong {
  font-weight: normal;
  color: #344b38;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  margin: 30px 0;
  font-size: 12px;
  color: var(--muted);
}
.catalog-footer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  color: #969b8f;
  font-size: 10px;
  line-height: 1.8;
}
.notice {
  padding: 16px;
  background: #edf0e2;
  margin-bottom: 20px;
  font-size: 12px;
  line-height: 1.7;
}
.empty {
  padding: 35px 0;
  grid-column: 1/-1;
  line-height: 1.8;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #263f32;
  color: white;
  padding: 14px 23px;
  border-radius: 6px;
  box-shadow: 0 4px 30px #0002;
  z-index: 20;
  font-size: 12px;
  max-width: 90vw;
}
dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 35px;
  max-width: 540px;
  width: 90vw;
}
dialog::backdrop {
  background: #182b2390;
}
.dialog-close {
  float: right;
}
dialog h2 {
  padding-top: 20px;
  margin-bottom: 10px;
}
dialog p {
  line-height: 1.9;
}
dialog .source {
  font-size: 11px;
  color: var(--muted);
}
.login-layout {
  max-width: 1180px;
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: center;
  gap: 120px;
  padding: 55px;
}
.login-story .brand {
  margin-bottom: 70px;
}
.login-story h1 {
  font-size: 66px;
}
.login-story .eyebrow {
  color: #879071;
}
.login-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 38px;
  box-shadow: 0 16px 65px #36412407;
}
.login-box h2 {
  margin-bottom: 15px;
}
.login-box form {
  margin-top: 30px;
}
.login-box label {
  display: block;
  font-size: 11px;
  margin-bottom: 9px;
}
.login-box input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  padding: 13px;
  margin-bottom: 22px;
  border-radius: 4px;
  background: #fffefb;
}
.primary {
  border: 0;
  border-radius: 4px;
  padding: 15px 18px;
  background: var(--green);
  color: white;
}
.login-submit {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  margin: 30px 0 20px;
  font-size: 12px;
}
.login-box .fine {
  margin: 0;
  font-size: 10px;
}
.book-art {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 190px;
  margin: 30px 0;
}
.art-book {
  height: 150px;
  width: 103px;
  padding: 18px 13px;
  font: 18px/1.4 Georgia;
  box-shadow: 4px 4px 0 #263f3210;
  letter-spacing: 1px;
  border-left: 5px solid #ffffff20;
}
.b1 {
  background: #466552;
  color: #eef0d8;
  transform: rotate(-9deg);
  height: 159px;
}
.b2 {
  background: #d7cba5;
  color: #4c503c;
  height: 181px;
  transform: rotate(2deg);
}
.b3 {
  background: #9f614c;
  color: #ffecd0;
  transform: rotate(9deg);
  height: 157px;
}
.error {
  color: #a34030;
  line-height: 1.6;
  font-size: 12px;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1550px) {
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1150px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workspace {
    gap: 25px;
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .progress-card {
    width: 145px;
    padding: 16px;
  }
  .login-layout {
    gap: 60px;
  }
  .login-story h1 {
    font-size: 54px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 75px;
    padding: 0 20px;
  }
  .edition-label {
    display: none;
  }
  .brand > span:last-child {
    font-size: 18px;
  }
  .workspace {
    display: block;
    padding: 0 20px;
  }
  aside {
    min-height: 0;
    border: 0;
    padding: 20px 0 0;
  }
  .taste,
  .aside-footer,
  aside > .eyebrow {
    display: none;
  }
  aside > nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }
  .nav-button {
    padding: 10px 5px;
    flex-direction: column;
    gap: 7px;
    text-align: center;
  }
  .nav-button span {
    font-size: 9px;
  }
  .main-content {
    padding-top: 30px;
  }
  .hero {
    gap: 15px;
    padding-bottom: 15px;
  }
  h1 {
    font-size: 36px;
  }
  .hero .lead {
    font-size: 12px;
  }
  .progress-card {
    width: 100px;
    padding: 13px;
  }
  .progress-card strong {
    font-size: 30px;
  }
  .progress-card > span {
    font-size: 9px;
  }
  .progress-card small {
    font-size: 9px;
  }
  .hero .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .toolbar {
    gap: 8px;
  }
  select,
  .secondary {
    padding: 10px 8px;
    font-size: 10px;
  }
  .book-grid {
    gap: 12px;
  }
  .book-card {
    padding: 12px;
  }
  .book-top {
    display: block;
    min-height: 0;
  }
  .cover {
    width: 72px;
    height: 104px;
    margin-bottom: 14px;
  }
  .book-title {
    font-size: 17px;
  }
  .book-meta .tag {
    font-size: 8px;
  }
  .rating-row {
    gap: 2px;
  }
  .rate {
    font-size: 9px;
    padding: 8px 0;
  }
  .card-actions {
    flex-wrap: wrap;
  }
  .rating-label {
    font-size: 9px;
  }
  .book-author {
    min-height: 30px;
  }
  .login-layout {
    display: block;
    padding: 35px 24px;
    max-width: 500px;
  }
  .login-story .brand {
    margin-bottom: 40px;
  }
  .login-story h1 {
    font-size: 46px;
  }
  .login-story .lead,
  .book-art,
  .login-story > .fine {
    display: none;
  }
  .login-story .eyebrow {
    font-size: 8px;
  }
  .login-box {
    padding: 28px;
    margin-top: 35px;
  }
  .login-box h2 {
    font-size: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.cover.has-image {
  padding: 0;
}
.cover.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover.has-image small,
.cover.has-image span {
  display: none;
}

/* Book details keep source prose readable and edition facts grouped. */
dialog { width: min(760px, calc(100vw - 32px)); max-height: 90vh; overflow-y: auto; }
.book-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.book-facts { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr; gap: 8px 16px; font-size: 14px; }
.book-facts dt { color: var(--muted, #777); }
.book-facts dd { margin: 0; overflow-wrap: anywhere; }
.edition-section { border-top: 1px solid #ddd; margin-top: 24px; padding-top: 16px; }
.edition-section select { display: block; width: 100%; max-width: 100%; margin: 10px 0 18px; }
.edition-cover { max-width: 140px; max-height: 210px; object-fit: contain; margin: 12px 0; }
.author-details { margin: 12px 0; }
.author-details summary { cursor: pointer; }
.edition-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-page { max-width: 760px; padding: 40px 24px; margin: auto; }
.status-page .book-facts { margin: 28px 0; }
.reader-settings { margin: 22px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.reader-settings summary { cursor: pointer; margin-bottom: 12px; }
.reader-settings label { display: block; margin-top: 12px; font-size: 13px; }
.reader-settings select { width: 100%; margin-top: 5px; padding: 8px; }
.reader-settings .fine { margin-top: 12px; }
body[data-text-size="large"] .book-description { font-size: 20px; line-height: 1.65; }
body[data-text-size="large"] .book-facts, body[data-text-size="large"] .author-details { font-size: 17px; }

.author-page { max-width: 1180px; padding: 36px 24px; margin: auto; }
.author-biography { max-width: 850px; margin: 24px 0; }
.author-biography summary { cursor: pointer; }
.book-author a { color: inherit; text-underline-offset: 3px; }
.author-page a.book-title { text-decoration: none; }

/* Book pages keep the cover, rating and share action together on narrow screens. */
.detail-heading { display:flex; gap:24px; align-items:flex-start; margin-bottom:20px; }
.detail-heading > div:last-child { min-width:0; flex:1; }
.detail-cover { width:130px; height:190px; flex:0 0 130px; }
.detail-heading h2 { margin-top:0; }
#detail-interaction { margin:18px 0 24px; max-width:540px; }
.share-url { display:block; width:100%; margin-top:10px; padding:8px; }
.share-url[hidden] { display:none; }
.other-editions { margin-top:18px; }
.other-editions summary { cursor:pointer; padding:8px 0; }
@media (max-width:480px) {
  .detail-heading { gap:14px; }
  .detail-cover { width:90px; height:135px; flex-basis:90px; font-size:13px; }
  .detail-heading h2 { font-size:24px; }
  #detail-interaction .rating-row { gap:3px; }
}

/* Pagination is independent of the sidebar navigation layout. */
.pagination,
.edition-pagination {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 2vw, 16px);
}
.pagination > span,
.edition-pagination > span {
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pagination .secondary,
.edition-pagination .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.pagination a:focus-visible,
.pagination button:focus-visible,
.edition-pagination button:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.edition-pagination .secondary { padding-inline: 8px; white-space: normal; }

/* Reader controls on author/series pages share the main workspace touch sizing. */
.author-page .rate,
.series-page .rate,
.author-page .card-actions button,
.series-page .card-actions button {
  min-height: 44px;
  font-size: 12px;
}
@media (max-width: 900px) {
  .author-page .rating-row,
  .series-page .rating-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
}
@media (max-width: 640px) {
  .author-page .book-grid,
  .series-page .book-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
