.bookstore-page {
  --bookstore-accent: #b89f7a;
  --bookstore-accent-dark: #8b6f48;
  --bookstore-soft: #faf3e8;
  --bookstore-warm: #eadcc6;
  --bookstore-paper: #ffffff;
  --bookstore-border: #eee4d6;
  --bookstore-ink: #34291d;
  background: #ffffff;
  color: var(--bookstore-ink);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

:root.theme-dark .bookstore-page {
  --bookstore-accent: #b9ad9e;
  --bookstore-accent-dark: #eadfce;
  --bookstore-soft: #2b2824;
  --bookstore-warm: #3a352f;
  --bookstore-paper: #211f1c;
  --bookstore-border: #3a342c;
  --bookstore-ink: #f1eadf;
  background: #171513;
  color: var(--bookstore-ink);
}

.bookstore-header {
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

:root.theme-dark .bookstore-header {
  background: rgba(23, 21, 19, .86);
}

.bookstore-author-entry {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  color: var(--bookstore-accent-dark);
  background: rgba(184, 159, 122, .16);
}

.bookstore-shell {
  height: calc(100% - 56px - 64px - env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 14px calc(52px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.bookstore-page[data-view="reader"] .bookstore-header,
.bookstore-page[data-view="reader"] .bookstore-tabbar {
  display: none;
}

.bookstore-page[data-view="reader"] .bookstore-shell {
  height: 100%;
  padding: 0;
}

.bookstore-hero {
  min-height: 174px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border-radius: 22px;
  background: #eadcc6;
  color: #3d2f20;
  border: 1px solid var(--bookstore-border);
}

.bookstore-search {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-radius: 21px;
  background: rgba(255, 253, 248, .68);
  color: #8b6f48;
  font-size: 14px;
}

.bookstore-hero-copy p,
.bookstore-hero-copy h2 {
  margin: 0;
}

.bookstore-hero-copy p,
.bookstore-hero-copy span {
  color: rgba(61, 47, 32, .66);
  font-size: 12px;
}

.bookstore-hero-copy h2 {
  margin: 6px 0;
  max-width: none;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.bookstore-channel-row {
  display: flex;
  gap: 8px;
  margin: 14px -14px 8px;
  padding: 0 14px 4px;
  overflow-x: auto;
}

.bookstore-channel-row button,
.bookstore-author-tabs button,
.bookstore-category-grid button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--bookstore-paper);
  color: #806d55;
  font-size: 13px;
  border: 1px solid var(--bookstore-border);
}

.bookstore-channel-row button.active,
.bookstore-author-tabs button.active {
  background: var(--bookstore-accent-dark);
  color: #fff;
}

.bookstore-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.bookstore-quick {
  min-width: 0;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 16px;
  background: var(--bookstore-paper);
  color: #4f3f2d;
  font-size: 12px;
  border: 1px solid var(--bookstore-border);
}

.bookstore-quick i {
  color: var(--bookstore-accent-dark);
  font-size: 19px;
}

.bookstore-section {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: var(--bookstore-paper);
  border: 1px solid var(--bookstore-border);
}

.bookstore-section h2,
.bookstore-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0;
}

.bookstore-section p {
  margin: 0;
  color: #8a745a;
  line-height: 1.55;
}

.bookstore-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bookstore-section-head h3 {
  margin: 0;
}

.bookstore-section-head button,
.bookstore-section-head span {
  color: var(--bookstore-accent-dark);
  font-size: 12px;
}

.bookstore-book-list {
  display: grid;
  gap: 0;
}

.bookstore-book-card {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 11px;
  padding: 12px 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}

.bookstore-book-card + .bookstore-book-card {
  border-top: 1px solid var(--bookstore-border);
}

.bookstore-cover {
  width: 54px;
  min-width: 54px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eadcc6;
  color: var(--bookstore-accent-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
}

.bookstore-cover svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.bookstore-cover.large {
  width: 78px;
  min-width: 78px;
  height: 104px;
  font-size: 28px;
}

.bookstore-cover.large svg {
  width: 30px;
  height: 30px;
}

.bookstore-book-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bookstore-book-copy strong {
  font-size: 15px;
}

.bookstore-book-copy em,
.bookstore-book-copy small,
.bookstore-book-copy span {
  color: #8a745a;
  font-style: normal;
  font-size: 12px;
  line-height: 1.38;
}

.bookstore-book-copy span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bookstore-heat {
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(184, 159, 122, .16);
  color: var(--bookstore-accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.bookstore-rank-list,
.bookstore-chapter-list,
.bookstore-work-list {
  display: grid;
  gap: 8px;
}

.bookstore-rank-list button,
.bookstore-chapter-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--bookstore-border);
  color: inherit;
  text-align: left;
}

.bookstore-rank-list b {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bookstore-soft);
  color: var(--bookstore-accent-dark);
}

.bookstore-rank-list span {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.bookstore-rank-list em {
  color: #8a745a;
  font-style: normal;
  font-size: 12px;
}

.bookstore-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bookstore-detail-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.bookstore-detail h2,
.bookstore-detail p,
.bookstore-detail em {
  margin: 0;
}

.bookstore-detail em {
  display: block;
  margin-top: 8px;
  color: #8a745a;
  font-style: normal;
  font-size: 12px;
}

.bookstore-intro {
  margin-top: 14px !important;
  color: #5e4934;
  line-height: 1.7;
}

.bookstore-tags,
.bookstore-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.bookstore-tags {
  flex-wrap: wrap;
}

.bookstore-detail-actions {
  flex-wrap: nowrap;
}

.bookstore-tags span {
  padding: 5px 9px;
  border-radius: 10px;
  background: var(--bookstore-soft);
  color: var(--bookstore-accent-dark);
  font-size: 12px;
}

.bookstore-detail-actions button,
.bookstore-author-card button,
.bookstore-write-panel button,
.bookstore-work-list button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  background: var(--bookstore-accent-dark);
  color: #fff;
  font-weight: 650;
}

.bookstore-detail-actions button.secondary {
  background: var(--bookstore-soft);
  color: var(--bookstore-accent-dark);
}

.bookstore-detail-actions button {
  border-radius: 8px;
}

.bookstore-detail-actions button[data-read-book],
.bookstore-detail-actions button[data-toggle-shelf] {
  flex: 1 1 0;
}

.bookstore-detail-actions button[data-toast] {
  flex: 0 0 auto;
}

.bookstore-reader {
  min-height: 100%;
  padding: env(safe-area-inset-top, 0px) 18px env(safe-area-inset-bottom, 0px);
  border-radius: 0;
  line-height: 1.95;
}

.bookstore-reader.theme-paper {
  background: #fffdf7;
  color: #2f2820;
}

.bookstore-reader.theme-green {
  background: #fff5e6;
  color: #34291d;
}

.bookstore-reader.theme-night {
  background: #1f2421;
  color: #dce4dc;
}

.bookstore-reader-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: inherit;
  opacity: .72;
  font-size: 13px;
}

.bookstore-reader h2 {
  margin: 0 0 18px;
  font-size: 22px;
  letter-spacing: 0;
}

.bookstore-reader p {
  margin: 0 0 16px;
  font-size: 17px;
}

.bookstore-reader-tools {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1.2fr;
  gap: 8px;
  margin-top: 22px;
  padding: 0 8px;
}

.bookstore-reader-tools button,
.bookstore-reader-top button {
  min-height: 34px;
  padding: 0 11px;
  background: rgba(127, 127, 127, .14);
  color: inherit;
}

.bookstore-reader-tools button {
  min-width: 0;
  padding: 0 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.bookstore-reader-top button {
  border-radius: 17px;
}

.bookstore-author-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: #eadcc6;
  color: #3d2f20;
}

.bookstore-author-card h2,
.bookstore-author-card p {
  margin: 0;
}

.bookstore-author-card p {
  margin-top: 5px;
  color: rgba(61, 47, 32, .66);
  font-size: 12px;
}

.bookstore-author-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(255, 252, 246, .44);
}

.bookstore-author-card button {
  background: var(--bookstore-paper);
  color: var(--bookstore-accent-dark);
  white-space: nowrap;
}

.bookstore-author-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 12px;
  padding: 3px;
  border-radius: 8px;
  background: #f8f2e9;
  border: 1px solid var(--bookstore-border);
}

