/* ==========================================================
   今日予你 · 视觉与动效
   动效语言参考高端酒店 / 奢侈品官网：
   慢、轻、克制；长缓出曲线；细金线；模糊到清晰的浮现；层层错落入场。
   ========================================================== */

/* ========== 主题色（类名挂在 html 上） ========== */
:root {
  --bg1: #f4f1ea;
  --bg2: #e3eaf0;
  --ink: #4a5560;
  --ink-soft: #8a96a0;
  --accent: #9fb4c6;
  --card: #fbf9f4;
  --card-edge: rgba(120, 140, 160, .18);
  --glow: rgba(190, 210, 228, .55);
  --beam: rgba(255, 250, 235, .75);
  --line: rgba(176, 150, 104, .55);     /* 细金线 */
  --sheen: rgba(255, 255, 255, .55);
  --shadow: rgba(40, 50, 70, .35);

  --ease-out: cubic-bezier(.16, 1, .3, 1);      /* 长缓出：几乎所有入场 */
  --ease-io: cubic-bezier(.76, 0, .24, 1);      /* 幕布、翻牌 */
  --ease-soft: cubic-bezier(.33, 0, .2, 1);
  --font: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}

/* 晴颂：暖橘奶油 */
.theme-qing {
  --bg1: #fbf3e6;
  --bg2: #f5d9bd;
  --ink: #6b5040;
  --ink-soft: #a88c78;
  --accent: #e8a878;
  --card: #fffaf1;
  --card-edge: rgba(200, 140, 90, .2);
  --glow: rgba(255, 200, 140, .6);
  --line: rgba(196, 140, 84, .6);
}

/* 雨笺：雾蓝灰低饱和 */
.theme-yu {
  --bg1: #dde3e7;
  --bg2: #aebcc6;
  --ink: #3f4c56;
  --ink-soft: #6f7f8a;
  --accent: #8ea2b0;
  --card: #eef1f2;
  --card-edge: rgba(70, 90, 105, .2);
  --glow: rgba(160, 180, 195, .5);
  --beam: rgba(240, 245, 248, .5);
  --line: rgba(110, 128, 142, .5);
  --sheen: rgba(255, 255, 255, .4);
}

/* 星契：深静谧灰 + 银星光 */
.theme-xing {
  --bg1: #1d2128;
  --bg2: #0d0f13;
  --ink: #e4e7ec;
  --ink-soft: #9aa1ad;
  --accent: #c9d1dd;
  --card: #23272f;
  --card-edge: rgba(210, 220, 235, .2);
  --glow: rgba(190, 205, 230, .22);
  --beam: rgba(200, 215, 240, .1);
  --line: rgba(214, 222, 236, .45);
  --sheen: rgba(220, 230, 250, .22);
  --shadow: rgba(0, 0, 0, .6);
}

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

