:root {
  color-scheme: light;
  --bg: #f7efe7;
  --bg-soft: #fbf7f2;
  --panel: rgba(255, 252, 248, 0.94);
  --panel-strong: #fffdfb;
  --text: #2d1f17;
  --muted: #7f7165;
  --line: rgba(195, 157, 97, 0.15);
  --line-strong: rgba(195, 157, 97, 0.26);
  --gold: #c7a260;
  --gold-deep: #b8893d;
  --pink: #ebb2c4;
  --pink-deep: #d27c9e;
  --shadow-xl: 0 28px 70px rgba(47, 27, 17, 0.12);
  --shadow-lg: 0 18px 40px rgba(47, 27, 17, 0.1);
  --shadow-md: 0 10px 24px rgba(47, 27, 17, 0.08);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 92% 6%, rgba(244, 218, 146, 0.25), transparent 24%),
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.7), transparent 22%),
    linear-gradient(180deg, #faf5ee 0%, #f4ece4 100%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { display: block; max-width: 100%; }

.shelf-shell {
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.shelf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.brand-link {
  display: inline-flex;
  min-width: 0;
  align-items: center;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
}

.brand-kicker,
.banner-kicker,
.section-eyebrow,
.continue-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-kicker {
  display: none;
}

.shelf-topbar h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.78rem, 3.05vw, 2.28rem);
  font-weight: 400;
  line-height: 1.08;
  display: inline-block;
  white-space: nowrap;
  position: relative;
  padding-bottom: 5px;
}

.shelf-topbar h1::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 66%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
}

.brand-note {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.15;
  font-style: italic;
  white-space: nowrap;
  opacity: 0.9;
}

.shelf-actions {
  flex: 0 0 auto;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.lang-btn {
  min-width: 72px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s ease;
}

.lang-btn.active {
  color: #fffaf6;
  border-color: rgba(195, 157, 97, 0.2);
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  box-shadow: 0 8px 18px rgba(183, 135, 57, 0.28);
}

.shelf-main {
  display: grid;
  gap: 24px;
}

.library-banner,
.continue-card,
.shelf-section {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.library-banner {
  min-height: 0;
  padding: 0;
}

.banner-image-wrap {
  position: relative;
  inset: auto;
  aspect-ratio: 16 / 9;
}

.banner-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(34, 20, 12, 0.06) 0%, rgba(34, 20, 12, 0.04) 36%, rgba(34, 20, 12, 0.42) 100%),
    linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(27,18,12,0.12) 100%);
}

.banner-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-copy {
  display: none;
}

.banner-kicker {
  color: rgba(255, 247, 239, 0.78);
}

.banner-copy h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1.06;
  color: #fffdf9;
  text-shadow: 0 1px 10px rgba(0,0,0,0.12);
}

.banner-copy p:last-child {
  margin: 0;
  max-width: 360px;
  color: rgba(255, 247, 239, 0.92);
  line-height: 1.82;
  font-size: 1rem;
}

.continue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 18px;
  align-items: center;
  padding: 26px 28px;
}

.continue-copy {
  display: grid;
  gap: 10px;
}

.continue-copy h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 2.4vw, 2.18rem);
  font-weight: 500;
  line-height: 1.18;
}

.continue-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
  font-size: 0.94rem;
}

.continue-meta-title,
.continue-meta-progress {
  display: inline;
}

.continue-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
  width: min(100%, 420px);
}

.continue-actions .hero-btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  white-space: nowrap;
}

.continue-cover-wrap {
  display: grid;
  place-items: center;
}

.continue-cover-wrap img {
  width: min(200px, 100%);
  max-height: 280px;
  object-fit: contain;
  filter: drop-shadow(0 22px 28px rgba(42, 22, 15, 0.16));
}

.hero-btn,
.book-read-btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.94);
  color: var(--text);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.hero-btn,
.book-read-btn,
.format-chip {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  background-clip: padding-box;
}

.hero-btn:hover,
.book-read-btn:hover,
.format-chip:not(.disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(47, 27, 17, 0.08);
}

