:root {
  --bg: #f4f3ee;
  --surface: #fffdf7;
  --surface-strong: #ece8dc;
  --ink: #202321;
  --muted: #68706a;
  --line: #ddd6c7;
  --jade: #1e6f5c;
  --jade-dark: #164d42;
  --cinnabar: #b94132;
  --gold: #b58a34;
  --blue-ink: #243748;
  --shadow: 0 18px 50px rgba(33, 36, 31, 0.12);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(30, 111, 92, 0.11), transparent 36%),
    linear-gradient(315deg, rgba(185, 65, 50, 0.09), transparent 34%),
    var(--bg);
  color: var(--ink);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: rgba(255, 253, 247, 0.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(30, 111, 92, 0.22);
  border-radius: var(--radius);
  background: var(--jade);
  color: #fffdf7;
  font-size: 24px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

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

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--cinnabar);
  color: #fffdf7;
  box-shadow: 0 10px 24px rgba(185, 65, 50, 0.22);
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-card span,
.section-heading span,
.eyebrow,
.form-preview label span,
.pillar-grid span,
.book-list span,
.category-grid span,
.resource-list span,
.account-list span,
.stats-grid span {
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.sidebar-card p,
.panel-note,
.reader-preview p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.main-content {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 56px) 48px;
}

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

.eyebrow {
  margin: 0 0 6px;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
}

h2 {
  font-size: clamp(30px, 4vw, 52px);
}

h3 {
  font-size: 22px;
}

.icon-button,
.mini-button {
  border: 0;
  cursor: pointer;
}

.icon-button,
.mini-button {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 44px;
  height: 44px;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 10px 26px rgba(33, 36, 31, 0.08);
}

.mini-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
}

.module-hero,
.profile-hero {
  min-height: 268px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 46px);
  border: 1px solid rgba(32, 35, 33, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.module-hero h2,
.profile-hero h2 {
  max-width: 760px;
}

.calendar-hero {
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.93), rgba(255, 253, 247, 0.76)),
    radial-gradient(circle at 86% 42%, rgba(30, 111, 92, 0.26), transparent 30%),
    var(--surface);
}

.chart-hero {
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.92), rgba(36, 55, 72, 0.16)),
    var(--surface);
}

.books-hero {
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.92), rgba(181, 138, 52, 0.18)),
    var(--surface);
}

.archive-hero {
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.92), rgba(185, 65, 50, 0.14)),
    var(--surface);
}

.profile-hero {
  background:
    linear-gradient(120deg, rgba(73, 37, 32, 0.94), rgba(185, 65, 50, 0.82));
  color: #fffdf7;
}

.profile-hero .eyebrow {
  color: #f2c66d;
}

.hero-stamp,
.archive-badge {
  width: 170px;
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(32, 35, 33, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.76);
}

.hero-stamp span,
.archive-badge span {
  color: var(--cinnabar);
  font-size: 14px;
  font-weight: 800;
}

.hero-stamp strong,
.archive-badge strong {
  margin-top: 6px;
  font-size: 40px;
}

.chart-orbit {
  width: 190px;
  height: 190px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 0 0 auto;
  padding: 18px;
  border: 1px solid rgba(32, 35, 33, 0.14);
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.74);
}

.chart-orbit span {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fffdf7;
  font-size: 24px;
  font-weight: 800;
}

.book-stack {
  width: 190px;
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
}

.book-stack span {
  height: 42px;
  border: 1px solid rgba(32, 35, 33, 0.12);
  border-radius: var(--radius);
  background: var(--jade);
}

.book-stack span:nth-child(2) {
  width: 84%;
  background: var(--cinnabar);
}

.book-stack span:nth-child(3) {
  width: 92%;
  background: var(--gold);
}

.large-avatar {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fffdf7;
  color: var(--jade-dark);
  font-size: 38px;
  font-weight: 900;
}

