/* ===== 宠护记 - Design System ===== */
/* 低饱和暖色调 · 珊瑚色点缀 · 浅绿辅助 · 微立体 */

:root {
  --bg: #FFF8F0;
  --bg-card: #FFFFFF;
  --bg-warm: #FFF3E6;
  --bg-soft: #FDF6ED;
  --coral: #F4845F;
  --coral-light: #F9A88C;
  --coral-dark: #D96B45;
  --green: #7EC8A0;
  --green-light: #A8DCC0;
  --green-dark: #5EAA80;
  --lavender: #B8A9D4;
  --text-primary: #3D3229;
  --text-secondary: #8A7E74;
  --text-muted: #B8ADA3;
  --border: #F0E6DA;
  --shadow: rgba(61, 50, 41, 0.08);
  --shadow-md: rgba(61, 50, 41, 0.12);
  --danger: #E85D5D;
  --danger-light: #FFF0F0;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-full: 50px;
  --nav-height: 64px;
  --header-height: 56px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ===== Header ===== */
#app-header {
  --header-total-height: calc(var(--header-height) + env(safe-area-inset-top));
  height: var(--header-height);
  padding-top: env(safe-area-inset-top);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-sizing: border-box;
}

#header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

#header-back {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: var(--coral);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

#header-back:hover {
  background: var(--bg-warm);
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
}

/* ===== Main Container ===== */
#page-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  position: absolute;
  top: calc(var(--header-height) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  /* 内容不被固定导航栏遮挡，scrollIntoView 也会正确停靠 */
  scroll-padding-top: calc(var(--nav-height) + 8px);
}

.page.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.page-inner {
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 24px);
  min-width: 0; /* 防止flex子元素撑破容器 */
  overflow: hidden; /* 防止子元素溢出 */
}
#page-records .page-inner {
  padding-top: 0;
}
#page-vaccine .page-inner {
  padding-top: 8px;
}
#page-weight .page-inner {
  padding-top: 0;
}

.hidden {
  display: none !important;
}

/* ===== Bottom Nav ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px var(--shadow);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--transition);
  position: relative;
}

.nav-item.active {
  color: var(--coral);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--coral);
  border-radius: 0 0 3px 3px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* ===== Pet List ===== */
.pet-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.pet-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
}

.pet-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-md);
}

.pet-card:active {
  transform: scale(0.97);
}

.pet-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  overflow: hidden;
  border: 3px solid var(--border);
}

.pet-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.pet-card-breed {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.pet-card-gender {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
}

.pet-card {
  position: relative;
}

/* ===== FAB ===== */
.fab {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244, 132, 95, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 50;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(244, 132, 95, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state .sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Pet Detail ===== */
.pet-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  position: relative;
}

.pet-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--coral-light);
}

.pet-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-detail-info h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.breed-tag {
  font-size: 13px;
  color: var(--coral);
  background: rgba(244, 132, 95, 0.1);
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}

.meta-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.icon-btn {
  position: absolute;
  top: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

#btn-edit-pet {
  right: 44px;
}

#btn-delete-pet {
  right: 8px;
}

.icon-btn:hover {
  background: var(--bg-warm);
  color: var(--coral);
}

.icon-btn.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.qa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 6px var(--shadow);
}

.qa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-md);
}

.qa-btn:active {
  transform: scale(0.95);
}

.qa-icon {
  font-size: 18px;
}

.qa-btn span:last-child {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Section Card */
.section-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

/* 拖拽排序 */
.home-draggable-section {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.home-draggable-section.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}
.home-draggable-section.drag-over {
  border-top: 3px solid var(--primary);
  margin-top: -3px;
}
.home-draggable-section.drag-over::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  z-index: 10;
}
/* 确保内部 section-card 撑满宽度 */
.home-draggable-section > .section-card {
  margin-bottom: 0;
}

/* 拖拽手柄 */
.drag-handle {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: grab;
  z-index: 5;
  padding: 4px 6px;
  border-radius: 4px;
  user-select: none;
  line-height: 1;
  letter-spacing: -2px;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
}
.drag-handle:hover {
  opacity: 1;
  color: var(--primary);
}
.drag-handle:active {
  cursor: grabbing;
}

