/* =========================================================================
 * 牛牛 & 莹宝儿 · 我们的小日子 —— 样式
 * 移动优先；桌面端居中放大。配色取自草地、奶油白和粉色爱心。
 * ========================================================================= */

:root {
  color-scheme: light;
  --maxw: 780px;

  --ink: #4a4038;
  --ink-2: #7d6f63;
  --ink-3: #a89a8d;

  --card: #fffffe;
  --cream: #fffaf2;

  --pink: #ff8fa3;
  --pink-deep: #f2647f;
  --pink-soft: #ffe6ec;
  --yellow: #ffd37a;
  --gold: #f0c04a;

  --grass: #6cbf6f;
  --grass-soft: #eaf7e6;
  --grass-deep: #3f7d47;

  --line: #f0e6d9;
  --shadow-s: 0 2px 6px rgba(122, 98, 74, 0.06);
  --shadow: 0 10px 26px rgba(122, 98, 74, 0.1), 0 2px 6px rgba(122, 98, 74, 0.06);
  --radius: 22px;
  --radius-s: 16px;
}

* { box-sizing: border-box; }

button { touch-action: manipulation; }

.cal-cell, .cal-nav, .cal-title, .day-close, .chip { touch-action: manipulation; }

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

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans CN", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(180deg, #dff1ff 0%, #f3fbff 22%, #fff8ec 58%, #fdf1e0 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 0 calc(28px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- 首屏 */
.hero {
  position: relative;
  border-radius: 0 0 32px 32px;
  overflow: hidden;
  background: linear-gradient(180deg, #e2f3ff 0%, #f1fbff 42%, #fdf6e8 100%);
  box-shadow: var(--shadow);
}

.hero-sky {
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0.9;
  box-shadow: 0 6px 14px rgba(140, 180, 210, 0.18);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
}

.cloud::before { width: 30px; height: 30px; left: 12px; top: -14px; }
.cloud::after { width: 22px; height: 22px; right: 12px; top: -9px; }

.cloud-a { width: 92px; left: 6%; top: 16px; animation: drift 14s ease-in-out infinite; }
.cloud-b { width: 68px; left: 46%; top: 6px; animation: drift 18s ease-in-out infinite reverse; }
.cloud-c { width: 54px; right: 8%; top: 32px; animation: drift 22s ease-in-out infinite; }

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(16px, -4px, 0); }
}

.hero-art { position: relative; padding-top: 10px; }

.scene {
  display: block;
  width: 100%;
  height: auto;
  /* 裁剪到取景框内：插画里画到框外的部分不参与绘制，避免压到下方文字 */
  overflow: hidden;
}

/* 场景里的小动效 */
.buddy { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 4.6s ease-in-out infinite; }
.capy { animation-delay: 0.9s; }

@keyframes breathe {
  0%, 100% { scale: 1; }
  50% { scale: 1.018; }
}

.cow-tail { transform-box: fill-box; transform-origin: 92% 8%; animation: tail 3.4s ease-in-out infinite; }

@keyframes tail {
  0%, 100% { rotate: -6deg; }
  50% { rotate: 8deg; }
}

.grass-row use { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 3.8s ease-in-out infinite; }
.grass-row use:nth-child(2n) { animation-delay: 0.7s; }
.grass-row use:nth-child(3n) { animation-delay: 1.3s; }

@keyframes sway {
  0%, 100% { rotate: -4deg; }
  50% { rotate: 4deg; }
}

.heart-float use { animation: floaty 4.2s ease-in-out infinite; }
.heart-float use:nth-child(2) { animation-delay: 0.8s; }
.heart-float use:nth-child(3) { animation-delay: 1.5s; }

@keyframes floaty {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}

.sun-core { transform-box: fill-box; transform-origin: 50% 50%; animation: sunPulse 5.2s ease-in-out infinite; }

@keyframes sunPulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.06; }
}

.hero-body {
  position: relative;
  padding: 4px 18px 24px;
  text-align: center;
}

