/* secreti.site — the recipient's page. Colours and fonts come from the card theme (--bg, --paper, --ink, --accent,
   --font-display, --font-body set on <body>). */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); background-attachment: fixed; color: #fff; font-family: 'Nunito', 'Cairo', system-ui, sans-serif; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
[dir="rtl"] body { font-family: 'Cairo', 'Nunito', sans-serif; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.stage { position: relative; z-index: 1; min-height: calc(100vh - 70px); min-height: calc(100dvh - 70px); display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.made { position: relative; z-index: 1; text-align: center; padding: 10px 0 24px; }
.made img { height: 22px; width: auto; opacity: .8; transition: opacity .2s; }
.made a:hover img { opacity: 1; }
button, input { font: inherit; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- lock screen ---------- */
.lock { width: min(420px, 100%); text-align: center; animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.lock .mark { width: 128px; height: 128px; margin: 0 auto 10px; position: relative; animation: hover 4s ease-in-out infinite; }
.lock .mark img { width: 100%; height: 100%; filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .35)); }
.lock .mark::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; background: var(--accent); filter: blur(30px); opacity: .55; z-index: -1; animation: breathe 3s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-10px) rotate(-3deg); } }
@keyframes breathe { 50% { opacity: .9; transform: scale(1.15); } }
.lock .for { font-family: var(--font-display); font-size: clamp(34px, 9vw, 48px); font-weight: 700; line-height: 1.1; margin: 6px 0 6px; text-shadow: 0 4px 24px rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
.lock .sub { font-weight: 700; font-size: 17px; opacity: .92; margin: 0 0 22px; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.glass { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 24px; padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.hint { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, .22); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.pw { width: 100%; height: 58px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .92); color: var(--ink); text-align: center; font-size: 20px; font-weight: 800; letter-spacing: .08em; padding: 0 46px; outline: none; transition: border-color .2s, box-shadow .2s; }
.pw:focus { border-color: #fff; box-shadow: 0 0 0 5px rgba(255, 255, 255, .25); }
.pw::placeholder { letter-spacing: 0; font-size: 17px; font-weight: 700; color: color-mix(in srgb, var(--ink) 45%, transparent); }
.field-wrap { position: relative; }
.unlock { width: 100%; height: 58px; margin-top: 12px; border: 0; border-radius: 16px; background: #fff; color: var(--accent); font-weight: 900; font-size: 18px; cursor: pointer; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); transition: transform .15s, box-shadow .2s; }
.unlock:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(0, 0, 0, .3); }
.unlock:active { transform: scale(.98); }
.err { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, .3); font-weight: 800; }
.shake { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.lock .note { margin-top: 16px; font-size: 13px; opacity: .8; font-weight: 700; }

/* ---------- opening: envelope ---------- */
.envelope-scene { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; animation: sceneOut .6s ease 2.7s forwards; }
@keyframes sceneOut { to { opacity: 0; visibility: hidden; } }
.envelope { position: relative; width: min(320px, 78vw); aspect-ratio: 1.45; animation: envIn .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes envIn { from { transform: translateY(60px) scale(.6) rotate(-6deg); opacity: 0; } }
.envelope .back { position: absolute; inset: 0; border-radius: 12px; background: color-mix(in srgb, var(--accent) 70%, #000); box-shadow: 0 30px 60px rgba(0, 0, 0, .4); }
.envelope .paper { position: absolute; left: 8%; right: 8%; top: 10%; height: 80%; border-radius: 8px; background: var(--paper); z-index: 1; box-shadow: 0 10px 24px rgba(0, 0, 0, .18); animation: paperUp 1s cubic-bezier(.3, .7, .2, 1) 1.15s both, paperOut .55s cubic-bezier(.2, .8, .2, 1) 2.1s forwards; display: grid; place-items: center; color: var(--accent); font-family: var(--font-display); font-size: 28px; font-weight: 700; }
@keyframes paperUp { to { transform: translateY(-62%); } }
/* then the card leaves the envelope and comes to the front, before the letter takes over */
@keyframes paperOut { from { transform: translateY(-62%); z-index: 5; } to { transform: translateY(-24%) scale(1.14); z-index: 5; } }
.envelope .front { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; z-index: 2; }
.envelope .front::before, .envelope .front::after { content: ""; position: absolute; bottom: 0; width: 72%; height: 100%; background: color-mix(in srgb, var(--accent) 85%, #fff); }
.envelope .front::before { left: 0; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.envelope .front::after { right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); filter: brightness(.95); }
.envelope .flap { position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 3; transform-origin: top; background: color-mix(in srgb, var(--accent) 92%, #fff); clip-path: polygon(0 0, 100% 0, 50% 100%); animation: flapOpen .7s ease .55s forwards; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .2)); }
/* the open flap folds back behind the card (the card is z-index 1, the front pocket 2) */
@keyframes flapOpen { to { transform: rotateX(180deg); z-index: 0; } }
.envelope .seal { position: absolute; left: 50%; top: 52%; width: 62px; height: 62px; margin: -31px 0 0 -31px; z-index: 4; animation: sealPop .5s ease .3s forwards; }
.envelope .seal img { width: 100%; height: 100%; }
@keyframes sealPop { 60% { transform: scale(1.3); } to { transform: scale(0) rotate(40deg); opacity: 0; } }

/* ---------- the letter ---------- */
.letter-wrap { width: min(680px, 100%); }
.opening .letter-wrap { animation: letterIn 1s cubic-bezier(.2, .7, .2, 1) 2.6s both; }
@keyframes letterIn { from { opacity: 0; transform: translateY(40px) scale(.96); } }
.banner { margin: 0 0 16px; padding: 14px 18px; border-radius: 18px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .25); font-weight: 800; font-size: 15px; backdrop-filter: blur(8px); }
.letter { position: relative; background: var(--paper); color: var(--ink); border-radius: 26px; padding: clamp(24px, 6vw, 46px); box-shadow: 0 40px 90px rgba(0, 0, 0, .4); overflow: hidden; }
.letter::before { content: ""; position: absolute; inset: 0; background:
    radial-gradient(60% 40% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(50% 35% at 0% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%); pointer-events: none; }
.letter > * { position: relative; }
.letter .to { font-family: var(--font-body); font-weight: 700; opacity: .7; margin: 0 0 4px; font-size: 16px; }
.letter h1 { font-family: var(--font-display); color: var(--accent); font-size: clamp(34px, 8vw, 54px); line-height: 1.08; margin: 0 0 20px; font-weight: 700; overflow-wrap: anywhere; }
.polaroid { display: block; margin: 0 auto 24px; max-width: 520px; padding: 12px 12px 34px; background: #fff; border-radius: 6px; box-shadow: 0 18px 40px rgba(0, 0, 0, .22); transform: rotate(-2deg); cursor: zoom-in; transition: transform .4s cubic-bezier(.2, .7, .2, 1); border: 0; }
.polaroid:hover { transform: rotate(0) scale(1.02); }
.polaroid img { display: block; width: 100%; height: auto; border-radius: 3px; }
.msg { font-family: var(--font-body); font-size: clamp(17px, 2.6vw, 19px); line-height: 1.75; }
.msg p { margin: 0 0 1em; white-space: pre-wrap; overflow-wrap: anywhere; }
.opening .msg p, .opening .letter h1, .opening .polaroid, .opening .album, .opening .voice, .opening .sign { opacity: 0; animation: lineIn .9s ease forwards; }
.opening .album .polaroid { opacity: 1; animation: none; }
@keyframes lineIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.sign { font-family: var(--font-display); color: var(--accent); font-size: clamp(26px, 5vw, 34px); text-align: end; margin: 18px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.date { text-align: end; font-size: 13px; opacity: .55; font-weight: 700; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.act { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .16); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; backdrop-filter: blur(8px); transition: background .2s, transform .15s; }
.act:hover { background: rgba(255, 255, 255, .26); transform: translateY(-2px); }
.act.main { background: #fff; color: var(--accent); border-color: #fff; }
.inline { display: inline; margin: 0; }
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.zoom[hidden] { display: none; }

/* ---------- album (Album packages): one polaroid per slide, swipe / arrows / dots ---------- */
.album { position: relative; max-width: 540px; margin: 0 auto 24px; }
.album-track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 10px 8px 24px; margin: 0 -8px; overscroll-behavior-x: contain; outline: none; }
.album-track::-webkit-scrollbar { display: none; }
.album .album-slide { flex: 0 0 calc(100% - 12px); margin: 0; scroll-snap-align: center; transform: rotate(-1.2deg); box-shadow: 0 8px 16px rgba(0, 0, 0, .16); }
/* ‹ › are mirrored by the browser in right-to-left text, so the arrows need no flipping */
.album .album-slide:nth-child(even) { transform: rotate(1.2deg); }
.album .album-slide:hover { transform: none; }
.album-slide img { aspect-ratio: 4 / 5; object-fit: contain; background: #fff; }
.album-nav { position: absolute; top: calc(50% - 32px); width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--accent); font-size: 28px; line-height: 1; font-weight: 900; cursor: pointer; box-shadow: 0 8px 22px rgba(0, 0, 0, .25); display: grid; place-items: center; padding: 0 0 3px; transition: transform .15s, opacity .2s; }
.album-nav:hover { transform: scale(1.08); }
.album-nav[disabled] { opacity: 0; pointer-events: none; }
.album-nav.prev { inset-inline-start: -10px; }
.album-nav.next { inset-inline-end: -10px; }
.album-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 2px; }
.album-dots span { width: 7px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 22%, transparent); transition: width .25s, background .25s; }
.album-dots span.on { width: 20px; background: var(--accent); }
.album-count { position: absolute; top: 20px; inset-inline-end: 18px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 800; }

/* ---------- voice message (Album + Voice) ---------- */
.voice { display: flex; align-items: center; gap: 14px; max-width: 520px; margin: 0 auto 24px; padding: 12px 18px 12px 12px; border-radius: 22px; background: color-mix(in srgb, var(--accent) 9%, var(--paper)); border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
[dir="rtl"] .voice { padding: 12px 12px 12px 18px; }
.voice-play { flex: none; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent); transition: transform .2s; }
.voice-play:active { transform: scale(.94); }
.voice-play:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
/* media icons never mirror, so physical sides here */
.voice-play span { width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.voice.playing .voice-play span { width: 16px; height: 18px; border: 0; margin: 0; background: linear-gradient(90deg, #fff 0 35%, transparent 35% 65%, #fff 65%); }
.voice-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.voice-body b { font-family: var(--font-body); font-weight: 700; color: var(--ink); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.voice-bar { position: relative; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 14%, transparent); cursor: pointer; }
.voice-bar::before { content: ""; position: absolute; inset: -10px 0; }
.voice-bar span { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 4px; background: var(--accent); }
.voice-time { justify-self: start; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--ink) 65%, transparent); }

/* ---------- gone ---------- */
.gone { width: min(460px, 100%); text-align: center; }
.gone .big { font-size: 70px; display: block; margin-bottom: 8px; animation: hover 4s ease-in-out infinite; }
.gone h1 { font-family: var(--font-display); font-size: clamp(30px, 7vw, 42px); margin: 0 0 10px; line-height: 1.15; }
.gone p { font-weight: 700; opacity: .9; }

/* ---------- theme demo: the code on the lock screen ---------- */
.hint.demo-code { font-size: 15px; background: rgba(0, 0, 0, .3); }
.hint.demo-code b { font-size: 18px; font-weight: 900; letter-spacing: .14em; padding: 1px 8px; border-radius: 8px; background: rgba(255, 255, 255, .92); color: var(--accent); }

/* ---------- the card's song: mute / play, always in reach (above the envelope) ---------- */
.music-btn { position: fixed; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; z-index: 40; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(0, 0, 0, .28); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 22px rgba(0, 0, 0, .25); transition: transform .15s, background .2s; -webkit-tap-highlight-color: transparent; }
.music-btn:hover { background: rgba(0, 0, 0, .4); }
.music-btn:active { transform: scale(.94); }
.music-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.music-btn svg { display: block; }
.music-btn .i-on, .music-btn.on .i-off { display: none; }
.music-btn.on .i-on { display: block; }
.music-btn.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .55); animation: musicPulse 2.4s ease-out infinite; pointer-events: none; }
@keyframes musicPulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
