:root {
  --page: #fffaf0;
  --page-dark: #f0e3c7;
  --ink: #26312b;
  --soft-ink: #687268;
  --gold: #b79245;
  --green: #2f7648;
  --green-deep: #1f4d35;
  --red-earth: #a75d3b;
  --blue: #367a8b;
  --violet: #6c6389;
  --line: rgba(52, 45, 32, 0.16);
  --shadow: 0 34px 90px rgba(49, 42, 29, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(51, 67, 44, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(51, 67, 44, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 10% 8%, rgba(183, 146, 69, 0.24), transparent 20rem),
    radial-gradient(circle at 92% 86%, rgba(47, 118, 72, 0.18), transparent 24rem),
    #e7e2d2;
  background-size: 46px 46px, 46px 46px, auto, auto, auto;
  font-family: "Microsoft YaHei", "Noto Serif SC", "Noto Sans SC", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.book-app {
  width: min(1180px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.reader-bar,
.reader-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: var(--green-deep);
  font-weight: 900;
}

.brand-mark strong {
  font-size: 18px;
}

.chapter-tabs,
.page-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chapter-tab,
.dot,
.turn-button,
.paper-button {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.72);
  color: var(--ink);
}

.chapter-tab {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 800;
}

.chapter-tab[aria-current="page"] {
  color: #fff;
  border-color: var(--green-deep);
  background: var(--green-deep);
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 132px;
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 900;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
}

.user-chip button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
}

.book-stage {
  position: relative;
  display: grid;
  place-items: center;
  perspective: 1800px;
  min-height: 720px;
}

.book-page {
  position: relative;
  width: min(920px, calc(100% - 92px));
  min-height: 680px;
  padding: 52px 58px 46px;
  border: 1px solid rgba(86, 69, 41, 0.22);
  border-radius: 6px 18px 18px 6px;
  background:
    linear-gradient(90deg, rgba(83, 61, 35, 0.18), transparent 52px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), transparent 28%, rgba(169, 139, 82, 0.12)),
    var(--page);
  box-shadow: var(--shadow), inset 20px 0 30px rgba(117, 86, 43, 0.12);
  transform-origin: left center;
  overflow: hidden;
}

.book-page::before {
  content: "";
  position: absolute;
  inset: 18px 22px;
  pointer-events: none;
  border: 1px solid rgba(183, 146, 69, 0.34);
  border-radius: 4px 14px 14px 4px;
}

.book-page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(38, 49, 43, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 25% 20%, rgba(60, 45, 24, 0.08), transparent 2px);
  background-size: 100% 34px, 38px 38px;
}

.book-page.turning-forward {
  animation: turnForward 460ms ease both;
}

.book-page.turning-back {
  animation: turnBack 460ms ease both;
}

@keyframes turnForward {
  0% { transform: rotateY(0deg); opacity: 1; }
  48% { transform: rotateY(-12deg) translateX(-16px); opacity: 0.72; }
  100% { transform: rotateY(0deg); opacity: 1; }
}

@keyframes turnBack {
  0% { transform: rotateY(0deg); opacity: 1; }
  48% { transform: rotateY(10deg) translateX(12px); opacity: 0.72; }
  100% { transform: rotateY(0deg); opacity: 1; }
}

.page-inner {
  position: relative;
  z-index: 1;
  min-height: 580px;
  display: grid;
  gap: 22px;
}

.auth-inner {
  align-content: center;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.82fr);
  gap: 36px;
  align-items: center;
}

.auth-copy {
  display: grid;
  gap: 18px;
}

.auth-card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 240, 0.5)),
    rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 40px;
  letter-spacing: 0;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--soft-ink);
  line-height: 1.7;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
}

.auth-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--soft-ink);
  background: transparent;
  font-weight: 900;
}

.auth-switch button[aria-selected="true"] {
  color: #fff;
  background: var(--green-deep);
}

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

.field-label {
  display: grid;
  gap: 7px;
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 900;
}

.field-label input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--red-earth);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.auth-note {
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  color: var(--soft-ink);
  background: rgba(183, 146, 69, 0.12);
  line-height: 1.65;
}

.folio {
  color: var(--red-earth);
  font-size: 13px;
  font-weight: 900;
}

.book-title {
  max-width: 7em;
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 76px;
  line-height: 0.98;
  letter-spacing: 0;
}

.chapter-title {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 50px;
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 640px;
  margin: 0;
  color: var(--soft-ink);
  font-size: 18px;
  line-height: 1.9;
}

.cover-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items: end;
}

.seal {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  justify-self: end;
  border-radius: 50%;
  border: 2px solid rgba(47, 118, 72, 0.24);
  background:
    radial-gradient(circle, rgba(47, 118, 72, 0.12) 0 40%, transparent 42%),
    conic-gradient(from -35deg, rgba(47, 118, 72, 0.26), rgba(183, 146, 69, 0.3), rgba(54, 122, 139, 0.24), rgba(47, 118, 72, 0.26));
  color: var(--green-deep);
  font-family: "SimSun", serif;
  font-size: 74px;
  font-weight: 900;
}

.metric-row,
.domain-grid,
.reward-grid,
.note-grid {
  display: grid;
  gap: 14px;
}

.metric-row {
  grid-template-columns: repeat(4, 1fr);
}

.metric,
.domain-tile,
.reward-ticket,
.note-panel,
.quote-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 252, 246, 0.66);
}

