/* ========== 全局变量（完全对齐小程序） ========== */
:root {
  --color-primary: #1B82D2;
  --color-primary-light: #E8F4FD;
  --color-primary-dark: #1570B8;
  --color-bg: #F8F8F8;
  --color-card: #FFFFFF;
  --color-text: #333333;
  --color-text-secondary: #666666;
  --color-text-hint: #B2B2B2;
  --color-success: #07C160;
  --color-border: #EEEEEE;
  --color-shadow: rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[v-cloak] { display: none; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#app {
  max-width: 768px;
  margin: 0 auto;
  background: var(--color-bg);
  min-height: 100vh;
  position: relative;
}

/* ========== 自定义顶部导航（小程序风） ========== */
.koala-nav {
  height: 44px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
}
.koala-nav .nav-left {
  display: flex;
  align-items: center;
  font-size: 24px;
}
.koala-nav .nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 12px;
}
.koala-nav .nav-right {
  min-width: 32px;
  display: flex;
  justify-content: flex-end;
  font-size: 20px;
}
.koala-nav .back-icon {
  font-size: 22px;
  color: var(--color-text);
  cursor: pointer;
  padding: 0 4px;
}

/* ========== 内容区 ========== */
.page-content {
  padding: 12px;
  min-height: calc(100vh - 44px);
}
.page-content.with-tab-bar {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ========== 卡片 ========== */
.card {
  background: var(--color-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========== 本周打卡 ========== */
.week-card {
  padding: 16px;
}
.free-read-tip {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #fff7e6 0%, #fff1d6 100%);
  color: #8a5a00;
  font-size: 12px;
  line-height: 1.5;
}
.free-read-tip b { color: #d97706; font-size: 14px; margin: 0 2px; }
.free-read-tip.empty {
  background: #f6f8fa;
  color: var(--color-text-secondary);
}
.week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.week-title {
  font-size: 15px;
  font-weight: 600;
}
.week-count {
  font-size: 13px;
  color: var(--color-text-secondary);
}
.week-count .num {
  color: var(--color-primary);
  font-weight: 600;
  margin: 0 2px;
}
.week-dots {
  display: flex;
  justify-content: space-between;
}
.day-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.day-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: all .3s;
}
.day-dot.checked { background: var(--color-primary); }
.day-dot.today { border: 2px solid var(--color-primary); }
.day-dot.future { background: var(--color-bg); border: 1px dashed #E0E0E0; }
.day-label {
  font-size: 11px;
  color: var(--color-text-hint);
}

/* ========== 书架 ========== */
.book-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.book-card {
  width: calc((100% - 24px) / 3);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 133.33%;
  border-radius: 6px;
  overflow: hidden;
  background: #F0F0F0;
  margin-bottom: 6px;
}
.book-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8F4FD 0%, #D1ECFA 100%);
  gap: 6px;
  padding: 8px;
}
.cover-placeholder .icon {
  font-size: 28px;
}
.cover-placeholder .title {
  font-size: 11px;
  color: #5B9BD5;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.progress-ring {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-ring.finished {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.progress-ring .ring-check {
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}
.progress-ring .ring-text {
  font-size: 9px;
  color: var(--color-primary);
  font-weight: 700;
  line-height: 1;
}
.book-title {
  font-size: 12px;
  color: var(--color-text);
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 自定义 Tab Bar（中间凸起加号） ========== */
.koala-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 768px;
  margin: 0 auto;
  z-index: 999;
}
.tabbar-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 56px;
  background: #FFFFFF;
  border-top: 1px solid var(--color-border);
  padding: 0 4px;
  position: relative;
  z-index: 1001;
}
.tabbar-safe {
  background: #fff;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  z-index: 1001;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  padding-top: 4px;
  cursor: pointer;
}
.tab-emoji {
  font-size: 20px;
  line-height: 1.2;
  opacity: 0.5;
  transition: opacity .2s;
}
.tab-item.active .tab-emoji { opacity: 1; }
.tab-text {
  font-size: 10px;
  color: var(--color-text-hint);
  line-height: 1.4;
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
}
.tab-item.active .tab-text {
  color: var(--color-primary);
  font-weight: 600;
}
/* 中心 Tab */
.center-tab {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.center-btn {
  position: absolute;
  bottom: 14px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B82D2 0%, #2196F3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(27, 130, 210, 0.45);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  transition: all .3s ease;
  cursor: pointer;
}
.center-btn.active {
  transform: rotate(45deg);
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.45);
}

/* ========== 快捷操作面板（添加书/打卡） ========== */
.action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.action-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.action-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 768px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 1002;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}
.action-panel.show { transform: translateY(0); }
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 10px;
}
.panel-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}
.panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text-hint);
  background: #F5F5F5;
  border-radius: 50%;
  cursor: pointer;
}
.panel-body {
  display: flex;
  padding: 10px 20px 20px;
  gap: 12px;
}
.panel-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #F8F9FC;
  border-radius: 12px;
  padding: 20px 12px;
  cursor: pointer;
  transition: background .2s;
}
.panel-item:active { background: #EEF2F8; }
.panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 10px;
}
.panel-icon.add-icon { background: #E8F4FD; }
.panel-icon.checkin-icon { background: #E8F8EE; }
.panel-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.panel-desc {
  font-size: 11px;
  color: var(--color-text-hint);
}

/* ========== 按钮 ========== */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:active { background: var(--color-primary-dark); }
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 14px;
  text-align: center;
  width: 100%;
  cursor: pointer;
}

/* ========== 统计 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.stat-card .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}
.stat-card .label {
  font-size: 12px;
  color: var(--color-text-hint);
  margin-top: 4px;
}
.chart-container {
  width: 100%;
  height: 240px;
}
.heatmap-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.heatmap-month {
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}
.heatmap-month-title {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
  color: var(--color-text-secondary);
}
.heatmap-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.heatmap-cell {
  aspect-ratio: 1;
  background: #F0F0F0;
  border-radius: 2px;
  cursor: pointer;
}
.heatmap-cell.l1 { background: #C7E2F7; }
.heatmap-cell.l2 { background: #8FC5EF; }
.heatmap-cell.l3 { background: #4FA3E0; }
.heatmap-cell.l4 { background: #1B82D2; }

/* ========== 陪伴 ========== */
.companion-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.coin-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
}
.coin-card {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.coin-card .num {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary);
}
.coin-card .lbl {
  font-size: 11px;
  color: var(--color-text-hint);
  margin-top: 2px;
}
.pet-scene {
  width: 100%;
  aspect-ratio: 1;
  max-width: 360px;
  background: linear-gradient(180deg, #E8F4FD 0%, #D1ECFA 100%);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
/* 旧占位（保留用于其他地方） */
.pet-sprite {
  width: 150px;
  height: 150px;
  animation: bounce 2.4s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ====== PetSprite Canvas 帧动画组件 ====== */
.pet-sprite-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pet-canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.pet-canvas.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ====== 宠物对话气泡（打字机） ====== */
.pet-dialog {
  position: absolute;
  top: 14px;
  right: 14px;
  max-width: 60%;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 3;
}
.pet-dialog::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 30%;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
}
.typing-cursor {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 700;
  animation: blink 0.8s infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.dialog-fade-enter-active,
.dialog-fade-leave-active {
  transition: opacity .25s ease, transform .25s ease;
}
.dialog-fade-enter-from,
.dialog-fade-leave-to {
  opacity: 0;
  transform: translateY(-6px);
}

/* ====== 豆数飘字 ====== */
.bean-float {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  background: rgba(27, 130, 210, 0.92);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(27, 130, 210, 0.35);
}
.bean-float-enter-active {
  animation: bean-up 1.6s ease-out forwards;
}
.bean-float-leave-active {
  animation: bean-fade .2s forwards;
}
@keyframes bean-up {
  0% { opacity: 0; transform: translateX(-50%) translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px); }
}
@keyframes bean-fade {
  to { opacity: 0; }
}

/* ====== 互动按钮禁用态 ====== */
.action-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.pet-name-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--color-primary-dark);
  font-weight: 500;
}
.note-bubble {
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #555;
  margin-top: 8px;
  position: relative;
  max-width: 320px;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.note-bubble::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 24px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #fff;
}
.pet-status {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
}
.status-item {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.status-item .row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
}
.status-item .row b { color: var(--color-text); }
.status-item .bar {
  width: 100%;
  height: 5px;
  background: #F0F0F0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.status-item .bar-inner {
  height: 100%;
  background: var(--color-primary);
  transition: width .4s;
}
.pet-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.action-btn {
  background: #fff;
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: transform .15s;
}
.action-btn:active { transform: scale(0.95); }
.action-btn .emoji { font-size: 26px; }
.action-btn .name {
  font-size: 11px;
  margin-top: 2px;
  color: var(--color-text);
}
.action-btn .cost {
  font-size: 10px;
  color: var(--color-text-hint);
  margin-top: 1px;
}

