/* 三个模板的样式。根元素 .tpl 自适应容器宽度，用 clamp 与 cqw，不依赖视口。 */
.tpl { container-type: inline-size; width: 100%; min-height: 100%; padding: 28px 20px; overflow: hidden; position: relative; }
.tpl img { width: 100%; height: 100%; object-fit: cover; }
.tpl p, .tpl h2 { overflow-wrap: anywhere; }

/* Love Letter：信纸、手写感衬线、拼贴 */
.tpl-letter { background: #f3e6d6; }
.letter-paper { background: #fffdf5 repeating-linear-gradient(transparent 0 31px, #ead9cc 31px 32px); border: 1px solid #e3d3c3; box-shadow: 0 6px 18px rgba(80,40,30,.12); padding: 28px 24px; transform: rotate(-.6deg); font-family: "Snell Roundhand", "Segoe Script", "Bradley Hand", "Brush Script MT", ui-serif, Georgia, serif; font-size: clamp(1.15rem, 5cqw, 1.5rem); line-height: 32px; color: #3b2a2a; }
.letter-paper p { margin: 0 0 32px; }
.letter-to { color: var(--accent); font-size: 1.15em; }
.letter-body { white-space: pre-wrap; }
.letter-sign { text-align: right; margin-bottom: 0 !important; }
.letter-date { text-align: right; font-size: .75em; color: var(--ink-2); margin: 0 !important; line-height: 32px; font-family: var(--font-body); }
.letter-photos { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.polaroid { margin: 0; width: min(46%, 220px); aspect-ratio: 1; background: #fff; padding: 8px 8px 26px; box-shadow: 0 4px 12px rgba(60,30,20,.25); transform: rotate(var(--tilt, -2deg)); }

/* Our Days：深色底、大号计数、照片墙 */
.tpl-days { background: var(--night); color: #fbe9ee; text-align: center; }
.days-head { padding: 12px 0 20px; }
.days-who { font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .08em; text-transform: uppercase; color: #e9a3b4; margin: 0 0 8px; }
.days-lead { font-family: var(--font-display); font-size: clamp(1.1rem, 5cqw, 1.5rem); margin: 0; color: #f5d6de; }
.days-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 28cqw, 9rem); line-height: 1; margin: .05em 0; color: #fff; font-variant-numeric: tabular-nums; }
.days-since, .days-hint { color: #cdb3bd; font-size: .9rem; margin: 10px 0 0; }
.days-wall { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); margin: 20px 0; }
.days-wall-1 { grid-template-columns: 1fr; }
.days-wall-2 { grid-template-columns: repeat(2, 1fr); }
.days-wall-4 { grid-template-columns: repeat(2, 1fr); }
.wall-cell { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #3d2a42; }
.wall-cell:first-child:nth-last-child(5), .wall-cell:first-child:nth-last-child(3) { grid-column: span 2; aspect-ratio: auto; }
.days-message { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.6; white-space: pre-wrap; margin: 12px auto 0; max-width: 34em; color: #fbe9ee; }

/* Valentine：大标题、Yes / No */
.tpl-val { background: radial-gradient(circle at 50% 0, #fff 0, var(--accent-soft) 70%); text-align: center; display: flex; flex-direction: column; justify-content: center; min-height: 420px; }
.val-ask[hidden], .val-yay[hidden] { display: none; }
.val-title { font-size: clamp(2rem, 10cqw, 3.4rem); color: #7d1f3a; margin: 0 0 8px; }
.val-from { color: var(--ink-2); margin: 0 0 12px; font-family: var(--font-display); font-style: italic; }
.val-arena { position: relative; height: 150px; margin: 24px auto 0; max-width: 420px; display: flex; gap: 16px; justify-content: center; align-items: center; }
.val-yes, .val-no { font: 700 1.2rem/1 var(--font-body); padding: 16px 36px; border-radius: 999px; min-height: 52px; cursor: pointer; border: 2px solid var(--accent); }
.val-yes { background: var(--accent); color: #fff; }
.val-yes:hover { background: #9d2f49; }
.val-no { background: #fff; color: var(--accent); transition: left .15s, top .15s; }
.val-yes:focus-visible, .val-no:focus-visible { outline: 3px solid #e9a3b4; outline-offset: 3px; }
.val-live { min-height: 1.6em; color: var(--ink-2); margin: 6px 0 0; }
.val-yay { position: relative; padding: 8px 0 40px; outline: none; }
.val-yay-title { font-size: clamp(2rem, 9cqw, 3rem); color: #7d1f3a; }
.val-message { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.6; white-space: pre-wrap; max-width: 30em; margin: 0 auto 16px; }
.val-photos { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.val-photo { width: min(30%, 150px); aspect-ratio: 1; border-radius: 12px; overflow: hidden; }
.val-hearts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.val-heart { position: absolute; bottom: -20px; color: var(--accent); font-size: 1.6rem; opacity: 0; animation: val-rise 2.6s ease-out infinite; }
@keyframes val-rise { 0% { transform: translateY(0) scale(.7); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-420px) scale(1.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .val-hearts { display: none; }
  .val-no { transition: none; }
}
