/* 2-4 写信。class 一律 lt- 开头；顶栏、标签借 cl-，开关借 dy-，翻页小圆点借 al-dots
   信纸三色：pp-ivory 象牙 / pp-lilac 丁香 / pp-mist 雾蓝；火漆四色：s-mauve / s-teal / s-sage / s-gold */
.pp-ivory { --pa: #FBF7F0; --pb: #F2EBE0; --pc: #EEE5D8; --pl: #D9CCBD; }
.pp-lilac { --pa: #F7F2F6; --pb: #EDE4EC; --pc: #E7DCE6; --pl: #CDBFCD; }
.pp-mist  { --pa: #F3F5F5; --pb: #E6EBEC; --pc: #DEE5E7; --pl: #BCC7CA; }
.s-mauve { --sw: #8C7591; --sd: #5F4D63; }
.s-teal  { --sw: #637479; --sd: #43535A; }
.s-sage  { --sw: #7F866F; --sd: #5A604E; }
.s-gold  { --sw: #AB9473; --sd: #7C6A50; }

.lt { position: relative; min-height: 100%; padding-bottom: calc(30px + var(--safe-b)); }
.lt .lace-edge { top: 0; }
.cl-btn.ghost { visibility: hidden; }
.cl-tabs sup { margin-left: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--mauve-btn); color: var(--paper); font-size: 10px; line-height: 15px; text-align: center; box-sizing: border-box; }

/* ---------- 信封 ---------- */
.lt-env { position: relative; width: 100%; aspect-ratio: 324 / 200; perspective: 900px; filter: drop-shadow(0 6px 10px rgba(81, 75, 74, .14)); }
.lt-env > svg.body, .lt-env > svg.pocket { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lt-env .body rect { fill: var(--pb); stroke: var(--pl); stroke-width: .8; }
.lt-env .pocket { z-index: 2; }
.lt-env .pocket path { fill: var(--pa); stroke: var(--pl); stroke-width: .7; }
.lt-env .pocket .fold { fill: none; opacity: .7; }
.lt-env .flap { position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 3; transform-origin: 50% 0; transition: transform .65s cubic-bezier(.4, .1, .3, 1) .35s, z-index 0s .65s; }
.lt-env .flap svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(81, 75, 74, .1)); }
.lt-env .flap path { fill: var(--pc); stroke: var(--pl); stroke-width: .7; }
/* 纸纹 */
.lt-env::after { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 5px; background-image: radial-gradient(rgba(140, 125, 120, .1) .6px, transparent .7px); background-size: 4px 4px; }

/* 火漆：永远是两半拼成的；读过的裂开一点，拆信时两半飞开 */
.lt-seal { position: absolute; z-index: 6; left: 50%; top: 56%; width: 15.5%; aspect-ratio: 1; transform: translate(-50%, -50%); transition: opacity .4s; }
.lt-seal i { position: absolute; inset: 0; transition: transform .5s cubic-bezier(.3, .6, .3, 1), opacity .5s; }
.lt-seal svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1.5px 1.5px rgba(50, 35, 45, .35)); }
.lt-seal .wx { fill: var(--sw); }
.lt-seal .rim { fill: none; stroke: var(--sd); stroke-width: 1.1; opacity: .8; }
.lt-seal .emb path { fill: none; stroke: var(--sd); stroke-width: 1; }
.lt-seal .emb circle { fill: var(--sd); }
.lt-seal .gl { fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; opacity: .35; }
.lt-seal.broken .h1 { transform: translate(-1.5px, 1px) rotate(-5deg); }
.lt-seal.broken .h2 { transform: translate(1.5px, -.5px) rotate(4deg); }
.lt-flower { position: absolute; z-index: 5; left: 50%; top: 56%; width: 30%; transform: translate(-22%, -70%) rotate(-28deg); pointer-events: none; transition: opacity .4s .2s, transform .6s .2s; }
.lt-stamp { position: absolute; z-index: 5; right: 5%; bottom: 9%; width: 12%; aspect-ratio: 4 / 5; padding: 3px; box-sizing: border-box;
  background: radial-gradient(circle, transparent 1.3px, #FFFDF9 1.6px) -2.5px -2.5px / 5px 5px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .14)); }
.lt-stamp img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.75) sepia(.12); }
.lt-pm { position: absolute; z-index: 6; right: 11%; bottom: 10%; width: 21%; height: auto; fill: none; stroke: var(--mauve-deep); stroke-width: .8; opacity: .45; transform: rotate(-8deg); }
.lt-pm text { fill: var(--mauve-deep); stroke: none; font-family: var(--font-serif); font-size: 6.5px; letter-spacing: .5px; }
.lt-pm .in { stroke-dasharray: 1.5 1.5; }
/* 定时拆封：十字丝带 + 蝴蝶结 */
.lt-ribbon { position: absolute; z-index: 7; background: linear-gradient(var(--mauve-pale), #B9ABBC 50%, var(--mauve-pale)); box-shadow: 0 1px 2px rgba(70, 50, 70, .2); }
.lt-ribbon.h { left: 0; right: 0; top: 54%; height: 7%; }
.lt-ribbon.v { top: 0; bottom: 0; left: 47.8%; width: 4.4%; background: linear-gradient(90deg, var(--mauve-pale), #B9ABBC 50%, var(--mauve-pale)); }
.lt-rbow { position: absolute; z-index: 8; left: 50%; top: 57%; width: 26%; transform: translate(-50%, -62%); filter: drop-shadow(0 2px 2px rgba(70, 50, 70, .25)); }
.lt-env.locked .lt-seal, .lt-env.locked .lt-flower { opacity: 0; }

/* 信封里探出来的信纸 */
.lt-peek { position: absolute; z-index: 1; left: 7%; right: 7%; top: 8%; bottom: 5%; background: var(--pa); border: 1px solid var(--pl); border-radius: 2px; padding: 12% 8% 0; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 9%; transition: transform .8s cubic-bezier(.3, .6, .3, 1) .9s; }
.lt-peek i { height: 1px; background: var(--pl); }
.lt-peek i:first-child { width: 40%; height: 3px; border-radius: 2px; background: var(--mauve-pale); }

/* 拆：火漆两半飞开 → 封口翻上去 → 信纸探出来 */
.lt-env.opening .lt-seal .h1 { transform: translate(-60%, 40%) rotate(-38deg); opacity: 0; }
.lt-env.opening .lt-seal .h2 { transform: translate(60%, 30%) rotate(32deg); opacity: 0; }
.lt-env.opening .lt-flower { opacity: 0; transform: translate(-22%, -20%) rotate(-50deg); }
.lt-env.opening .flap { transform: rotateX(180deg); z-index: 0; }
.lt-env.opening .lt-peek { transform: translateY(-58%); }

/* ---------- 信箱：一页三封，左右滑 ---------- */
.lt-box { height: 100%; min-height: 0; display: flex; flex-direction: column; box-sizing: border-box; padding-bottom: calc(10px + var(--safe-b)); }
.lt-box > .cl-top { flex: none; }
.lt-pages { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.lt-pages::-webkit-scrollbar { display: none; }
.lt-page { flex: 0 0 100%; scroll-snap-align: start; padding: 4px 26px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-evenly; }
.lt-item { display: flex; align-items: center; gap: 14px; color: var(--ink); animation: lt-in .6s cubic-bezier(.3, .7, .3, 1) both; }
.lt-item:nth-child(2) { flex-direction: row-reverse; animation-delay: .12s; }
.lt-item:nth-child(3) { animation-delay: .24s; }
.lt-item .lt-env { flex: none; width: 60%; }
.lt-item.unread .lt-env { animation: lt-bob 3.2s ease-in-out infinite; }
.lt-item.unread .lt-seal .gl { animation: lt-shine 2.4s ease-in-out infinite; }
@keyframes lt-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes lt-bob { 50% { transform: translateY(-4px); } }
@keyframes lt-shine { 50% { opacity: .8; } }
.lt-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lt-item:nth-child(2) .lt-meta { align-items: flex-end; text-align: right; }
.lt-meta .who { font-size: 13px; }
.lt-meta .who em { font-family: var(--font-script); font-style: normal; font-size: 18px; color: var(--mauve-deep); }
.lt-meta .tt { font-size: 14px; font-weight: 600; letter-spacing: 1px; line-height: 1.4; }
.lt-st { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.lt-st.new { color: var(--mauve-deep); }
.lt-st.new i { width: 6px; height: 6px; border-radius: 50%; background: var(--mauve-btn); animation: cl-pulse 1.6s ease-in-out infinite; }
.lt-st.lock { color: var(--mauve-deep); flex-wrap: wrap; }
.lt-st.lock b { font-family: var(--font-serif); font-weight: 500; font-size: 12.5px; color: var(--teal); }
.lt-dots { flex: none; }
.lt-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 13px; line-height: 2; color: var(--ink-2); text-align: center; }
.lt-empty a { color: var(--mauve-deep); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 读信 ---------- */
.lt-stage { display: flex; flex-direction: column; align-items: center; padding: 70px 34px 0; transition: transform .7s ease-in, opacity .6s ease-in; }
.lt-stage .lt-env { cursor: pointer; animation: lt-bob 3.2s ease-in-out infinite; }
.lt-stage .lt-env.opening { animation: none; }
.lt-stage.away { transform: translateY(140px) scale(.85); opacity: 0; }
.lt-hint { margin: 34px 0 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13.5px; letter-spacing: 2px; color: var(--mauve-deep); text-align: center; }
.lt-hint small { font-size: 11.5px; letter-spacing: 1px; color: var(--ink-2); }
.lt-hint .cd { display: inline-flex; align-items: center; gap: 5px; }
.lt-hint .cd b { font-family: var(--font-serif); font-weight: 500; font-size: 18px; color: var(--teal); letter-spacing: 1px; }

.lt-open { opacity: 0; transition: opacity .4s; }
.lt-open.on { opacity: 1; }
.lt-open.on .lt-sheet { animation: lt-unfold 1s cubic-bezier(.3, .7, .2, 1) both; }
.lt-open.on .lt-sheet::after { animation: lt-creases 1.6s ease-out both; }
.lt-open.now .lt-sheet, .lt-open.now .lt-sheet::after { animation: none; }
@keyframes lt-unfold { 0% { clip-path: inset(33.3% 0 33.3% 0); transform: translateY(40px); } 55% { clip-path: inset(0 0 33.3% 0); } 100% { clip-path: inset(0); transform: none; } }
@keyframes lt-creases { 0%, 50% { opacity: 1; } 100% { opacity: .35; } }

/* 信纸 */
.lt-sheet { position: relative; margin: 10px 22px 0; padding: 26px 22px 22px; background-color: var(--pa); background-image: radial-gradient(rgba(140, 125, 120, .1) .6px, transparent .7px); background-size: 4px 4px;
  border: 1px solid var(--pl); border-radius: 2px; box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--lace), 0 12px 26px rgba(81, 75, 74, .12); }
/* 折痕：信是折成三折寄来的 */
.lt-sheet::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: linear-gradient(transparent calc(33.3% - 1px), rgba(120, 100, 110, .12) 33.3%, rgba(255, 255, 255, .5) calc(33.3% + 1px), transparent calc(33.3% + 2px), transparent calc(66.6% - 1px), rgba(120, 100, 110, .12) 66.6%, rgba(255, 255, 255, .5) calc(66.6% + 1px), transparent calc(66.6% + 2px)); }
.lt-corner { position: absolute; right: -14px; top: -18px; width: 74px; transform: rotate(16deg); pointer-events: none; filter: drop-shadow(0 2px 2px rgba(81, 75, 74, .12)); }
.lt-dt { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: 13px; color: var(--ink-2); }
.lt-dear { margin: 14px 0 0; font-family: var(--font-script); font-size: 30px; line-height: 1.2; color: var(--mauve-deep); }
.lt-body { margin-top: 10px; background-image: repeating-linear-gradient(transparent 0 31px, var(--pl) 31px 32px); background-position: 0 -4px; }
.lt-body p { margin: 0; font-size: 15px; line-height: 32px; text-indent: 2em; color: var(--ink); }
.lt-sign { margin: 18px 0 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lt-sign i { font-family: var(--font-script); font-style: normal; font-size: 22px; color: var(--mauve-deep); }
.lt-sign b { font-size: 17px; font-weight: 500; letter-spacing: 4px; margin-right: 6px; }

.lt-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 22px 24px 0; }
.lt-reads { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); letter-spacing: 1px; }
.lt-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--mauve-deep); text-decoration: underline; text-underline-offset: 3px; }
.lt-reply { margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 24px; border-radius: 21px; background: var(--mauve-btn); color: var(--paper); font-size: 14px; letter-spacing: 2px; box-shadow: var(--shadow-accent); }

/* ---------- 写信 ---------- */
.lt-pick { display: flex; justify-content: center; gap: 22px; margin: 2px 0 6px; }
.lt-pick > div { display: flex; align-items: center; gap: 7px; }
.lt-pick span { font-size: 11.5px; color: var(--ink-2); letter-spacing: 1px; margin-right: 2px; }
.lt-pick .sw { width: 24px; height: 24px; border-radius: 50%; padding: 0; border: 1px solid var(--line); transition: transform .2s; }
.lt-pick .sw.pp-ivory, .lt-pick .sw.pp-lilac, .lt-pick .sw.pp-mist { background: var(--pa); border-color: var(--pl); }
.lt-pick .sw.s-mauve, .lt-pick .sw.s-teal, .lt-pick .sw.s-sage, .lt-pick .sw.s-gold { background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .35), transparent 50%), var(--sw); border-color: var(--sd); }
.lt-pick .sw[aria-pressed="true"] { transform: scale(1.12); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--mauve-btn); }
.lt-re { margin: 2px 24px 0; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 12px; color: var(--mauve-deep); }
.lt-wrap { padding: 8px 0 0; }
.lt-paperform { transition: background-color .3s; }
.lt-title { display: block; width: 100%; margin-top: 8px; border: 0; border-bottom: 1px dashed var(--pl); background: none; padding: 6px 0; font: inherit; font-size: 15px; font-weight: 600; letter-spacing: 1px; color: var(--ink); outline: 0; }
.lt-paperform textarea { display: block; width: 100%; box-sizing: border-box; border: 0; resize: none; outline: 0; font: inherit; font-size: 15px; line-height: 32px; color: var(--ink); padding: 0; margin-top: 8px; min-height: 288px;
  background: transparent repeating-linear-gradient(transparent 0 31px, var(--pl) 31px 32px); background-attachment: local; }
.lt-title::placeholder, .lt-paperform textarea::placeholder { color: #B3A9A2; font-weight: 400; }
.lt-opts { margin: 18px 22px 0; display: flex; flex-direction: column; gap: 10px; }
.lt-opts .dy-lockrow { margin: 0; }
.lt-unlock { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-size: 12.5px; color: var(--ink-2); }
.lt-unlock[hidden] { display: none; }
.lt-unlock input { border: 0; border-bottom: 1px solid var(--lace); background: none; font-family: var(--font-serif); font-size: 16px; color: var(--teal); outline: 0; }
.lt-remind { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 4px 2px; }
.lt-remind > span { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); margin-right: 2px; }
.lt-remind button { height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--lace); background: var(--card); font-size: 12px; color: var(--ink-2); }
.lt-remind button[aria-pressed="true"] { background: var(--mauve-btn); border-color: var(--mauve-btn); color: var(--paper); }

