/* ===========================================================
   我们的今天 — 样式
   移动优先，浅暖色，无外部字体与网络依赖
   =========================================================== */

:root {
  --bg: #faf4f1;
  --card: #fffdfc;
  --ink: #382d29;
  --ink-soft: #5f4f49;
  --muted: #9c8b83;
  --rose: #d4787f;
  --rose-deep: #b95f68;
  --rose-soft: #f2d9d8;
  --cream: #fff6f2;
  --gold: #b8873f;
  --line: #f0e2dd;
  --radius: 24px;
  --shadow: 0 6px 22px rgba(148, 104, 96, 0.07), 0 1px 3px rgba(148, 104, 96, 0.05);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, #fff8f5 0%, rgba(255, 248, 245, 0) 60%),
    radial-gradient(80% 40% at 100% 0%, #fdeef0 0%, rgba(253, 238, 240, 0) 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(34px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 13px;
  /* 只有两张卡片，竖屏高的手机上下居中，别让底下空一大片 */
  min-height: 100dvh;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- 首屏 ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 20px;
  background: linear-gradient(162deg, #fff8f5 0%, #ffeef0 58%, #ffe4ea 100%);
  border-color: #f7e0dc;
}

.hero::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -110px; top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 68%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.greet { color: var(--rose-deep); font-weight: 600; }

.hero-main { margin-top: 14px; }

.days-label {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
}

.days-num {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0 0 -2px;
  line-height: 1;
}

.days-num #dayNum {
  font-size: 66px;
  font-weight: 700;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-shadow: 0 1px 0 #fff;
}

.days-unit {
  font-size: 17px;
  font-weight: 500;
  color: var(--rose-deep);
  padding-bottom: 6px;
}

.days-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.heart {
  position: absolute;
  right: 20px;
  bottom: 78px;
  width: 26px;
  height: 26px;
  fill: var(--rose);
  opacity: 0.85;
  animation: beat 2.6s ease-in-out infinite;
  transform-origin: center;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  56% { transform: scale(1); }
}

.tap-btn {
  position: relative;
  margin-top: 16px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--rose-soft);
  background: rgba(255, 255, 255, 0.78);
  color: var(--rose-deep);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: transform 0.18s ease, background 0.3s ease, color 0.3s ease;
}

.tap-btn:active { transform: scale(0.985); }

.tap-btn.done {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}

/* 打卡成功那一下的「弹」 */
.tap-btn.pop { animation: tapPop 0.62s cubic-bezier(0.22, 0.9, 0.3, 1); }

@keyframes tapPop {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.055); }
  60%  { transform: scale(0.995); }
  100% { transform: scale(1); }
}

/* ---------------- 小猫 ---------------- */

.cat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 14px 8px;
}

.cat-stage {
  flex: 0 0 126px;
  width: 126px;
  height: 112px;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.cat-stage svg { width: 100%; height: 100%; display: block; overflow: visible; }

.cat-stage[hidden], .cat-photo[hidden] { display: none !important; }

/* 真照片模式：岁岁本人的照片，做成微微倾斜的相框 */
.cat-photo {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 134px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--rose-soft);
  transform: perspective(720px) rotateY(-5deg) rotateX(1.5deg);
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 10px 22px -10px rgba(120, 70, 60, 0.35), 0 2px 6px rgba(120, 70, 60, 0.08);
  -webkit-tap-highlight-color: transparent;
  animation: catFloat 5.5s ease-in-out infinite;
}

.cat-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 34%;
  display: block;
  transform: scale(1.55);
  transform-origin: 50% 34%;
}

.cat-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), inset 0 -18px 24px -14px rgba(60, 30, 25, 0.35);
  pointer-events: none;
}

.cat-photo.is-nudge { animation: catNudge 0.5s ease; }
.cat-photo.cat-photo-empty { transform: none; }

@keyframes catFloat {
  0%, 100% { transform: perspective(720px) rotateY(-5deg) rotateX(1.5deg) translateY(0); }
  50%      { transform: perspective(720px) rotateY(-2deg) rotateX(0.5deg) translateY(-3px); }
}

