.book-wrap { max-width: 1160px; margin: 0 auto; padding: 48px 14px 72px; text-align: center; }
.book-wrap h1 { margin-bottom: 28px; }
.book { position: relative; width: min(100%, 1040px, 122vh); aspect-ratio: 8 / 5; margin: auto; perspective: 2200px; padding: 0; touch-action: pan-y; user-select: none; filter: drop-shadow(0 34px 36px #5a104355); }
.book::before { content: ""; position: absolute; inset: -14px; z-index: -1; border-radius: 26px; background: radial-gradient(#ffffff55 2px, transparent 3px) 0 0/18px 18px, linear-gradient(160deg,#ff7cc4,#d81b82); border: 2px solid #fff; }
.leaf, .flip { position: absolute; top: 0; width: 50%; height: 100%; }
.leaf.left { left: 0; } .leaf.right { left: 50%; }
.leaf, .face { overflow: hidden; container-type: inline-size; text-align: left; background: #fffaf2; }
.leaf.left, .flip.forward .back, .flip.backward .front { border-radius: 14px 2px 2px 14px; box-shadow: inset -22px 0 28px -18px #3a0a2b55; }
.leaf.right, .flip.forward .front, .flip.backward .back { border-radius: 2px 14px 14px 2px; box-shadow: inset 22px 0 28px -18px #3a0a2b55; }

/* 넘어가는 종이 */
.flip { transform-style: preserve-3d; z-index: 5; }
.flip[hidden] { display: none; }
.flip.forward { left: 50%; transform-origin: left center; animation: forward .85s cubic-bezier(.45,.05,.35,1) forwards; }
.flip.backward { left: 0; transform-origin: right center; animation: backward .85s cubic-bezier(.45,.05,.35,1) forwards; }
.face { position: absolute; inset: 0; backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }
@keyframes forward { to { transform: rotateY(-180deg); } }
@keyframes backward { to { transform: rotateY(180deg); } }

/* 가운데 바인더 링 */
.rings { position: absolute; z-index: 6; top: 6%; bottom: 6%; left: calc(50% - 16px); width: 32px; background: repeating-linear-gradient(180deg, transparent 0 26px, #9aa0b4 26px, #fff 31px, #9aa0b4 36px, transparent 36px 52px); border-radius: 10px; pointer-events: none; }

/* 속지 */
[data-paper="pink"] { background: radial-gradient(#fff 1.5cqw, transparent 1.7cqw) 0 0/9cqw 9cqw, #ffc6e6; }
[data-paper="blue"] { background: repeating-linear-gradient(180deg, transparent 0 6cqw, #3d9be855 6cqw 6.3cqw), #e6f4ff; }
[data-paper="grid"] { background: linear-gradient(#c9b2ff55 1px, transparent 1px) 0 0/5cqw 5cqw, linear-gradient(90deg,#c9b2ff55 1px, transparent 1px) 0 0/5cqw 5cqw, #fffaf2; }
[data-paper="denim"] { background: url("assets/denim.png") center/cover, #24304a; }
[data-paper="none"] { background: #ffe3f3; }

.book figure { position: absolute; left: var(--x); top: var(--y); width: var(--w); margin: 0; rotate: var(--r); }
.book figure img { display: block; width: 100%; pointer-events: none; }
.book figure.missing { display: none; }
.book .p-full { inset: 0; width: 100%; height: 100%; rotate: none; }
.book .p-full img { height: 100%; object-fit: cover; }
.p-photo img { border: 1.4cqw solid #fff; box-shadow: 0 2cqw 3cqw #3a0a2b40; }
.p-polaroid { background: #fff; padding: 2.2cqw 2.2cqw 1.2cqw; box-shadow: 0 2cqw 4cqw #3a0a2b45; }
.p-polaroid img { aspect-ratio: 4 / 4.4; object-fit: cover; }
.p-polaroid figcaption { padding-top: 1cqw; text-align: center; font: 700 3.6cqw/1.4 "Gaegu", "HY엽서M", "Comic Sans MS", "Malgun Gothic", cursive; color: #3a0a2b; }
.p-cut img { filter: drop-shadow(0 2cqw 2cqw #3a0a2b50); }

.note { position: absolute; left: var(--x); top: var(--y); rotate: var(--r); margin: 0; font: 800 4.2cqw/1.45 "Gaegu", "HY엽서M", "Comic Sans MS", "Malgun Gothic", cursive; color: #b01672; white-space: nowrap; }
.note.big { font-size: 6.6cqw; color: #e8147f; text-shadow: .4cqw .4cqw 0 #fff; }
.note.card { background: #fff7a8; color: #3a0a2b; padding: 1.4cqw 2.6cqw; box-shadow: 0 1.4cqw 2.4cqw #3a0a2b40; }
.tape { position: absolute; z-index: 3; left: var(--x); top: var(--y); width: 18%; height: 4.4%; rotate: var(--r); background: repeating-linear-gradient(45deg,#ffffffb0 0 6px,#d7ff3fb0 6px 12px); }
.book small { position: absolute; bottom: 1.6cqw; right: 3cqw; font: 700 3cqw "Courier New", monospace; color: #7a2a6a; background: #ffffffc0; padding: 0 1.4cqw; border-radius: 99px; }
.book .cta { position: absolute; left: 50%; translate: -50% 0; top: 76%; z-index: 4; font-size: max(.8rem, 3.6cqw); white-space: nowrap; }

.pager { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 38px; font-weight: 800; }
.pager span { min-width: 90px; font-family: "Courier New", monospace; }
.pager button:disabled { opacity: .35; cursor: default; }
.hint { margin-top: 8px; font-size: .85rem; color: #7a2a6a; }

@media (max-width: 760px) {
  .book { width: 100%; aspect-ratio: 4 / 5; }
  .leaf.left, .rings { display: none; }
  .leaf.right, .flip.forward, .flip.backward { left: 0; width: 100%; }
  .flip.forward, .flip.backward { transform-origin: left center; }
  .flip.backward { animation-name: forward; }
}

/* 화면 전체를 쓰는 다이어리 보기 */
.book-wrap { position: fixed; inset: 0; z-index: 50; max-width: none; padding: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(#ffffff80 2px, transparent 3px) 0 0/30px 30px, radial-gradient(circle at 50% 40%, #ffd9f0, #e9b7ff 55%, #b9dcff); }
.book-wrap h1, .book-wrap .hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.book-wrap .eyebrow { position: absolute; left: 16px; top: 12px; margin: 0; }
.book-wrap .exit { position: absolute; right: 16px; top: 10px; z-index: 8; padding: 6px 16px; border-radius: 99px; background: #fff; border: 2px solid #e8147f; color: #a80d63; font-weight: 800; }
.book-wrap .book { width: min(calc(100vw - 56px), calc((100vh - 112px) * 1.6)); }
.book-wrap .pager { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; }
.book-wrap .pager button { padding: 8px 26px; }
@media (max-width: 760px) {
  .book-wrap .book { width: min(calc(100vw - 36px), calc((100vh - 130px) * .8)); }
}
/* 실제 펜으로 적은 느낌: 손글씨 글꼴, 잉크 색, 써 내려가는 모션 */
.note, .p-polaroid figcaption { font-family: "Nanum Pen Script", "HY엽서M", cursive; font-weight: 400; letter-spacing: .01em; }
.note { color: #c0106c; font-size: 6.4cqw; line-height: 1.15; text-shadow: none; }
.note.big { font-size: 9cqw; color: #d8127c; text-shadow: .35cqw .35cqw 0 #fff; }
.note.card { color: #24337f; font-size: 6cqw; line-height: 1.1; padding: 2cqw 3cqw 1.4cqw; background: repeating-linear-gradient(180deg, #0000 0 5.9cqw, #8fa8d866 5.9cqw 6.2cqw), #fffbd0; }
.p-polaroid figcaption { color: #24337f; font-size: 6cqw; line-height: 1.05; padding-top: 1.4cqw; }
.leaf .note { animation: write 1.1s steps(28) .15s both; }
@keyframes write { from { clip-path: inset(-20% 100% -20% -5%); } to { clip-path: inset(-20% -5% -20% -5%); } }
@media (prefers-reduced-motion: reduce) { .leaf .note { animation: none; } }
/* 글씨는 움직이지 않고 처음부터 적혀 있습니다 */
.leaf .note { animation: none; clip-path: none; }

/* 마지막 장: 직접 엮은 키링과 큰 영문 제목 */
.book canvas.ring { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: auto; rotate: var(--r); pointer-events: none; filter: drop-shadow(0 2cqw 2cqw #3a0a2b50); }
.book .shout { position: absolute; left: 50%; top: 33%; translate: -50% 0; margin: 0; padding: 1.6cqw 4cqw; white-space: nowrap; font: 900 7.4cqw/1.1 Impact, "Arial Black", sans-serif; letter-spacing: .03em; color: #d7ff3f; background: #3a0a2b; border-radius: 99px; rotate: -2deg; }
.book .cta.low { top: 88%; }