/* ============================================================
   观读 · 微信读书阅读统计
   设计语言：Notion 式纸感文档风（对标参考截图）
   ============================================================ */

:root {
  --bg: #f7f6f3;
  --paper: #ffffff;
  --ink: #37352f;
  --ink-2: #6f6e69;
  --ink-3: #9b9a97;
  --line: #e9e9e6;
  --line-2: #ededeb;
  --navy: #1f3a5f;
  --navy-soft: #e8eef6;
  --blue: #1f6feb;
  --green: #0f9d58;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 15, 15, .06);
  --shadow-md: 0 4px 14px rgba(15, 15, 15, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --maxw: 980px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* ============ 按钮 ============ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px 18px;
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn-primary:hover { background: #1a5fd0; }
.btn-primary:active { transform: translateY(1px); }
.btn-inline { width: auto; padding: 9px 18px; font-size: 14px; }

.btn-ghost {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink-2); font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

.link-btn {
  background: none; border: none; color: var(--blue);
  font-size: 14px; cursor: pointer; padding: 4px 0;
}
.link-btn:hover { text-decoration: underline; }

/* ============================================================
   授权登录页（伪装成微信读书账号授权）
   ============================================================ */
.auth-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 18px;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 34px 30px 26px;
}
.auth-logo { text-align: center; margin-bottom: 14px; }
.auth-title {
  font-size: 22px; font-weight: 700; text-align: center;
}
.auth-sub {
  text-align: center; color: var(--ink-2); font-size: 14px;
  margin: 6px 0 22px;
}

.auth-steps { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.auth-steps li { display: flex; gap: 12px; align-items: flex-start; }
.step-dot {
  flex: 0 0 24px; height: 24px; border-radius: 50%;
  background: var(--navy-soft); color: var(--navy);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.step-body p { font-size: 14px; color: var(--ink); }

.qr-box {
  margin-top: 10px;
  width: 148px; height: 148px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.qr-box img, .qr-box canvas { width: 132px !important; height: 132px !important; }
.qr-fallback { font-size: 13px; color: var(--blue); text-align: center; padding: 0 10px; }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-form input:focus {
  outline: none; border-color: var(--blue); background: var(--paper);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
}
.auth-note {
  margin-top: 14px; font-size: 12px; color: var(--ink-3);
  text-align: center; line-height: 1.6;
}
.auth-extra {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.auth-foot {
  margin-top: 18px; font-size: 12px; color: var(--ink-3);
  letter-spacing: .06em;
}

/* ============================================================
   仪表盘
   ============================================================ */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 22px 60px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.head-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.month-select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); font-size: 13px; color: var(--ink-2); cursor: pointer;
}

.seg {
  display: inline-flex; background: var(--line-2);
  border-radius: 999px; padding: 3px;
}
.seg-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.seg-btn.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

/* ---- 统计卡 ---- */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.stat-value { display: block; font-size: 21px; font-weight: 700; letter-spacing: .01em; }

/* ---- 通用区块 ---- */
.block {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.block-head h2 { font-size: 15px; font-weight: 700; }
.block-hint { font-size: 12px; color: var(--ink-3); }

/* ---- 封面无限滚动 ---- */
.carousel {
  overflow: hidden; cursor: grab;
  margin: 0 -20px; padding: 2px 20px 4px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.carousel.dragging { cursor: grabbing; }
.carousel-track {
  display: flex; gap: 16px; width: max-content;
  will-change: transform;
}
.cover-card {
  flex: 0 0 auto; width: 104px; text-align: center;
  user-select: none; -webkit-user-select: none;
  cursor: pointer;
}
.cover-img, .cover-ph {
  width: 104px; height: 148px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(15, 15, 15, .16);
  margin-bottom: 8px;
  pointer-events: none;
}
.cover-img { object-fit: cover; }
.cover-ph {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px 10px;
  background:
    linear-gradient(180deg, rgba(20, 24, 33, .34), rgba(20, 24, 33, 0) 42%, rgba(20, 24, 33, .34)),
    linear-gradient(160deg, var(--c1), var(--c2));
  color: #fff; text-align: left;
  text-shadow: 0 1px 3px rgba(20, 24, 33, .45);
}
.cover-ph-title {
  font-size: 13px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-ph-author { font-size: 10px; opacity: .92; }
.cover-name {
  font-size: 12px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-time { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ---- 双栏 ---- */
.grid-2 {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px;
}
.grid-2 .block { margin-bottom: 16px; }

/* ---- 热力图 ---- */
.hm-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.hm-table th {
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  text-align: center; padding: 0 0 2px;
}
.hm-table th.hm-week { text-align: left; padding-right: 4px; width: 26px; }
.hm-cell {
  width: 100%; aspect-ratio: 1; min-width: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-2);
  background: #f1f1ee;
}
.hm-cell.empty { background: transparent; }
.hm-cell.lv1 { background: #dde6f1; }
.hm-cell.lv2 { background: #b4c7e0; }
.hm-cell.lv3 { background: #6f92bd; color: #fff; }
.hm-cell.lv4 { background: #2e4a73; color: #fff; }
.hm-cell.today { outline: 2px solid var(--blue); outline-offset: 1px; }

/* 日视图：24 小时分布 */
.hours { display: flex; flex-direction: column; gap: 6px; }
.hour-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.hour-label { flex: 0 0 44px; text-align: right; font-variant-numeric: tabular-nums; }
.hour-bar { flex: 1; height: 14px; background: #f1f1ee; border-radius: 4px; overflow: hidden; }
.hour-bar i { display: block; height: 100%; background: var(--navy); border-radius: 4px; }
.hour-val { flex: 0 0 46px; font-variant-numeric: tabular-nums; }

/* 周视图：7 天柱状 */
.week-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.wb-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.wb-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.wb-bar { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--navy); min-height: 3px; }
.wb-day { font-size: 11px; color: var(--ink-3); }
.wb-val { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.heatmap-legend {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 10px;
  font-size: 11px; color: var(--ink-3);
}
.lg { width: 12px; height: 12px; border-radius: 3px; background: #f1f1ee; }
.lg.lv1 { background: #dde6f1; } .lg.lv2 { background: #b4c7e0; }
.lg.lv3 { background: #6f92bd; } .lg.lv4 { background: #2e4a73; }
.heatmap-note { margin-top: 8px; font-size: 11px; color: var(--ink-3); }

/* ---- 读得最多的书 ---- */
.top-list { list-style: none; display: flex; flex-direction: column; }
.top-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background .12s;
}
.top-item:hover { background: var(--bg); }
.top-item + .top-item { border-top: 1px solid var(--line-2); }
.top-info { flex: 1; min-width: 0; }
.top-title {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-author { font-size: 11.5px; color: var(--ink-3); }
.top-track {
  flex: 0 0 108px; height: 7px; border-radius: 99px;
  background: #f1f1ee; overflow: hidden;
}
.top-fill { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.top-time {
  flex: 0 0 52px; text-align: right;
  font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---- 读书卡 ---- */
.note-list { display: flex; flex-direction: column; gap: 14px; }
.note-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  background: var(--paper);
}
.note-card:hover { box-shadow: var(--shadow-md); border-color: #d8d8d3; }
.note-topline {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.note-source { display: flex; align-items: center; gap: 7px; }
.note-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--ink-3); text-transform: uppercase;
}
.note-from {
  font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px;
}
.note-link {
  font-size: 12px; color: var(--blue);
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 55%;
}
.note-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.note-main { display: flex; gap: 14px; }
.note-cover-img, .note-cover-ph {
  width: 58px; height: 82px; border-radius: 6px; flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(15,15,15,.14);
}
.note-cover-img { object-fit: cover; }
.note-cover-ph {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  color: #fff; font-size: 11px; font-weight: 700; text-align: center;
  padding: 6px; line-height: 1.3;
}
.note-body { flex: 1; min-width: 0; }
.note-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-title { font-size: 15.5px; font-weight: 700; }
.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--navy-soft); color: var(--navy); font-weight: 600;
}
.chip.gray { background: #f1f1ee; color: var(--ink-2); font-weight: 500; }
.note-author { font-size: 12.5px; color: var(--ink-2); margin: 2px 0 8px; }
.note-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar {
  flex: 1; height: 6px; border-radius: 99px;
  background: #f1f1ee; overflow: hidden;
}
.bar i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.note-progress span { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.note-quote {
  font-family: var(--serif);
  font-size: 13.5px; line-height: 1.85; color: var(--ink);
  border-left: 3px solid var(--navy);
  padding: 2px 0 2px 12px; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.note-quote em { font-style: normal; color: var(--ink-3); font-size: 12px; }
.note-foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ============================================================
   书籍详情（文档风，对标参考图 2）
   ============================================================ */
.page-doc { max-width: 760px; }
.back-link { margin-bottom: 18px; }

.doc-hero { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.doc-cover { flex: 0 0 auto; }
.doc-cover img, .doc-cover .cover-ph {
  width: 96px; height: 136px; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15,15,15,.18);
}
.doc-cover .cover-ph { padding: 10px 8px; }
.doc-title { font-size: 26px; font-weight: 700; line-height: 1.35; }
.doc-author { font-size: 14px; color: var(--ink-2); margin: 4px 0 14px; }
.doc-progress { display: flex; align-items: center; gap: 10px; max-width: 320px; }
.doc-progress span { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.doc-h2 {
  display: flex; align-items: center; gap: 7px;
  font-size: 17px; font-weight: 700;
  margin: 26px 0 10px;
}
.doc-h2 .icon { color: var(--ink-2); }
.doc-meta { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.doc-meta + .doc-meta { margin-bottom: 18px; }

/* 分章节划线 */
.hl-chapter {
  font-size: 14.5px; font-weight: 700; color: var(--ink);
  margin: 22px 0 8px;
}
.hl-item { margin-bottom: 14px; }
.hl-text {
  font-family: var(--serif);
  font-size: 14.5px; line-height: 2; color: var(--ink);
}
.hl-review {
  margin-top: 6px; margin-left: 14px;
  padding: 8px 12px;
  background: var(--navy-soft); border-radius: 8px;
  font-size: 13px; color: var(--ink);
}
.hl-review::before { content: "我的想法 · "; font-weight: 700; color: var(--navy); }
.hl-item.idea { margin-bottom: 14px; }
.hl-idea {
  padding: 12px 14px;
  background: linear-gradient(180deg, #fff7e6, #fffdf7);
  border: 1px solid #f0d9a8; border-left: 3px solid #d4a24e;
  border-radius: 8px;
  font-size: 14px; line-height: 1.9; color: var(--ink);
}
.hl-idea::before { content: "💡 书摘 / 想法 · "; font-weight: 700; color: #b9842f; }

.empty-tip {
  padding: 26px 0; text-align: center;
  color: var(--ink-3); font-size: 14px;
}

/* 读后感 */
.review-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.review-form textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); font-size: 14px; line-height: 1.7;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.review-form textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31,111,235,.12);
}
.review-form .btn-inline { align-self: flex-end; }

.doc-reviews { display: flex; flex-direction: column; gap: 10px; }
.review-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; background: var(--paper);
}
.review-card time { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 5px; }
.review-card p { font-size: 14px; line-height: 1.8; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 760px) {
  .page { padding: 18px 14px 48px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .head-right { width: 100%; }
  .stats-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .note-link { max-width: 100%; }
  .note-main { flex-direction: row; }
  .doc-hero { flex-direction: row; }
  .doc-title { font-size: 22px; }
  .top-track { flex-basis: 70px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 26px 20px 20px; }
  .cover-card, .cover-img, .cover-ph { width: 88px; }
  .cover-img, .cover-ph { height: 126px; }
  .hm-cell { min-width: 24px; font-size: 10px; }
  .seg-btn { padding: 5px 12px; }
}