.bookstore-author-tabs button {
  min-width: 0;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: #806d55;
}

.bookstore-author-tabs button.active {
  background: var(--bookstore-paper);
  color: var(--bookstore-ink);
  box-shadow: none;
}

.bookstore-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bookstore-stat {
  padding: 13px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--bookstore-border);
}

.bookstore-stat strong,
.bookstore-stat span {
  display: block;
}

.bookstore-stat strong {
  font-size: 20px;
}

.bookstore-stat span {
  margin-top: 4px;
  color: #8a745a;
  font-size: 12px;
}

.bookstore-notice {
  padding: 12px;
  border-radius: 14px;
  background: #fff8df;
  color: #7a5a13;
  line-height: 1.5;
}

.bookstore-work-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--bookstore-border);
}

.bookstore-work-list span {
  color: #8a745a;
  font-size: 12px;
}

.bookstore-work-list button {
  grid-row: span 2;
  min-height: 32px;
}

.bookstore-write-panel input,
.bookstore-write-panel textarea {
  width: 100%;
  border: 1px solid var(--bookstore-border);
  outline: 0;
  border-radius: 14px;
  background: #ffffff;
  color: inherit;
  font: inherit;
}

.bookstore-write-panel input {
  height: 44px;
  padding: 0 12px;
}