.panel {
  border: 1px solid rgba(32, 35, 33, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 10px 30px rgba(33, 36, 31, 0.07);
}

.calendar-layout,
.two-column-layout,
.reading-layout,
.archive-layout,
.profile-layout {
  display: grid;
  gap: 16px;
}

.calendar-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.month-panel {
  grid-row: span 2;
  padding: 20px;
}

.day-panel,
.schedule-panel,
.input-panel,
.chart-preview,
.reader-panel,
.shelf-panel,
.category-panel,
.resource-panel,
.stats-panel,
.account-panel {
  padding: 20px;
}

.two-column-layout,
.reading-layout,
.archive-layout,
.profile-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reader-panel,
.category-panel,
.account-panel {
  min-height: 320px;
}

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

.section-heading h3 {
  margin-top: 6px;
}

.week-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.month-grid span {
  min-height: 70px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
  font-weight: 800;
}

.month-grid small {
  color: #fffdf7;
  font-size: 11px;
}

.month-grid .muted-day {
  color: #a5aaa4;
  background: rgba(236, 232, 220, 0.6);
}

.month-grid .today {
  background: var(--jade);
  color: #fffdf7;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.info-list div {
  display: grid;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.info-list dt {
  color: var(--muted);
  font-size: 13px;
}

.info-list dd {
  margin: 0;
  font-weight: 800;
}

.timeline-list,
.resource-list,
.account-list,
.book-list {
  display: grid;
  gap: 12px;
}

.timeline-list div,
.resource-list div,
.book-list div,
.account-list div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
}

.timeline-list time,
.resource-list span,
.book-list span,
.account-list span {
  color: var(--muted);
  font-size: 13px;
}

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

.form-preview label {
  display: grid;
  gap: 7px;
}

.form-preview label div {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
  color: var(--muted);
  font-weight: 700;
}

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

.pillar-grid div,
.stats-grid div,
.category-grid div {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
  text-align: center;
}

.pillar-grid strong {
  font-size: 24px;
}

.panel-note {
  margin: 20px 0 0;
}

.reader-preview {
  min-height: 220px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
}

.reader-preview p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

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

.category-grid strong,
.resource-list strong,
.account-list strong,
.book-list strong {
  font-size: 16px;
}

.archive-badge svg {
  color: var(--jade);
}

.account-list div {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
}

.account-list span {
  justify-self: end;
}

.stats-grid strong {
  font-size: 34px;
}

.bottom-nav {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .calendar-layout,
  .two-column-layout,
  .reading-layout,
  .archive-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .month-panel {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(160deg, rgba(30, 111, 92, 0.12), transparent 40%),
      var(--bg);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    padding: 18px 14px 92px;
  }

  .topbar {
    align-items: center;
    margin-bottom: 16px;
  }

  .module-hero,
  .profile-hero {
    min-height: 280px;
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 20px;
  }

  .hero-stamp,
  .archive-badge,
  .chart-orbit,
  .book-stack {
    width: 100%;
    min-height: 120px;
  }

  .chart-orbit {
    height: auto;
    border-radius: var(--radius);
  }

  .book-stack {
    align-self: stretch;
  }

  .month-grid span {
    min-height: 52px;
    font-size: 14px;
  }

  .pillar-grid,
  .category-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-list div {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .account-list span {
    grid-column: 2;
    justify-self: start;
  }

  .bottom-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    height: 68px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    border: 1px solid rgba(32, 35, 33, 0.12);
    border-radius: var(--radius);
    background: rgba(255, 253, 247, 0.94);
    box-shadow: 0 18px 40px rgba(33, 36, 31, 0.18);
    backdrop-filter: blur(18px);
  }

  .bottom-nav a {
    min-width: 0;
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .bottom-nav a.active {
    color: var(--cinnabar);
  }

  .bottom-nav svg {
    width: 21px;
    height: 21px;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 30px;
  }

  h3 {
    font-size: 20px;
  }

  .pillar-grid,
  .category-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .month-grid span {
    min-height: 46px;
  }
}

.calendar-page {
  background:
    linear-gradient(135deg, rgba(36, 55, 72, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(185, 65, 50, 0.08), transparent 30%),
    #f1f2f5;
}

.calendar-main {
  padding-bottom: 56px;
}

.almanac-workspace {
  display: grid;
  grid-template-columns: minmax(460px, 640px) minmax(300px, 360px);
  align-items: start;
  justify-content: center;
  gap: 18px;
}

.almanac-phone {
  width: 100%;
  max-width: 640px;
}

.almanac-card,
.almanac-hero {
  border: 1px solid rgba(32, 35, 33, 0.08);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 24px rgba(44, 47, 54, 0.06);
}

.almanac-hero {
  min-height: 170px;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 249, 0.82)),
    radial-gradient(circle at 90% 18%, rgba(185, 65, 50, 0.2), transparent 28%),
    radial-gradient(circle at 84% 82%, rgba(30, 111, 92, 0.18), transparent 30%),
    #fff;
}

.almanac-hero-date {
  min-height: 120px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #c54c3d, var(--cinnabar));
  box-shadow: 0 16px 28px rgba(185, 65, 50, 0.22);
  color: #fffdf7;
}

.almanac-hero-date span {
  color: #f2c66d;
  font-size: 13px;
  font-weight: 800;
}

.almanac-hero-date strong {
  font-size: 58px;
  line-height: 1;
}

.almanac-hero-copy p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.almanac-hero-copy h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.18;
}