.hero-btn.primary,
.book-read-btn {
  border-color: rgba(233, 177, 196, 0.22);
  background: linear-gradient(135deg, rgba(236, 181, 199, 0.2), rgba(255,255,255,0.98));
}

.shelf-section {
  padding: 28px;
}

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

.section-head h2 {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(1.58rem, 2.5vw, 2.08rem);
  font-weight: 500;
  line-height: 1.2;
}

.section-note,
.book-progress,
.book-full-title,
.format-tip,
.book-subtitle {
  color: var(--muted);
}

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

.book-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(195, 157, 97, 0.12);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,241,234,0.94));
  box-shadow: 0 18px 34px rgba(47, 27, 17, 0.08);
}

.book-body {
  display: grid;
  gap: 16px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.book-art {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 10%, rgba(255,255,255,0.94), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.99), rgba(244, 233, 223, 0.94));
}

.book-art::after {
  content: "";
  position: absolute;
  inset: auto 16px 12px;
  height: 20px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(33, 18, 12, 0.18), rgba(33, 18, 12, 0));
  filter: blur(10px);
}

.book-art img {
  position: relative;
  z-index: 1;
  width: min(82%, 220px);
  max-height: 288px;
  object-fit: contain;
  filter: drop-shadow(0 26px 30px rgba(40, 20, 14, 0.16));
}

.book-copy {
  display: grid;
  gap: 0;
}

.book-subtitle {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.book-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.22;
}

.book-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.book-title-row .book-title {
  flex: 1 1 auto;
  min-width: 0;
}

.book-progress,
.book-progress-inline {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.68rem;
  line-height: 1.2;
  color: rgba(120, 104, 88, 0.88);
  white-space: nowrap;
  opacity: 0.92;
}

.book-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.book-read-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 15px;
  font-size: 0.82rem;
  box-shadow: none;
}

.download-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  padding-top: 0;
}

.download-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--muted);
}

.download-head img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.format-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.format-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(195, 157, 97, 0.15);
  border-radius: 999px;
  background: rgba(255,255,255,0.94);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  outline: none;
  box-shadow: none;
}

.format-chip:link,
.format-chip:visited,
.format-chip:hover,
.format-chip:active,
.format-chip:focus,
.format-chip:focus-visible {
  color: var(--text);
  text-decoration: none;
  outline: none;
  box-shadow: none;
}

.format-chip img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.format-chip.disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.format-tip {
  font-size: 0.8rem;
  line-height: 1.55;
}

.book-actions.single-format {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  flex-wrap: nowrap;
}

.book-actions.single-format .book-read-btn {
  width: auto;
  min-width: 0;
  padding: 0 14px;
  min-height: 36px;
  justify-content: center;
  font-size: 0.78rem;
}

.book-actions.single-format .download-panel {
  display: flex;
  align-items: stretch;
}

.book-actions.single-format .format-actions {
  display: flex;
  align-items: stretch;
}

