* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
  --c1: #FF4A8A;
  --c2: #64B5FF;
  --c3: #FFD147;
  --c4: #44D87C;
  --bg: #F8F9FB;
  --card: #ffffff;
  --text: #2A2A2A;
  --radius: 24px;
  --shadow: 0 8px 22px rgba(0,0,0,0.08);
  --transition: all 0.25s ease;
}

body {
  background: var(--bg);
  color: var(--text);
  padding-bottom: 80px;
  min-height: 100vh;
  transition: var(--transition);
}

/* 加载动画 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0,0,0,0.1);
  border-top: 4px solid var(--c1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 头部样式 */
.header {
  text-align: center;
  padding: 32px 22px 12px;
}

.greet {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.today {
  font-size: 14px;
  color: #888;
}

/* 卡片样式 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 20px 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:active {
  transform: scale(0.98);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.anni-card {
  background: linear-gradient(135deg, var(--c1), #FF72A7);
  color: white;
}

/* 纪念日样式 */
.anni-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.anni-item:last-child {
  border-bottom: none;
}

.anni-info h3 {
  font-size: 16px;
  font-weight: 600;
}

.anni-info p {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 4px;
}

.anni-day {
  font-size: 20px;
  font-weight: 700;
}

/* 进度条样式 */
.progress-container {
  width: 100%;
  height: 8px;
  background-color: #F2F2F2;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  background-color: var(--c1);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* 任务样式 */
.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid #F2F2F2;
  transition: var(--transition);
}

.task-item:last-child {
  border-bottom: none;
}

.task-name {
  font-size: 16px;
  font-weight: 500;
}

.task-desc {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.task-btn {
  background: var(--c1);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 10px 18px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.task-btn:active {
  transform: scale(0.94);
}

.task-btn.done {
  background: var(--c4);
}

.task-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* 自定义弹窗 */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--card);
  padding: 20px;
  border-radius: 12px;
  width: 80%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.modal-header {
  text-align: center;
  margin-bottom: 15px;
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
}

.modal-body {
  margin-bottom: 20px;
  text-align: center;
  color: var(--text);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* 底部导航 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
  z-index: 999;
  transition: var(--transition);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #999;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 16px;
  border-radius: 16px;
}

.tab.active {
  color: var(--c1);
  background: rgba(255, 74, 138, 0.1);
}

.tab i {
  font-size: 24px;
}

/* 页面样式 */
.page {
  display: none;
  animation: pageIn 0.32s ease forwards;
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 设置页面 */
.set-page {
  padding: 20px;
}

.set-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.set-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--c1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

input {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #EAEAEA;
  font-size: 16px;
  margin-bottom: 16px;
  outline: none;
  transition: var(--transition);
  background: var(--bg);
  color: var(--text);
}

input:focus {
  border-color: var(--c2);
  box-shadow: 0 0 0 3px rgba(100,181,255,0.15);
}

.btn {
  width: 100%;
  padding: 18px;
  border-radius: 18px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.96);
}

.btn1 {
  background: var(--c1);
  color: white;
}

.btn2 {
  background: var(--c2);
  color: white;
}

/* 编辑项样式 */
.edit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #F2F2F2;
}

.edit-item:last-child {
  border-bottom: none;
}

.edit-btns {
  display: flex;
  gap: 8px;
}

.e1 {
  background: var(--c2);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.e2 {
  background: #FF6363;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 30px 0;
  color: #bbb;
  font-size: 14px;
}

/* 开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--c1);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--c1);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* 仪表盘样式 */
.dashboard {
  padding: 0 20px;
}

.stats-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stats-item {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 74, 138, 0.05);
  margin: 0 4px;
}

.stats-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--c1);
}

.stats-label {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* 图表容器 */
.chart-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 20px 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* 目标卡片 */
.goal-card {
  background: linear-gradient(135deg, var(--c2), #87C3FF);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 20px 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.goal-progress {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  margin: 16px 0;
  overflow: hidden;
}

.goal-progress-bar {
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.goal-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goal-name {
  font-size: 16px;
  font-weight: 600;
}

.goal-percent {
  font-size: 18px;
  font-weight: 700;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .stats-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .stats-item {
    margin: 0;
  }
}

/* 深色模式 */
body.dark-mode {
  --bg: #1A1A1A;
  --card: #2A2A2A;
  --text: #F0F0F0;
  --shadow: 0 8px 22px rgba(0,0,0,0.3);
}

body.dark-mode .tabbar {
  background: #2A2A2A;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
}

body.dark-mode input {
  border-color: #444;
  background: #333;
  color: var(--text);
}

body.dark-mode .task-item {
  border-bottom-color: #333;
}

body.dark-mode .edit-item {
  border-bottom-color: #333;
}

body.dark-mode .slider {
  background-color: #555;
}

body.dark-mode .empty {
  color: #666;
}

/* 成功/错误提示 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease forwards;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.success {
  background: var(--c4);
}

.toast.error {
  background: #FF6363;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 成就徽章 */
.achievement-badge {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--c3), #FFE066);
  color: #333;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin: 4px;
  box-shadow: 0 2px 8px rgba(255, 209, 71, 0.4);
}

/* 打卡日历 */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.calendar-day.checked {
  background: var(--c1);
  color: white;
}

.calendar-day.today {
  border: 2px solid var(--c1);
}

.calendar-day.other-month {
  color: #ccc;
}