.hero-kicker {
  margin: 0 0 4px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: clamp(24px, 7vw, 36px);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.name-a { color: #6a5344; }
.name-b { color: #d9678a; }

.amp { display: inline-grid; place-items: center; width: 1.05em; height: 1.05em; }
.amp-heart { width: 100%; height: 100%; animation: beat 2.6s ease-in-out infinite; }

@keyframes beat {
  0%, 100% { scale: 1; }
  18% { scale: 1.16; }
  36% { scale: 1; }
  54% { scale: 1.1; }
}

.together { margin-top: 10px; }
.together-label { margin: 0; font-size: 13px; color: var(--ink-2); }

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

.days-num {
  font-size: clamp(56px, 19vw, 92px);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ff7d95 0%, #ff9f6b 55%, #ffc65c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.days-unit { font-size: 18px; font-weight: 700; color: var(--pink-deep); }

.together-exact {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 通用区块 */
.page-main { padding: 22px 14px 0; }

.section { margin-bottom: 26px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 4px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.section-head p { margin: 0; font-size: 12px; color: var(--ink-3); }

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

/* ---------------------------------------------------------------- 倒计时卡片 */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }

.cd-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.cd-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -46px auto;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--tint, var(--grass-soft));
  opacity: 0.55;
  pointer-events: none;
}

.cd-card.is-today { border-color: #ffc9d5; box-shadow: 0 10px 26px rgba(242, 100, 127, 0.18); }

.cd-ring {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: conic-gradient(var(--ring, var(--pink)) calc(var(--p, 0) * 1%), #f1e8dd 0);
  display: grid;
  place-items: center;
}

.cd-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
}

.cd-ring-ic { position: relative; z-index: 1; width: 30px; height: 30px; }
.cd-ring-ic use, .cd-ring-ic svg { width: 100%; height: 100%; display: block; }

.cd-main { flex: 1 1 auto; min-width: 0; position: relative; z-index: 1; }

.cd-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.cd-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 999px;
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.cd-tag.lunar { background: #eef6ff; color: #4a86c8; }
.cd-tag.solar { background: #fff4dd; color: #b9812a; }

.cd-date { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }

.cd-days {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  text-align: right;
  min-width: 66px;
}

.cd-days b {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ring, var(--pink-deep));
}

.cd-days span { font-size: 12px; color: var(--ink-3); margin-left: 2px; }
.cd-days em { display: block; font-style: normal; font-size: 11px; color: var(--ink-3); }

.cd-card.is-today .cd-days b { font-size: 17px; white-space: nowrap; }

/* ---------------------------------------------------------------- 月历 */
.calendar { padding: 12px 10px 12px; }

.cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
}

.cal-nav {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;
  background: #f5f8f2;
  color: var(--grass-deep);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cal-nav:active { background: #e9f2e4; }

.cal-title {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 0;
}

.cal-title small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); margin-left: 6px; }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding-bottom: 4px;
}

.cal-week span {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
}

.cal-week span.we { color: #dd8ba0; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.cal-cell {
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  color: inherit;
  padding: 5px 0 4px;
  min-height: 48px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.cal-cell:active { background: #f4f7f1; }
.cal-cell .d { font-size: 14.5px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cal-cell .l {
  font-size: 9.5px;
  line-height: 1.1;
  color: var(--ink-3);
  transform: scale(0.94);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
.cal-cell .l.fest { color: #d96f8c; }
.cal-cell .l.term { color: #7a9c6d; }
.cal-cell.out { opacity: 0.32; }

.cal-cell.today { background: linear-gradient(180deg, #ffeaef, #ffd8e2); }
.cal-cell.today .d { color: #d94a68; }
.cal-cell.today .l { color: #cf7e90; }

.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--grass); }

.cal-cell .marks { display: flex; gap: 3px; height: 5px; margin-top: 1px; }
.cal-cell .mark { width: 5px; height: 5px; border-radius: 50%; }
.mark.birthday { background: var(--pink); }
.mark.love { background: var(--gold); }
.mark.festival { background: #7fc98a; }

.cal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 6px 0;
  margin-top: 6px;
  border-top: 1px dashed var(--line);
}

.legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-birthday { background: var(--pink); }
.dot-love { background: var(--gold); }
.dot-festival { background: #7fc98a; }
.dot-today { background: #ffd0da; box-shadow: inset 0 0 0 1.5px #f091a7; }

/* 选中日期详情 */
.day-card { margin-top: 12px; padding: 15px 15px 14px; animation: pop 0.22s ease-out; }

@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.day-head { display: flex; align-items: center; gap: 10px; }
.day-date { font-size: 19px; font-weight: 850; }
.day-lunar { font-size: 12.5px; color: #4a86c8; background: #eef6ff; padding: 2px 8px; border-radius: 999px; }
.day-week { font-size: 12.5px; color: var(--ink-3); }
.day-close {
  margin-left: auto;
  border: none;
  background: #f5f2ec;
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.day-rel { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.day-events { display: grid; gap: 8px; margin-top: 12px; }

.day-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  background: #fbf8f2;
  border: 1px solid #f3ebdf;
}

.day-event .ic { width: 26px; height: 26px; flex: 0 0 auto; }
.day-event .t { font-size: 14px; font-weight: 650; }
.day-event .n { font-size: 11.5px; color: var(--ink-3); }
.day-event .delta { margin-left: auto; font-size: 12px; color: var(--ink-2); white-space: nowrap; }

.day-empty { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------------------------------------------------------------- 小日子 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips-wrap { justify-content: flex-start; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  font-size: 13px;
  color: var(--ink);
}

.chip .ic { width: 20px; height: 20px; }
.chip b { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--pink-deep); }
.chip small { color: var(--ink-3); font-size: 11.5px; }
.chip.is-today { border-color: #ffc9d5; background: #fff7f9; }

.chips .chip-sub { background: transparent; border: none; box-shadow: none; color: var(--ink-3); font-size: 12.5px; padding: 8px 4px; }

/* ---------------------------------------------------------------- 时间线 */
.timeline {
  list-style: none;
  margin: 0;
  padding: 16px 16px 8px;
  display: grid;
  gap: 2px;
}

.tl-item { position: relative; padding: 0 0 18px 28px; }

.tl-item::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--grass);
  z-index: 1;
}

.tl-item::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: #efe3d5;
}

.tl-item:last-child { padding-bottom: 8px; }
.tl-item:last-child::after { display: none; }
.tl-item.done::before { background: var(--grass); }
.tl-item.todo::before { border-color: #e3d7c8; border-style: dashed; background: #fffdf9; }
.tl-item.todo .tl-title { color: var(--ink-2); }

.tl-title { font-size: 15px; font-weight: 750; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.tl-note { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.tl-badge { font-size: 10.5px; font-weight: 700; padding: 1.5px 8px; border-radius: 999px; background: var(--grass-soft); color: var(--grass-deep); }
.tl-badge.soon { background: var(--pink-soft); color: var(--pink-deep); }

/* ---------------------------------------------------------------- 页脚 */
.footer {
  padding: 6px 18px 12px;
  text-align: center;
  color: var(--ink-3);
}

.footer-art { display: grid; place-items: center; }
.footer-svg { width: 150px; height: 50px; opacity: 0.9; }
.footer-line { margin: 2px 0 4px; font-size: 12.5px; color: var(--ink-2); }
.footer-meta { margin: 0; font-size: 11px; color: var(--ink-3); }

/* ---------------------------------------------------------------- 大屏适配 */
@media (min-width: 620px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .page-main { padding: 26px 20px 0; }
  .hero { border-radius: 0 0 34px 34px; }
  .hero-body { padding: 0 28px 28px; }
  .cal-cell { min-height: 54px; }
  .cal-cell .d { font-size: 15.5px; }
  .cal-cell .l { font-size: 10.5px; }
}

@media (min-width: 820px) {
  .page { padding-top: 18px; }
  .hero { border-radius: 30px; }
  .page-main { padding: 26px 24px 0; }
}

/* 超窄屏（iPhone SE 一代等）微调 */
@media (max-width: 340px) {
  .cal-cell { min-height: 42px; }
  .cal-cell .d { font-size: 13.5px; }
  .cd-days { min-width: 58px; }
  .cd-days b { font-size: 21px; }
  .cd-ring { width: 54px; height: 54px; }
}

/* 尊重系统「减弱动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