/* 拖拽容器（JS 动态创建） */
#home-drag-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Profile Pet List */
.pet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.profile-pet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.profile-pet-item:last-child {
  border-bottom: none;
}

.pet-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.pet-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-name-sm {
  font-weight: 500;
  color: var(--text-primary);
  min-width: 60px;
}

.pet-info-sm {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Home Feature Grid */
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.feature-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.feature-card:active {
  transform: scale(0.95);
  background: var(--bg-secondary);
}

.feature-card .feature-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.feature-card .feature-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-btn {
  background: none;
  border: none;
  color: var(--coral);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.sub-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
}

/* Photo Gallery */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform var(--transition);
}

.photo-thumb:hover {
  transform: scale(1.05);
}

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

/* 首页相册 - 3列，更大尺寸 */
#home-photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Chart */
.chart-container {
  position: relative;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 120px;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

.chart-container.large {
  min-height: 200px;
  margin-bottom: 16px;
}

/* ===== Reminder ===== */
.reminder-header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reminder-header .date-nav {
  flex: 1;
}

.view-toggle {
  display: flex;
  background: rgba(0,0,0,0.05);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

.toggle-btn {
  padding: 4px 12px;
  border: none;
  background: transparent;
  border-radius: 18px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}

.toggle-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.date-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 2px 6px var(--shadow);
}

.date-nav-btn:hover {
  background: var(--coral);
  color: white;
  border-color: var(--coral);
}

.date-nav-btn.small {
  width: 28px;
  height: 28px;
  font-size: 16px;
  box-shadow: none;
}

.date-display {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reminder-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}

.reminder-item:hover {
  box-shadow: 0 4px 12px var(--shadow-md);
}

.reminder-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.reminder-info {
  flex: 1;
  min-width: 0;
}

.reminder-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.reminder-pet-name {
  font-size: 12px;
  color: var(--text-secondary);
}

.reminder-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--coral);
  flex-shrink: 0;
}

.reminder-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.reminder-check.checked {
  background: var(--green);
  border-color: var(--green);
}

.reminder-check.checked::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.reminder-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.reminder-repeat-tag {
  font-size: 11px;
  color: var(--green-dark);
  background: rgba(126, 200, 160, 0.15);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

.reminder-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.reminder-item:hover .reminder-delete {
  opacity: 1;
}

.reminder-delete:hover {
  color: var(--danger);
}

/* ===== Weight ===== */
.weight-pet-selector {
  margin-bottom: 16px;
}

.weight-records {
  max-height: 300px;
  overflow-y: auto;
}

.weight-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.weight-record-item:last-child {
  border-bottom: none;
}

.weight-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.weight-val span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.weight-date {
  font-size: 13px;
  color: var(--text-secondary);
}

.weight-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.weight-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ===== Settings ===== */
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 2px 12px var(--shadow);
  border: 1px solid var(--border);
}