/* ========== 我的 ========== */
.profile-header {
  background: linear-gradient(135deg, #1B82D2 0%, #2196F3 100%);
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(27, 130, 210, 0.3);
}
.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  margin-right: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}
.profile-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-info h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}
.profile-info p {
  margin: 0;
  opacity: 0.9;
  font-size: 12px;
  line-height: 1.5;
}
.menu-list {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .menu-icon {
  margin-right: 12px;
  color: var(--color-primary);
  font-size: 18px;
  width: 22px;
  text-align: center;
}
.menu-item .menu-title {
  flex: 1;
  font-size: 14px;
}
.menu-item .menu-arrow {
  color: var(--color-text-hint);
  font-size: 16px;
}

/* ========== 详情页封面头 ========== */
.detail-cover-head {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
  margin: -12px -12px 12px;
}
.detail-cover-head .bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.7);
  transform: scale(1.2);
}
.detail-cover-head .bg.empty {
  background: linear-gradient(135deg, #1B82D2, #5B9BD5);
  filter: none;
}
.detail-cover-head .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.45));
}
.detail-cover-head .content {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 16px;
  color: #fff;
  z-index: 1;
}
.detail-cover-head .thumb {
  width: 88px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  margin-right: 14px;
  background: #fff;
  flex-shrink: 0;
}
.detail-cover-head h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.detail-cover-head p {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
}