.bookstore-write-panel textarea {
  min-height: 190px;
  margin-top: 10px;
  padding: 12px;
  line-height: 1.7;
  resize: vertical;
}

.bookstore-write-panel div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.bookstore-bars {
  height: 120px;
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--bookstore-border);
}

.bookstore-bars span {
  flex: 1;
  height: var(--v);
  border-radius: 8px 8px 3px 3px;
  background: var(--bookstore-accent);
}

.bookstore-empty {
  padding: 28px 16px;
  border-radius: 18px;
  background: var(--bookstore-paper);
  border: 1px solid var(--bookstore-border);
  color: #8a745a;
  text-align: center;
}

.bookstore-tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid rgba(139, 111, 72, .1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bookstore-tabbar button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #b8aa97;
  font-size: 11px;
}

.bookstore-tabbar i {
  font-size: 18px;
}

.bookstore-tabbar button.active {
  color: var(--bookstore-accent-dark);
}

:root.theme-dark .bookstore-channel-row button,
:root.theme-dark .bookstore-quick,
:root.theme-dark .bookstore-section,
:root.theme-dark .bookstore-empty {
  background: var(--bookstore-paper);
  color: #f1eadf;
  border-color: var(--bookstore-border);
}

:root.theme-dark .bookstore-rank-list button,
:root.theme-dark .bookstore-chapter-list button,
:root.theme-dark .bookstore-stat,
:root.theme-dark .bookstore-work-list div,
:root.theme-dark .bookstore-write-panel input,
:root.theme-dark .bookstore-write-panel textarea,
:root.theme-dark .bookstore-bars {
  background: var(--bookstore-paper);
  border-color: var(--bookstore-border);
}

:root.theme-dark .bookstore-book-card {
  background: transparent;
}

:root.theme-dark .bookstore-book-copy em,
:root.theme-dark .bookstore-book-copy small,
:root.theme-dark .bookstore-book-copy span,
:root.theme-dark .bookstore-section p,
:root.theme-dark .bookstore-stat span,
:root.theme-dark .bookstore-work-list span,
:root.theme-dark .bookstore-rank-list em {
  color: #aaa6a0;
}

:root.theme-dark .bookstore-tabbar {
  background: rgba(23, 21, 19, .9);
  border-top-color: rgba(255, 255, 255, .08);
}

:root.theme-dark .bookstore-author-tabs {
  background: rgba(58, 53, 47, .72);
  border-color: var(--bookstore-border);
}

:root.theme-dark .bookstore-author-tabs button {
  color: #aaa6a0;
}

:root.theme-dark .bookstore-author-tabs button.active {
  background: #211f1c;
  color: #f1eadf;
}

@media (max-width: 360px) {
  .bookstore-shell {
    padding-left: 10px;
    padding-right: 10px;
  }
  .bookstore-quick-grid {
    gap: 6px;
  }
  .bookstore-hero-copy h2 {
    font-size: 21px;
  }
  .bookstore-detail-actions button[data-read-book],
  .bookstore-detail-actions button[data-toggle-shelf] {
    flex: 1 1 0;
  }
}