html { min-height: 100%; scroll-behavior: smooth; background: var(--bg2); }
[hidden] { display: none !important; }
button, a, textarea { touch-action: manipulation; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg2) linear-gradient(170deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* 纸质噪点 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.theme-xing body::before { opacity: .15; }

/* ==========================================================
   过场动画
   动画默认就是最终状态，靠 fill-mode: both 在开始前套用起始帧，
   即使某个浏览器不支持某项动画，字也一定显示出来。
   .go 在 logo 图片加载完才加上。
   ========================================================== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(170deg, var(--bg1) 0%, var(--bg2) 100%);
  overflow: hidden;
  -webkit-clip-path: inset(0 0 0 0);
  clip-path: inset(0 0 0 0);
  transition: -webkit-clip-path 1.5s var(--ease-io), clip-path 1.5s var(--ease-io);
}
.intro:not(.go) .intro-logo,
.intro:not(.go) .intro-slogan,
.intro:not(.go) .intro-rule { visibility: hidden; }
.intro-skip {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 36px);
  border: 0;
  padding: 14px;
  background: none;
  color: var(--ink-soft);
  font: 11px var(--font);
  letter-spacing: .25em;
  cursor: pointer;
}

/* 离场：像幕布一样向上收起，logo 先轻轻上浮淡出 */
.intro.leave {
  -webkit-clip-path: inset(0 0 100% 0);
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}
.intro.leave .intro-logo,
.intro.leave .intro-slogan,
.intro.leave .intro-rule {
  opacity: 0;
  transform: translate3d(0, -36px, 0);
  transition: opacity .8s var(--ease-soft), transform 1.4s var(--ease-io);
}

/* 斜照进来的一束光，呼应 logo 原图里的窗光 */
.intro-light {
  position: absolute;
  inset: -50%;
  background: linear-gradient(115deg, transparent 38%, var(--beam) 48%, transparent 58%);
  opacity: 0;
}
.go .intro-light { animation: beam 4.4s var(--ease-out) 0s both; }
@keyframes beam {
  0% { opacity: 0; transform: translate3d(-34%, 0, 0); }
  35% { opacity: 1; }
  100% { opacity: .5; transform: translate3d(10%, 0, 0); }
}

.intro-logo {
  position: relative;
  width: min(84vw, 420px);
  height: calc(min(84vw, 420px) * .538);
}

/* 字迹：从左到右晕开，同时从微微失焦到清晰 */
.logo-main {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
.go .logo-main { animation: ink 2.6s var(--ease-out) .25s both; }
@keyframes ink {
  0% {
    opacity: 0;
    -webkit-clip-path: inset(0 100% 0 0);
    clip-path: inset(0 100% 0 0);
    filter: blur(6px);
    transform: scale(1.04);
  }
  15% { opacity: 1; }
  100% {
    opacity: 1;
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
    filter: blur(0);
    transform: scale(1);
  }
}

/* 小鸟：从右下方划一道弧线飞到“你”字上方 */
.logo-bird {
  position: absolute;
  left: 69.6%;
  top: 4.9%;
  width: 13.4%;
  -webkit-transform-origin: 50% 60%;
  transform-origin: 50% 60%;
}
.go .logo-bird { animation: fly 2s cubic-bezier(.3, .6, .25, 1) 1.5s both; }
@keyframes fly {
  0% { opacity: 0; transform: translate3d(140%, 180%, 0) rotate(20deg) scale(.55); }
  25% { opacity: 1; }
  55% { transform: translate3d(28%, -42%, 0) rotate(-10deg) scale(1.05); }
  80% { transform: translate3d(-4%, 5%, 0) rotate(3deg) scale(.98); }
  100% { opacity: 1; transform: none; }
}

/* 星点闪烁 */
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
  background: radial-gradient(circle, #fff6d8 0%, rgba(255, 240, 200, .8) 30%, transparent 70%);
  -webkit-clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.go .spark { animation: twinkle 1.8s ease-in-out both; }
.s1 { left: 34%; top: 14%; }
.s2 { left: 92%; top: 30%; width: 14px; height: 14px; }
.s3 { left: 8%; top: 76%; }
.go .s1 { animation-delay: 2.2s; }
.go .s2 { animation-delay: 2.6s; }
.go .s3 { animation-delay: 3s; }
@keyframes twinkle {
  0% { opacity: 0; transform: scale(.2) rotate(0); }
  45% { opacity: 1; transform: scale(1.4) rotate(45deg); }
  100% { opacity: 0; transform: scale(.6) rotate(90deg); }
}

/* 一道从中间向两侧画开的细金线 */
.intro-rule {
  display: block;
  width: 64px;
  height: 1px;
  margin-top: 22px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.go .intro-rule { animation: draw 1.6s var(--ease-out) 2.3s both; }
@keyframes draw {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

/* slogan：逐字由虚到实浮现（JS 拆成 span） */
.intro-slogan {
  position: relative;
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: .5em;
  padding-left: .5em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.intro-slogan span { display: inline-block; }
.go .intro-slogan span {
  animation: rise 1.4s var(--ease-out) both;
  animation-delay: calc(2.5s + var(--i) * 70ms);
}

/* 通用：由虚到实、轻轻上浮 */
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

/* ========== 氛围光 ========== */
.aura {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(40% 30% at 30% 25%, var(--glow), transparent 70%),
    radial-gradient(35% 28% at 75% 70%, var(--glow), transparent 70%);
  animation: breathe 12s ease-in-out infinite alternate;
}
.theme-qing .aura { animation: drift 18s ease-in-out infinite alternate; }
.theme-yu .aura { opacity: .7; animation: breathe 16s ease-in-out infinite alternate; }
.theme-xing .aura { opacity: .6; }

@keyframes breathe {
  from { opacity: .55; transform: scale(1); }
  to { opacity: 1; transform: scale(1.06); }
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0); opacity: .7; }
  to { transform: translate3d(3%, 2%, 0); opacity: 1; }
}

/* 晴颂浮动亮斑 */
.theme-qing .aura::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(6px 6px at 20% 40%, rgba(255, 240, 210, .9), transparent),
    radial-gradient(4px 4px at 60% 30%, rgba(255, 240, 210, .8), transparent),
    radial-gradient(5px 5px at 80% 55%, rgba(255, 240, 210, .8), transparent),
    radial-gradient(3px 3px at 40% 65%, rgba(255, 240, 210, .9), transparent);
  animation: floaty 12s ease-in-out infinite alternate;
}
@keyframes floaty {
  from { transform: translateY(0); opacity: .5; }
  to { transform: translateY(-30px); opacity: 1; }
}

/* 雨笺雾 */
.theme-yu .aura::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(220, 228, 233, .5) 100%);
  animation: breathe 18s ease-in-out infinite alternate;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 3s var(--ease-soft);
}
.theme-xing #stars { opacity: 1; }

/* ========== 布局 ========== */
.page {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 18px) 28px calc(env(safe-area-inset-bottom) + 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero { min-height: 100svh; padding-top: calc(env(safe-area-inset-top) + 12px); }
.hero .brand-logo { width: min(36vw, 154px); }
.hero .info { margin-top: 20px; }
.hero .actions { margin-top: 14px; }

/* 层层错落入场：.rv 元素在 .ready-page 后按 --d 依次浮现 */
.rv {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  filter: blur(6px);
  transition:
    opacity 1.4s var(--ease-out) var(--d, 0s),
    transform 1.6s var(--ease-out) var(--d, 0s),
    filter 1.4s var(--ease-out) var(--d, 0s);
}
.ready-page .rv { opacity: 1; transform: none; filter: blur(0); }

.brand { text-align: center; }
.brand-logo { display: block; width: min(44vw, 190px); height: auto; }

.rule {
  display: block;
  width: 40px;
  height: 1px;
  margin-top: 2px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.rule.rv { transform: scaleX(0); filter: none; }
.ready-page .rule.rv { transform: scaleX(1); }

.today {
  margin-top: 12px;
  min-height: 3.4em;
  font-size: 11.5px;
  letter-spacing: .18em;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.75;
}
.today span { display: block; }

/* ========== 卡牌 ========== */
.stage {
  margin-top: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* 结构：.card（透视 + 入场 + 悬浮）> .card-tilt（随手机倾斜）> .card-inner（翻牌） */
.card {
  --card-height: calc(min(70vw, 296px) * 1.48);
  width: min(70vw, 296px);
  height: var(--card-height);
  transition: height 1s var(--ease-out);
  -webkit-perspective: 1600px;
  perspective: 1600px;
  opacity: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.card.enter { animation: cardIn 2s var(--ease-out) both; }
.card.ready { opacity: 1; animation: float 8s ease-in-out infinite; }
.card.flipped { height: max(var(--card-height), var(--story-height, 0px)); }

@keyframes cardIn {
  0% { opacity: 0; transform: translate3d(0, 70px, 0) scale(.92); }
  40% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -6px, 0); }
}

.card-tilt {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 1.7s var(--ease-io);
}
.card.flipped .card-inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}
/* 翻牌时整张卡轻轻抬起再落下（scale 属性不支持的浏览器自动忽略） */
.card.lift .card-inner { animation: lift 1.7s var(--ease-io); }
@keyframes lift {
  0%, 100% { scale: 1; }
  50% { scale: 1.06; }
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  box-shadow:
    0 30px 60px -30px var(--shadow),
    0 12px 24px -18px var(--shadow),
    0 1px 2px rgba(40, 50, 70, .06);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  /* iOS 防止翻转时背面穿透 */
  -webkit-transform: translateZ(1px);
  transform: translateZ(1px);
}

.card-front {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.card-art {
  position: relative;
  flex: 1;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg1), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 内框细线 */
.card-art::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 6px;
  pointer-events: none;
}
.card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.2s var(--ease-out), transform 2.4s var(--ease-out);
}
.card-art img.loaded { opacity: 1; transform: scale(1); }
.card-art-name {
  font-size: 32px;
  letter-spacing: .4em;
  padding-top: .4em;
  color: rgba(255, 255, 255, .88);
  writing-mode: vertical-rl;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .1);
}
.card-art img.loaded + .card-art-name { display: none; }

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 4px 1px;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: .2em;
}
.card-name { color: var(--ink); font-size: 14px; letter-spacing: .3em; }

