:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f1f5ef;
  --ink: #1f2a24;
  --muted: #6d756f;
  --line: #dfe5dc;
  --accent: #237b57;
  --accent-2: #c7552a;
  --gold: #b18b2c;
  --blue: #376b9e;
  --shadow: 0 18px 45px rgba(38, 53, 44, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(35, 123, 87, 0.08), transparent 360px),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
a {
  font: inherit;
}

.shell {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.section-head,
.top-actions,
.book-row,
.recommend-card,
.category-item,
.pref-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  letter-spacing: 0;
}

.top-actions {
  gap: 10px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.icon-button span {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.sync-pill {
  min-width: 92px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  text-align: center;
}

.sync-pill.live {
  color: var(--accent);
  border-color: rgba(35, 123, 87, 0.28);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.metric,
.panel,
.book-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 148px;
  padding: 20px;
}

.metric span,
.muted,
.book-meta,
.note-meta,
.reason {
  color: var(--muted);
}

.metric span {
  display: block;
  margin-bottom: 18px;
  font-size: 14px;
}

.metric strong {
  display: block;
  font-size: clamp(26px, 2.35vw, 36px);
  line-height: 1;
  letter-spacing: 0;
  word-break: keep-all;
  white-space: nowrap;
}

.metric small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.metric.primary {
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent),
    #1f6d4e;
}

.metric.primary strong {
  font-size: clamp(30px, 3vw, 44px);
}

.metric.primary span,
.metric.primary small {
  color: rgba(255, 255, 255, 0.78);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
}

.main-column,
.side-column {
  display: grid;
  gap: 18px;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head.compact {
  margin-bottom: 16px;
}

.text-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

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

.book-row {
  gap: 16px;
  min-height: 128px;
  padding: 14px;
}

.cover {
  position: relative;
  width: 72px;
  aspect-ratio: 0.72;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(160deg, #2f7b5a, #d4b15d);
  box-shadow: inset 0 0 0 1px rgba(31, 42, 36, 0.1);
}

.cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cover.fallback::before {
  content: attr(data-title);
  position: absolute;
  inset: 10px 9px;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  color: white;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.cover.fallback::after {
  content: "";
  position: absolute;
  inset: auto 9px 10px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.cover.fallback img {
  display: none;
}

.book-body {
  min-width: 0;
  flex: 1;
}

.book-title {
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-meta {
  margin-top: 6px;
  font-size: 13px;
}

.progress-line {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece5;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #73a65e);
}

.book-stats {
  display: grid;
  gap: 8px;
  min-width: 122px;
  text-align: right;
}

.book-stats strong {
  font-size: 20px;
}

.book-stats a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.panel {
  padding: 18px;
}

.trend-panel {
  min-height: 280px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(30, minmax(4px, 1fr));
  align-items: end;
  gap: 5px;
  height: 182px;
  padding-top: 18px;
  border-bottom: 1px solid var(--line);
}

.bar {
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--blue);
}

.bar.hot {
  background: var(--accent-2);
}

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

.category-item {
  justify-content: space-between;
  min-height: 86px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.category-item span {
  color: var(--muted);
  font-size: 13px;
}

.category-item strong {
  font-size: 24px;
}

.preference-list,
.note-list,
.recommend-list {
  display: grid;
  gap: 12px;
}

.pref-row {
  gap: 12px;
}

.pref-label {
  width: 74px;
  color: var(--muted);
  font-size: 13px;
}

.pref-meter {
  height: 9px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece5;
}

.pref-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.pref-value {
  width: 52px;
  font-size: 13px;
  text-align: right;
}

.side-number {
  color: var(--accent);
  font-size: 28px;
}

.note-card,
.recommend-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.note-card strong,
.recommend-card strong {
  display: block;
  font-size: 15px;
}

.note-meta,
.reason {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.recommend-card {
  gap: 12px;
  align-items: flex-start;
}

.recommend-card .cover {
  width: 46px;
  border-radius: 5px;
}

@media (max-width: 1050px) {
  .overview-grid,
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .metric.primary,
  .main-column,
  .side-column {
    grid-column: 1 / -1;
  }

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

@media (max-width: 680px) {
  .shell {
    width: min(100% - 24px, 1420px);
    padding-top: 18px;
  }

  .topbar,
  .overview-grid,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: space-between;
  }

  .metric {
    min-height: 118px;
  }

  .metric strong {
    font-size: clamp(24px, 8vw, 32px);
  }

  .metric.primary strong {
    font-size: clamp(28px, 9vw, 40px);
  }

  .book-row {
    align-items: flex-start;
  }

  .book-stats {
    min-width: 72px;
  }

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