/* 寄信动画 */
.lt-post { position: fixed; z-index: 50; top: 0; bottom: 0; left: 50%; width: min(100%, var(--app-max)); transform: translateX(-50%); background: rgba(248, 243, 236, .9);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); overflow: hidden; }
.lt-post[hidden] { display: none; }
.lt-fold { position: absolute; left: 50%; top: 16%; width: 240px; height: 300px; margin-left: -120px; background: var(--pa); border: 1px solid var(--pl); box-shadow: 0 10px 24px rgba(81, 75, 74, .14);
  display: flex; flex-direction: column; justify-content: space-around; padding: 30px 26px; box-sizing: border-box; transform-origin: 50% 50%;
  transition: transform .75s cubic-bezier(.5, .1, .3, 1), opacity .25s; }
.lt-fold i { height: 1px; background: var(--pl); box-shadow: 0 30px 0 var(--pl), 0 60px 0 var(--pl); }
.lt-post .lt-env { position: absolute; left: 50%; top: 58%; width: 290px; transform: translate(-50%, 160%); opacity: 0; transition: transform .75s cubic-bezier(.3, .7, .3, 1), opacity .4s; }
.lt-post .lt-env .flap { transition: transform .55s cubic-bezier(.4, .1, .3, 1), z-index 0s .3s; }
.lt-post .lt-seal, .lt-post .lt-flower { opacity: 0; }
.lt-post .lt-seal { transform: translate(-50%, -50%) scale(2.4); }
.lt-post .lt-seal i { transform: none !important; opacity: 1 !important; }
.lt-post .lt-peek { display: none; }
.lt-post.s1 .lt-fold { transform: scaleY(.33); }
.lt-post.s2 .lt-env { transform: translate(-50%, -50%); opacity: 1; }
.lt-post.s2 .lt-fold { transform: translateY(205px) scale(.84, .28); opacity: 0; transition: transform .7s cubic-bezier(.5, .1, .3, 1) .25s, opacity .2s .8s; }
.lt-post.s3 .lt-env.opening .flap { transform: none; z-index: 3; transition: transform .55s cubic-bezier(.4, .1, .3, 1), z-index 0s; }
.lt-post.s4 .lt-seal { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1), opacity .15s; }
.lt-post.s4 .lt-flower { opacity: 1; transform: translate(-22%, -70%) rotate(-28deg); transition: opacity .4s .3s; }
.lt-post.s5 .lt-env { transform: translate(40%, -230%) rotate(-14deg) scale(.45); opacity: 0; transition: transform .85s cubic-bezier(.5, 0, .7, .4), opacity .6s .25s; }
@media (prefers-reduced-motion: reduce) { .lt-item, .lt-item .lt-env, .lt-stage .lt-env, .lt-open.on .lt-sheet { animation: none !important; } }