.book-actions.single-format .format-chip {
  min-width: 48px;
  min-height: 36px;
  padding: 0 8px;
  justify-content: center;
  background: rgba(255, 250, 244, 0.98);
  border-color: rgba(214, 182, 119, 0.22);
  gap: 4px;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.book-actions.single-format .format-chip span {
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

body[data-lang="en"] .book-grid {
  grid-template-columns: minmax(360px, 520px);
  justify-content: start;
}

body[data-lang="en"] .book-card .book-art {
  padding-block: 20px 14px;
  place-items: center start;
  padding-inline: 24px 0;
}

body[data-lang="en"] .book-card .book-art img {
  transform: translateY(6px);
  margin-left: 0;
}

body[data-lang="en"] .library-banner {
  border-radius: 32px;
}

body[data-lang="en"] .banner-image-wrap {
  aspect-ratio: 16 / 8.7;
}

body[data-lang="en"] .book-actions {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

body[data-lang="en"] .book-read-btn {
  width: 100%;
  justify-content: center;
  min-height: 42px;
}

body[data-lang="en"] .download-panel {
  width: 100%;
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

body[data-lang="en"] .format-actions {
  flex-wrap: nowrap;
  gap: 9px;
}

body[data-lang="en"] .format-chip {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.78rem;
  border-color: rgba(195, 157, 97, 0.16);
  background: rgba(255, 252, 249, 0.98);
  color: rgba(44, 34, 27, 0.96);
}

body[data-lang="en"] .continue-card {
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "eyebrow cover"
    "title cover"
    "meta cover"
    "actions actions";
  gap: 34px;
  row-gap: 14px;
  align-items: start;
  padding: 34px 38px;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(249, 243, 236, 0.94));
}

body[data-lang="en"] .continue-copy {
  display: contents;
}

body[data-lang="en"] .continue-eyebrow,
body[data-lang="en"] .section-eyebrow {
  color: rgba(112, 101, 90, 0.92);
  letter-spacing: 0.22em;
}

body[data-lang="en"] .continue-copy h2,
body[data-lang="en"] .section-head h2 {
  font-weight: 400;
}

body[data-lang="en"] .continue-eyebrow {
  grid-area: eyebrow;
}

body[data-lang="en"] .continue-copy h2 {
  grid-area: title;
  font-size: clamp(2.06rem, 3.2vw, 2.56rem);
}

body[data-lang="en"] .continue-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  max-width: 640px;
  font-size: 0.96rem;
  line-height: 1.8;
}

body[data-lang="en"] .continue-meta-title {
  color: rgba(87, 76, 66, 0.95);
}

body[data-lang="en"] .continue-meta-progress {
  color: rgba(142, 117, 86, 0.96);
  white-space: nowrap;
}

body[data-lang="en"] .continue-cover-wrap img {
  width: min(324px, 100%);
  max-height: 412px;
  filter: drop-shadow(0 36px 38px rgba(40, 20, 14, 0.18));
}

body[data-lang="en"] .book-card {
  padding: 26px 26px 22px;
  border-radius: 32px;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.99), rgba(250, 244, 238, 0.95));
}

body[data-lang="en"] .book-art {
  min-height: 336px;
  background:
    radial-gradient(circle at 50% 6%, rgba(255,255,255,0.96), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245, 236, 228, 0.94));
}

body[data-lang="en"] .book-art img {
  width: min(82%, 286px);
  max-height: 326px;
  filter: drop-shadow(0 36px 36px rgba(40, 20, 14, 0.16));
}

body[data-lang="en"] .book-title-row {
  align-items: baseline;
  gap: 10px;
}

body[data-lang="en"] .book-title {
  font-size: 1.4rem;
  font-weight: 500;
}

body[data-lang="en"] .book-progress-inline {
  font-size: 0.76rem;
  white-space: nowrap;
  color: rgba(112, 101, 90, 0.9);
}

body[data-lang="en"] .book-copy {
  gap: 10px;
}

body[data-lang="en"] .continue-actions {
  grid-area: actions;
  width: 100%;
  max-width: none;
}

body[data-lang="en"] .hero-btn,
body[data-lang="en"] .book-read-btn {
  min-height: 46px;
}

body[data-lang="en"] .shelf-section {
  padding-bottom: 34px;
}

body[data-lang="en"] .download-head {
  display: none;
}

body[data-lang="en"] .format-chip img {
  width: 15px;
  height: 15px;
}

body[data-lang="en"] .book-read-btn {
  width: auto;
  justify-self: start;
  padding: 0 22px;
  min-width: 160px;
}

body[data-lang="en"] .download-panel {
  width: auto;
}

body[data-lang="en"] .download-panel .format-actions {
  gap: 8px;
}

body[data-lang="en"] .download-panel .format-chip {
  min-width: 84px;
  justify-content: center;
}

body[data-lang="en"] .continue-cover-wrap {
  grid-area: cover;
  justify-content: start;
  align-self: end;
  padding-inline-start: 0;
}

body[data-lang="en"] .continue-cover-wrap img {
  margin-left: 0;
}