/* ========== 心得卡片 ========== */
.note-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  box-shadow: 0 2px 8px var(--color-shadow);
}
.note-card .cover {
  width: 50px;
  height: 68px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--color-primary);
}
.note-card .info { flex: 1; min-width: 0; }
.note-card .title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--color-text);
}
.note-card .date {
  font-size: 11px;
  color: var(--color-text-hint);
  margin-bottom: 4px;
}
.note-card .content {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ========== 空状态 ========== */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--color-text-hint);
}
.empty-state .emoji {
  font-size: 40px;
  margin-bottom: 8px;
}
.empty-state .msg {
  font-size: 13px;
}

/* ========== Vant 主题覆盖（蓝色） ========== */
:root {
  --van-primary-color: #1B82D2;
}
.van-button--primary {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}
.van-tab--active,
.van-tab.van-tab--active {
  color: var(--color-primary) !important;
}
.van-tabs__line {
  background: var(--color-primary) !important;
}
.van-search {
  background: transparent !important;
  padding: 8px 0 !important;
}
.van-search__content {
  border-radius: 10px !important;
}

/* ========== 通用全局弹窗（打卡/加书） ========== */
.koala-popup {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  max-height: 85dvh; /* 移动端键盘弹起时用动态视口高度 */
  width: 100%;
  background: #fff;
}
.koala-popup-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--color-border);
}
.koala-popup-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}
.koala-popup-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
}
.koala-popup-footer {
  flex-shrink: 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--color-border);
}
.koala-popup-footer .btn-primary:disabled {
  opacity: 0.5;
}

