/* ========================================
   哼哼的乐园 - 每日打卡工作台样式
   适配6-7岁儿童：大按钮、圆角、高对比、无干扰
   ======================================== */

:root {
  --blue: #4A90D9;
  --blue-dark: #357ABD;
  --blue-light: #E8F4FD;
  --orange: #FF8C42;
  --orange-dark: #E8782E;
  --red: #E74C3C;
  --green: #50C878;
  --yellow: #F5B041;
  --purple: #9B59B6;
  --gray: #95A5A6;
  --bg: #F5F7FA;
  --card-bg: #FFFFFF;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --shadow: 0 4px 16px rgba(44, 62, 80, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
}

/* 顶部标题栏 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--blue);
  color: white;
  box-shadow: 0 2px 10px rgba(74, 144, 217, 0.3);
  flex-shrink: 0;
  z-index: 10;
}

.top-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 28px;
  line-height: 1;
}

.top-title h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

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

/* 主内容区 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  padding-bottom: calc(90px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-around;
  background: white;
  padding: 8px 4px calc(8px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(44, 62, 80, 0.1);
  z-index: 100;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 14px;
  min-height: 58px;
}

.nav-item:active {
  transform: scale(0.96);
}

.nav-item.active {
  color: var(--blue);
  background: var(--blue-light);
}

.nav-icon {
  font-size: 24px;
  line-height: 1;
}

.nav-label {
  font-weight: 500;
}

/* 通用卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 页面标题 */
.page-header {
  text-align: center;
  margin-bottom: 18px;
}

.page-header h2 {
  font-size: 22px;
  color: var(--text);
}

.page-header p {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 打卡分类卡片 */
.checkin-category {
  border-left: 6px solid;
  padding: 16px;
  margin-bottom: 14px;
}

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

.category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
}

.category-icon {
  font-size: 26px;
}

.category-status {
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 20px;
  font-weight: 600;
  background: #f1f3f5;
  color: var(--text-light);
}

.category-status.complete {
  background: #D4EDDA;
  color: #155724;
}

.category-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-left: 2px;
}

/* 大复选框项目 */
.checkin-item {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  margin-bottom: 10px;
  background: #FAFBFC;
  border-radius: var(--radius-sm);
  border: 2px solid #E8ECF0;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 56px;
}

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

.checkin-item:active {
  transform: scale(0.99);
}

.checkin-item.checked {
  background: #E8F8F0;
  border-color: var(--green);
}

.checkin-item.disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.checkin-checkbox {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #CBD5E1;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: white;
}

.checkin-item.checked .checkin-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.checkin-text {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
}

/* 提交区 */
.submit-section {
  position: sticky;
  bottom: 8px;
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 6px 24px rgba(44, 62, 80, 0.15);
  margin-top: 8px;
  text-align: center;
}

.points-preview {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.point-pill {
  background: var(--blue-light);
  color: var(--blue);
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 15px;
}

.point-pill.bonus {
  background: #FFF3E0;
  color: var(--orange-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 54px;
  width: 100%;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-blue {
  background: var(--blue);
  color: white;
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.35);
}

.btn-blue:active {
  background: var(--blue-dark);
}

.btn-orange {
  background: var(--orange);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.35);
}

.btn-orange:active {
  background: var(--orange-dark);
}

.btn-green {
  background: var(--green);
  color: white;
  box-shadow: 0 4px 12px rgba(80, 200, 120, 0.35);
}

.submitted-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #D4EDDA;
  color: #155724;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 17px;
  font-weight: 700;
}

/* 历史记录 */
.history-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.cal-weekday {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  padding: 8px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: white;
  border: 2px solid #E8ECF0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.cal-day:active {
  transform: scale(0.95);
}

.cal-day.today {
  border-color: var(--blue);
  background: var(--blue-light);
}

.cal-day.checked {
  background: #E8F8F0;
  border-color: var(--green);
}

.cal-day.full {
  background: linear-gradient(135deg, #E8F8F0 0%, #D4EDDA 100%);
  border-color: var(--green);
}

.cal-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 2px;
}

.cal-day.full .cal-dot {
  width: 8px;
  height: 8px;
  background: var(--orange);
}