body[data-lang="en"] .book-copy {
  gap: 8px;
}

body[data-lang="en"] .book-actions {
  gap: 8px;
}

@media (max-width: 1080px) {
  .continue-card {
    grid-template-columns: minmax(0, 1fr) 210px;
  }

  body[data-lang="en"] .continue-card {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
}

@media (max-width: 900px) {
  .shelf-shell {
    width: min(100vw - 24px, 1240px);
    padding-top: 18px;
  }

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

  .continue-cover-wrap {
    justify-content: start;
  }

  body[data-lang="en"] .continue-cover-wrap {
    justify-content: start;
    padding-inline-start: 0;
  }

  body[data-lang="en"] .continue-actions {
    width: min(100%, 440px);
  }
}

@media (max-width: 768px) {
  .shelf-shell {
    width: calc(100vw - 20px);
    padding-bottom: 34px;
  }

  .shelf-topbar {
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
  }

  .shelf-actions {
    align-self: center;
  }

  .shelf-topbar h1 {
    font-size: 1.44rem;
    padding-bottom: 5px;
  }

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

  .book-card,
  .shelf-section,
  .continue-card {
    border-radius: 24px;
  }

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

  .book-art {
    min-height: 196px;
  }

  .book-art img {
    max-height: 180px;
    width: min(80%, 140px);
  }

  .book-title {
    font-size: 0.98rem;
  }

  .book-progress-inline {
    font-size: 0.62rem;
  }

  .format-actions {
    gap: 6px;
  }

  .format-chip {
    min-height: 32px;
    padding: 0 9px;
    gap: 6px;
    font-size: 0.76rem;
  }

  body[data-lang="en"] .book-grid {
    grid-template-columns: 1fr;
  }

  body[data-lang="en"] .continue-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "eyebrow"
      "title"
      "meta"
      "actions"
      "cover";
    gap: 18px;
    padding: 22px 20px;
  }

  body[data-lang="en"] .book-card {
    padding: 22px 20px 18px;
  }

  body[data-lang="en"] .continue-cover-wrap img {
    width: min(240px, 86%);
    max-height: 310px;
  }

  body[data-lang="en"] .continue-meta {
    display: grid;
    gap: 2px;
  }

  body[data-lang="en"] .book-art {
    min-height: 232px;
  }

  body[data-lang="en"] .book-art img {
    width: min(78%, 196px);
    max-height: 238px;
  }

  body[data-lang="en"] .book-read-btn {
    min-width: 0;
    width: 100%;
    justify-content: center;
  }

  body[data-lang="en"] .book-actions.single-format {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-lang="en"] .download-panel {
    width: 100%;
  }

  body[data-lang="en"] #bookGrid .download-panel .format-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  body[data-lang="en"] #bookGrid .download-panel .format-chip {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 540px) {
  .shelf-shell {
    width: calc(100vw - 16px);
  }

  .brand-block {
    min-height: 44px;
  }

  .shelf-topbar h1 {
    font-size: 1.26rem;
    padding-bottom: 4px;
  }

  .brand-note {
    font-size: 0.48rem;
  }

  .lang-btn {
    min-width: 66px;
    padding: 8px 12px;
  }

  .shelf-section,
  .continue-card {
    padding: 18px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .book-art {
    min-height: 180px;
  }

  .continue-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .continue-cover-wrap img {
    width: min(160px, 100%);
    max-height: 220px;
  }
}

@media (max-width: 390px) {
  .book-grid {
    gap: 14px 10px;
  }

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

  .book-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .book-title {
    font-size: 0.94rem;
  }

  .book-progress-inline {
    font-size: 0.64rem;
  }

  .book-actions.single-format {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .book-actions.single-format .book-read-btn,
  .book-actions.single-format .download-panel,
  .book-actions.single-format .format-actions,
  .book-actions.single-format .format-chip {
    width: 100%;
  }

  .book-actions.single-format .download-panel {
    display: block;
  }

  .book-actions.single-format .format-chip {
    min-width: 0;
    justify-content: center;
  }
}
