.book { padding-top: 16px; animation: rise .6s both; }
.book-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.book-head h1 { font-size: clamp(30px, 3.8vw, 46px); font-weight: 600; max-width: 22ch; }
.book-head .muted { margin-top: 8px; }
.head-right { display: grid; justify-items: end; gap: 8px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.pdf-note { font-size: 13px; color: var(--ink-2); max-width: 300px; text-align: right; }

.viewer { display: grid; grid-template-columns: 60px minmax(0, 1fr) 60px; align-items: center; gap: 14px; }
.nav { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); font: 400 34px/1 var(--display); color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--ink); padding-bottom: 5px; transition: transform .15s; }
.nav:hover { transform: translateY(-2px) scale(1.05); }
.stage { perspective: 2200px; display: flex; justify-content: center; }

.sheet {
  --cream: #fff8ec; container-type: inline-size; position: relative; aspect-ratio: 11.25 / 8.75; width: min(100%, calc((100vh - 250px) * 1.2857)); min-width: min(100%, 520px); overflow: hidden;
  border-radius: 6px 18px 18px 6px; background: var(--cream);
  box-shadow: 0 40px 60px -34px rgba(44, 46, 53, .6), 0 0 0 1px rgba(44, 46, 53, .1);
}
.sheet::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(40, 20, 5, .22), transparent 3.5%, transparent 97%, rgba(255, 255, 255, .25)); }
.turn-next { animation: turnNext .5s cubic-bezier(.2, .7, .2, 1); transform-origin: left center; }
.turn-prev { animation: turnPrev .5s cubic-bezier(.2, .7, .2, 1); transform-origin: right center; }
@keyframes turnNext { from { transform: rotateY(-12deg) translateX(4%); opacity: 0; } }
@keyframes turnPrev { from { transform: rotateY(12deg) translateX(-4%); opacity: 0; } }