/* Vant 字段在弹窗内的样式微调 */
.koala-popup-body .van-cell-group {
  margin: 0 0 8px;
}
.koala-popup-body .van-cell {
  padding: 12px 16px;
}

/* 加书弹窗：封面上传区 */
.cover-upload-row {
  display: flex;
  align-items: center;
  padding: 12px 20px 16px;
  gap: 14px;
}
.cover-upload-row .van-uploader {
  flex-shrink: 0;
}
.cover-upload-placeholder {
  width: 90px;
  height: 120px;
  border: 1.5px dashed #CCC;
  border-radius: 8px;
  background: #FAFAFA;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--color-text-hint);
}
.cover-upload-placeholder .ic {
  font-size: 28px;
}
.cover-upload-placeholder .txt {
  font-size: 12px;
}
.cover-upload-hint {
  flex: 1;
  font-size: 13px;
  color: var(--color-text-hint);
  line-height: 1.6;
}
/* 让 Vant 上传预览图也遵循 3:4 */
.cover-upload-row .van-uploader__preview-image,
.cover-upload-row .van-uploader__preview {
  width: 90px !important;
  height: 120px !important;
  border-radius: 8px;
}

/* ========== 打卡弹窗（完全自定义，对齐小程序） ========== */
/* 自定义 sheet（替换 vant popup） */
.ck-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
}
.ck-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2001;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
/* slide-up 动画 */
.ck-slide-enter-active, .ck-slide-leave-active { transition: transform .28s ease; }
.ck-slide-enter-from, .ck-slide-leave-to { transform: translateY(100%); }
.ck-slide-enter-to, .ck-slide-leave-from { transform: translateY(0); }