.login-avatar {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-card h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.login-tabs {
  display: flex;
  margin: 20px 0 16px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.login-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
}

.login-tab.active {
  background: var(--bg-card);
  color: var(--coral);
  font-weight: 600;
  box-shadow: 0 1px 4px var(--shadow);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sms-row {
  display: flex;
  gap: 10px;
}

.flex-1 {
  flex: 1;
}

/* User Card */
.user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.user-info h3 {
  font-size: 18px;
  font-weight: 600;
}

.settings-group {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 6px var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: none;
  border: none;
  width: 100%;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:hover {
  background: var(--bg-soft);
}

.settings-item.danger {
  color: var(--danger);
  justify-content: center;
}

.app-info {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Form Elements ===== */
.input-field {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg-soft);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  pointer-events: auto;
}

.input-field:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(244, 132, 95, 0.1);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.styled-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg-soft);
  color: var(--text-primary);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A7E74' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* ===== Buttons ===== */
.btn-primary {
  padding: 13px 24px;
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(244, 132, 95, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(244, 132, 95, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.98);
}

.full-width {
  width: 100%;
}

.btn-outline {
  padding: 10px 16px;
  background: none;
  border: 1.5px solid var(--coral);
  color: var(--coral);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-outline:hover {
  background: rgba(244, 132, 95, 0.08);
}

.btn-text {
  background: none;
  border: none;
  color: var(--coral);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
}

.btn-default {
  padding: 10px 20px;
  background: #f0f0f0;
  color: #666;
  border: 1.5px solid #ccc;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-default:hover {
  background: #e0e0e0;
  border-color: #aaa;
}

.btn-danger {
  padding: 10px 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger-outline {
  padding: 8px 16px;
  background: none;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
}

/* ===== Pickers ===== */
.species-picker, .gender-picker, .reminder-type-picker, .repeat-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.species-btn, .gender-btn, .sterilized-btn, .reminder-type-btn, .repeat-btn {
  padding: 8px 14px;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.species-btn.active, .gender-btn.active, .sterilized-btn.active, .reminder-type-btn.active, .repeat-btn.active {
  background: rgba(244, 132, 95, 0.1);
  border-color: var(--coral);
  color: var(--coral);
  font-weight: 600;
}

/* ===== Avatar Picker ===== */
.avatar-picker {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-warm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  border: 2px dashed var(--border);
}
.avatar-picker:hover {
  background: color-mix(in srgb, var(--coral) 8%, var(--bg-warm));
  border-color: var(--coral);
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 10px;
  border: 3px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}
.avatar-picker:hover .avatar-preview {
  border-color: var(--coral);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-btn {
  font-size: 14px;
  color: var(--coral);
  font-weight: 600;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(61, 50, 41, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: -1;
  pointer-events: none;
}

.modal-overlay.dark {
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.modal-content .modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-card);
  flex-shrink: 0;
}

.modal-content .modal-body {
  flex: 1;
  padding-bottom: 80px;
}

.modal-footer-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--bg-card);
  padding: 12px 16px;
  border-top: 1px solid #eee;
}

.modal-content.confirm-box {
  border-radius: var(--radius);
  max-height: none;
  width: auto;
  min-width: 280px;
  max-width: 360px;
  margin: auto;
  padding: 24px;
  text-align: center;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.confirm-actions .btn-outline {
  border-color: #ccc;
  color: #666;
  flex: 1;
}

.confirm-actions .btn-outline:hover {
  background: #f5f5f5;
  border-color: #aaa;
}

.confirm-actions .confirm-ok-btn {
  flex: 1;
}

.choice-item {
  transition: all 0.15s;
}

.choice-item:hover {
  background: #dce8ff !important;
  transform: scale(1.01);
}

.choice-item.selected {
  background: #bcd4ff !important;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-soft);
  color: var(--text-primary);
}

.modal-close.light {
  color: white;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
}

.modal-body {
  padding: 20px;
  padding-bottom: 32px;
}

/* Photo Viewer */
.photo-viewer-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
}

.photo-viewer-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  object-fit: contain;
}

/* Confirm Dialog */
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

#confirm-message {
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  z-index: 200;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Reminder Mini List ===== */
.reminder-mini-list .reminder-item {
  padding: 10px 12px;
  margin-bottom: 6px;
}

/* ===== Pet Selector (Dashboard) ===== */
.pet-selector {
  margin-bottom: 16px;
  position: relative;
}

.pet-cards-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pet-cards-scroll::-webkit-scrollbar {
  display: none;
}

/* 勤快榜浮动按钮 */
.leaderboard-float-btn {
  position: fixed;
  top: calc(var(--header-height) + 60px);
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #FF9A3C, #FF6B35);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
  z-index: 10;
  transition: transform var(--transition), box-shadow var(--transition);
}
.leaderboard-float-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.5);
}
.leaderboard-rank {
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
}

/* 宠物详情卡片（首页） */
.pet-card-mini {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px var(--shadow);
  min-width: 100%;
}
.pet-card-mini.active {
  border-color: var(--coral);
  background: rgba(244, 132, 95, 0.05);
}
.pet-card-mini-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.pet-card-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pet-card-mini-info {
  flex: 1;
  min-width: 0;
}
.pet-card-mini-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.pet-card-mini-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.pet-card-mini-actions {
  display: flex;
  gap: 6px;
}
.pet-card-mini-action {
  flex: 1;
  padding: 4px 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  white-space: nowrap;
}
.pet-card-mini-action:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== Quick Actions Grid (Dashboard) ===== */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.qa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.qa-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.qa-btn:active {
  transform: scale(0.95);
}

/* ===== Detail Entries ===== */
.detail-entries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.entry-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 6px var(--shadow);
}

.entry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-md);
}