@keyframes catNudge {
  0%   { transform: perspective(720px) rotateY(-5deg) scale(1); }
  40%  { transform: perspective(720px) rotateY(-9deg) scale(1.045); }
  100% { transform: perspective(720px) rotateY(-5deg) scale(1); }
}

/* 摸一下冒出来的小爱心 */
.cat-heart {
  position: absolute;
  left: 50%;
  top: 46%;
  font-size: 15px;
  color: var(--rose);
  pointer-events: none;
  animation: catHeartPop 1.1s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes catHeartPop {
  0%   { transform: translate(-50%, 0) scale(0.4); opacity: 0; }
  30%  { opacity: 0.95; }
  100% { transform: translate(-50%, -46px) scale(1.15); opacity: 0; }
}

.cat-say { flex: 1 1 auto; min-width: 0; }

.cat-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--rose-deep);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.cat-line {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  min-height: 2.9em;
}

/* ---------------- 备考 ---------------- */

.exam-card { padding: 16px 18px 18px; }

.exam-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.exam-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
}

.exam-left { font-size: 13px; color: var(--muted); }
.exam-left b {
  font-size: 22px;
  color: var(--rose-deep);
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
.exam-left i { font-style: normal; }

.bar {
  margin: 10px 0 13px;
  height: 6px;
  border-radius: 999px;
  background: #f6e6e4;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0b3b4, var(--rose));
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.quote {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  letter-spacing: 0.2px;
}

/* ---------------- 回忆 ---------------- */

.mem-card { overflow: hidden; }

.mem-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f3e7e2;
}

.mem-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.mem-photo img.loaded { opacity: 1; }

.mem-body { padding: 15px 18px 18px; }

.mem-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.mem-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.mem-tags span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fbeff0;
  color: #b7797e;
  letter-spacing: 0.5px;
}

.mem-title {
  margin: 8px 0 7px;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.mem-text {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.mem-text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.more-btn {
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--rose-deep);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.mem-card.no-photo { position: relative; }
.mem-card.no-photo .mem-body { padding-top: 20px; }
.mem-card.no-photo .mem-body::before {
  content: "“";
  display: block;
  font-size: 44px;
  line-height: 0.6;
  color: var(--rose-soft);
  margin-bottom: 6px;
  font-family: Georgia, serif;
}

/* ---------------- 倒数小卡 ---------------- */

.chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-width: 108px;
  padding: 11px 15px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  scroll-snap-align: start;
}

.chip .n {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.chip .n small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }

.chip .l {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.chip.today { background: linear-gradient(160deg, #fff6f4, #ffe9ec); border-color: #f8dade; }
.chip.today .n { color: var(--rose-deep); }

/* ---------------- 全部回忆 ---------------- */

.gal-card { padding: 4px 6px 6px; }

.gal-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.gal-count { color: var(--muted); font-weight: 400; font-size: 12px; }

.chev {
  margin-left: auto;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  transition: transform 0.28s ease;
}

.gal-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 0 8px 8px;
}

.gallery button {
  padding: 0;
  border: 0;
  background: #f3e7e2;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  position: relative;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.gallery button:active img { transform: scale(1.03); }

/* ---------------- 页脚 ---------------- */

.foot {
  margin-top: 4px;
  text-align: center;
  font-size: 12px;
  color: #bfaea7;
  letter-spacing: 0.6px;
  line-height: 1.9;
}

/* ---------------- 弹层 ---------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 28, 26, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.22s ease both;
}

.sheet[hidden] { display: none; }

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

.sheet-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.sheet-fig { margin: 0; max-width: 100%; text-align: center; }

.sheet-fig img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 16px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.sheet-fig figcaption {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13.5px;
  line-height: 1.7;
}

.sheet-letter {
  place-items: stretch;
  padding: 0;
  background: #fdf7f2;
  overflow: auto;
}

.sheet-letter .sheet-close { position: fixed; color: var(--ink); background: rgba(0, 0, 0, 0.05); }

.letter {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(64px + env(safe-area-inset-top)) 26px calc(60px + env(safe-area-inset-bottom));
  font-size: 16px;
  line-height: 2.05;
  color: #4a3b35;
  letter-spacing: 0.3px;
}

.letter h1 {
  font-size: 21px;
  font-weight: 650;
  margin: 0 0 22px;
  letter-spacing: 1px;
}

.letter p { margin: 0 0 17px; }

.letter hr {
  border: 0;
  height: 1px;
  background: #eadbd3;
  margin: 30px 0;
}

.letter strong { font-weight: 650; color: var(--rose-deep); }

.letter blockquote {
  margin: 0 0 17px;
  padding-left: 14px;
  border-left: 2px solid #ecd8d2;
  color: #7d6a63;
  font-size: 14.5px;
  line-height: 1.9;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 70;
}

#confetti[hidden] { display: none; }

.noscript { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------------- 减少动效 ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===========================================================
   小猫（SVG 内部状态）
   =========================================================== */

.cat-svg {
  overflow: visible;
  transition: transform 0.5s ease;
}

.cat-stage.cat-small .cat-svg { transform: scale(0.97); }
.cat-stage.cat-mid .cat-svg { transform: scale(1.04); }
.cat-stage.cat-big .cat-svg { transform: scale(1.09); }

/* 呼吸 */
.cat-svg .cat-body-g {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: catBreathe 3.8s ease-in-out infinite;
}
@keyframes catBreathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.016, 0.984); }
}

/* 尾巴 */
.cat-svg .cat-tail {
  transform-box: fill-box;
  transform-origin: 6% 94%;
  animation: catTail 2.9s ease-in-out infinite alternate;
}
@keyframes catTail {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(9deg); }
}

