* { box-sizing: border-box; }
:root { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    background: #f8dce5 url("heart-bg.jpg") center / 520px;
    color: #713b50;
    font-family: "Pixelify Sans", sans-serif;
}
[hidden] { display: none !important; }
#envelope-container {
    border: 0;
    padding: 32px 20px;
    background: transparent;
    color: #713b50;
    font: inherit;
    text-align: center;
    cursor: pointer;
}
#envelope { display: block; width: 200px; margin: 0 auto 28px; animation: pulse 1.8s ease-in-out infinite; }
#envelope-container span { display: block; font-size: clamp(28px, 6vw, 42px); }
#envelope-container small { display: block; margin-top: 12px; font-size: 18px; }
#envelope-container:focus-visible { outline: 3px solid #a94b70; outline-offset: 6px; border-radius: 16px; }
body.letter-open { display: block; }
#letter-container { width: 100%; padding: 40px 20px; }
.letter-window {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    padding: 50px clamp(22px, 6vw, 68px) 36px;
    background: #fff8f5;
    border: 2px solid #dfa4b7;
    border-top: 12px solid #eab4c6;
    border-radius: 16px;
    box-shadow: 0 16px 50px #85405a26, 6px 6px 0 #f3cbd7;
    animation: unfold 0.6s ease both;
}
.letter-header { text-align: center; }
.letter-label { font-size: 17px; color: #a3657e; }
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.2; margin: 14px 0 12px; font-weight: 500; }
h1:focus { outline: none; }
.cat { display: block; width: 145px; max-width: 50%; margin: 10px auto; }
.letter-intro { font-size: 19px; line-height: 1.5; margin: 12px 0; }
.divider { display: block; color: #c47b98; font-size: 23px; margin: 24px 0 32px; }
.letter-text { font-family: "Nunito", sans-serif; font-size: 16px; line-height: 1.95; overflow-wrap: anywhere; }
.letter-text p { margin: 0 0 24px; }
.letter-text p:first-child { font-weight: 600; color: #a04a6b; }
.letter-text p:last-child { color: #a04a6b; }
.letter-footer { border-top: 1px solid #ebcad5; padding-top: 24px; margin-top: 36px; text-align: center; }
.letter-footer img { width: 100px; }
.letter-footer p { font-size: 28px; margin: 8px 0; }
@keyframes pulse { 50% { transform: translateY(-6px) scale(1.04); } }
@keyframes unfold { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 480px) {
    #letter-container { padding: 20px 12px; }
    .letter-window { padding-top: 30px; border-radius: 12px; box-shadow: 0 8px 24px #85405a20; }
    .letter-text { font-size: 15px; line-height: 1.9; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}
body:has(#password-dialog[open]) { overflow: hidden; }
#password-dialog {
    width: min(520px, calc(100% - 28px));
    max-height: calc(100svh - 32px);
    overflow-y: auto;
    padding: 38px clamp(20px, 5vw, 38px) 28px;
    border: 2px solid #dfa4b7;
    border-top: 10px solid #eab4c6;
    border-radius: 18px;
    background: #fff8f5;
    color: #713b50;
    text-align: center;
    box-shadow: 0 20px 80px #713b5040;
    font-family: "Pixelify Sans", sans-serif;
}
#password-dialog[open] { animation: unfold .3s ease both; }
#password-dialog::backdrop { background: #713b5066; backdrop-filter: blur(5px); }
.dialog-close { position: absolute; top: 9px; right: 10px; width: 36px; height: 36px; border: none; background: transparent; color: #94516b; font-size: 28px; cursor: pointer; }
#puzzle-title { font-size: clamp(25px, 6vw, 32px); margin: 14px 0; font-weight: 500; }
#puzzle-description { font-size: 18px; line-height: 1.5; }
.rebus { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 14px); margin: 26px 0; padding: 22px 10px; background: #fbe8ef; border: 1px dashed #dca2b7; border-radius: 12px; }
.rebus-piece { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.rebus-piece strong { font-size: clamp(25px, 7vw, 36px); font-weight: 500; }
.rebus-piece small { font-size: 13px; }
.rebus-emoji { font-family: sans-serif; font-size: 35px; line-height: 1.2; }
.rebus-plus { font-size: 24px; color: #b16c87; }
.crossed-out { text-decoration: line-through; text-decoration-thickness: 2px; color: #b26e86; }
#password-form { text-align: left; }
#password-form label { display: block; font-size: 19px; margin-bottom: 10px; }
#letter-password { display: block; width: 100%; padding: 14px 16px; border: 2px solid #e6bacb; border-radius: 10px; background: #fffcfa; color: #713b50; font: 16px "Nunito", sans-serif; }
#letter-password::placeholder { color: #a8798c; }
#letter-password:focus { outline: 3px solid #eab4c655; border-color: #b86a89; }
#letter-password[aria-invalid="true"] { border-color: #b54d70; }
.password-error { min-height: 2.6em; font-size: 16px; line-height: 1.3; color: #ac3f64; margin: 8px 0; }
.unlock-button { width: 100%; border: 2px solid #b56c89; border-radius: 10px; padding: 13px; background: #eab4c6; box-shadow: 0 4px 0 #c387a0; color: #613247; font: 22px "Pixelify Sans", sans-serif; cursor: pointer; }
.unlock-button:hover { background: #f0c4d2; }
.unlock-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #c387a0; }
.dialog-close:focus-visible, .unlock-button:focus-visible, .puzzle-hint summary:focus-visible { outline: 3px solid #a94b70; outline-offset: 3px; }
.puzzle-hint { margin-top: 24px; font-size: 16px; line-height: 1.5; }
.puzzle-hint summary { cursor: pointer; color: #94516b; }
.puzzle-hint p { margin-bottom: 0; }
.rebus-words { flex-wrap: wrap; gap: 10px; }
.rebus-words .rebus-piece { flex: 0 1 auto; }
.rebus-words .rebus-piece strong { font-size: clamp(20px, 5vw, 28px); white-space: nowrap; }
.rebus-words .rebus-piece small { font-size: 12px; }
.rebus-key { font-size: 28px; }
.password-instructions { margin: 12px 0 0; font-size: 15px; line-height: 1.5; color: #94516b; }
/* Pastel stationery, ribbons and tiny keepsakes. */
:root { --rose: #ad577c; --blush: #f3c6d8; --ink: #713b50; }
body {
    background-image: linear-gradient(135deg, #fff5f8d9, #fbe0edd9), url("heart-bg.jpg");
    background-size: cover, 460px;
    background-attachment: fixed;
    padding: 32px 0;
    isolation: isolate;
}
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(#bd78962b .9px, transparent .9px);
    background-size: 18px 18px;
    mask-image: linear-gradient(#0008, transparent 80%);
}
::selection { background: #f4bfd5; color: #613247; }
.floating-charms { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.floating-charms span { position: absolute; color: #d48caa; opacity: .55; font-size: 30px; animation: charm-drift 7s ease-in-out infinite alternate; }
.floating-charms span:nth-child(1) { left: 8%; top: 15%; font-size: 48px; }
.floating-charms span:nth-child(2) { right: 12%; top: 20%; animation-delay: -2s; }
.floating-charms span:nth-child(3) { left: 13%; top: 72%; animation-delay: -4s; }
.floating-charms span:nth-child(4) { right: 7%; top: 76%; font-size: 52px; animation-delay: -1s; }
.floating-charms span:nth-child(5) { left: 28%; top: 5%; animation-delay: -3s; }
.floating-charms span:nth-child(6) { right: 24%; top: 92%; font-size: 24px; animation-delay: -5s; }
#envelope-container {
    position: relative; width: min(440px, calc(100% - 40px)); padding: 34px 24px 32px;
    border: 1px solid #fff; border-radius: 28px;
    background: linear-gradient(155deg, #fffafbeF, #fff0f6eF);
    box-shadow: 0 20px 65px #9b527521, 0 0 0 7px #ffffff55, inset 0 0 0 9px #fff7fa;
    transition: box-shadow .25s ease;
}
#envelope-container:hover { box-shadow: 0 24px 70px #9b527536, 0 0 0 9px #ffffff77, inset 0 0 0 9px #fff7fa; }
#envelope-container .envelope-eyebrow { font-size: 15px; letter-spacing: 2px; color: #a76b85; margin: 0 0 28px; }
#envelope-container .envelope-bow { position: absolute; right: 21px; top: -24px; font-size: 47px; transform: rotate(15deg); filter: drop-shadow(0 4px 2px #b46c8920); }
#envelope { width: min(210px, 68%); filter: drop-shadow(0 12px 8px #b36e8b24); margin-bottom: 24px; }
#envelope-container .envelope-note { font-size: 16px; color: #a76b85; margin-top: 12px; }
#envelope-container small { display: inline-block; font-size: 15px; margin-top: 25px; padding: 11px 16px; background: #f7dce8; border-radius: 30px; border: 1px dashed #d8a0b7; }
#letter-container { padding-top: 20px; }
.letter-window { position: relative; border: 1px solid #e5b4c7; border-radius: 8px 8px 24px 24px; padding-top: 58px; background: linear-gradient(90deg, #f9dfeb55 1px, transparent 1px) 28px 0 / calc(100% - 56px) 100% no-repeat, #fffaf7; box-shadow: 0 20px 65px #9b52751c, 6px 6px 0 #f9e7ef, 7px 7px 0 #e8bacb, 12px 12px 0 #fff4f8; }
.paper-tape { position: absolute; width: 150px; height: 32px; top: -15px; left: calc(50% - 75px); transform: rotate(-3deg); background: repeating-linear-gradient(90deg, #e6a9c177 0 8px, #f8cddc99 8px 16px); border-left: 2px dashed #fff9; border-right: 2px dashed #fff9; }
.birthday-badge { display: table; margin: 0 auto 21px; padding: 8px 15px; border: 1px dashed #db9eb8; border-radius: 24px; color: #a45b7b; background: #fcebf2; font-size: 15px; }
h1 { color: #9e4c71; text-wrap: balance; text-shadow: 1px 2px #f6dbe7; }
.letter-header .cat { padding: 0; background: transparent; border: 0; border-radius: 0; margin: 22px auto; filter: drop-shadow(0 6px 4px #ba7b9620); }
.divider { display: flex; align-items: center; gap: 18px; justify-content: center; }
.divider::before, .divider::after { content: ""; flex: 1; max-width: 110px; height: 1px; background: linear-gradient(90deg, transparent, #dfa6bf, transparent); }
.letter-text p { margin-bottom: 28px; }
.letter-text p:first-child { padding: 20px 22px; border-radius: 4px 16px 16px; background: #fbedf2; border-left: 3px solid #dfa1ba; font-weight: 500; }
.letter-footer { border-top-style: dashed; }
.letter-footer img { transform: rotate(-5deg); }
.footer-note { display: block; margin-top: 14px; font-size: 16px; color: #aa718b; }
#password-dialog { border: 1px solid #dfabc2; border-radius: 24px; background: radial-gradient(ellipse at top, #fce4ee, transparent 65%), #fffaf7; box-shadow: 0 24px 90px #713b5040, inset 0 0 0 6px #fff8fb; }
#password-dialog::backdrop { background: #75476255; backdrop-filter: blur(7px); }
.puzzle-bow { font-size: 36px; margin-bottom: 12px; }
.dialog-close { border-radius: 50%; background: #f8e2ed; width: 32px; height: 32px; font-size: 24px; }
.rebus { background: #fff8fb; box-shadow: 0 5px 0 #f5dfe9; border-color: #d595b0; }
#letter-password { border-radius: 14px; transition: border-color .2s, box-shadow .2s; }
.unlock-button { border-radius: 14px; background: linear-gradient(#f5c9da, #eeb5cc); transition: background .2s, transform .15s; }
.puzzle-hint summary { font-size: 15px; }
@keyframes charm-drift { from { transform: translateY(0) rotate(-9deg); } to { transform: translateY(-18px) rotate(9deg); } }
@media (max-width: 480px) {
    body { padding: 32px 0 24px; }
    #envelope-container { padding: 28px 18px; }
    #envelope-container .envelope-eyebrow { font-size: 13px; letter-spacing: 1px; }
    #envelope-container small { font-size: 14px; padding: 10px 12px; }
    #letter-container { padding: 4px 14px 16px; }
    .letter-window { padding-top: 42px; }
    .letter-text p:first-child { padding: 15px; }
    .floating-charms span { opacity: .3; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
.keepsakes { margin-top: 52px; padding-top: 35px; border-top: 1px dashed #dfabc2; text-align: center; }
.keepsakes h2 { color: #9e4c71; font-size: clamp(27px, 5vw, 35px); font-weight: 500; margin: 14px 0; }
.section-note, .surprise-card > p, .music-card p { font-size: 16px; line-height: 1.6; color: #96617b; }
.polaroid-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 35px 0 40px; padding: 8px 3px; }
.polaroid { position: relative; margin: 0; padding: 9px 9px 15px; background: #fff; box-shadow: 0 5px 16px #8e4a6a24; transform: rotate(-4deg); transition: transform .2s; }
.polaroid:nth-child(2) { transform: rotate(3deg) translateY(9px); }
.polaroid:nth-child(3) { transform: rotate(-2deg); }
.polaroid::before { content: ''; position: absolute; z-index: 1; top: -9px; left: calc(50% - 22px); width: 44px; height: 19px; transform: rotate(8deg); background: #ecc3d399; }
.polaroid:hover { transform: rotate(0) translateY(-4px); }
.photo-slot { position: relative; aspect-ratio: 3 / 4; background: #f9e4ed; display: grid; place-items: center; overflow: hidden; }
.photo-slot > span { font-size: 38px; }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #f9e4ed; }
.polaroid figcaption { font-size: 14px; line-height: 1.4; padding-top: 13px; }
.surprise-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.surprise-card { padding: 22px 16px; border: 1px dashed #d9a2ba; border-radius: 18px; background: #fff3f8; }
.keepsakes h3 { font-size: 23px; font-weight: 500; margin: 0 0 12px; color: #994f71; }
.surprise-card > p { margin: 10px 0; }
.cake-button { position: relative; display: block; margin: 24px auto 12px; padding: 0; width: 112px; height: 110px; border: 0; background: transparent; font-size: 80px; cursor: pointer; }
.candle-flame { position: absolute; z-index: 1; left: 48px; top: 8px; width: 14px; height: 22px; background: #ffcc73; border-radius: 80% 15% 70% 40%; transform: rotate(-35deg); box-shadow: 0 0 20px #ffb86bcc; animation: flicker 1s ease-in-out infinite alternate; }
.cake-button.blown-out .candle-flame { display: none; }
.cake-button.blown-out { filter: saturate(.65); }
.text-button { border: 0; background: none; color: #a75d7d; text-decoration: underline; cursor: pointer; font: 15px "Pixelify Sans", sans-serif; padding: 9px; }
.jar-button { display: block; position: relative; width: 100px; height: 110px; margin: 24px auto 12px; padding: 0; background: transparent; border: none; cursor: pointer; transition: transform .2s; }
.jar-button:hover { transform: rotate(-6deg); }
.jar-lid { position: absolute; top: 2px; left: 10px; width: 80px; height: 18px; background: repeating-linear-gradient(90deg, #d88aa9 0 5px, #e7a4bd 5px 10px); border: 2px solid #be7695; border-radius: 5px; z-index: 1; }
.jar-glass { position: absolute; inset: 17px 7px 0; border: 3px solid #dca4bc; border-radius: 10px 10px 20px 20px; background: linear-gradient(110deg, #fff9 15%, #f6cddd88 15% 80%, #fff8 80%); color: #ca7b9d; display: grid; place-items: center; font-size: 22px; line-height: 1.3; }
.jar-label { position: absolute; top: 56px; left: 13px; right: 13px; padding: 5px 0; background: #fff9f2; border: 1px dashed #d89bb6; color: #95516f; font: 15px "Pixelify Sans", sans-serif; transform: rotate(-5deg); }
.little-message { font-size: 17px; line-height: 1.6; min-height: 3.2em; margin: 16px 0 0; color: #965775; }
.music-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding: 24px 18px; margin-top: 22px; background: #f8e9f2; border: 1px solid #ead0df; border-radius: 18px; }
.music-card > div { flex: 1; min-width: 140px; text-align: left; }
.music-card h3 { margin-bottom: 6px; }
.music-card p { margin: 0; }
.music-disc { display: grid; place-items: center; flex-shrink: 0; width: 60px; height: 60px; border: 8px double #d69eb9; border-radius: 50%; color: #a45c80; background: #f6d7e6; font-size: 30px; }
.music-card.playing .music-disc { animation: record-spin 7s linear infinite; }
.cute-button { border: 1px solid #b86c8d; border-radius: 30px; padding: 12px 20px; background: linear-gradient(#f8d7e6, #efb9cf); box-shadow: 0 4px 0 #d59bb6; color: #773d59; font: 18px "Pixelify Sans", sans-serif; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.cute-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #d59bb6; }
.cute-button:hover { background: #fce4ee; }
.cute-button:focus-visible, .jar-button:focus-visible, .cake-button:focus-visible, .text-button:focus-visible { outline: 3px solid #a94b70; outline-offset: 5px; }
#heart-shower { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.shower-heart { position: absolute; top: -60px; color: #ce719c; font-size: 26px; animation: heart-fall 3s ease-in forwards; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes flicker { to { transform: rotate(-25deg) scale(.88); opacity: .8; } }
@keyframes record-spin { to { transform: rotate(360deg); } }
@keyframes heart-fall { to { transform: translateY(calc(100vh + 80px)) rotate(250deg); opacity: 0; } }
@media (max-width: 540px) {
    .polaroid-gallery { grid-template-columns: 1fr; max-width: 240px; margin: 28px auto 38px; gap: 28px; }
    .surprise-grid { grid-template-columns: 1fr; }
    .music-card > div { text-align: center; }
    .music-card .cute-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.letter-footer .footer-signature { font-size: 20px; color: #aa718b; margin-top: 12px; }

/* Soft candy stationery, with generous reading space. */
:root { --rose: #974967; --ink: #613d50; }
body {
    color: var(--ink);
    background-image: radial-gradient(ellipse at 15% 10%, #fff7e8bb, transparent 45%), linear-gradient(135deg, #fff5f8ed, #f9e1f0ed), url("heart-bg.jpg");
    background-size: cover, cover, 460px;
}
.floating-charms span { opacity: .38; }
#envelope-container { width: min(490px, calc(100% - 44px)); padding: 42px 28px 38px; border-radius: 34px; }
#envelope { width: min(250px, 76%); margin-bottom: 30px; }
#envelope-container span:not([class]) { font-size: clamp(34px, 7vw, 48px); line-height: 1.2; }
#envelope-container .envelope-eyebrow { color: #87536c; font-size: 17px; }
#envelope-container .envelope-note { font: 600 18px/1.6 "Nunito", sans-serif; color: #87536c; }
#envelope-container small { font-size: 18px; line-height: 1.5; padding: 12px 20px; color: #78445d; }
#letter-container { padding: 30px 24px 48px; }
.letter-window {
    max-width: 900px;
    padding: 66px clamp(24px, 7vw, 82px) 46px;
    background: #fffcf9;
    border-color: #e5b3c9;
    border-radius: 20px 20px 30px 30px;
    box-shadow: 0 22px 75px #92526c18, 6px 6px 0 #f9e7ef, 7px 7px 0 #e8bacb;
}
.paper-tape { width: 170px; left: calc(50% - 85px); height: 35px; }
.letter-header { position: relative; }
.letter-header::before, .letter-header::after { position: absolute; top: 160px; color: #c983a4; font-size: 30px; pointer-events: none; }
.letter-header::before { content: "\2661"; left: 9%; transform: rotate(-18deg); }
.letter-header::after { content: "\2727"; right: 9%; transform: rotate(12deg); }
.birthday-badge { font-size: 18px; color: #87435f; padding: 11px 19px; background: #fce7f0; border-color: #d4a0b8; }
.letter-label { display: block; font-size: 19px; line-height: 1.6; color: #85516a; }
h1 { max-width: 650px; margin: 18px auto; font-size: clamp(34px, 5.5vw, 49px); line-height: 1.22; color: #924666; }
.letter-header .cat { width: 245px; max-width: 80%; margin: 28px auto 22px; filter: drop-shadow(0 9px 6px #b9789624); }
.letter-intro { font: 600 20px/1.65 "Nunito", sans-serif; color: #7f4c64; max-width: 440px; margin: 14px auto; }
.divider { font-size: 25px; margin: 30px 0 44px; }
.letter-text { font: 500 19px/1.95 "Nunito", sans-serif; color: #613d50; overflow-wrap: break-word; }
.letter-text p { margin: 0 0 32px; }
.letter-text p:first-child { font-size: 20px; font-weight: 700; line-height: 1.9; padding: 25px 28px; border: 1px solid #efd0de; border-left: 4px solid #d991b1; border-radius: 8px 24px 24px; background: linear-gradient(135deg, #fff0f5, #fff8f1); color: #86465f; }
.letter-text p:last-child { padding: 22px 25px; margin-top: 38px; border-top: 1px dashed #dba8c0; border-bottom: 1px dashed #dba8c0; background: #fff5f8; font-weight: 700; color: #86465f; }
.keepsakes { margin-top: 60px; padding-top: 42px; }
.keepsakes h2 { font-size: clamp(31px, 5vw, 40px); margin: 22px 0 16px; }
.section-note, .surprise-card > p, .music-card p { font: 600 17px/1.7 "Nunito", sans-serif; color: #7d4e65; }
.polaroid-gallery { gap: 22px; margin: 42px 0 52px; }
.polaroid { padding: 11px 11px 18px; border: 1px solid #f0dce5; border-radius: 3px; }
.polaroid figcaption { font-size: 18px; padding-top: 16px; color: #78445d; }
.photo-slot, .photo-slot img { background: #fff3f8; }
.surprise-grid { gap: 24px; }
.surprise-card { padding: 28px 22px; border-radius: 24px; background: linear-gradient(145deg, #fff4f8, #fffaf3); box-shadow: 0 7px 20px #a66a8510; }
.keepsakes h3 { font-size: 27px; line-height: 1.3; }
.little-message { font: 600 18px/1.7 "Nunito", sans-serif; color: #7c455e; }
.surprise-card .little-message { margin-top: 20px; padding: 14px 12px; border-radius: 14px; background: #ffffffb3; }
.text-button { font-size: 18px; min-height: 44px; }
.music-card { padding: 28px 24px; border-radius: 24px; background: #f9edf5; }
.cute-button { font-size: 20px; padding: 14px 22px; min-height: 48px; }
.letter-footer { position: relative; padding-top: 42px; margin-top: 48px; }
.letter-footer::before { content: "\2661  \2661  \2661"; display: block; color: #bd7a9a; letter-spacing: 12px; font-size: 24px; margin-bottom: 20px; }
.letter-footer img { display: block; width: 230px; max-width: 80%; margin: 0 auto 24px; transform: none; filter: drop-shadow(0 8px 5px #b9789620); }
.letter-footer p { font-size: 39px; color: #974967; }
.letter-footer .footer-signature { font-size: 25px; color: #85516a; }
.footer-note { font: 600 17px/1.7 "Nunito", sans-serif; color: #85516a; }
#password-dialog { width: min(560px, calc(100% - 28px)); padding: 36px clamp(20px, 5vw, 40px) 30px; }
#puzzle-title { font-size: clamp(29px, 6vw, 38px); }
#puzzle-description { font: 600 18px/1.65 "Nunito", sans-serif; color: #79485f; }
.rebus { padding: 25px 12px; row-gap: 18px; border-radius: 18px; }
.rebus-words .rebus-piece strong { font-size: clamp(24px, 5vw, 30px); }
.rebus-words .rebus-piece small { font-size: 15px; }
#password-form label { font-size: 23px; }
#letter-password { font-size: 18px; padding: 15px 17px; color: #613d50; }
#letter-password::placeholder { color: #886076; }
.password-instructions, .password-error { font-size: 17px; }
.puzzle-hint, .puzzle-hint summary { font-size: 18px; color: #7f4b65; }
.puzzle-hint summary { padding: 10px 0; }
.dialog-close { width: 44px; height: 44px; top: 8px; right: 8px; }
.unlock-button { font-size: 25px; padding: 15px; }
@media (max-width: 600px) {
    #letter-container { padding: 18px 14px 30px; }
    .letter-window { padding: 46px 22px 34px; }
    .letter-text { font-size: 18px; line-height: 1.9; }
    .letter-text p { margin-bottom: 28px; }
    .letter-text p:first-child { padding: 20px 18px; font-size: 18px; }
    .letter-text p:last-child { padding: 20px 15px; }
    .letter-header .cat { width: 210px; }
    .letter-footer img { width: 210px; }
    .letter-header::before { left: 0; }
    .letter-header::after { right: 0; }
    .birthday-badge { font-size: 16px; padding: 10px 13px; }
    .letter-label { font-size: 17px; }
    .letter-intro { font-size: 18px; }
    .polaroid-gallery { grid-template-columns: 1fr; max-width: 290px; margin: 36px auto 45px; gap: 32px; }
    .surprise-grid { grid-template-columns: 1fr; }
    .music-card { padding: 25px 20px; }
    .music-card > div { text-align: center; }
    .music-card .cute-button { width: 100%; }
    #envelope-container { padding: 34px 22px; }
    #envelope-container .envelope-eyebrow { font-size: 15px; letter-spacing: 1px; }
    #envelope-container small { font-size: 17px; }
}
/* Phone layout, safe areas and on-screen keyboard. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
img { max-width: 100%; }
button, input, summary { -webkit-tap-highlight-color: #d993b333; }
button, summary { touch-action: manipulation; }
#puzzle-title:focus { outline: none; }
#password-dialog { max-height: calc(100dvh - 24px); overscroll-behavior-y: contain; scroll-padding-block: 20px; }
#letter-password { scroll-margin-block: 28px; }
@media (max-width: 600px) {
    html { scrollbar-gutter: auto; }
    body {
        padding: max(34px, env(safe-area-inset-top)) env(safe-area-inset-right) max(26px, env(safe-area-inset-bottom)) env(safe-area-inset-left);
        background-attachment: scroll;
    }
    body.letter-open { padding-top: max(18px, env(safe-area-inset-top)); }
    #envelope-container { width: calc(100% - 36px); max-width: 430px; padding: 30px 20px; }
    #envelope-container .envelope-note { font-size: 17px; }
    #envelope-container small { white-space: normal; }
    #letter-container { padding: 12px 10px 26px; }
    .letter-window { padding: 42px clamp(16px, 5vw, 26px) 32px; box-shadow: 0 12px 35px #92526c14, 3px 3px 0 #f5dce7; }
    h1 { font-size: clamp(30px, 8.5vw, 42px); overflow-wrap: break-word; }
    .letter-text { font-size: 18px; line-height: 1.85; }
    .letter-text p:first-child, .letter-text p:last-child { padding: 18px 14px; }
    .letter-header .cat, .letter-footer img { width: 220px; max-width: 85%; }
    .letter-label, .birthday-badge, .section-note { overflow-wrap: break-word; }
    .birthday-badge { max-width: 100%; line-height: 1.5; }
    .polaroid-gallery { width: calc(100% - 14px); max-width: 310px; }
    .polaroid { min-width: 0; }
    .surprise-card { min-width: 0; padding: 26px 18px; }
    .keepsakes h2 { font-size: clamp(28px, 7.5vw, 36px); }
    .keepsakes h3 { font-size: 26px; }
    .music-card { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 18px; padding: 24px 17px; }
    .music-card > div { min-width: 0; width: 100%; }
    .cute-button, .unlock-button { width: 100%; min-height: 50px; white-space: normal; line-height: 1.4; }
    .text-button, .puzzle-hint summary { min-height: 48px; }
    #password-dialog { width: calc(100% - 20px); padding: 52px 20px 24px; margin: auto; border-radius: 20px; }
    #password-dialog .letter-label { font-size: 16px; }
    #puzzle-title { font-size: clamp(27px, 7vw, 34px); line-height: 1.25; }
    #puzzle-description { font-size: 17px; }
    #letter-password { width: 100%; min-width: 0; min-height: 52px; font-size: 18px; }
    .password-error { min-height: 1.5em; line-height: 1.5; }
    .puzzle-bow { margin-bottom: 8px; }
    .puzzle-hint { margin-top: 16px; }
    .rebus { margin-block: 20px; }
    .floating-charms span { opacity: .22; animation: none; }
}
@media (max-width: 400px) {
    .rebus-words { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .rebus-words .rebus-piece, .rebus-words .rebus-plus:nth-child(2) { grid-column: 1 / -1; }
    .rebus-words .rebus-piece { gap: 5px; }
    .rebus-words .rebus-plus:nth-child(4) { justify-self: end; }
    .rebus-key { justify-self: start; }
    .rebus-words .rebus-piece strong { font-size: 27px; }
    #envelope-container span:not([class]) { font-size: 33px; }
    .letter-intro { font-size: 17px; }
    .letter-footer p { font-size: 35px; }
}
@media (max-height: 500px) and (max-width: 950px) {
    #password-dialog { max-height: calc(100dvh - 12px); margin-block: auto; padding-top: 50px; }
    #password-dialog .puzzle-bow { display: none; }
}