/* 卡面流光：入场后扫过一次，之后随手机倾斜轻微移动 */
.sheen {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, var(--sheen) 50%, transparent 58%);
  opacity: 0;
  transform: translate3d(calc(var(--sx, 0) * 1%), 0, 0);
  transition: opacity .8s var(--ease-soft);
}
.card.tilting .sheen { opacity: .7; }
.card.glint .sheen { animation: glint 2.2s var(--ease-io) both; }
@keyframes glint {
  0% { opacity: 0; transform: translate3d(-70%, 0, 0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(70%, 0, 0); }
}

.card-back {
  -webkit-transform: rotateY(180deg) translateZ(1px);
  transform: rotateY(180deg) translateZ(1px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 66px 26px 58px;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--glow), transparent 62%),
    var(--card);
}
/* 背面内框细线 */
.card-back::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  pointer-events: none;
}
.back-mark {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: .5em;
  padding-left: .5em;
  color: var(--ink-soft);
}
.back-rule {
  position: absolute;
  top: 48px;
  left: 50%;
  width: 28px;
  height: 1px;
  margin-left: -14px;
  background: var(--line);
  transform: scaleX(0);
  transition: transform 1.4s var(--ease-out) .9s;
}
.card.flipped .back-rule { transform: scaleX(1); }

