/* PetGame - 萌宠养成日记 升级版样式 */
/* 糖果色游戏主题 */

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

:root {
  /* 糖果色系 */
  --primary: #FF6B6B;
  --primary-dark: #FF5252;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --purple: #A78BFA;
  --pink: #F472B6;

  /* 背景 */
  --bg-light: #FFF5F5;
  --bg-card: #FFFFFF;

  /* 文字 */
  --text-primary: #2D3436;
  --text-secondary: #636E72;
  --text-light: #B2BEC3;

  /* 功能色 */
  --food-color: #FF8C00;
  --mood-color: #FF69B4;
  --clean-color: #00CED1;
  --growth-color: #4CAF50;
  --coin-color: #FFD700;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 20px rgba(255, 107, 107, 0.4);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

body {
  font-family: 'Nunito', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #FFF0F5 0%, #FFF5F5 50%, #F0F8FF 100%);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* 页面 */
.page { display: none; min-height: 100vh; padding-bottom: 120px; }
.page.active { display: block; }

/* 顶部栏 */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-btns {
  display: flex;
  gap: 8px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

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

.coin-icon { font-size: 16px; }
.coin-num { font-size: 14px; font-weight: 700; }

/* 签到栏 */
.checkin-bar {
  background: linear-gradient(135deg, var(--accent) 0%, #FFA500 100%);
  color: white;
  margin: 16px 20px 0;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
  cursor: pointer;
  animation: pulse-glow 2s ease-in-out infinite;
}

.checkin-bar:hover {
  transform: scale(1.02);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(255, 215, 0, 0.6); }
}

.checkin-streak {
  font-size: 13px;
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
}

/* 内容区 */
.content { padding: 16px 20px; }

/* 天气 */
.weather {
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(255, 255, 255, 0.8);
}

/* 房间容器 */
.room-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 3px solid rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

#room-canvas {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-lg);
  display: block;
}

.pet-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  cursor: pointer;
  transition: transform 0.1s;
  width: 300px;
  height: 300px;
}

.pet-canvas:active {
  transform: translate(-50%, -60%) scale(0.95);
}

/* 睡姿效果 */
.sleeping-zzz {
  position: absolute;
  top: 15px;
  right: 60px;
  font-size: 28px;
  z-index: 15;
  animation: zzzFloat 1.8s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes zzzFloat {
  0% { opacity: 0; transform: translateY(0) translateX(0); }
  20% { opacity: 1; }
  80% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-60px) translateX(30px); }
}

