/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: #FFF0F5;
  color: #444;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== 通用类 ===== */
.hidden { display: none !important; }
.btn-primary {
  background: linear-gradient(135deg, #FFB7C5, #FF69B4);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 6px rgba(255, 105, 180, 0.3);
}
.btn-secondary {
  background: white;
  color: #FF69B4;
  border: 1.5px solid #FFB7C5;
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-full { width: 100%; margin-top: 8px; }

/* ===== 屏幕容器 ===== */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 首次引导 ===== */
#onboarding {
  background: linear-gradient(180deg, #FFF0F5 0%, #FFE4EC 100%);
  padding: 40px 32px;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.onboarding-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 320px;
}
.onboarding-slide {
  display: none;
  animation: fadeInUp 0.5s ease;
}
.onboarding-slide.active { display: block; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.onboarding-icon { font-size: 72px; margin-bottom: 20px; }
.onboarding-slide h2 {
  font-size: 26px;
  font-weight: 700;
  color: #FF69B4;
  margin-bottom: 12px;
}
.onboarding-slide p {
  font-size: 15px;
  color: #D47FA0;
  line-height: 1.6;
  margin-bottom: 24px;
}
.onboarding-slide input[type="text"],
.onboarding-slide input[type="number"],
.onboarding-slide input[type="time"] {
  width: 100%;
  padding: 14px;
  border: 2px solid #FFD1DC;
  border-radius: 14px;
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  background: white;
  outline: none;
  transition: border-color 0.2s;
}
.onboarding-slide input:focus { border-color: #FF69B4; }
.weight-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.weight-input input { width: 120px !important; }
.weight-input span { font-size: 18px; color: #FF69B4; font-weight: 600; }
.goal-preview {
  margin-top: 16px;
  font-size: 14px;
  color: #D47FA0;
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 16px;
  border-radius: 12px;
}
.time-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.time-inputs label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid #FFD1DC;
  font-size: 15px;
  color: #666;
}
.time-inputs input[type="time"] {
  border: none;
  background: transparent;
  font-size: 16px;
  color: #FF69B4;
  font-weight: 600;
  width: auto;
}
.hint {
  font-size: 12px !important;
  color: #999 !important;
  margin-top: 12px !important;
}
.onboarding-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFD1DC;
  transition: background 0.3s, transform 0.3s;
}
.dot.active { background: #FF69B4; transform: scale(1.2); }

/* ===== 主界面 ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 240, 245, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 179, 197, 0.15);
}
.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #FF69B4;
  letter-spacing: 0.5px;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.icon-btn:active { opacity: 1; }

.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 40px;
  -webkit-overflow-scrolling: touch;
}
.main-scroll::-webkit-scrollbar { display: none; }

/* ===== Kitty 区域 ===== */
.kitty-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 8px;
  position: relative;
}
.speech-bubble {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 10px 16px;
  margin-bottom: 8px;
  max-width: 260px;
  text-align: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(255, 105, 180, 0.1);
  animation: bubblePop 0.4s ease;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.9);
}
@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.8) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.speech-bubble p {
  font-size: 13px;
  color: #C06080;
  line-height: 1.5;
}
.kitty-character {
  width: 160px;
  height: 140px;
  transition: transform 0.3s;
}
.kitty-character:active { transform: scale(1.05); }
.kitty-svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 8px rgba(255, 105, 180, 0.15)); }

/* Kitty 状态动画 */
.kitty-state-happy .kitty-eye { ry: 3; rx: 6; }
.kitty-state-happy #kitty-mouth { d: path('M92 115 Q100 125 108 115'); fill: #FFB7C5; }
.kitty-state-sad #kitty-mouth { d: path('M92 120 Q100 112 108 120'); }
.kitty-state-thirsty .kitty-eye { ry: 5; rx: 5; }
.kitty-state-sleeping .kitty-eye { ry: 1; rx: 6; opacity: 0.4; }