.art { position: absolute; inset: 0; background: #ebe5d3; }
.art img { width: 100%; height: 100%; object-fit: cover; }
.repaint { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 12px; align-items: center; background: rgba(255, 248, 236, .72); backdrop-filter: blur(3px); font-weight: 800; font-size: 18px; }
.repaint.bad { inset: auto 0 0 0; padding: 10px; background: rgba(140, 47, 22, .88); color: #fff; font-size: 15px; backdrop-filter: none; }

.sheet [contenteditable] { cursor: text; border-radius: 1cqw; outline: 2px dashed transparent; outline-offset: 1cqw; transition: outline-color .2s, background .2s; }
.sheet [contenteditable]:hover { outline-color: rgba(255, 171, 45, .95); }
.sheet [contenteditable]:focus { outline: 3px solid var(--accent); background: rgba(255, 250, 240, .55); }

.words {
  position: absolute; top: 5.7%; left: 50%; transform: translateX(-50%); width: 46%; z-index: 1;
  font: 2.6cqw/1.4 var(--page-serif); color: #281c14;
  text-shadow: 0 0 .25em #fffaee, 0 0 .5em #fffaee, 0 0 .9em #fffaee, 0 0 1.4em #fffaee;
}
.words.top_left { left: 4.44%; transform: none; }
.words.top_right { left: auto; right: 4.44%; transform: none; }
.words.dark { color: #fff; text-shadow: 0 0 .25em #141428, 0 0 .5em #141428, 0 0 .9em #141428, 0 0 1.4em #141428; }
.pnum { position: absolute; right: 4.4%; bottom: 4.2%; font: 1.7cqw var(--page-serif); color: #281c14; text-shadow: 0 0 .3em #fffaee, 0 0 .3em #fffaee; }

.pnum.even { right: auto; left: 4.4%; }

.cover-title {
  position: absolute; left: 4.4%; top: 10%; width: 40%; z-index: 1; text-align: center;
  font: 700 6.4cqw/1.3 var(--casual); color: #fff;
  -webkit-text-stroke: .09em #c0562b; paint-order: stroke fill; text-shadow: 0 .06em .2em rgba(0, 0, 0, .2);
}

.plain { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: var(--casual); color: #4a2e18; }
.belongs { font-size: 3.3cqw; }
.owner { font-size: 7.1cqw; font-weight: 700; color: #c0562b; margin-top: 2cqw; }
.dedic { font-size: 3.3cqw; line-height: 1.4; max-width: 60%; padding: 1cqw; }
.end .portrait { width: 26.7cqw; aspect-ratio: 1; border-radius: 50%; border: .42cqw solid #c0562b; background: #fff center / 300% auto no-repeat; background-position: 100% 22%; }
.the-end { font-size: 6.5cqw; font-weight: 700; color: #c0562b; margin-top: 4cqw; }

.under { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 74px 0; flex-wrap: wrap; }
.counter { font-weight: 800; color: var(--ink); }
.hint { color: var(--ink-2); font-size: 15px; }
.mobile-slot { display: none; }
.mobile-edit { display: grid; gap: 6px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.mobile-words { background: #fffdf8; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font: 17px/1.5 var(--page-serif); color: var(--ink); outline: none; }
.mobile-words:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--ring); }
.redraw { display: flex; gap: 10px; margin: 14px 74px 0; padding: 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; animation: rise .3s both; }
.redraw input { flex: 1; }

.thumbs { display: flex; gap: 14px; overflow-x: auto; padding: 22px 74px 12px; scroll-snap-type: x proximity; }
.thumb { flex: 0 0 120px; border: 0; background: none; padding: 0; cursor: pointer; display: grid; gap: 6px; scroll-snap-align: center; font: 700 12px var(--body); color: var(--ink-2); }
.thumb img, .thumb > span { width: 100%; aspect-ratio: 11.25 / 8.75; object-fit: cover; border-radius: 4px 8px 8px 4px; border: 3px solid transparent; transition: border-color .2s, transform .2s; }
.thumb > span { display: grid; place-items: center; background: #fff8ec; font: 600 14px var(--display); color: #c0562b; box-shadow: 0 0 0 1px var(--line) inset; }
.thumb:hover img, .thumb:hover > span { transform: translateY(-3px); }
.thumb.on img, .thumb.on > span { border-color: var(--accent); }
.thumb.on small { color: var(--ink); }

.order { width: min(880px, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 28px; background: var(--card); color: var(--ink); box-shadow: 0 40px 80px -30px rgba(20, 22, 28, .55); }
.order::backdrop { background: rgba(44, 46, 53, .5); backdrop-filter: blur(4px); }
.order[open] { animation: rise .35s both; }
.order .close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--sand); font: 700 24px/1 var(--body); color: var(--ink); cursor: pointer; z-index: 2; }
.order-body { display: grid; grid-template-columns: 300px 1fr; gap: 34px; padding: 36px; }
.order-body h2 { font-size: 32px; font-weight: 600; margin-bottom: 20px; }
.order-book { background: var(--sand); border-radius: 20px; padding: 24px; display: grid; gap: 20px; align-content: start; }
.order-cover { aspect-ratio: 11.25 / 8.75; border-radius: 4px 12px 12px 4px; background: var(--line) center / cover; position: relative; transform: rotate(-3deg); box-shadow: inset 8px 0 10px -6px rgba(0, 0, 0, .4), 0 18px 30px -16px rgba(44, 46, 53, .6); }
.order-cover span { position: absolute; left: 6%; top: 10%; width: 46%; font: 700 15px/1.2 var(--casual); color: #fff; -webkit-text-stroke: 3px #c0562b; paint-order: stroke fill; text-align: center; }
.order-book ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; display: grid; gap: 4px; }
.order-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-weight: 800; font-size: 15px; }
.field small { font-weight: 500; }
.order-done { grid-column: 1 / -1; text-align: center; display: grid; gap: 14px; justify-items: center; padding: 20px 10px; max-width: 560px; margin: 0 auto; }
.burst { font-size: 64px; animation: drop .6s cubic-bezier(.2, 1.6, .4, 1) both; }

@media (max-width: 760px) {
  .viewer { grid-template-columns: 1fr; }
  .nav { display: none; }
  .mobile-slot { display: block; margin-top: 14px; }
  .mobile-slot:empty { display: none; }
  .sheet [contenteditable] { pointer-events: none; }
  .hint { display: none; }
  .under, .redraw, .thumbs { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .redraw { flex-wrap: wrap; padding: 12px; }
  .head-right { justify-items: start; }
  .pdf-note { text-align: left; }
  .order-body { grid-template-columns: 1fr; padding: 24px; }
  .order-book { display: none; }
}