/* 寄语：逐字由虚到实浮现（JS 拆字并写入 --t 延迟） */
.message {
  font-size: 16.5px;
  line-height: 2.1;
  letter-spacing: .08em;
  text-align: justify;
  color: var(--ink);
  min-height: 6em;
}
.message span {
  opacity: 0;
  filter: blur(5px);
  animation: ink-in 1.6s var(--ease-out) forwards;
  animation-delay: var(--t);
}
.message.complete span { opacity: 1; filter: none; animation: none; }
@keyframes ink-in {
  from { opacity: 0; filter: blur(5px); }
  to { opacity: 1; filter: blur(0); }
}
/* 等待模型时的呼吸点 */
.message.waiting::after {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: wait 1.8s ease-in-out infinite;
}
@keyframes wait {
  0%, 100% { opacity: .15; transform: scale(.8); }
  50% { opacity: .8; transform: scale(1.3); }
}

.back-foot {
  position: absolute;
  bottom: 26px;
  left: 26px;
  right: 26px;
  text-align: right;
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-soft);
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  transition: opacity 1.4s var(--ease-out), transform 1.4s var(--ease-out);
}
.typed .back-foot { opacity: 1; transform: none; }

/* ========== 卡面信息 ========== */
.info { margin-top: 26px; text-align: center; }
.info > * {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  filter: blur(4px);
  transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out), filter 1s var(--ease-out);
}
.info.show > * { opacity: 1; transform: none; filter: blur(0); }
.info.show > :nth-child(2) { transition-delay: .15s; }

.category {
  font-size: 13px;
  letter-spacing: .45em;
  padding-left: .45em;
  color: var(--ink);
}
.intro-text {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.9;
  letter-spacing: .12em;
  color: var(--ink-soft);
}

/* ========== 按钮：文字 + 细线，不用色块 ========== */
.actions { display: grid; justify-items: center; margin-top: 22px; }
.actions > button { grid-area: 1 / 1; }