.history-detail {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.history-detail h3 {
  font-size: 17px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-empty {
  text-align: center;
  color: var(--text-light);
  padding: 30px 0;
  font-size: 15px;
}

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

.detail-category {
  background: #FAFBFC;
  border-radius: var(--radius-sm);
  padding: 12px;
}

.detail-category-name {
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-item {
  font-size: 13px;
  padding: 4px 10px;
  background: #E8F8F0;
  color: #155724;
  border-radius: 12px;
}

/* 月度统计 */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
}

.stat-card.full .stat-value {
  color: var(--orange);
}

.stats-categories {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.stats-categories h3 {
  font-size: 17px;
  margin-bottom: 14px;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #F0F2F5;
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.stats-row-bar {
  flex: 1;
  height: 10px;
  background: #EDF0F3;
  border-radius: 5px;
  margin: 0 12px;
  overflow: hidden;
}

.stats-row-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.stats-row-count {
  font-weight: 700;
  color: var(--text-light);
  min-width: 30px;
  text-align: right;
}

.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-selector button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: white;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.month-selector h3 {
  font-size: 18px;
  min-width: 120px;
  text-align: center;
}

/* 奖励积分 */
.points-hero {
  background: linear-gradient(135deg, var(--blue) 0%, #6BA3E0 100%);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.points-hero .big-points {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  margin: 8px 0;
}

.points-hero .points-label {
  font-size: 16px;
  opacity: 0.95;
}

.points-mini-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.points-mini-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.points-mini-card .num {
  font-size: 26px;
  font-weight: 800;
  color: var(--orange);
}

.points-mini-card .label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.points-log {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.points-log h3 {
  font-size: 17px;
  margin-bottom: 12px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #FAFBFC;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.log-item .earn {
  color: var(--green);
  font-weight: 700;
}

.log-item .spend {
  color: var(--red);
  font-weight: 700;
}

.log-empty {
  text-align: center;
  color: var(--text-light);
  padding: 20px 0;
  font-size: 14px;
}

/* 宠物小屋 */
.pet-stage-name {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pet-mood {
  text-align: center;
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.dragon-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  background: radial-gradient(circle at center, #FFF9F0 0%, #FFF5E6 40%, #FFEBD6 100%);
  border-radius: var(--radius);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(255, 140, 66, 0.1);
}

.dragon-container svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: 300px;
  filter: drop-shadow(0 8px 20px rgba(180, 40, 20, 0.25));
}

.pet-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.pet-action-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.pet-action-card .action-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.pet-action-card .action-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.pet-action-card .action-cost {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.pet-action-card button {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  min-height: 42px;
}

.growth-bar {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.growth-bar h4 {
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.growth-bar h4 span {
  color: var(--text-light);
  font-weight: 600;
}

.progress-track {
  height: 16px;
  background: #EDF0F3;
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange) 0%, #FF6B35 100%);
  border-radius: 8px;
  transition: width 0.5s ease;
}

.decorations-shop {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.decorations-shop h4 {
  font-size: 16px;
  margin-bottom: 12px;
}

.deco-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.deco-item {
  background: #FAFBFC;
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deco-item:active {
  transform: scale(0.97);
}

.deco-item.owned {
  border-color: var(--green);
  background: #E8F8F0;
}

.deco-item .deco-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.deco-item .deco-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

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

/* 提示消息 */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(44, 62, 80, 0.92);
  color: white;
  padding: 12px 22px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  white-space: nowrap;
}

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

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 86%;
  max-width: 360px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.modal-overlay.show .modal-box {
  transform: scale(1);
}

.modal-box h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.modal-box p {
  color: var(--text-light);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

/* 响应式桌面端 */
@media (min-width: 768px) {
  #app {
    max-width: 720px;
  }

  .bottom-nav {
    max-width: 720px;
  }

  .main-content {
    padding: 20px;
    padding-bottom: calc(100px + var(--safe-bottom));
  }

  .stats-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .points-mini-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .pet-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .deco-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 动画 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dragon-container svg {
  animation: float 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 8px 20px rgba(180, 40, 20, 0.25)); }
  50% { filter: drop-shadow(0 8px 30px rgba(255, 100, 30, 0.45)); }
}

.dragon-container.fire-stage svg {
  animation: float 4s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
}

/* 辅助 */
.hidden {
  display: none !important;
}
