/* DM Gift Shop Preview — recipient message page */

body.msg-body { background: #2B1E2F; color: #FFF6EE; min-height: 100vh; }
.msg-stage {
	min-height: 100vh; min-height: 100dvh;
	max-width: 560px; margin: 0 auto;
	padding: 24px 18px 40px;
	display: flex; flex-direction: column; align-items: center;
}

.msg-brand {
	display: inline-flex; align-items: center; gap: 8px; direction: ltr;
	font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 20px;
	color: #FFF6EE; text-decoration: none;
}
.msg-brand .dm { color: #F2604E; }
.msg-brand.big { font-size: 28px; }
.msg-brand:hover { color: #FFF6EE; }

/* ---------- Intro / envelope ---------- */
.intro {
	flex: 1; width: 100%;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	text-align: center; padding: 24px 0;
	transition: opacity .6s ease, transform .6s ease;
}
.eyebrow {
	margin: 0; display: inline-flex; align-items: center; gap: 10px;
	font-size: 18px; font-weight: 500; color: #E8A33D; letter-spacing: .5px;
}
.intro h1 { margin: 6px 0 0; font-size: 44px; font-weight: 800; line-height: 1.2; }

.envelope {
	position: relative; display: block;
	width: min(320px, 82vw); aspect-ratio: 3 / 2;
	margin: 40px auto 34px; padding: 0; border: 0; background: none; cursor: pointer;
	perspective: 900px;
	animation: envFloat 3.2s ease-in-out infinite;
}
.envelope:focus-visible { outline: 3px solid #E8A33D; outline-offset: 10px; border-radius: 16px; }
.envelope > span { position: absolute; display: block; }
.env-back { inset: 0; background: #D94C3A; border-radius: 16px; box-shadow: 0 30px 50px -24px rgba(0,0,0,.6); }
.letter {
	left: 9%; right: 9%; top: 9%; bottom: 8%;
	background: #FFF6EE; border-radius: 10px; z-index: 1;
	display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
	transition: transform 1s cubic-bezier(.2,.8,.2,1);
}
.letter-line { display: block; height: 7px; border-radius: 9px; background: #EADBD0; }
.letter-line.w80 { width: 70%; } .letter-line.w60 { width: 50%; }
.env-front {
	inset: 0; z-index: 2; border-radius: 16px;
	background: #F2604E;
	clip-path: polygon(0 28%, 50% 64%, 100% 28%, 100% 100%, 0 100%);
}
.flap {
	left: 0; right: 0; top: 0; height: 66%; z-index: 3;
	background: #E5533F; border-radius: 16px 16px 0 0;
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	transform-origin: top center;
	transition: transform .75s cubic-bezier(.5,0,.3,1), z-index 0s .38s;
}
.rib { background: #2B1E2F; z-index: 4; transition: transform .5s cubic-bezier(.6,0,.4,1); }
.rib-v { top: 0; bottom: 0; left: 50%; width: 12%; margin-left: -6%; transform-origin: top; }
.rib-h { left: 0; right: 0; top: 47%; height: 11%; transform-origin: right; }
.bow {
	position: absolute; z-index: 5; width: 58%; left: 21%; top: 22%;
	filter: drop-shadow(0 6px 8px rgba(0,0,0,.25));
	overflow: visible;
}
.bow .loop, .bow .knot { transition: transform .6s cubic-bezier(.4,0,.2,1), opacity .5s; transform-box: fill-box; }
.bow .loop-l, .bow .tail-l { transform-origin: 100% 50%; }
.bow .loop-r, .bow .tail-r { transform-origin: 0% 50%; }

.open-btn {
	display: inline-flex; align-items: center; gap: 10px;
	background: #F2604E; color: #2B1E2F; border: 0; cursor: pointer;
	font-size: 18px; font-weight: 800; padding: 15px 30px; min-height: 52px; border-radius: 16px;
	box-shadow: 0 14px 30px -14px rgba(242,96,78,.8);
	animation: pulse 2.4s ease-in-out infinite;
}
.hint { margin: 14px 0 0; font-size: 14px; color: #C9B7C6; }

/* opening sequence */
.msg-stage[data-stage="untie"] .rib-v,
.msg-stage[data-stage="open"] .rib-v,
.msg-stage[data-stage="reveal"] .rib-v { transform: scaleY(0); }
.msg-stage[data-stage="untie"] .rib-h,
.msg-stage[data-stage="open"] .rib-h,
.msg-stage[data-stage="reveal"] .rib-h { transform: scaleX(0); }
.msg-stage:not([data-stage="closed"]) .loop-l { transform: translate(-70%, -90%) rotate(-70deg); opacity: 0; }
.msg-stage:not([data-stage="closed"]) .loop-r { transform: translate(70%, -90%) rotate(70deg); opacity: 0; }
.msg-stage:not([data-stage="closed"]) .tail-l { transform: translate(-60%, 80%) rotate(-40deg); opacity: 0; }
.msg-stage:not([data-stage="closed"]) .tail-r { transform: translate(60%, 80%) rotate(40deg); opacity: 0; }
.msg-stage:not([data-stage="closed"]) .knot { transform: scale(0); opacity: 0; }
.msg-stage:not([data-stage="closed"]) .envelope { animation: none; }
.msg-stage:not([data-stage="closed"]) .open-btn,
.msg-stage:not([data-stage="closed"]) .hint { opacity: 0; pointer-events: none; transition: opacity .3s; }
.msg-stage[data-stage="open"] .flap,
.msg-stage[data-stage="reveal"] .flap { transform: rotateX(180deg); z-index: 0; }
.msg-stage[data-stage="open"] .letter,
.msg-stage[data-stage="reveal"] .letter { transform: translateY(-62%); }
.msg-stage[data-stage="reveal"] .intro { opacity: 0; transform: scale(.9); }

/* ---------- Letter view ---------- */
.intro[hidden] { display: none; }
.letter-view { width: 100%; animation: riseIn .9s cubic-bezier(.2,.8,.2,1) both; }
.letter-view[hidden] { display: none; }
.msg-card {
	background: #FFF6EE; color: #2B1E2F; border-radius: 26px;
	padding: 26px 22px 24px; margin-top: 20px;
	box-shadow: 0 40px 70px -30px rgba(0,0,0,.6);
}
.occasion {
	margin: 0; display: inline-flex; align-items: center; gap: 8px;
	font-size: 15px; font-weight: 700; color: #E5533F;
}
.msg-card h2 { margin: 6px 0 18px; font-size: 28px; font-weight: 800; }

.player { border-radius: 20px; overflow: hidden; background: #2B1E2F; }
.player-screen {
	position: relative; aspect-ratio: 4 / 3;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.avatar {
	width: 84px; height: 84px; border-radius: 999px; background: #F2604E; color: #2B1E2F;
	display: flex; align-items: center; justify-content: center;
	font-size: 38px; font-weight: 800;
	box-shadow: 0 0 0 0 rgba(242,96,78,.6);
}
.player.playing .avatar { animation: ring 1.6s ease-out infinite; }
.wave { display: flex; align-items: center; gap: 4px; height: 46px; }
.wave span {
	display: block; width: 4px; height: var(--h); border-radius: 4px; background: #F2604E; opacity: .55;
	transform: scaleY(.35); transform-origin: center;
	transition: transform .3s;
}
.player.playing .wave span { opacity: 1; animation: wave .9s ease-in-out infinite alternate; animation-delay: var(--d); }
.player-label {
	position: absolute; top: 14px; right: 14px;
	font-size: 13px; font-weight: 700; color: #FFF6EE;
	background: rgba(255,246,238,.14); padding: 6px 12px; border-radius: 999px;
}
.player-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #3A2A3F; direction: ltr; }
.play {
	width: 46px; height: 46px; flex: 0 0 auto; border-radius: 999px; border: 0; cursor: pointer;
	background: #FFF6EE; display: flex; align-items: center; justify-content: center;
}
.play .i-pause { display: none; }
.player.playing .play .i-play { display: none; }
.player.playing .play .i-pause { display: block; }
.progress { flex: 1; height: 6px; border-radius: 9px; background: rgba(255,246,238,.2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: #F2604E; border-radius: 9px; }
.time { font-size: 13px; color: #E9DCE6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-note { margin: 10px 2px 0; font-size: 13px; color: #6B5A6E; }

.typed {
	margin: 22px 0 0; min-height: 7.5em;
	font-size: 19px; line-height: 1.9; font-weight: 500;
}
.typed::after {
	content: ''; display: inline-block; width: 2px; height: 1.1em; margin-right: 3px;
	background: #E5533F; vertical-align: middle; animation: caret .8s steps(1) infinite;
}
.typed.done::after { display: none; }
.signature {
	margin: 10px 0 0; text-align: left;
	font-family: 'Aref Ruqaa', 'Tajawal', serif; font-size: 30px; color: #E5533F;
	opacity: 0; transform: translateY(8px); transition: opacity .8s, transform .8s;
}
.signature.show { opacity: 1; transform: none; }

.react { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.heart-btn {
	display: inline-flex; align-items: center; gap: 10px; position: relative;
	background: #E5533F; color: #FFFFFF; border: 0; cursor: pointer;
	font-size: 16px; font-weight: 800; padding: 12px 22px; min-height: 48px; border-radius: 14px;
}
.heart-btn.sent { background: #23735F; }
.replay {
	background: none; border: 0; cursor: pointer; padding: 10px 4px; min-height: 44px;
	font-size: 15px; font-weight: 700; color: #5A4A5E; text-decoration: underline; text-underline-offset: 4px;
}

.msg-foot { margin-top: 34px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.msg-foot p { margin: 0; font-size: 15px; color: #C9B7C6; }
.cta {
	margin-top: 8px; display: inline-flex; align-items: center; justify-content: center;
	background: #FFF6EE; color: #2B1E2F; text-decoration: none;
	font-size: 17px; font-weight: 800; padding: 14px 26px; min-height: 50px; border-radius: 16px;
}
.cta:hover { color: #2B1E2F; }

/* real video */
.player.has-video .player-screen { aspect-ratio: 16 / 9; background: #000; gap: 0; }
.vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.big-play {
	position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
	border-radius: 999px; background: rgba(255,246,238,.92); pointer-events: none;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 0 0 0 rgba(255,246,238,.5); animation: ring 1.8s ease-out infinite;
	transition: opacity .3s, transform .3s;
}
.player.playing .big-play { opacity: 0; transform: scale(.6); }
.player.has-video .player-label { z-index: 1; }
.unmute {
	position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2;
	display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
	background: #FFF6EE; color: #2B1E2F; border: 0; cursor: pointer;
	font-family: inherit; font-size: 15px; font-weight: 800; padding: 10px 18px; min-height: 44px; border-radius: 999px;
	box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); animation: pulse 1.8s ease-in-out infinite;
}
.unmute[hidden] { display: none; }

/* sound template chips */
.sound-themes { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; margin-left: 4px; }
.st-chip {
	font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
	padding: 8px 16px; min-height: 44px; border-radius: 999px;
	border: 1.5px solid #E6D9D0; background: #FFFFFF; color: #2B1E2F;
	transition: background .25s, color .25s, transform .2s;
}
.st-chip:hover { transform: translateY(-2px); }
.st-chip.active { background: #2B1E2F; border-color: #2B1E2F; color: #FFF6EE; }

/* mute toggle */
.sound-toggle {
	position: fixed; top: 16px; left: 16px; z-index: 40;
	width: 46px; height: 46px; border-radius: 999px; border: 0; cursor: pointer;
	background: rgba(255,246,238,.14); display: flex; align-items: center; justify-content: center;
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.sound-toggle .i-off { display: none; }
.sound-toggle[aria-pressed="false"] .i-on { display: none; }
.sound-toggle[aria-pressed="false"] .i-off { display: block; }

/* confetti + floating hearts */
.confetti-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.piece {
	position: absolute; top: -20px; display: block;
	animation: fall var(--t, 2.8s) cubic-bezier(.3,.6,.4,1) forwards;
}
.float-heart {
	position: fixed; z-index: 31; pointer-events: none;
	animation: heartUp 1.6s ease-out forwards;
}

@keyframes envFloat { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-10px) rotate(1.5deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes wave { from { transform: scaleY(.3); } to { transform: scaleY(1); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(242,96,78,.6); } 100% { box-shadow: 0 0 0 26px rgba(242,96,78,0); } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes fall {
	0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
	100% { transform: translate(var(--x), 110vh) rotate(var(--r)); opacity: .9; }
}
@keyframes heartUp {
	0% { transform: translate(0, 0) scale(.6); opacity: 1; }
	100% { transform: translate(var(--x), -220px) scale(1.3); opacity: 0; }
}

@media (min-width: 700px) {
	.msg-stage { padding-top: 36px; }
	.intro h1 { font-size: 54px; }
	.msg-card { padding: 34px 32px 30px; }
}