.entry-btn span:first-child {
  font-size: 24px;
}

.entry-btn span:last-child {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Record Mini Item ===== */
.record-mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.record-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.record-mini-item:last-child {
  border-bottom: none;
}

.record-amount {
  color: var(--text-primary);
  font-weight: 500;
}

.record-date {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Records Page ===== */
.records-header {
  margin-bottom: 16px;
}
#records-stats-container {
  display: block;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}
.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
}

.record-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.record-info {
  flex: 1;
  min-width: 0;
}

.record-title {
  font-size: 15px;
  font-weight: 600;
}

.record-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.record-time {
  font-size: 12px;
  color: var(--text-muted);
}

.record-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.record-item:hover .record-delete {
  opacity: 1;
}

.record-delete:hover {
  color: var(--danger);
}

/* ===== Timeline (Medicals) ===== */
.timeline-list {
  position: relative;
  padding-left: 20px;
}

.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  border: 2px solid var(--bg);
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-content {
  flex: 1;
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-hospital {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-diagnosis {
  font-size: 13px;
  color: var(--coral);
  margin-bottom: 2px;
}

.timeline-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.medical-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.timeline-item:hover .medical-delete {
  opacity: 1;
}

.medical-delete:hover {
  color: var(--danger);
}

/* ===== Album Grid ===== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.album-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
}

.album-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== QRCode ===== */
.qrcode-card {
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 12px var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.qrcode-pet-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.qrcode-pet-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
  border: 2px solid var(--coral-light);
}

.qrcode-pet-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qrcode-pet-info h3 {
  font-size: 18px;
  font-weight: 600;
}

.qrcode-pet-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.qrcode-image {
  margin: 20px auto;
  padding: 20px;
  background: white;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

.qrcode-placeholder {
  font-size: 24px;
  font-weight: 700;
  color: var(--coral);
  letter-spacing: 2px;
}

.qrcode-contact p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.qrcode-actions {
  margin-top: 16px;
}

/* ===== Shops ===== */
.shop-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  /* 确保不折行，即使宽度不够也横向滚动 */
  flex-wrap: nowrap;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.shop-filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn.active {
  background: rgba(244, 132, 95, 0.1);
  border-color: var(--coral);
  color: var(--coral);
  font-weight: 600;
}

.shops-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shop-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.shop-header h4 {
  font-size: 16px;
  font-weight: 600;
}

.shop-type-tag {
  font-size: 11px;
  color: var(--green-dark);
  background: rgba(126, 200, 160, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.shop-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.shop-phone {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--coral);
  text-decoration: none;
}

/* ===== Member Card ===== */
.member-card {
  background: linear-gradient(135deg, #FFF8F0, #FFE8D6);
  border-color: var(--coral-light);
}

.member-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.member-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--coral-dark);
}

.member-expire-date {
  font-size: 13px;
  color: var(--coral);
  margin-bottom: 8px;
  font-weight: 500;
}

.member-benefits {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.member-benefits span {
  font-size: 11px;
  color: var(--coral);
  background: rgba(244, 132, 95, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.member-badge {
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.btn-primary.small {
  padding: 6px 16px;
  font-size: 13px;
}

.btn-outline.small {
  padding: 6px 14px;
  font-size: 12px;
}

/* ===== Checkin ===== */
.checkin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.checkin-info {
  display: flex;
  gap: 16px;
}

.checkin-days, .checkin-points {
  font-size: 13px;
  color: var(--text-secondary);
}

.checkin-days b, .checkin-points b {
  color: var(--coral);
  font-size: 16px;
}

/* ===== Invite ===== */
.invite-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.invite-code-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary, #FF6B35);
  letter-spacing: 2px;
  font-family: monospace;
}

.btn-copy-invite {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 14px;
  border: 1.5px solid var(--primary, #FF6B35);
  color: var(--primary, #FF6B35);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-invite:active {
  background: var(--primary, #FF6B35);
  color: #fff;
}

.invite-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.invite-row .input-field {
  flex: 1;
}

/* ===== 🏆 排行榜 ===== */
.leaderboard-header {
  margin-bottom: 12px;
  min-width: 0;
  overflow: hidden;
}
#leaderboard-list {
  min-width: 0;
  overflow: hidden;
}
.leaderboard-hero {
  text-align: center;
  padding: 20px 0 14px;
}
.leaderboard-trophy {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 6px;
  animation: mascotBounce 1s ease infinite alternate;
}
.leaderboard-hero h2 {
  margin: 4px 0 6px;
  font-size: 20px;
  color: var(--text-primary);
}
.my-rank-card {
  background: linear-gradient(135deg, #F4845F 0%, #F9A88C 100%);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  margin-bottom: 12px;
}
.my-rank-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.my-rank-label {
  font-size: 12px;
  opacity: 0.85;
}
.my-rank-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.my-rank-stats {
  display: flex;
  gap: 12px;
}
.my-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.my-stat span {
  font-size: 18px;
  font-weight: 700;
}
.my-stat small {
  font-size: 10px;
  opacity: 0.85;
}
.score-rule-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.score-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.score-rule-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}
.rule-pts {
  color: var(--coral);
  font-weight: 600;
}
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.leaderboard-loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}
.lb-skeleton {
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0e8df 25%, #fdf6ed 50%, #f0e8df 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 6px var(--shadow);
  transition: transform 0.15s ease;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.leaderboard-item:active {
  transform: scale(0.98);
}
.leaderboard-item.top3 {
  border: 1.5px solid rgba(244,132,95,0.25);
  background: linear-gradient(135deg, #fff 70%, rgba(244,132,95,0.07));
}
.rank-num {
  font-size: 18px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  color: var(--text-secondary);
}
.rank-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rank-avatar-fallback {
  font-size: 18px;
  font-weight: 700;
  color: var(--coral);
}
.rank-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.rank-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-name .member-badge-sm {
  font-size: 10px;
  background: linear-gradient(135deg, #F4845F, #F9A88C);
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.rank-pets {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  flex-wrap: wrap;
  min-width: 0;
}
.rank-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  overflow: hidden;
}
.lb-rec-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-warm);
  padding: 2px 5px;
  border-radius: 6px;
  flex-shrink: 1;
  min-width: 0;
}
.rank-score {
  text-align: right;
  flex-shrink: 0;
  flex-basis: 52px;
  width: 52px;
  min-width: 52px;
}
.rank-score span {
  font-size: 20px;
  font-weight: 700;
  color: var(--coral);
}
.rank-score small {
  font-size: 11px;
  color: var(--text-muted);
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== 🐾 动画萌宠形象 ===== */
.pet-mascot-zone {
  background: linear-gradient(135deg, #FFF3E6 0%, #FFF8F0 100%);
  border-radius: 20px;
  padding: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}
.pet-mascot-scene {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 130px;
  position: relative;
}
.mascot-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mascot-bg {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 30px;
  background: rgba(244,132,95,0.1);
  border-radius: 50%;
  filter: blur(6px);
}
.mascot-body {
  animation: breathe 3s ease-in-out infinite;
  position: relative;
  cursor: pointer;
  transform-origin: bottom center;
}
@keyframes breathe {
  0%, 100% { transform: scaleY(1) translateY(0); }
  50% { transform: scaleY(1.04) translateY(-4px); }
}
.mascot-ears {
  display: flex;
  justify-content: space-between;
  width: 64px;
  margin: 0 auto -10px;
  position: relative;
  z-index: 2;
}
.mascot-ears.cat-ears .ear {
  width: 18px;
  height: 22px;
  background: inherit;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.mascot-ears.rabbit-ears .ear.long {
  width: 12px;
  height: 36px;
  border-radius: 6px;
  background: inherit;
}
.mascot-ears.dog-ears .ear.floppy {
  width: 22px;
  height: 20px;
  border-radius: 0 0 12px 12px;
  background: inherit;
  margin-top: 8px;
}
.mascot-head {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  position: relative;
  z-index: 3;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.mascot-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.mascot-eyes {
  display: flex;
  gap: 14px;
}
.mascot-eye {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #333;
  position: relative;
  transition: height 0.1s;
}
.mascot-eye.blinking {
  height: 2px;
  margin-top: 5px;
}
.mascot-eye .pupil {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 1px;
  right: 1px;
}
.mascot-nose {
  width: 9px;
  height: 7px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: #FF6B6B;
}
.mascot-mouth {
  width: 14px;
  height: 7px;
  border-bottom: 2px solid #333;
  border-radius: 0 0 8px 8px;
}
.mascot-cheek {
  position: absolute;
  width: 14px;
  height: 8px;
  border-radius: 50%;
  bottom: 14px;
}
.mascot-cheek.left { left: 6px; }
.mascot-cheek.right { right: 6px; }
.mascot-body-main {
  width: 54px;
  height: 52px;
  border-radius: 30px 30px 20px 20px;
  position: relative;
  z-index: 2;
  margin-top: -6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mascot-belly {
  width: 32px;
  height: 30px;
  border-radius: 50%;
  opacity: 0.8;
}
.mascot-paws {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  position: absolute;
  bottom: -6px;
}
.mascot-paw {
  width: 14px;
  height: 10px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.85;
}
.mascot-tail {
  position: absolute;
  right: -14px;
  bottom: 10px;
  width: 12px;
  height: 28px;
  border-radius: 6px;
  transform-origin: bottom center;
  animation: wagTail 1.2s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes wagTail {
  from { transform: rotate(-20deg); }
  to   { transform: rotate(20deg); }
}
.mascot-shadow {
  width: 60px;
  height: 12px;
  background: rgba(0,0,0,0.08);
  border-radius: 50%;
  margin: 4px auto 0;
  filter: blur(3px);
}
.mascot-name-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--coral);
  background: rgba(255,255,255,0.8);
  border-radius: 10px;
  padding: 2px 8px;
  margin-top: 4px;
  box-shadow: 0 1px 4px var(--shadow);
}
@keyframes mascotBounce {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

/* ===== 🐾 AI 萌宠形象 ===== */
.mascot-wrapper.ai-mascot {
  flex-direction: column;
  align-items: center;
}
.mascot-wrapper.ai-mascot .mascot-body {
  animation: mascotAiFloat 3s ease-in-out infinite;
  background: none;
  border-radius: 0;
  box-shadow: none;
  width: auto;
  height: auto;
}
#mascot-ai-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 16px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
@keyframes mascotAiFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-8px) scale(1.03); }
}

/* ===== 💎 会员对比表 ===== */
.compare-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: linear-gradient(135deg, #F4845F 0%, #F9A88C 100%);
  color: #fff;
  padding: 14px 12px;
  border-radius: 12px 12px 0 0;
  text-align: center;
}
.compare-col-label { }
.compare-col { position: relative; }
.compare-col.vip {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 4px 0;
}
.compare-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: var(--coral);
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
}
.compare-plan-name { font-size: 13px; font-weight: 600; }
.compare-plan-price { font-size: 16px; font-weight: 700; }
.compare-plan-price span { font-size: 11px; font-weight: 400; opacity: 0.85; }
.compare-group-title {
  background: var(--bg-soft);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.compare-row.alt {
  background: var(--bg-soft);
}
.compare-label {
  font-size: 13px;
  color: var(--text-primary);
}
.compare-val {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}
.compare-val.vip {
  font-weight: 600;
  color: var(--coral);
}
.cmp-yes { color: #5EAA80; font-size: 15px; }
.cmp-no  { color: var(--text-muted); font-size: 15px; }

/* ===== AI 助手样式 ===== */
.ai-entry {
  border: 1.5px dashed #a78bfa !important;
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%) !important;
}
.ai-entry:active {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%) !important;
}

.ai-report-modal {
  max-height: 85vh;
}
.ai-report-modal .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}
.ai-report-modal .modal-footer {
  padding: 12px 20px 20px;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}
.ai-loading p {
  color: var(--text-secondary);
  font-size: 14px;
}
.ai-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

#ai-report-content {
  line-height: 1.7;
  font-size: 14px;
  color: var(--text-primary);
}
#ai-report-content h4 {
  margin: 12px 0 6px;
  font-size: 15px;
  color: var(--text-primary);
}
#ai-report-content p {
  margin: 6px 0;
}
#ai-report-content strong {
  color: var(--coral);
}

.ai-reminder-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.ai-reminder-item .ai-reminder-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.ai-reminder-item .ai-reminder-info {
  flex: 1;
}
.ai-reminder-item .ai-reminder-name {
  font-weight: 600;
  margin-bottom: 2px;
}
.ai-reminder-item .ai-reminder-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== AI 生成提醒按钮 ===== */
.ai-gen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 40px);
  margin: 20px auto 16px;
  padding: 12px;
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  border: 1.5px dashed #a78bfa;
  border-radius: 12px;
  color: #7c3aed;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-gen-btn:active {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  transform: scale(0.98);
}

.ai-report-text {
  line-height: 1.8;
  font-size: 14px;
}
.ai-report-text h4 {
  color: var(--coral);
  margin: 12px 0 4px;
  font-size: 15px;
}
.ai-report-text p {
  margin: 6px 0;
}
/* 宠物档案报告样式 */
.ai-report-text.pet-report {
  background: linear-gradient(135deg, #f8f9ff 0%, #fff5f5 100%);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #e8e0ff;
}
.ai-report-text.pet-report h4 {
  color: var(--coral);
  font-size: 16px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--coral);
  margin-top: 16px;
}
.ai-report-text.pet-report h4:first-child {
  margin-top: 0;
}
.ai-report-text.pet-report h4::before {
  content: '🐾 ';
}
.ai-report-text.pet-report p {
  color: #555;
  font-size: 13px;
}

/* ===== AI 问答弹窗 ===== */
.ai-chat-modal {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.ai-chat-modal .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  border-radius: 24px 24px 0 0;
  flex-shrink: 0;
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: calc(92vh - 200px);
}
.ai-chat-bubble {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: fadeInUp 0.2s ease;
}
.ai-chat-bubble.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}
.ai-chat-bubble.assistant {
  align-self: flex-start;
}
.ai-bubble-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(124,58,237,0.15);
}
.ai-bubble-text {
  background: #f3f4f6;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 100%;
  word-break: break-word;
}
.ai-chat-bubble.user .ai-bubble-text {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}
.ai-chat-bubble.assistant.loading .ai-bubble-text {
  background: #f3f4f6;
  min-width: 60px;
}
/* 打点动画 */
.ai-typing-dots span {
  display: inline-block;
  animation: typingDot 1.2s infinite;
  font-size: 20px;
  line-height: 1;
  opacity: 0.3;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* 快捷建议 */
.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 0;
}
.ai-suggest-btn {
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-suggest-btn:hover, .ai-suggest-btn:active {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #7c3aed;
}

/* 输入区 */
.ai-chat-input-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 8px);
}
.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
#ai-chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.2s;
}
#ai-chat-input:focus {
  border-color: #a78bfa;
  background: #fff;
}
.ai-chat-send-btn {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.ai-chat-send-btn:active {
  transform: scale(0.95);
  opacity: 0.85;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
