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

body {
  margin: 0;
  min-height: 100vh;
  background: #a8d5c9;
  color: #1f3d37;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

.app {
  position: relative;
  z-index: 2;
}

.snow-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.fall-snow {
  position: absolute;
  top: -30px;
  color: #ffffff;
  opacity: 0.85;
  animation-name: snowfall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes snowfall {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { transform: translateY(105vh) translateX(40px); opacity: 0; }
}

.twinkle-star {
  position: absolute;
  color: #fff6c8;
  font-size: 20px;
  animation: twinkle 2.6s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.25); }
}

.shooting-star {
  position: absolute;
  top: 8%;
  right: -10%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fffbe6);
  transform: rotate(-25deg);
  animation: shoot 9s ease-in infinite 4s;
}

@keyframes shoot {
  0%, 88% { opacity: 0; transform: translate(0, 0) rotate(-25deg); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-300px, 150px) rotate(-25deg); }
}

.page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 20px 60px;
  overflow: hidden;
}

.header {
  padding: 36px 8px 20px;
  text-align: center;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.title {
  color: #1f5f52;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 0 2px 0 rgba(255,255,255,0.6);
}

.title-emoji {
  margin-left: 8px;
  font-size: 28px;
}

.countdown {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 20px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  color: #1f5f52;
  font-size: 14px;
  font-weight: 600;
}

.progress-wrap {
  margin: 16px auto 0;
  max-width: 320px;
}

.progress-bar {
  height: 9px;
  border-radius: 10px;
  background: rgba(255,255,255,0.75);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: #c8453b;
  transition: width 0.4s ease;
}

.progress-text {
  margin-top: 6px;
  color: #2c6357;
  font-size: 12px;
}

.calendar {
  margin-top: 8px;
}

.cal-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 112px;
  gap: 2px;
}