.almanac-hero-tags,
.almanac-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.almanac-hero-tags span,
.almanac-chip-row span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(185, 65, 50, 0.1);
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 800;
}

.almanac-calendar-card {
  padding: 14px 12px 16px;
  margin-bottom: 14px;
}

.almanac-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.almanac-tabs button {
  min-width: 0;
  height: 36px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #8d9298;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.almanac-tabs button.active {
  border-color: var(--cinnabar);
  background: #fff7f6;
  color: var(--cinnabar);
}

.almanac-month-bar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.almanac-round-button,
.almanac-month-label,
.almanac-today-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.almanac-round-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f2f5;
  color: var(--ink);
}

.almanac-month-label {
  min-height: 38px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.almanac-today-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(185, 65, 50, 0.32);
  border-radius: 999px;
  background: transparent;
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 800;
}

.almanac-weekdays,
.almanac-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.almanac-weekdays {
  margin-bottom: 6px;
  color: #8d9298;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.almanac-weekdays span {
  padding: 4px 0;
}

.almanac-day {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  padding: 2px;
}

.almanac-day .solar-num {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
}

.almanac-day .lunar-text {
  max-width: 100%;
  overflow: hidden;
  color: #858b91;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.almanac-day.outside {
  opacity: 0.42;
}

.almanac-day.today:not(.selected) {
  outline: 2px solid rgba(30, 111, 92, 0.28);
  outline-offset: -2px;
}

.almanac-day.selected {
  background: var(--cinnabar);
  color: #fff;
}

.almanac-day.selected .lunar-text {
  color: rgba(255, 255, 255, 0.86);
}

.almanac-day.has-event:not(.selected) .lunar-text {
  color: var(--cinnabar);
}

.almanac-panels {
  display: grid;
  gap: 14px;
}

.almanac-panel {
  display: none;
  padding: 18px;
}

.almanac-panel.active {
  display: block;
}

.almanac-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.almanac-section-title span,
.almanac-info-grid span,
.almanac-info-row span,
.almanac-pillars span {
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 900;
}

.almanac-section-title strong {
  font-size: 20px;
}

.almanac-muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

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

.almanac-info-grid div,
.almanac-pillars div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
}

.almanac-pillars div {
  text-align: center;
}

.almanac-pillars strong {
  font-size: 26px;
}

.almanac-yiji {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.almanac-yiji div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
}

.almanac-yiji b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
}

.almanac-yiji .yi b {
  background: #1f8b5c;
}

.almanac-yiji .ji b {
  background: var(--cinnabar);
}

.almanac-yiji span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.almanac-info-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.almanac-desktop-detail {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 16px;
}

.desktop-summary-card,
.desktop-yiji-card {
  padding: 20px;
}

.desktop-big-day {
  margin: 12px 0;
  color: var(--cinnabar);
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
}