/* 思考气泡 */
.thought-bubble {
  position: absolute;
  top: 20px;
  left: 55%;
  background: white;
  border-radius: 20px;
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  z-index: 20;
  opacity: 0;
  transform: translateY(0) scale(0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.thought-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid white;
}

.thought-bubble.show {
  opacity: 1;
  transform: translateY(-10px) scale(1);
}

.bubble-emoji { font-size: 28px; }

/* 状态面板 */
.status-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 3px solid rgba(255, 255, 255, 0.8);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.status-row:last-child { margin-bottom: 0; }

.status-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.bar-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-track {
  flex: 1;
  height: 14px;
  background: #F0F0F0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bar {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.food-bar {
  background: linear-gradient(90deg, #FF8C00, #FFB347);
}
.mood-bar {
  background: linear-gradient(90deg, #FF69B4, #FFB6D9);
}
.clean-bar {
  background: linear-gradient(90deg, #00CED1, #7FFFD4);
}
.growth-bar {
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.bar-value {
  min-width: 45px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* 任务面板 */
.quest-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 3px solid rgba(255, 255, 255, 0.8);
}

.quest-header {
  margin-bottom: 12px;
}

.quest-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.quest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: #F8F9FA;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.quest-item:last-child { margin-bottom: 0; }

.quest-item.completed {
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

.qi-icon {
  font-size: 24px;
  width: 36px;
  text-align: center;
}

.qi-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qi-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.qi-bar-track {
  height: 6px;
  background: #E0E0E0;
  border-radius: 5px;
  overflow: hidden;
}

.qi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), #26A69A);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.qi-reward {
  font-size: 13px;
  color: var(--coin-color);
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.qi-status {
  font-size: 13px;
  color: var(--text-light);
  min-width: 40px;
  text-align: center;
  font-weight: 600;
}

/* 信息栏 */
.info-row {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  justify-content: space-around;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 2px solid rgba(255, 255, 255, 0.8);
}

/* 动作按钮 */
.actions {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 20%, white 100%);
  padding: 20px 16px 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  z-index: 100;
}

.action-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 16px 8px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.action-btn:hover::before {
  left: 100%;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.action-btn:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.action-icon {
  font-size: 28px;
  transition: transform 0.2s ease;
}

.action-btn:active .action-icon {
  transform: scale(1.2);
}

.action-label {
  font-size: 12px;
  opacity: 0.95;
}

.heal-btn {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  animation: heal-pulse 1.5s ease-in-out infinite;
}

@keyframes heal-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(255, 107, 107, 0.6); }
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* 商店标签 */
.shop-tabs {
  display: flex;
  padding: 12px 16px;
  gap: 8px;
  background: #F8F9FA;
  overflow-x: auto;
}

.tab-btn {
  flex-shrink: 0;
  background: white;
  border: 2px solid #E0E0E0;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 商店网格 */
.shop-grid,
.backpack-grid,
.wardrobe-grid,
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.shop-item,
.backpack-item,
.wardrobe-item {
  background: linear-gradient(135deg, #FAFAFA 0%, #F0F0F0 100%);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.shop-item:hover,
.backpack-item:hover,
.wardrobe-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.shop-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-item.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.item-emoji {
  font-size: 40px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.item-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-price {
  font-size: 13px;
  color: var(--coin-color);
  font-weight: 700;
}

.item-owned {
  font-size: 11px;
  color: var(--growth-color);
  font-weight: 600;
}

.item-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.backpack-item {
  position: relative;
}

.item-effect {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 600;
}

.wardrobe-item.equipped {
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
  border-color: var(--growth-color);
}

.item-status {
  font-size: 11px;
  color: var(--text-light);
}

/* 成就 */
.ach-progress-bar {
  padding: 12px 16px;
  background: #F8F9FA;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.achievement-item {
  background: #F5F5F5;
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.achievement-item.unlocked {
  background: linear-gradient(135deg, #FFF9C4 0%, #FFECB3 100%);
  border: 2px solid var(--accent);
}

.achievement-item.locked {
  opacity: 0.6;
  filter: grayscale(0.5);
}

.ach-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.ach-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ach-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.ach-reward {
  font-size: 12px;
  color: var(--coin-color);
  font-weight: 700;
}

/* 已装备栏 */
.equipped-slots {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  margin-bottom: 12px;
  background: #F8F9FA;
  border-radius: var(--radius-md);
}

.equip-slot {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px dashed #E0E0E0;
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.equip-slot.filled {
  border-style: solid;
  border-color: var(--primary);
  font-size: 24px;
  background: #FFF5F5;
}

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-light);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: white;
  padding: 20px 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  text-align: center;
  max-width: 320px;
  width: 85%;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-top: 4px solid var(--primary);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon { font-size: 36px; margin-bottom: 8px; }
.toast-title { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.toast-desc { font-size: 14px; color: var(--text-secondary); }

/* 粒子效果 */
.particle {
  position: fixed;
  font-size: 24px;
  pointer-events: none;
  z-index: 9998;
  animation: particleFly 1s ease-out forwards;
}

@keyframes particleFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.5);
  }
}

/* 获得弹窗 */
.gain-popup {
  position: fixed;
  font-size: 20px;
  font-weight: 800;
  pointer-events: none;
  z-index: 9997;
  animation: gainFloat 1s ease-out forwards;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes gainFloat {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-60px); }
}

/* 震动效果 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.shake { animation: shake 0.5s ease; }

/* 发光效果 */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px currentColor; }
  50% { box-shadow: 0 0 30px currentColor, 0 0 50px currentColor; }
}

.vibrate {
  animation: shake 0.1s ease;
}

/* 进化动画 */
.evolve-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: evolveBg 3s ease forwards;
}

.evolve-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(255, 107, 107, 0.2) 50%, transparent 100%);
  animation: evolvePulse 1s ease-in-out infinite;
}

@keyframes evolveBg {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes evolvePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.evolve-content {
  position: relative;
  text-align: center;
  animation: evolveZoom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes evolveZoom {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.evolve-sparkles {
  font-size: 40px;
  margin-bottom: 20px;
  animation: sparkleRotate 2s linear infinite;
}

@keyframes sparkleRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.evolve-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
}

.evolve-level {
  font-size: 48px;
  margin-bottom: 10px;
}

.evolve-desc {
  font-size: 18px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
}

.evolve-reward {
  font-size: 24px;
  color: var(--coin-color);
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #F0F0F0; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #CCC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #AAA; }