.tree {
  position: relative;
  width: 56px;
  height: 100px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tree:active { transform: scale(0.94); }

.tree-layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #2f7d63;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.layer-top { top: 16px; width: 34px; height: 32px; }
.layer-mid { top: 40px; width: 46px; height: 36px; }
.layer-bottom { top: 62px; width: 56px; height: 36px; }

.tree-trunk {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 15px;
  height: 18px;
  transform: translateX(-50%);
  background: #9a6b42;
  border-radius: 3px;
}

.tree-number {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  text-align: center;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 3;
}

.star-top {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  color: #f2c14e;
  font-size: 22px;
  z-index: 4;
  animation: twinkle 2s ease-in-out infinite;
}

.done-mark {
  position: absolute;
  top: 14px;
  right: 0;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: #c8453b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  z-index: 5;
}

.lock-mark {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  z-index: 5;
}

.gift-icon {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  z-index: 5;
  animation: giftBounce 1.6s ease-in-out infinite;
}

@keyframes giftBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

.tree-locked { opacity: 0.45; filter: grayscale(0.8); }
.tree-locked .tree-layer { background: #7fa89b; }
.tree-blind .tree-layer { background: #cf5b4e; }
.tree-blind.tree-locked .tree-layer { background: #a98b86; }
.tree-done .tree-layer { background: #1f5f52; }

.preview-tip {
  margin-top: 8px;
  text-align: center;
  color: #c8453b;
  font-size: 12px;
  font-weight: 600;
}

.footer-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
}

.footer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 130px;
  height: 76px;
  border: none;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  color: #1f5f52;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(31,95,82,0.12);
}

.footer-btn:active { transform: scale(0.96); }
.footer-icon { margin-bottom: 4px; font-size: 26px; }

.back-btn {
  margin: 20px 0 8px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: #1f5f52;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.day-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 16px;
  border-radius: 20px;
  background: #1f5f52;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.play-page .title {
  margin-top: 14px;
  font-size: 28px;
  letter-spacing: 1px;
}

.prompt {
  margin-top: 12px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(255,255,255,0.85);
  color: #1f3d37;
  font-size: 16px;
  line-height: 1.7;
}

.blindbox-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
}

.blindbox-hint {
  color: #2c6357;
  font-size: 14px;
  margin-bottom: 28px;
}

.blindbox {
  position: relative;
  width: 180px;
  height: 180px;
  cursor: pointer;
}

.box-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 180px;
  height: 120px;
  background: #c8453b;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.box-body::after {
  content: '?';
  color: #ffe9a8;
  font-size: 60px;
  font-weight: 800;
}

.box-lid {
  position: absolute;
  top: 26px;
  left: -9px;
  width: 198px;
  height: 36px;
  background: #e05a4e;
  border-radius: 10px;
  z-index: 2;
  transform-origin: left center;
  transition: transform 0.5s ease;
}

.blindbox.opening .box-lid { transform: rotate(-70deg) translateY(-12px); }
.blindbox.opening .box-body { animation: shake 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.blindbox-tap {
  margin-top: 28px;
  color: #2c6357;
  font-size: 13px;
}

.options { margin-top: 26px; }

.option {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  border: 2px solid transparent;
  cursor: pointer;
}

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

.option-index {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border-radius: 50%;
  background: #1f5f52;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.option-text { font-size: 16px; color: #1f3d37; }
.option.selected { border-color: #1f5f52; }
.option.correct { border-color: #2f7d63; background: #d9f0e4; }
.option.wrong { border-color: #c8453b; background: #f8dedb; }

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: #c8453b;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:disabled { background: #c9b9b5; cursor: default; }

.result-card {
  margin-top: 20px;
  padding: 20px;
  border-radius: 14px;
  background: #fff;
}

.result-title { font-size: 20px; font-weight: 700; }
.result-title.right { color: #2f7d63; }
.result-title.wrong-text { color: #c8453b; }
.result-answer { margin-top: 8px; font-size: 14px; color: #1f3d37; }
.result-explain { margin-top: 6px; font-size: 13px; color: #5a6f6a; line-height: 1.6; }

.coloring-panel {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#color-canvas {
  width: 100%;
  max-width: 360px;
  height: auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(31,95,82,0.2);
  cursor: crosshair;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.color-dot {
  width: 36px;
  height: 36px;
  margin: 4px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}

.color-dot.active { border-color: #1f5f52; transform: scale(1.15); }

.color-actions {
  display: flex;
  width: 100%;
  gap: 12px;
  margin-top: 12px;
}

.ghost-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #1f5f52;
  border-radius: 12px;
  background: transparent;
  color: #1f5f52;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ghost-btn.mini { flex: none; }

.task-card {
  margin-top: 26px;
  padding: 20px;
  border-radius: 14px;
  background: rgba(255,255,255,0.88);
}

.task-label { color: #1f5f52; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.task-text { color: #1f3d37; font-size: 16px; line-height: 1.8; }

.photo-section { margin-top: 26px; }
.photo-label { display: block; color: #1f5f52; font-size: 14px; font-weight: 600; margin-bottom: 10px; }

.photo-box {
  width: 100%;
  height: 200px;
  border-radius: 14px;
  border: 2px dashed rgba(31,95,82,0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #5a6f6a;
  font-size: 14px;
}

.photo-plus { font-size: 40px; color: #1f5f52; }
.photo-note { margin-top: 8px; font-size: 12px; color: #5a6f6a; }
.finish-btn { margin-top: 30px; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 40px 24px 28px;
  border-radius: 24px;
  background: #fffaf0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.modal-rays {
  position: absolute;
  top: -90px;
  left: 50%;
  width: 320px;
  height: 320px;
  transform: translateX(-50%);
  background: repeating-conic-gradient(from 0deg, rgba(242,193,78,0.25) 0deg 15deg, transparent 15deg 30deg);
  animation: spin 12s linear infinite;
}

@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }

.modal-emoji { position: relative; font-size: 76px; animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.2); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.modal-title { position: relative; margin-top: 12px; font-size: 24px; font-weight: 800; color: #c8453b; }
.modal-desc { position: relative; margin-top: 10px; font-size: 14px; color: #5a6f6a; text-align: center; }
.modal-btn { position: relative; }

.login-page {
  min-height: 100vh;
  padding-top: 60px;
  display: flex;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
  height: fit-content;
  padding: 36px 24px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31,95,82,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-icon { font-size: 48px; }
.login-title { margin-top: 12px; font-size: 24px; font-weight: 800; color: #1f5f52; }
.login-desc { margin-top: 8px; font-size: 14px; color: #7a8b86; }

.login-input {
  width: 100%;
  margin-top: 26px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #eef2f0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
}

.login-btn { margin-top: 20px; }
.login-hint { margin-top: 16px; font-size: 12px; color: #9aaba6; }
.login-back { margin-top: 20px; }

.banner {
  margin-top: 8px;
  padding: 26px 20px;
  border-radius: 18px;
  background: #1f5f52;
}

.banner-title { color: #fff; font-size: 26px; font-weight: 800; }
.banner-desc { margin-top: 6px; color: #cfe6de; font-size: 13px; }

.section {
  margin-top: 18px;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(31,95,82,0.06);
}

.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-title { color: #1f5f52; font-size: 17px; font-weight: 700; }
.section-hint { color: #c8453b; font-size: 13px; font-weight: 600; }
.section-desc { margin-top: 8px; color: #6b7f7a; font-size: 12px; line-height: 1.6; }

.day-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.day-cell {
  width: 100%;
  min-width: 0;
  height: 46px;
  border-radius: 10px;
  background: #eef2f0;
  color: #4a5f5a;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.day-cell.on { background: #c8453b; color: #fff; }
.save-blind { margin-top: 16px; }

.day-list { margin-top: 12px; }

.day-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #eef2f0;
  cursor: pointer;
}

.day-row-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1f5f52;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.day-row-main { flex: 1; margin-left: 12px; min-width: 0; }
.day-row-title { font-size: 15px; font-weight: 600; color: #1f3d37; }
.day-row-prompt { margin-top: 3px; font-size: 12px; color: #7a8b86; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-row-tag { padding: 4px 9px; border-radius: 12px; background: #e5f0eb; color: #1f5f52; font-size: 11px; }
.day-row-arrow { margin-left: 8px; color: #9aaba6; font-size: 22px; }

.preview-row { display: flex; align-items: center; gap: 16px; margin-top: 16px; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: #c9d4d0;
  border-radius: 26px;
  cursor: pointer;
  transition: 0.2s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider { background: #1f5f52; }
.switch input:checked + .slider::before { transform: translateX(20px); }

.date-picker {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: #eef2f0;
  color: #1f3d37;
  font-size: 13px;
}

.pin-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.pin-input { flex: 1; min-width: 0; padding: 10px 12px; border: none; border-radius: 10px; background: #eef2f0; font-size: 15px; }
.logout-btn { width: 100%; margin-top: 18px; border-color: #c8453b; color: #c8453b; }

.day-head { margin-top: 10px; color: #1f5f52; font-size: 22px; font-weight: 800; }

.label { display: block; margin: 16px 0 8px; color: #1f5f52; font-size: 13px; font-weight: 700; }
.label:first-child { margin-top: 0; }

.type-grid { display: flex; flex-wrap: wrap; }

.type-cell {
  padding: 8px 14px;
  margin: 4px;
  border-radius: 12px;
  background: #eef2f0;
  color: #4a5f5a;
  font-size: 13px;
  cursor: pointer;
}

.type-cell.on { background: #1f5f52; color: #fff; }

.input, .textarea {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #eef2f0;
  color: #1f3d37;
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
}

.textarea { min-height: 90px; resize: vertical; }
.option-input { margin-bottom: 8px; }
.save-btn { margin-top: 24px; }

.summary {
  margin-top: 8px;
  padding: 22px;
  border-radius: 18px;
  background: #1f5f52;
}

.summary-title { color: #fff; font-size: 24px; font-weight: 800; }
.summary-count { margin-top: 6px; color: #cfe6de; font-size: 14px; }

.empty {
  margin-top: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #5a6f6a;
  font-size: 14px;
}

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

.record-card {
  display: flex;
  align-items: flex-start;
  margin-top: 12px;
  padding: 16px;
  border-radius: 14px;
  background: #fff;
}

.record-day {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c8453b;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-main { flex: 1; margin-left: 12px; min-width: 0; }
.record-title { font-size: 15px; font-weight: 600; color: #1f3d37; }
.record-detail { margin-top: 4px; font-size: 13px; color: #5a6f6a; }
.record-time { margin-top: 4px; font-size: 11px; color: #9aaba6; }
.record-photo { width: 100px; height: 100px; margin-top: 8px; border-radius: 8px; object-fit: cover; cursor: pointer; }
.record-check { color: #2f7d63; font-size: 22px; font-weight: 700; }
.clear-btn { margin-top: 24px; border-color: #c8453b; color: #c8453b; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 24px;
  background: rgba(31,61,55,0.9);
  color: #fff;
  font-size: 14px;
  z-index: 100;
  white-space: nowrap;
}

/* ============ 跨设备同步 UI ============ */
.sync-badge {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 8px rgba(31,61,55,0.14);
  font-size: 12px;
  color: #5a6f6a;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sync-badge .sb-dot { width: 8px; height: 8px; border-radius: 50%; background: #b7c4c0; flex-shrink: 0; }
.sync-badge.sb-synced .sb-dot { background: #2f7d63; }
.sync-badge.sb-syncing .sb-dot { background: #e2872b; animation: sb-pulse 1s infinite; }
.sync-badge.sb-pending .sb-dot { background: #e2a52b; }
.sync-badge.sb-offline .sb-dot { background: #9aaba6; }
.sync-badge.sb-error .sb-dot { background: #c8453b; }
.sync-badge.sb-synced { color: #2f7d63; }
.sync-badge.sb-error { color: #c8453b; }
@keyframes sb-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.sync-card { max-width: 360px; width: calc(100% - 40px); text-align: center; }
.sync-connected-label { margin-top: 12px; font-size: 13px; color: #5a6f6a; }
.family-code {
  margin: 10px auto;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #1f5f52;
  background: #eef6f3;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #a8d5c9;
}
.sync-tip { font-size: 13px; color: #5a6f6a; line-height: 1.6; margin: 12px 0; }
.sync-state { font-size: 12px; color: #9aaba6; margin: 8px 0; }
.sync-state .sb-synced { color: #2f7d63; }
.sync-state .sb-error { color: #c8453b; }
.sync-actions { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.leave-family { margin: 4px auto 0; display: block; color: #c8453b; border-color: #e6c4c0; }
.sync-field { margin-top: 16px; }
.sync-field-label { font-size: 13px; font-weight: 600; color: #1f3d37; margin-bottom: 8px; text-align: left; }
.sync-field .login-input { margin-bottom: 8px; }
.sync-hint { font-size: 11px; color: #9aaba6; line-height: 1.5; margin: -2px 0 6px; text-align: left; }
.sync-field .mini { width: 100%; }
.sync-divider { margin: 14px 0; font-size: 12px; color: #9aaba6; position: relative; }
.sync-divider::before, .sync-divider::after {
  content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: #e2ece8;
}
.sync-divider::before { left: 0; }
.sync-divider::after { right: 0; }
.sync-parent-info { font-size: 13px; color: #5a6f6a; margin: 10px 0; }
.sync-parent-info b { color: #1f5f52; letter-spacing: 2px; font-size: 15px; }
.mini:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 380px) {
  .tree { width: 58px; }
  .layer-bottom { width: 58px; }
  .layer-mid { width: 48px; }
  .title { font-size: 30px; }
}