.almanac-loading {
  grid-column: 1 / -1;
  padding: 32px 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .almanac-workspace {
    grid-template-columns: minmax(0, 640px);
  }

  .almanac-desktop-detail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .calendar-page {
    background: #f1f2f5;
  }

  .calendar-main {
    padding: 18px 14px 92px;
  }

  .almanac-desktop-detail {
    display: none;
  }

  .almanac-workspace {
    display: block;
  }

  .almanac-phone {
    max-width: 460px;
    margin: 0 auto;
    padding-top: 12px;
  }

  .almanac-hero {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 146px;
    padding: 16px;
  }

  .almanac-hero-date {
    min-height: 98px;
  }

  .almanac-hero-date strong {
    font-size: 52px;
  }

  .almanac-hero-copy h2 {
    font-size: 24px;
  }

  .almanac-calendar-card {
    padding: 12px 10px 14px;
  }

  .almanac-day {
    min-height: 48px;
  }

  .almanac-day .solar-num {
    font-size: 16px;
  }

  .almanac-day .lunar-text {
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .almanac-hero {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
  }

  .almanac-hero-date strong {
    font-size: 46px;
  }

  .almanac-hero-copy h2 {
    font-size: 22px;
  }

  .almanac-month-bar {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
  }

  .almanac-today-button {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .almanac-info-grid,
  .almanac-pillars {
    grid-template-columns: 1fr;
  }
}

.is-hidden {
  display: none !important;
}

.primary-button,
.ghost-button,
.ghost-inline-button,
.books-tab,
.books-crumb,
.books-page-button,
.books-card,
.history-item,
.books-reader-back {
  font: inherit;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--jade), var(--jade-dark));
  color: #fffdf7;
  box-shadow: 0 14px 26px rgba(30, 111, 92, 0.2);
  cursor: pointer;
}

.ghost-button,
.ghost-inline-button,
.books-reader-back {
  border: 1px solid var(--line);
  background: #fffefb;
  color: var(--ink);
  cursor: pointer;
}

.ghost-inline-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 800;
}

.books-hero-shell {
  align-items: stretch;
}

.books-hero-copy {
  display: grid;
  align-content: start;
  gap: 16px;
  max-width: 700px;
}

.books-hero-note {
  margin: 0;
  max-width: 42rem;
}

.books-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.books-continue-card {
  width: min(360px, 100%);
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(32, 35, 33, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.97), rgba(255, 254, 251, 0.82));
  box-shadow: 0 18px 40px rgba(33, 36, 31, 0.08);
}

.books-continue-card strong {
  font-size: 24px;
  line-height: 1.25;
}

.books-continue-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.books-card-label {
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.books-progress-track,
.books-card-progress,
.books-reader-progress-track {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 35, 33, 0.08);
}

.books-progress-track,
.books-reader-progress-track {
  height: 8px;
}

.books-progress-track i,
.books-card-progress i,
.books-reader-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold), var(--cinnabar));
}