.cta {
  position: relative;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: .45em;
  padding: 12px 6px 12px calc(6px + .45em);
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out);
}
.cta.show { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.cta-soft { color: var(--ink-soft); font-size: 12px; }

/* 下划线：两端渐隐的细线，常态缓慢呼吸，按下时收拢 */
.cta::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  transform: scaleX(0);
  transition: transform 1.2s var(--ease-out) .2s;
}
.cta.show::after { transform: scaleX(1); animation: hairline 3.6s ease-in-out 1.4s infinite; }
.cta:active::after { transform: scaleX(.4); transition-duration: .3s; transition-delay: 0s; }
@keyframes hairline {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ========== 星契彩蛋 ========== */
.egg {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 34px);
  z-index: 5;
  max-width: 78vw;
  padding: 12px 22px;
  font-size: 12.5px;
  line-height: 1.8;
  letter-spacing: .12em;
  color: #eef1f5;
  text-align: center;
  background: rgba(34, 39, 50, .6);
  border: 1px solid rgba(220, 228, 240, .16);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  opacity: 0;
  filter: blur(6px);
  transform: translate3d(-50%, 14px, 0);
  transition: opacity 1.4s var(--ease-out), transform 1.6s var(--ease-out), filter 1.4s var(--ease-out);
  pointer-events: none;
}
.egg.show { opacity: 1; filter: blur(0); transform: translate3d(-50%, 0, 0); }

.fallback {
  margin-top: 40px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
}

.scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 14px 0;
  margin-top: auto;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: .26em;
}
.scroll-cue i { position: relative; display: block; width: 1px; height: 34px; background: var(--card-edge); overflow: hidden; }
.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, var(--ink-soft), transparent);
  animation: scroll-trace 3.4s var(--ease-io) infinite;
}
@keyframes scroll-trace {
  0% { transform: translateY(-100%); }
  70%, 100% { transform: translateY(100%); }
}