/* ===== 进度圆环 ===== */
.progress-area {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.progress-ring {
  position: relative;
  width: 180px;
  height: 180px;
}
#wave-canvas { width: 100%; height: 100%; }
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.progress-text .current {
  font-size: 36px;
  font-weight: 700;
  color: #FF69B4;
  line-height: 1;
}
.progress-text .goal {
  font-size: 13px;
  color: #D47FA0;
  margin-top: 2px;
}
.progress-text .badge {
  display: inline-block;
  margin-top: 6px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  animation: badgePop 0.5s ease;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* ===== 快捷按钮 ===== */
.quick-buttons {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}
.quick-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  background: rgba(255, 183, 197, 0.12);
  border: 2px solid rgba(255, 183, 197, 0.2);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.quick-btn:active {
  background: rgba(255, 183, 197, 0.25);
  transform: scale(0.95);
}
.quick-btn .icon { font-size: 22px; }
.quick-btn .amount {
  font-size: 14px;
  font-weight: 600;
  color: #FF69B4;
}

/* ===== 记录区域 ===== */
.records-section { margin-top: 20px; }
.records-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: #FF69B4;
  margin-bottom: 10px;
}
.records-list { display: flex; flex-direction: column; gap: 8px; }
.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(255, 105, 180, 0.06);
}
.record-item .record-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.record-item .drop-icon { font-size: 14px; opacity: 0.6; }
.record-item .amount {
  font-size: 15px;
  font-weight: 600;
  color: #444;
}
.record-item .time {
  font-size: 12px;
  color: #D47FA0;
}
.record-item .delete-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #FFB7C5;
  cursor: pointer;
  padding: 4px;
}
.record-item .delete-btn:active { color: #FF69B4; }

/* ===== 小贴士 ===== */
.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 183, 197, 0.08);
  border: 1px solid rgba(255, 183, 197, 0.15);
  border-radius: 14px;
  padding: 14px;
  margin-top: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.tip-card:active { background: rgba(255, 183, 197, 0.15); }
.tip-icon { font-size: 20px; flex-shrink: 0; }
.tip-title {
  font-size: 13px;
  font-weight: 700;
  color: #FF69B4;
  margin-bottom: 2px;
}
.tip-text {
  font-size: 13px;
  color: #C06080;
  line-height: 1.5;
}

/* ===== 安装提示 ===== */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #FFB7C5, #FF69B4);
  color: white;
  padding: 14px 20px;
  text-align: center;
  font-size: 13px;
  z-index: 100;
  animation: slideUp 0.4s ease;
}
.install-banner p { margin-bottom: 8px; }
.install-banner button {
  background: white;
  color: #FF69B4;
  border: none;
  border-radius: 12px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: white;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  border-radius: 24px 24px 0 0;
  padding: 20px;
  animation: modalUp 0.3s ease;
  overflow-y: auto;
}
@keyframes modalUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #FF69B4;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px;
}

/* 预设按钮 */
.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.preset-btn {
  padding: 14px;
  background: rgba(255, 183, 197, 0.1);
  border: 2px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #FF69B4;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.preset-btn:hover, .preset-btn.active {
  background: #FFB7C5;
  color: white;
  border-color: #FF69B4;
}
.preset-btn:active { transform: scale(0.95); }

/* 自定义输入 */
.custom-input { margin-bottom: 12px; }
.custom-input label {
  display: block;
  font-size: 13px;
  color: #D47FA0;
  margin-bottom: 6px;
}
.custom-input .input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 183, 197, 0.08);
  border-radius: 12px;
  padding: 0 14px;
}
.custom-input input {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  color: #444;
}
.custom-input span { color: #FF69B4; font-weight: 600; }

.selected-preview {
  text-align: center;
  padding: 12px;
  background: rgba(255, 183, 197, 0.06);
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #888;
}
.selected-preview strong { color: #FF69B4; font-size: 20px; }

/* 设置表单 */
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.settings-form label {
  font-size: 14px;
  color: #666;
}
.settings-form input[type="text"],
.settings-form input[type="number"],
.settings-form input[type="time"] {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 2px solid #FFD1DC;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.settings-form input:focus { border-color: #FF69B4; }
.settings-form .input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-form .input-row input { flex: 1; }
.settings-form .input-row span { color: #FF69B4; font-weight: 600; }
.goal-display {
  margin-top: 6px;
  padding: 10px 14px;
  background: rgba(255, 183, 197, 0.1);
  border-radius: 10px;
  color: #FF69B4;
  font-weight: 700;
}

/* Toggle Switch */
.toggle-label {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.toggle-label input { display: none; }
.toggle-switch {
  width: 48px;
  height: 28px;
  background: #ddd;
  border-radius: 14px;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-label input:checked + .toggle-switch { background: #FF69B4; }
.toggle-label input:checked + .toggle-switch::after { transform: translateX(20px); }

/* ===== 庆祝弹窗 ===== */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.celebrate-content {
  background: linear-gradient(135deg, #FFB7C5, #FF69B4);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  color: white;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(255, 105, 180, 0.4);
  animation: celebrateIn 0.5s ease;
  position: relative;
  z-index: 2;
}
@keyframes celebrateIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.celebrate-emoji { font-size: 56px; margin-bottom: 12px; }
.celebrate-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.celebrate-content p {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 20px;
}
.celebrate-content .btn-primary {
  background: white;
  color: #FF69B4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
#confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* ===== 响应式微调 ===== */
@media (max-width: 360px) {
  .quick-buttons { gap: 8px; }
  .quick-btn { padding: 10px 4px; }
  .preset-buttons { gap: 8px; }
  .preset-btn { padding: 10px; font-size: 13px; }
}
