:root {
    color-scheme: dark;
    font-family: Inter, system-ui, sans-serif;
    background: #240b17;
    color: #fff0eb;
    --heading: "Cormorant Garamond", Georgia, serif;
    --muted: #e0b8c3;
    --line: #bd748a59;
    --surface: #542239;
    --blush: #f4bfca;
    --ink: #3b1325;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: #240b17;
}

.heart-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 16% 8%, #a949676f, transparent 42%),
        radial-gradient(ellipse at 86% 74%, #961d5c70, transparent 52%),
        radial-gradient(ellipse at 47% 35%, #601a3f95, transparent 68%),
        linear-gradient(160deg, #381020, #1a0712 79%);
}

.heart-background::before,
.heart-background::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.heart-background::before {
    inset: 0;
    background:
        radial-gradient(circle, #f7bed94d 0.9px, transparent 1.6px) 0 0 / 67px 67px,
        radial-gradient(circle, #f7bed933 0.65px, transparent 1.4px) 29px 32px / 43px 43px,
        repeating-linear-gradient(124deg, transparent 0 31px, #ffd3e608 31px 32px);
}

.heart-background::after {
    width: min(82vw, 44rem);
    height: 86vh;
    top: -19vh;
    right: -30vw;
    border: 1px solid #f8a9c92c;
    border-radius: 50%;
    box-shadow: 0 0 0 2rem #ee91b50d, 0 0 0 5rem #ee91b50a, 0 0 0 9rem #ee91b509;
    transform: rotate(-25deg);
}

.heart-background span {
    position: absolute;
    top: var(--y);
    left: var(--x);
    color: var(--heart-color, #ffc9dc);
    font: var(--size)/1 Georgia, serif;
    opacity: 0.52;
    animation: float-heart var(--duration) ease-in-out var(--delay) infinite alternate;
    transform: rotate(var(--angle));
}

.heart-background span:nth-child(3n) { --heart-color: #ff91b7; }
.heart-background span:nth-child(4n) { --heart-color: #e77eae; }
.heart-background span:nth-child(1) { --x: 6%; --y: 15%; --size: 2.5rem; --angle: -25deg; --duration: 5s; --delay: -2s; }
.heart-background span:nth-child(2) { --x: 84%; --y: 17%; --size: 1.4rem; --angle: 20deg; --duration: 5s; --delay: -4s; }
.heart-background span:nth-child(3) { --x: 92%; --y: 35%; --size: 2.9rem; --angle: 16deg; --duration: 7s; --delay: -6s; }
.heart-background span:nth-child(4) { --x: 14%; --y: 75%; --size: 2.7rem; --angle: -16deg; --duration: 6s; --delay: -3s; }
.heart-background span:nth-child(5) { --x: 78%; --y: 83%; --size: 1.8rem; --angle: 18deg; --duration: 7s; --delay: -4s; }
.heart-background span:nth-child(6) { --x: 85%; --y: 94%; --size: 3.4rem; --angle: 15deg; --duration: 8s; --delay: -5s; }
.heart-background span:nth-child(7) { --x: 3%; --y: 53%; --size: 1.4rem; --angle: -15deg; --duration: 5s; --delay: -3s; }
.heart-background span:nth-child(8) { --x: 25%; --y: 91%; --size: 1.8rem; --angle: 22deg; --duration: 6s; --delay: -5s; }
.heart-background span:nth-child(9) { --x: 35%; --y: 10%; --size: 1.15rem; --angle: 18deg; --duration: 6s; --delay: -2s; }
.heart-background span:nth-child(10) { --x: 62%; --y: 13%; --size: 0.85rem; --angle: -20deg; --duration: 5s; --delay: -1s; }
.heart-background span:nth-child(11) { --x: 76%; --y: 26%; --size: 2.05rem; --angle: 20deg; --duration: 8s; --delay: -4s; }
.heart-background span:nth-child(12) { --x: 11%; --y: 33%; --size: 1.1rem; --angle: -20deg; --duration: 6s; --delay: -4s; }
.heart-background span:nth-child(13) { --x: 19%; --y: 25%; --size: 1.8rem; --angle: -17deg; --duration: 8s; --delay: -3s; }
.heart-background span:nth-child(14) { --x: 94%; --y: 58%; --size: 1.15rem; --angle: 18deg; --duration: 5s; --delay: -4s; }
.heart-background span:nth-child(15) { --x: 88%; --y: 72%; --size: 2.1rem; --angle: 16deg; --duration: 7s; --delay: -3s; }
.heart-background span:nth-child(16) { --x: 6%; --y: 89%; --size: 1.25rem; --angle: -23deg; --duration: 5s; --delay: -1s; }
.heart-background span:nth-child(17) { --x: 55%; --y: 91%; --size: 1.5rem; --angle: -16deg; --duration: 6s; --delay: -2s; }
.heart-background span:nth-child(18) { --x: 69%; --y: 96%; --size: 0.9rem; --angle: 20deg; --duration: 7s; --delay: -5s; }

@keyframes float-heart {
    from { opacity: 0.37; transform: translate(0, 0) rotate(var(--angle)); }
    to { opacity: 0.72; transform: translate(0.5rem, -1.9rem) rotate(calc(var(--angle) + 15deg)); }
}

@keyframes screen-in {
    from { opacity: 0; transform: translateY(0.65rem); }
    to { opacity: 1; transform: translateY(0); }
}

.site {
    position: relative;
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding: clamp(1.5rem, 5vw, 4rem) clamp(0.875rem, 4vw, 2rem);
}

.screen {
    width: min(100%, 29rem);
}

.screen:not([hidden]) {
    animation: screen-in 390ms ease-out both;
}

h1 {
    margin: 0 0 1.35rem;
    font-family: var(--heading);
    font-size: clamp(2.65rem, 8vw, 4.5rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 0.98;
    text-align: center;
    text-wrap: balance;
}

h1:focus,
.confirmation:focus {
    outline: none;
}

.form {
    display: grid;
    gap: 0.75rem;
}

.lock-screen {
    padding: clamp(1.5rem, 6vw, 3rem);
    background: linear-gradient(155deg, #522238df, #371120f2);
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    box-shadow: 0 1.25rem 4rem #17030d80;
}

.lock-screen h1 {
    margin-bottom: 1.45rem;
}

#lock-title,
#envelope-title {
    font-family: "Marck Script", cursive;
    font-size: clamp(3.2rem, 12vw, 5.4rem);
    font-weight: 400;
    letter-spacing: -0.04em;
    line-height: 1.03;
}

#envelope-title {
    margin-bottom: 0.65rem;
}

.lock-screen label {
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.65;
    text-align: center;
    text-wrap: balance;
}

#answer,
button {
    min-height: 2.9rem;
    font: inherit;
}

#answer {
    width: 100%;
    padding: 0.68rem 1rem;
    background: #300d20;
    color: inherit;
    border: 1px solid var(--line);
    border-radius: 0.78rem;
    text-align: center;
}

#answer::placeholder {
    color: #c89eae;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--blush);
    outline-offset: 3px;
}

.button {
    padding: 0.65rem 1rem;
    border: 1px solid #ffd5dd78;
    border-radius: 0.8rem;
    background: #f0b4c4;
    color: var(--ink);
    font-weight: 600;
}

.button:disabled {
    background: #a16d80;
    border-color: transparent;
    color: #270817;
    cursor: default;
}

#unlock-form .button:disabled {
    cursor: wait;
}

.message,
.confirmation {
    margin: 0;
    line-height: 1.45;
}

.message {
    color: #ffd3d9;
    text-align: center;
    font-size: 0.875rem;
}

.message:empty,
.confirmation:empty {
    display: none;
}

.envelope-screen {
    text-align: center;
}

.envelope-button {
    display: inline-grid;
    justify-items: center;
    gap: 1.3rem;
    margin-top: 0.7rem;
    padding: 0.75rem 0.6rem;
    color: var(--blush);
    background: transparent;
    border: 0;
    border-radius: 0.75rem;
}

.envelope-stage {
    width: min(17rem, 70vw);
    padding-top: min(6.4rem, 24vw);
}

.envelope {
    display: grid;
    position: relative;
    isolation: isolate;
    aspect-ratio: 1.58;
    place-items: center;
    background: linear-gradient(150deg, #974662, #71304e);
    border-radius: 0.45rem;
    box-shadow: 0 1rem 3rem #17030daa;
}

.envelope-paper,
.envelope-pocket,
.envelope-flap-open,
.envelope-flap-closed {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.envelope-flap-open,
.envelope-flap-closed {
    height: 61%;
    transform-origin: top;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope-flap-open {
    background: linear-gradient(#a75272, #ce8099);
    transform: scaleY(0);
}

.envelope-paper {
    inset: 0.8rem 1.1rem 0.65rem;
    display: grid;
    place-items: start center;
    padding-top: 0.85rem;
    background: linear-gradient(155deg, #fff0ed, #eeb8ca);
    border: 1px solid #f8d7de;
    color: #a44266;
}

.envelope-paper span {
    font-size: 1.28rem;
}

.envelope-pocket {
    background:
        linear-gradient(146deg, transparent 49.5%, #c57792 50%) left / 51% 100% no-repeat,
        linear-gradient(214deg, transparent 49.5%, #b56684 50%) right / 51% 100% no-repeat,
        #b56684;
    clip-path: polygon(0 0, 50% 57%, 100% 0, 100% 100%, 0 100%);
}

.envelope-flap-closed {
    background: linear-gradient(#e19bb1, #c77492);
}

.envelope-seal {
    position: relative;
    top: 3%;
    display: grid;
    place-items: center;
    width: 2.55rem;
    aspect-ratio: 1;
    border: 1px solid #df8fa7;
    border-radius: 50%;
    background: #8d2448;
    box-shadow: 0 0.2rem 0.55rem #48122c80, inset 0 0 0 3px #771b3b;
    color: #ffd5de;
}

.envelope-button.is-opening {
    cursor: default;
}

.is-opening .envelope-seal {
    animation: unseal 160ms ease-out both;
}

.is-opening .envelope-flap-closed {
    animation: flip-closed 160ms ease-in 80ms both;
}

.is-opening .envelope-flap-open {
    animation: flip-open 230ms ease-out 240ms both;
}

.is-opening .envelope-paper {
    animation: lift-paper 525ms cubic-bezier(0.25, 0.75, 0.25, 1) 405ms both;
}

@keyframes unseal {
    to { opacity: 0; transform: scale(0.75); }
}

@keyframes flip-closed {
    to { transform: scaleY(0); }
}

@keyframes flip-open {
    to { transform: scaleY(-1); }
}

@keyframes lift-paper {
    84%, 100% { transform: translateY(-63%) rotate(-3deg); }
}

.button-text,
.text-button {
    text-decoration: underline;
    text-underline-offset: 0.24em;
}

.letter-screen {
    width: min(100%, 55rem);
}

.letter {
    display: grid;
    gap: clamp(1.4rem, 4vw, 2.7rem);
    padding: clamp(1.3rem, 5vw, 3rem);
    background: #f8e3e6;
    color: var(--ink);
    border-radius: 1.15rem;
    box-shadow: 0 1.15rem 3.5rem #17030d85;
}

.letter h1 {
    margin-bottom: 1.3rem;
    font-size: clamp(2.5rem, 6vw, 3.85rem);
    text-align: left;
}

.letter p {
    margin: 0 0 0.95rem;
    font-family: "Spectral", Georgia, serif;
    font-size: 1.075rem;
    line-height: 1.6;
}

.letter p:last-child {
    margin-bottom: 0;
}

.letter-heart {
    display: inline-block;
    color: #a4335a;
    font-size: 0.65em;
    vertical-align: 0.08em;
}

.letter-photo {
    align-self: start;
    width: min(100%, 22rem);
    margin: 0 auto;
    padding: 0.45rem;
    background: #fff2ef;
    border: 1px solid #e4bbc5;
    border-radius: 0.4rem;
    box-shadow: 0 0.55rem 1.4rem #68284530;
}

.letter-photo img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.19rem;
}

.letter-screen > .button {
    display: block;
    width: min(100%, 22rem);
    margin: 1.1rem auto 0;
}

.idea-list {
    display: grid;
    gap: 0.65rem;
}

.idea {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.77rem;
    padding: 0.95rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: 0.88rem;
    background: #57243ba0;
    color: inherit;
    text-align: left;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.idea:active:not(:disabled) {
    transform: scale(0.98);
}

.idea-icon {
    display: grid;
    min-width: 2.65rem;
    min-height: 2.65rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: #7b36536b;
    font-size: 1.15rem;
}

.idea-copy {
    display: grid;
    gap: 0.23rem;
}

.idea strong {
    font-family: var(--heading);
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
}

.idea-copy span {
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.picker {
    display: grid;
    min-inline-size: 0;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.calendar {
    padding: clamp(0.55rem, 2.7vw, 1rem);
    background: #43172bde;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.calendar h2 {
    margin: 0 0 0.45rem;
    padding: 0 0.22rem;
    font-family: var(--heading);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.choice-grid {
    display: grid;
    gap: 0.3rem;
}

.day-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday {
    align-self: center;
    color: var(--muted);
    text-align: center;
    font-size: 0.74rem;
}

.choice {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.choice input,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.choice span {
    display: grid;
    min-height: 2.75rem;
    place-items: center;
    border: 1px solid #b86e864f;
    border-radius: 0.58rem;
    background: var(--surface);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.day-grid .choice span {
    font-family: var(--heading);
    font-size: 1.36rem;
    font-weight: 700;
}

.choice input:focus-visible + span {
    outline: 2px solid var(--blush);
    outline-offset: 2px;
}

.choice input:checked + span {
    border-color: #ffe0e4;
    background: var(--blush);
    color: var(--ink);
    font-weight: 700;
}

.picker:disabled .choice {
    cursor: default;
}

.text-button {
    justify-self: center;
    padding: 0 0.42rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--blush);
    font-size: 0.88rem;
}

.confirmation {
    display: grid;
    gap: 0.24rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: #4e1b31;
    text-align: center;
}

.confirmation strong {
    font-family: var(--heading);
    font-size: 1.65rem;
}

.confirmation span {
    color: var(--muted);
    font-size: 0.88rem;
}

.confirmation:not(:empty) {
    animation: screen-in 280ms ease-out both;
}

#idea-confirmation,
.admin-status {
    margin-top: 0.85rem;
}

@media (min-width: 48rem) {
    .letter {
        grid-template-columns: 1.25fr 1fr;
        align-items: center;
    }
}

@media (hover: hover) {
    .button:hover:not(:disabled) {
        background: #ffd0db;
    }

    .idea:hover,
    .choice:hover input:not(:checked, :disabled) + span {
        background: #74344f;
    }

    .envelope-button:hover:not(:disabled) .button-text {
        color: #ffe0ea;
    }
}

@media (prefers-reduced-motion: reduce) {
    .screen:not([hidden]),
    .heart-background span,
    .is-opening .envelope span,
    .confirmation:not(:empty) {
        animation: none;
    }

    .idea {
        transition: none;
    }
}
