/* 贈り物の包み（紙の帯とリボン）。受け取ったカレンダーを開ける前だけ。絵は自作 */
.hang { position: relative; isolation: isolate; }
#wrap-root { display: contents; }

/* 指のスクロールを止めるのは、開け口のまわりと長押しのボタンだけ（低い横向きの画面は、帯の上でもスクロールできる） */
.wrap { position: absolute; z-index: 6; touch-action: pan-y; overscroll-behavior: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* 包みの間は、カレンダーを少しだけ沈めて、帯を手前に見せる（上下の絵は見える） */
.wrap::before { content: ""; position: absolute; inset: 0; border-radius: 6px; background: rgba(6,18,24,.16); pointer-events: none; transition: opacity .4s; }
.wrap.leaving::before { opacity: 0; }
.wrap.leaving { pointer-events: none; }
.wrap-band { position: absolute; color: #3a2a1c; cursor: grab;
  filter: drop-shadow(0 2px 1px rgba(30,6,4,.5)) drop-shadow(0 9px 9px rgba(0,0,0,.45)); }
.wrap.touching .wrap-band { cursor: grabbing; }
.wrap-half { pointer-events: none; transform-origin: 50% 50%; }
.wrap-half .wrap-card { visibility: visible; }
.wrap-paper { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }

/* 宛名と差出人の札: 帯に紐で留めた荷札。上の端からはみ出して掛かる */
.wrap-card { position: absolute; left: 50%; translate: -50% 0; rotate: -1.6deg; width: max-content; max-width: calc(100% - 46px); min-width: 54%;
  padding: 8px 18px 7px 30px; text-align: center; font-size: 15px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; word-break: auto-phrase; text-wrap: balance;
  background: #fbf1d8 url(/assets/paper.svg); box-shadow: 0 1px 0 #cdb98c, 1px 4px 6px rgba(20,4,2,.55);
  clip-path: polygon(15px 0, 100% 0, 100% 100%, 15px 100%, 0 50%); }
.wrap-card.is-long { font-size: 13px; line-height: 1.3; }
.wrap-card .plate-part { display: inline-block; max-width: 100%; white-space: pre-wrap; }
/* 荷札の穴 */
.wrap-card::before { content: ""; position: absolute; left: 12px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: #7a2b23; box-shadow: 0 0 0 2.5px #d9c391, inset 0 1px 2px rgba(0,0,0,.7); }

.wrap-frame { position: absolute; touch-action: none; }
.wrap-frame::before { content: ""; position: absolute; inset: -34px -30px; }

.wrap-guide { position: absolute; left: 40px; right: 18px; text-align: center; color: #fff3d6; font-size: 13px; font-weight: 700; line-height: 1.4;
  text-shadow: 0 1px 2px rgba(40,4,2,.9); pointer-events: none; text-wrap: balance; }
.wrap.stuck .wrap-guide { color: #ffe39a; }
.wrap.torn .wrap-guide { visibility: hidden; }
.wrap-hold.stage-hold { position: absolute; left: 50%; bottom: 17px; translate: -50% 0; width: max-content; max-width: calc(100% - 36px); line-height: 1.3; text-align: left;
  color: #fdf1d4; border-color: rgba(255,236,200,.5); background: rgba(60,10,6,.42); box-shadow: 0 3px 0 rgba(40,6,2,.55); }
.wrap-hold.stage-hold:active, .wrap-hold.stage-hold.pressing { color: #fff8e4; background: rgba(120,70,10,.55); border-color: #ffe08c; box-shadow: none; transform: translateY(3px); }
.wrap-hold.gone { visibility: hidden; }
.wrap-hold.stage-hold { overflow: hidden; isolation: isolate; }
.wrap-hold .hold-words { display: flex; flex-direction: column; line-height: 1.3; padding: 4px 0 5px; pointer-events: none; }
.wrap-hold .hold-why { font-size: 11px; font-weight: 600; opacity: .85; }
/* 押している間は、破れた分だけ帯が進む */
.wrap-hold.stage-hold::after { content: ""; position: absolute; z-index: -1; left: 0; top: 0; bottom: 0; width: var(--done, 0%); opacity: 0; pointer-events: none; background: rgba(255,206,92,.42); border-right: 3px solid #ffe27e; transition: width .08s linear; }
.wrap-hold.stage-hold.pressing::after { opacity: 1; }

/* 手本と光は、寄った窓と同じ部品（main.css）。包みの上での出し方だけ */
.wrap.touching:not(.stuck) .tips { opacity: 0; }
.wrap.touching:not(.stuck) .hint svg { opacity: .16; }
.wrap.touching:not(.stuck) .hint-trail { visibility: hidden; }
.wrap.stuck .hint, .wrap.stuck .hint-trail, .wrap.stuck .hint .touch-ring { animation-duration: 2.2s; }
.wrap.torn .tips, .wrap.torn .hint, .wrap.torn .hint-trail { display: none; }

/* 包みの間は、上の札と帯を隠す（同じ字が帯の荷札にある。「あと◯日」は開けてから出る）。紐と釘は見せる */
.hang.wrapped .head > .plate, .hang.wrapped .head > .tape { visibility: hidden; }
.hang.wrapped .head:has(> .plate:not([hidden])) > .string, .hang.wrapped .head:has(> .plate:not([hidden])) > .nail { display: block; }

/* 破った後に残る帯の切れ端。カレンダーの後ろから、左右と下の端にのぞく */
.wrap-scraps { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.wrap-scrap { position: absolute; display: block; filter: drop-shadow(2px 5px 4px rgba(0,0,0,.5)); }
/* 傾きを大きくすると、390 幅で画面の外へ出て横にずれる（カレンダーの外の余白は 16px） */
.wrap-scrap-left { rotate: -90.6deg; }
.wrap-scrap-right { rotate: 90.7deg; }
.wrap-scrap-bottom { right: 17%; rotate: 175deg; } /* 左下の付箋と、右下の感想のボタンの間 */
.wrap-scraps.fresh { animation: wrap-settle .5s .45s ease-out backwards; }
@keyframes wrap-settle { from { opacity: 0; transform: translateY(-8px); } }

/* 開けた直後: 今日の窓、または「あと◯日」の帯が一度だけ弾む */
.tape.wrap-attention { animation: wrap-pop 1.3s .55s cubic-bezier(.3,.7,.3,1) backwards; }
.win.today.wrap-attention { animation: wrap-hop 1.5s .6s cubic-bezier(.3,.7,.3,1) 2; }
@keyframes wrap-pop { 0% { opacity: 0; scale: .7; } 28% { opacity: 1; scale: 1.2; box-shadow: 0 0 18px 6px rgba(255,214,110,.95); } 48% { scale: .97; } 68% { scale: 1.08; } 100% { scale: 1; } }
@keyframes wrap-hop { 22% { scale: 1.2; } 42% { scale: .98; } 60% { scale: 1.08; } 80% { scale: 1; } }

@media (max-height: 700px) {
  .wrap-card { font-size: 13.5px; padding-block: 6px 5px; }
  .wrap-card.is-long { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tape.wrap-attention, .win.today.wrap-attention, .wrap-scraps.fresh { animation: none; }
}