.books-continue-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.books-summary-layout {
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.books-summary-layout .category-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.books-summary-layout .books-overview-grid {
  flex: 1;
  align-content: stretch;
}

.books-overview-tile {
  min-height: 118px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.books-overview-tile:hover {
  border-color: var(--accent, #b8965a);
  box-shadow: 0 6px 18px rgba(184, 150, 90, 0.12);
  transform: translateY(-1px);
}

.books-overview-tile:focus-visible {
  outline: 2px solid var(--accent, #b8965a);
  outline-offset: 2px;
}

.books-overview-tile strong {
  font-size: 20px;
  line-height: 1.3;
}

.books-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-page-link {
  white-space: nowrap;
}

.reading-history {
  display: grid;
  gap: 12px;
}

.history-item {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
  text-align: left;
  cursor: pointer;
}

.history-item strong {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 16px;
}

.history-progress-inline {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-item span,
.history-item small {
  display: none;
}

.books-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.books-overview-grid div {
  min-height: 118px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
}

.books-overview-grid strong {
  font-size: 22px;
}

.books-overview-grid small {
  color: var(--muted);
  font-size: 12px;
}

.history-page-panel {
  padding: 20px;
}

.history-page-header {
  margin-bottom: 16px;
}

.history-page-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-page-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-page-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.history-record {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
  text-align: left;
  cursor: pointer;
}

.history-record-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.history-record-head strong {
  font-size: 18px;
}

.history-record-progress {
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 800;
}

.history-record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 13px;
}

.history-page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.books-browser-panel,
.books-reader-panel {
  padding: 20px;
}

.books-browser-panel {
  margin-top: 24px;
}

.books-browser-heading {
  margin-bottom: 16px;
}

.books-browser-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.books-browser-tools {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
}

.books-tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.books-back-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(185, 65, 50, 0.5);
  border-radius: 18px;
  background: #fffefb;
  color: var(--cinnabar);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  align-self: flex-start;
}

.books-back-button:hover {
  background: rgba(185, 65, 50, 0.06);
  box-shadow: 0 4px 12px rgba(185, 65, 50, 0.12);
}

.books-back-button:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 2px;
}

.books-back-button.is-hidden {
  display: none;
}

.books-back-button i {
  width: 16px;
  height: 16px;
}

.books-tabs {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  gap: 10px;
  padding: 4px 2px;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.books-tabs::-webkit-scrollbar {
  display: none;
}

.books-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.books-tab:hover {
  color: var(--cinnabar);
}

.books-tab.active {
  border-color: rgba(185, 65, 50, 0.72);
  background: #fffefb;
  color: var(--cinnabar);
  box-shadow: none;
}

.books-breadcrumb {
  min-height: 30px;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.books-crumb {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.books-breadcrumb .books-crumb:last-child {
  color: var(--ink);
}

.books-crumb-sep {
  color: rgba(32, 35, 33, 0.32);
}

.books-search {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
  overflow: hidden;
}

.books-search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.books-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 14px;
}

.books-card {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.books-card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(32, 35, 33, 0.12);
  border-radius: 14px;
  box-shadow: 0 14px 26px rgba(33, 36, 31, 0.12);
}

.books-card-dir .books-card-cover {
  aspect-ratio: 5 / 4;
}

.books-tone-jade {
  background: linear-gradient(135deg, #285d4c, #1e6f5c 52%, #88b7a8);
}

.books-tone-cinnabar {
  background: linear-gradient(135deg, #81352b, #b94132 52%, #de9b8b);
}

.books-tone-gold {
  background: linear-gradient(135deg, #8f6c22, #b58a34 52%, #e4c77b);
}

.books-tone-ink {
  background: linear-gradient(135deg, #1e2c36, #243748 52%, #6d8799);
}

.books-folder-mark {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  font-weight: 900;
}

.books-card-ribbon {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.books-spine {
  position: absolute;
  top: 16px;
  right: 10px;
  bottom: 16px;
  min-width: 28px;
  max-width: 56px;
  padding: 8px 4px;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: inset 0 0 0 1px rgba(32, 35, 33, 0.08);
  color: var(--ink);
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
}

.books-spine[data-cols="2"] {
  max-width: 44px;
}

.books-spine[data-cols="3"] {
  max-width: 56px;
}

.books-card-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 38%, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.books-card-body {
  display: grid;
  gap: 4px;
}

.books-card-body strong {
  font-size: 15px;
  line-height: 1.35;
}

.books-card-body span,
.books-card small {
  color: var(--muted);
  font-size: 12px;
}

.books-card-progress {
  height: 4px;
}

.books-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
}

.books-page-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffefb;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.books-page-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.books-page-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.books-loading,
.books-empty,
.books-error {
  grid-column: 1 / -1;
  padding: 36px 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fffefb;
  color: var(--muted);
  text-align: center;
}

.books-error {
  border-style: solid;
  color: var(--cinnabar);
  background: rgba(185, 65, 50, 0.08);
}

.books-reader-panel {
  margin-top: 18px;
}

body.books-reader-mode .books-reader-panel {
  margin-top: 0;
}

body.books-reader-mode .main-content {
  padding-bottom: 24px;
}

.books-reader-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  margin: -20px -20px 16px;
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.books-reader-back {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
}

.books-reader-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(185, 65, 50, 0.12);
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 900;
}

.books-reader-meta h3 {
  margin-top: 8px;
  font-size: clamp(22px, 3vw, 30px);
}

.books-reader-meta p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.books-reader-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.books-font-label {
  min-width: 46px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.books-reader-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 254, 251, 0.92);
  margin-bottom: 16px;
}

.books-reader-scroll {
  max-height: min(74vh, 980px);
  overflow: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}

.books-reader-content {
  font-size: 18px;
}

.books-article {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(32, 35, 33, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 254, 251, 0.92));
  box-shadow: 0 16px 34px rgba(33, 36, 31, 0.08);
}

.books-article-head {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.books-article-head p,
.books-article-head span {
  margin: 0;
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 800;
}

.books-article-head h2 {
  font-size: clamp(28px, 4vw, 38px);
}

.books-article-desc {
  max-width: 42rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.books-article-body {
  color: var(--ink);
  line-height: 2.05;
}

.books-article-body h4 {
  margin: 30px 0 16px;
  text-align: center;
  font-size: 1.08em;
  line-height: 1.55;
}

.books-article-body p {
  margin: 0 0 20px;
  text-align: justify;
  text-indent: 2em;
  word-break: break-word;
}

@media (max-width: 1120px) {
  .books-hero-shell {
    flex-direction: column;
  }

  .books-continue-card {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .books-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .books-overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .books-summary-bar,
  .books-continue-meta,
  .books-reader-progress {
    grid-template-columns: 1fr;
  }

  .books-reader-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 14px;
    margin: -14px -14px 14px;
  }

  .books-reader-back {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .books-reader-meta h3 {
    font-size: 16px;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .books-reader-meta p {
    display: none;
  }

  .books-reader-status {
    display: none;
  }

  .books-reader-controls {
    justify-content: flex-end;
  }

  .books-reader-scroll {
    max-height: none;
  }
}

@media (max-width: 540px) {
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 8px;
  }

  .books-overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .books-card-body strong {
    font-size: 12px;
  }

  .books-card-body span {
    font-size: 10px;
  }

  .books-card-cover {
    padding: 8px;
    border-radius: 10px;
  }

  .books-card-dir .books-card-cover {
    aspect-ratio: 4 / 3;
  }

  .books-folder-mark {
    font-size: 18px;
  }

  .books-card-ribbon {
    font-size: 9px;
    padding: 2px 6px;
  }

  .books-spine {
    font-size: 11px;
  }
}

@media (max-width: 760px) {
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .books-browser-tools {
    gap: 14px;
    margin-bottom: 22px;
  }

  .books-tool-row {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .books-tabs {
    gap: 8px;
    padding: 2px 0 6px;
    scroll-snap-type: x proximity;
  }

  .books-tab {
    flex: 0 0 calc((100% - 24px) / 4);
    min-width: calc((100% - 24px) / 4);
    padding: 0 8px;
    font-size: 13px;
    text-align: center;
    scroll-snap-align: start;
  }

  .books-search {
    width: 100%;
    min-width: 0;
  }

  .books-back-button {
    width: 100%;
    justify-content: center;
  }

  .books-summary-layout {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .books-summary-layout .category-panel {
    padding: 14px;
  }

  .books-summary-layout .section-heading {
    gap: 10px;
    margin-bottom: 12px;
  }

  .books-summary-layout .section-heading h3 {
    font-size: 18px;
  }

  .books-summary-layout .books-overview-grid div,
  .books-summary-layout .books-overview-tile {
    min-height: 96px;
    padding: 12px;
  }

  .books-summary-layout .books-overview-grid strong {
    font-size: 22px;
  }
}

@media (max-width: 540px) {
  .books-summary-layout {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .books-summary-layout .category-panel {
    padding: 12px;
  }

  .books-summary-layout .section-heading {
    gap: 8px;
    margin-bottom: 10px;
  }

  .books-summary-layout .section-heading h3 {
    font-size: 16px;
  }

  .books-summary-layout .books-overview-grid div,
  .books-summary-layout .books-overview-tile {
    min-height: 84px;
    padding: 10px;
  }

  .books-summary-layout .books-overview-grid strong {
    font-size: 18px;
  }

  .books-summary-layout .books-overview-grid span,
  .books-summary-layout .books-overview-grid small {
    font-size: 10px;
  }
}