.journal { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 0 36px; }
.chapter {
  position: relative;
  min-height: 640px;
  min-height: 84svh;
  padding: clamp(76px, 12vh, 140px) 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-margin-top: 24px;
}
.chapter + .chapter { border-top: 1px solid var(--card-edge); }
.chapter-head { position: relative; text-align: center; margin-bottom: 52px; }
.chapter-index { display: block; margin-bottom: 22px; color: var(--ink-soft); font-size: 11px; letter-spacing: .18em; }
.eyebrow { color: var(--ink-soft); font-size: 10px; line-height: 1.8; letter-spacing: .22em; margin-bottom: 16px; }
.chapter h2 { font-weight: 400; font-size: clamp(23px, 4vw, 29px); letter-spacing: .3em; padding-left: .3em; }
.chapter-rule { display: block; margin: 24px auto 0; width: 42px; height: 1px; background: var(--line); }
.reveal { opacity: 1; transform: none; filter: none; }
.ready-page .reveal:not(.visible) { opacity: 0; transform: translate3d(0, 24px, 0); filter: blur(4px); }
.ready-page .reveal {
  transition: opacity 1.2s var(--ease-out) var(--d, 0s), transform 1.5s var(--ease-out) var(--d, 0s), filter 1.2s var(--ease-out) var(--d, 0s);
}
.chapter-head .chapter-rule { transform: scaleX(.2); transition: transform 1.6s var(--ease-out) .15s; }
.chapter-head.visible .chapter-rule { transform: scaleX(1); }
.day-layout { display: grid; gap: 38px; }
.date-sheet { text-align: center; }
.date-sheet > p:first-child { font-size: 12px; letter-spacing: .24em; }
.date-sheet time { display: block; font-size: clamp(76px, 19vw, 112px); font-weight: 400; line-height: 1.4; letter-spacing: -.04em; }
#dateLunar { color: var(--ink-soft); font-size: 11px; letter-spacing: .12em; line-height: 1.9; }
.festival { display: inline-block; margin-top: 18px; padding: 5px 12px; border: 1px solid var(--line); font-size: 11px; letter-spacing: .2em; }
.day-notes { display: grid; gap: 28px; max-width: 360px; margin: 0 auto; }
.day-notes > div { border-left: 1px solid var(--line); padding-left: 20px; }
.day-notes dt { font-size: 14px; letter-spacing: .18em; margin-bottom: 10px; }
.day-notes dd { font-size: 13px; line-height: 2; color: var(--ink-soft); letter-spacing: .06em; }
.day-notes .hou { font-size: 11px; margin-top: 6px; }
.day-notes .note-small { font-size: 10px; margin-top: 6px; }
.history-story { max-width: 440px; margin: 0 auto; }
.history-year { color: var(--ink-soft); font-size: 13px; letter-spacing: .18em; margin-bottom: 24px; }
.chapter-prose { font-size: clamp(17px, 2.7vw, 21px); line-height: 2.3; letter-spacing: .08em; overflow-wrap: anywhere; }
.chapter-aside { margin-top: 28px; font-size: 11px; line-height: 2; letter-spacing: .1em; color: var(--ink-soft); }
.work-sheet {
  position: relative;
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  padding: 38px 30px;
  border: 1px solid var(--card-edge);
  background: linear-gradient(135deg, var(--beam), transparent 65%);
  box-shadow: 0 28px 55px -45px var(--shadow);
}
.work-sheet::before { content: ""; position: absolute; top: -1px; left: 30px; width: 24px; height: 34px; border: 1px solid var(--line); border-top: 0; }
.work-kind { color: var(--ink-soft); font-size: 10px; letter-spacing: .2em; margin: 16px 0 20px; }
.work-sheet h3 { font-weight: 400; font-size: 20px; line-height: 1.8; letter-spacing: .1em; margin-bottom: 26px; }
.work-sheet .chapter-prose { font-size: 16px; }
.work-sheet .chapter-aside { margin-top: 32px; }
.letter-sheet { width: 100%; max-width: 500px; margin: 0 auto; }
.letter-sheet label { display: block; color: var(--ink-soft); font-size: 12px; letter-spacing: .12em; line-height: 2; margin-bottom: 24px; }
.letter-sheet textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 210px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(transparent 0 34px, var(--card-edge) 34px 35px);
  color: var(--ink);
  font: 16px/35px var(--font);
  letter-spacing: .06em;
  caret-color: var(--ink);
}
.letter-sheet textarea::placeholder { color: var(--ink-soft); opacity: .7; }
.letter-meta { display: flex; justify-content: space-between; gap: 16px; min-height: 38px; padding-top: 14px; font-size: 10px; color: var(--ink-soft); letter-spacing: .06em; }
#letterCount { flex-shrink: 0; }
.letter-sheet .chapter-aside { margin-top: 14px; font-size: 10px; }
.page-footer { padding: 30px 0 calc(env(safe-area-inset-bottom) + 64px); text-align: center; }
.page-footer p { margin: 30px 0 24px; font-size: 12px; letter-spacing: .12em; line-height: 2; color: var(--ink-soft); }
.page-footer a { display: inline-block; padding: 12px; font-size: 11px; color: var(--ink); text-decoration: none; letter-spacing: .12em; }
.page-footer a span { margin-left: 8px; }

@media (min-width: 720px) {
  .journal { padding: 0 80px; }
  .day-layout { grid-template-columns: 1fr 1fr; gap: 70px; align-items: center; }
  .day-notes { margin: 0; }
  .chapter-head { margin-bottom: 64px; }
}

@media (max-width: 380px) {
  .message { font-size: 15px; line-height: 1.9; letter-spacing: .04em; }
}

@media (max-width: 360px) {
  .journal { padding: 0 26px; }
  .card-back { padding: 66px 20px 58px; }
  .work-sheet { padding: 34px 22px; }
}

@media (max-height: 700px) {
  .card { --card-height: calc(min(68vw, 250px) * 1.48); width: min(68vw, 250px); }
  .brand-logo { width: min(36vw, 160px); }
  .info { margin-top: 18px; }
  .actions { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .3s !important;
    transition-delay: 0s !important;
  }
  .intro { display: none; }
  .message span { opacity: 1; filter: none; }
  .ready-page .reveal { opacity: 1; transform: none; filter: none; }
}