/* ========== 添加新书弹窗（对齐小程序 add-book 页） ========== */
.ck-sheet-add { max-height: 92vh; display: flex; flex-direction: column; }
.ck-sheet-add .koala-popup { display: flex; flex-direction: column; max-height: 92vh; }
.ck-sheet-add .koala-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.ck-sheet-add .koala-popup-title { font-size: 17px; font-weight: 600; color: #333; }
.ck-sheet-add .panel-close { font-size: 20px; color: #999; cursor: pointer; padding: 4px 10px; }
.ck-sheet-add .top-submit {
  background: #07C160; color: #fff; padding: 6px 16px; border-radius: 16px;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.ck-sheet-add .top-submit.disabled { background: #b8e3c7; cursor: not-allowed; }
.addbook-body { padding: 20px 16px 24px; overflow-y: auto; flex: 1; }

/* 封面上传（对齐小程序 cover-section） */
.cover-section {
  width: 130px; height: 170px; margin: 0 auto 24px; border-radius: 8px;
  border: 1.5px dashed #d9d9d9; display: flex; align-items: center;
  justify-content: center; overflow: hidden; cursor: pointer; background: #fafafa;
}
.cover-section .cover-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: #999;
}
.cover-section .plus-icon { font-size: 36px; color: #c0c0c0; line-height: 1; }
.cover-section .cover-tip { font-size: 12px; color: #999; }
.cover-section .cover-preview { width: 100%; height: 100%; object-fit: cover; }
.cover-section { position: relative; }
.cover-section .cover-uploading-mask {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 13px; border-radius: inherit;
}

/* 表单卡片（对齐小程序 form-card） */
.addbook-form {
  background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 4px 16px; border: 1px solid #f0f0f0;
}
.addbook-form .form-item {
  display: flex; align-items: center; padding: 14px 0; gap: 12px;
}
.addbook-form .form-item.half { flex: 1; }
.addbook-form .form-row { display: flex; gap: 16px; }
.addbook-form .form-label {
  font-size: 14px; color: #666; min-width: 56px; flex-shrink: 0;
}
.addbook-form .form-input {
  flex: 1; border: none; outline: none; font-size: 15px; color: #333;
  background: transparent; padding: 4px 0; min-width: 0; width: 100%;
}
.addbook-form .form-input::placeholder { color: #c0c0c0; }
.addbook-form .form-divider { height: 1px; background: #f0f0f0; }
.addbook-form .form-select {
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; color: #333; min-width: 0;
}
.addbook-form .form-select .placeholder { color: #c0c0c0; }
.addbook-form .form-select .select-arrow { color: #c0c0c0; font-size: 18px; margin-left: 6px; }
.form-tip { color: #999; font-size: 12px; padding: 12px 4px 0; }

/* picker-sheet（对齐小程序 picker-modal） */
.picker-sheet { max-height: 60vh; display: flex; flex-direction: column; }
.picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.picker-cancel { color: #969799; font-size: 14px; cursor: pointer; }
.picker-title { font-size: 16px; color: #323233; font-weight: 500; }
.picker-add { color: #07C160; font-size: 14px; cursor: pointer; font-weight: 500; }
.picker-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.picker-item {
  padding: 14px 20px; font-size: 15px; color: #333; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #f7f7f7;
}
.picker-item.selected { color: #07C160; font-weight: 500; }
.picker-item .check { color: #07C160; font-size: 16px; }
.picker-empty { padding: 40px 20px; color: #c0c0c0; text-align: center; font-size: 14px; }

/* Van Popup 宿主容器需要允许内部 flex 正常工作 */
.koala-van-popup {
  max-height: 90vh !important;
  max-height: 90dvh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.checkin-popup {
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 768px;
  flex: 1;
  min-height: 0;
  background: #fff;
  box-sizing: border-box;
}
.checkin-top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.checkin-top-bar .top-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text-hint);
  background: #F5F5F5;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.checkin-top-bar .top-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 10px;
}
.checkin-top-bar .top-submit {
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 6px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.checkin-top-bar .top-submit:active {
  background: var(--color-primary-dark);
}
.checkin-top-bar .top-submit.disabled {
  opacity: 0.6;
  pointer-events: none;
}
.checkin-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
}

.ck-field {
  margin-bottom: 18px;
}
.ck-field.half { flex: 1; margin-bottom: 0; }
.ck-row {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}
.ck-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.ck-label .optional {
  color: var(--color-text-hint);
  font-weight: 400;
}
.ck-picker-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #F8F8F8;
  border-radius: 10px;
  font-size: 15px;
  color: var(--color-text);
  cursor: pointer;
  min-height: 44px;
}
.ck-picker-box.empty {
  color: var(--color-text-hint);
}
.ck-picker-arrow {
  color: var(--color-text-hint);
  font-size: 12px;
  margin-left: 8px;
}
.ck-hint {
  font-size: 12px;
  color: var(--color-primary);
  margin-top: 6px;
}

.num-box {
  display: flex;
  align-items: center;
  background: #F8F8F8;
  border-radius: 10px;
  overflow: hidden;
  height: 44px;
}
.num-btn {
  width: 40px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--color-primary);
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
  flex-shrink: 0;
}
.num-btn:active {
  background: #E8F4FD;
}
.num-input {
  flex: 1;
  width: 0;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ck-note {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  background: #F8F8F8;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  color: var(--color-text);
  resize: vertical;
  outline: none;
  font-family: inherit;
  line-height: 1.6;
  box-sizing: border-box;
}
.ck-note::placeholder {
  color: var(--color-text-hint);
}
.ck-note:focus {
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--color-primary);
}
.ck-note-count {
  text-align: right;
  font-size: 11px;
  color: var(--color-text-hint);
  margin-top: 4px;
}

/* ========== 英语朗读模块 ========== */
.panel-icon.english-icon { background: #FFF1E0; }

/* —— 录音弹窗 —— */
.er-record-sheet {
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.er-body {
  padding: 16px 16px 24px;
  overflow-y: auto;
}
.er-cover-preview {
  margin-top: 10px;
  text-align: center;
}
.er-cover-preview img {
  max-width: 160px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.er-record-area {
  margin-top: 24px;
  padding: 24px 16px;
  background: #F8F9FC;
  border-radius: 16px;
  text-align: center;
}
.er-timer {
  font-size: 44px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 18px;
}
.er-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.er-actions audio {
  width: 100%;
  max-width: 320px;
}
.er-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 100px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, opacity .2s;
}
.er-btn:active { transform: scale(.96); }
.er-btn:disabled { opacity: .4; cursor: not-allowed; }
.er-btn-primary { background: var(--color-primary); color: #fff; }
.er-btn-stop { background: #FF4D4F; color: #fff; }
.er-btn-secondary { background: #fff; color: var(--color-text); border: 1px solid #E5E8EE; }
.er-btn-icon { font-size: 16px; }
.er-recording-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #FF4D4F;
  animation: er-pulse 1s infinite;
}
@keyframes er-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}
.er-tip {
  font-size: 12px;
  color: var(--color-text-hint);
}
.er-tip-error { color: #FF4D4F; }
.er-tip-bottom {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--color-text-hint);
}

/* —— 朗读历史主页 —— */
.er-page {
  padding: 12px 14px 32px;
}
.er-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.er-stat-card {
  flex: 1;
  background: linear-gradient(135deg, #FFF6E5 0%, #FFEACC 100%);
  border-radius: 14px;
  padding: 18px 12px;
  text-align: center;
}
.er-stat-card:nth-child(2) {
  background: linear-gradient(135deg, #E8F4FD 0%, #C9E5FA 100%);
}
.er-stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.er-stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-hint);
}
.er-dim-switch {
  display: inline-flex;
  background: #F0F2F6;
  border-radius: 100px;
  padding: 3px;
  margin-bottom: 14px;
}
.er-dim-item {
  padding: 6px 18px;
  font-size: 13px;
  border-radius: 100px;
  color: var(--color-text-hint);
  cursor: pointer;
  transition: all .2s;
}
.er-dim-item.active {
  background: #fff;
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.er-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0 12px;
}
.er-nav-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #F0F2F6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.er-nav-btn.disabled { opacity: .3; cursor: not-allowed; }
.er-nav-title { font-size: 16px; font-weight: 600; color: var(--color-text); }

.er-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--color-text-hint);
  margin-bottom: 6px;
}
.er-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.er-day-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #F8F9FC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text);
  cursor: default;
}
.er-day-cell.empty { background: transparent; }
.er-day-cell.has {
  background: linear-gradient(135deg, #FFE2A0 0%, #FFB84C 100%);
  color: #5C3B00;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255,184,76,.35);
}
.er-day-cell.has:active { transform: scale(.95); }
.er-day-cell.today {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
.er-day-num {}
.er-day-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #FF4D4F;
  color: #fff;
  border-radius: 100px;
  padding: 0 5px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
}

/* —— 年视图 12 宫格 —— */
.er-year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.er-mini-month {
  background: #F8F9FC;
  border-radius: 10px;
  padding: 8px 6px;
}
.er-mini-title {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-hint);
  margin-bottom: 4px;
}
.er-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.er-mini-cell {
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: transparent;
}
.er-mini-cell.empty { background: transparent; }
.er-mini-cell.has {
  background: #FFB84C;
  cursor: pointer;
}
.er-mini-cell.today {
  outline: 1px solid var(--color-primary);
}

.er-loading, .er-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--color-text-hint);
  font-size: 13px;
}

/* —— 当日详情弹层 —— */
.er-day-sheet {
  max-height: 80vh;
}
.er-day-body {
  padding: 14px 16px 24px;
  overflow-y: auto;
}
.er-day-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #F8F9FC;
  border-radius: 12px;
  margin-bottom: 10px;
}
.er-day-cover {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #E8EBF0;
}
.er-day-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.er-day-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.er-day-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.er-day-meta {
  font-size: 12px;
  color: var(--color-text-hint);
}
.er-day-audio {
  width: 100%;
  margin-top: 4px;
  height: 32px;
}