/* 头 */
.cat-svg .cat-head-g {
  transform-box: fill-box;
  transform-origin: 50% 94%;
  animation: catBob 4.4s ease-in-out infinite;
}
@keyframes catBob {
  0%, 100% { transform: translateY(0) rotate(-0.8deg); }
  50%      { transform: translateY(-1.8px) rotate(0.8deg); }
}

/* 眨眼 */
.cat-svg .eyes-open {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: catBlink 5.8s ease-in-out infinite;
}
@keyframes catBlink {
  0%, 91%, 100% { transform: scaleY(1); }
  94%           { transform: scaleY(0.08); }
}

/* 默认隐藏的分支 */
.cat-svg .eyes-closed,
.cat-svg .eyes-happy { display: none; }

.cat-svg .cat-zzz,
.cat-svg .cat-book,
.cat-svg .cat-hearts {
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* --- 睡觉 --- */
.cat-svg.is-sleeping .cat-body-g {
  animation: none;
  transform: scale(1.02, 0.955);
}
.cat-svg.is-sleeping .cat-head-g {
  animation: none;
  transform: translateY(6px) rotate(-5deg);
}
.cat-svg.is-sleeping .cat-tail {
  animation: none;
  transform: rotate(16deg);
}
.cat-svg.is-sleeping .eyes-open { display: none; }
.cat-svg.is-sleeping .eyes-closed { display: block; }
.cat-svg.is-sleeping .cat-zzz { opacity: 1; }
.cat-svg.is-sleeping .cat-zzz text {
  animation: catZ 2.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.cat-svg.is-sleeping .cat-zzz text + text { animation-delay: 0.8s; }
@keyframes catZ {
  0%   { opacity: 0.25; transform: translateY(2px) scale(0.9); }
  50%  { opacity: 1;    transform: translateY(-2px) scale(1.05); }
  100% { opacity: 0.25; transform: translateY(-5px) scale(1.1); }
}

/* --- 学习 --- */
.cat-svg.is-studying .cat-book { opacity: 1; }
.cat-svg.is-studying .cat-head-g {
  animation: catRead 5.2s ease-in-out infinite;
}
@keyframes catRead {
  0%, 100% { transform: translateY(2px) rotate(-2deg); }
  50%      { transform: translateY(0.5px) rotate(2deg); }
}
.cat-svg.is-studying .eyes-open {
  animation: catBlink 4.6s ease-in-out infinite;
}

/* --- 摸头 --- */
.cat-svg.is-petting .eyes-open { display: none; }
.cat-svg.is-petting .eyes-happy { display: block; }
.cat-svg.is-petting .cat-head-g {
  animation: catPetHead 1.1s ease-in-out infinite;
}
@keyframes catPetHead {
  0%, 100% { transform: rotate(3deg) translateY(-1px); }
  50%      { transform: rotate(6.5deg) translateY(-2px); }
}
.cat-svg.is-petting .cat-tail {
  animation: catPetTail 0.8s ease-in-out infinite alternate;
}
@keyframes catPetTail {
  from { transform: rotate(0deg); }
  to   { transform: rotate(20deg); }
}
.cat-svg.is-petting .cat-hearts { opacity: 1; }

.cat-svg .cat-hearts .h {
  animation: catHeart 1.7s ease-out infinite;
}
.cat-svg .cat-hearts .h1 { animation-delay: 0s; }
.cat-svg .cat-hearts .h2 { animation-delay: 0.5s; }
.cat-svg .cat-hearts .h3 { animation-delay: 1s; }

@keyframes catHeart {
  0%   { transform: translate(146px, 74px) scale(0.5); opacity: 0; }
  22%  { opacity: 1; }
  100% { transform: translate(154px, 30px) scale(1.6); opacity: 0; }
}

.cat-svg .cat-hearts .h2 {
  animation-name: catHeart2;
}
@keyframes catHeart2 {
  0%   { transform: translate(168px, 86px) scale(0.45); opacity: 0; }
  22%  { opacity: 0.95; }
  100% { transform: translate(184px, 44px) scale(1.35); opacity: 0; }
}

.cat-svg .cat-hearts .h3 {
  animation-name: catHeart3;
}
@keyframes catHeart3 {
  0%   { transform: translate(126px, 88px) scale(0.4); opacity: 0; }
  22%  { opacity: 0.9; }
  100% { transform: translate(116px, 44px) scale(1.25); opacity: 0; }
}

/* --- 欢呼（考试当天 / 考前夜） --- */
.cat-svg.is-cheering .eyes-open { display: none; }
.cat-svg.is-cheering .eyes-happy { display: block; }
.cat-svg.is-cheering .cat-sparkles { opacity: 1; }
.cat-svg .cat-sparkles { opacity: 0; transition: opacity 0.4s ease; }
.cat-svg .cat-sparkles .s {
  transform-box: view-box;
  animation: catSpark 1.5s ease-in-out infinite;
}
.cat-svg .cat-sparkles .s2 { animation-delay: 0.35s; animation-name: catSpark2; }
.cat-svg .cat-sparkles .s3 { animation-delay: 0.7s; animation-name: catSpark3; }

@keyframes catSpark {
  0%, 100% { opacity: 0.15; transform: translate(56px, 62px) scale(0.6); }
  50%      { opacity: 1;    transform: translate(56px, 56px) scale(1); }
}
@keyframes catSpark2 {
  0%, 100% { opacity: 0.15; transform: translate(166px, 54px) scale(0.55); }
  50%      { opacity: 1;    transform: translate(166px, 47px) scale(0.95); }
}
@keyframes catSpark3 {
  0%, 100% { opacity: 0.15; transform: translate(150px, 104px) scale(0.5); }
  50%      { opacity: 1;    transform: translate(150px, 99px) scale(0.85); }
}

.cat-svg.is-cheering .cat-body-g { animation: catBounce 0.9s ease-in-out infinite; }
@keyframes catBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ---------------- 极窄屏 ---------------- */

@media (max-width: 340px) {
  .days-num #dayNum { font-size: 56px; }
  .cat-stage { flex-basis: 104px; width: 104px; height: 94px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
}