.metric {
  min-height: 92px;
  padding: 16px;
}

.metric strong {
  display: block;
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 10px;
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 800;
}

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

.domain-tile {
  min-height: 126px;
  padding: 16px;
  border-top: 5px solid var(--tone);
}

.domain-tile b {
  display: block;
  color: var(--tone);
  font-family: "SimSun", serif;
  font-size: 36px;
  line-height: 1;
}

.domain-tile strong {
  display: block;
  margin-top: 12px;
}

.domain-tile small,
.reward-ticket p,
.note-panel p,
.quote-panel {
  color: var(--soft-ink);
  line-height: 1.65;
}

.quote-panel {
  padding: 22px;
  font-family: "SimSun", serif;
  font-size: 24px;
}

.action-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
}

.domain-menu {
  display: grid;
  gap: 9px;
  align-content: start;
}

.domain-choice {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.38);
  text-align: left;
}

.domain-choice[aria-selected="true"] {
  border-color: var(--tone);
  background: rgba(47, 118, 72, 0.08);
}

.domain-choice b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--tone);
}

.count-pill,
.point-pill,
.total-pill {
  border-radius: 999px;
  font-weight: 900;
}

.count-pill {
  min-width: 26px;
  padding: 3px 8px;
  background: rgba(38, 49, 43, 0.08);
  color: var(--soft-ink);
  font-size: 12px;
  text-align: center;
}

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

.action-line {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
}

.action-line.done {
  border-color: rgba(47, 118, 72, 0.44);
  background: rgba(47, 118, 72, 0.09);
}

.check-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(38, 49, 43, 0.18);
  border-radius: 50%;
  color: transparent;
  background: #fffdf8;
}

.action-line.done .check-button {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.check-button svg,
.reset-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-copy strong {
  display: block;
}

.action-copy small {
  display: block;
  margin-top: 4px;
  color: var(--soft-ink);
  line-height: 1.45;
}

.point-pill {
  padding: 7px 10px;
  background: rgba(183, 146, 69, 0.16);
  color: #755621;
  white-space: nowrap;
}

.custom-form {
  display: grid;
  grid-template-columns: 1fr 72px 42px;
  gap: 10px;
  margin-top: 12px;
}

.custom-form input,
.custom-form button,
.journal {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.custom-form input {
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
}

.paper-button {
  min-height: 42px;
  border-radius: 4px;
  color: #fff;
  background: var(--green-deep);
  font-weight: 900;
}

.reset-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--red-earth);
  background: rgba(255, 255, 255, 0.52);
}

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

.reward-ticket {
  min-height: 178px;
  padding: 18px;
  border-left: 6px solid var(--tone);
}

.reward-ticket.locked {
  opacity: 0.58;
}

.reward-ticket strong {
  display: block;
  font-size: 20px;
}

.reward-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--tone);
  font-weight: 900;
}

.week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.42);
}

.bar-wrap {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  gap: 8px;
  justify-items: center;
}

.bar {
  align-self: end;
  width: 100%;
  min-height: 6px;
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(to top, var(--green), var(--gold));
}

.bar-label {
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 900;
}

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

.note-panel {
  padding: 18px;
}

.done-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

.done-list li {
  padding: 9px 10px;
  border-left: 4px solid var(--green);
  background: rgba(47, 118, 72, 0.08);
}

.journal {
  width: 100%;
  min-height: 190px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

.turn-button {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: var(--green-deep);
  font-size: 40px;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 14px 36px rgba(49, 42, 29, 0.16);
}

.turn-prev {
  left: 4px;
}

.turn-next {
  right: 4px;
}

.turn-button:disabled {
  opacity: 0.34;
  cursor: default;
}

.reader-foot {
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 900;
}

.dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
}

.dot[aria-current="page"] {
  background: var(--green-deep);
}

@media (max-width: 860px) {
  .reader-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chapter-tabs {
    justify-content: flex-start;
  }

  .user-box {
    justify-content: flex-start;
  }

  .book-stage {
    min-height: 760px;
  }

  .book-page {
    width: calc(100% - 18px);
    min-height: 720px;
    padding: 34px 22px 34px;
    border-radius: 5px 14px 14px 5px;
  }

  .book-page::before {
    inset: 12px;
  }

  .book-title {
    font-size: 54px;
  }

  .chapter-title {
    font-size: 36px;
  }

  .cover-grid,
  .action-layout,
  .note-grid,
  .reward-grid,
  .metric-row,
  .auth-layout {
    grid-template-columns: 1fr;
  }

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

  .seal {
    width: 128px;
    height: 128px;
    justify-self: start;
    font-size: 52px;
  }

  .turn-button {
    top: auto;
    bottom: 10px;
    width: 46px;
    height: 46px;
    transform: none;
  }

  .turn-prev {
    left: 22px;
  }

  .turn-next {
    right: 22px;
  }
}

@media (max-width: 520px) {
  .book-app {
    width: min(100% - 14px, 1180px);
  }

  .chapter-tab {
    padding: 0 10px;
    font-size: 12px;
  }

  .book-stage {
    min-height: 800px;
  }

  .book-page {
    min-height: 760px;
  }

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

  .action-line {
    grid-template-columns: 34px 1fr;
  }

  .point-pill {
    grid-column: 2;
    width: max-content;
  }

  .custom-form {
    grid-template-columns: 1fr;
  }
}
