:root {
    --night: #240a16;
    --wine: #5e1733;
    --wine-deep: #3f0d22;
    --berry: #8e1f45;
    --rose: #e8a0b4;
    --blush: #f6d6de;
    --paper: #fcf4ee;
    --ink: #3a1424;
    --ink-soft: #7a4a5c;
    --gold: #d6b27a;
    --serif: 'Cormorant Garamond', Georgia, serif;
    --script: 'Great Vibes', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    font-family: var(--serif);
    font-size: 18px;
    color: var(--ink);
    background-color: var(--night);
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(142, 31, 69, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 90%, rgba(94, 23, 51, 0.7) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #3a0f22 0%, var(--night) 75%);
    background-attachment: fixed;
    overflow-x: hidden;
}

button {
    font: inherit;
    color: inherit;
}

/* ---------- Pétales ---------- */

.petals {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.petals span {
    position: absolute;
    top: -10%;
    border-radius: 80% 0 80% 0;
    background: linear-gradient(135deg, #f4b8c6, #c94a6c);
    animation-name: fall, sway;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: infinite, infinite;
    animation-direction: normal, alternate;
}

@keyframes fall {
    to { top: 110%; }
}

@keyframes sway {
    from { transform: translateX(-24px) rotate(-20deg); }
    to { transform: translateX(24px) rotate(40deg); }
}

/* ---------- Scènes ---------- */

main {
    position: relative;
    z-index: 1;
}

.scene {
    display: none;
    min-height: 100vh;
    min-height: 100svh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}

.scene.active {
    display: flex;
    animation: appear 0.9s ease both;
}

@keyframes appear {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 36px 26px 30px;
    background: var(--paper);
    border-radius: 18px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(214, 178, 122, 0.4);
}

.card::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(214, 178, 122, 0.55);
    border-radius: 12px;
    pointer-events: none;
}

.card-wide {
    max-width: 520px;
}

.kicker {
    font-style: italic;
    font-size: 1.15rem;
    color: var(--ink-soft);
    letter-spacing: 0.02em;
}

#scene-letter .kicker {
    color: var(--blush);
    font-size: 1.6rem;
    margin-bottom: 36px;
}

.heart {
    color: #e3123d;
    font-style: normal;
    text-shadow: 0 0 12px rgba(227, 18, 61, 0.6);
}

h1 {
    font-weight: 500;
    font-size: 2.5rem;
    line-height: 1.15;
    margin: 10px 0 18px;
}

h2 {
    font-weight: 600;
    font-size: 1.6rem;
    margin-top: 26px;
}

h3 {
    font-weight: 600;
    font-size: 1.2rem;
    margin: 24px 0 10px;
}

.script {
    font-family: var(--script);
    font-weight: 400;
    color: var(--berry);
}

.script.big {
    font-size: 3.2rem;
    line-height: 1.1;
}

.lead {
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--ink-soft);
    margin-top: 8px;
}

.small {
    font-size: 1rem;
    font-style: italic;
    color: var(--ink-soft);
    margin: 4px 0 16px;
}

.hint {
    margin-top: 30px;
    color: var(--rose);
    font-style: italic;
    font-size: 1.05rem;
    animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

/* ---------- Enveloppe ---------- */

.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    border: none;
    background: none;
    cursor: pointer;
    perspective: 900px;
    filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.5));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.envelope > span {
    position: absolute;
    left: 0;
    width: 100%;
}

.env-back {
    top: 0;
    height: 100%;
    background: #d98a9e;
    border-radius: 6px;
    z-index: 1;
}

.env-paper {
    top: 10px;
    left: 16px !important;
    width: calc(100% - 32px) !important;
    height: calc(100% - 20px);
    background: var(--paper);
    border-radius: 4px;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 22px;
    font-size: 2rem;
    transition: transform 0.9s ease 0.45s;
}

.env-front {
    top: 0;
    height: 100%;
    background: linear-gradient(160deg, #f2c2ce, #e7a7b8);
    clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
    border-radius: 6px;
    z-index: 3;
}

.env-flap {
    top: 0;
    height: 58%;
    background: linear-gradient(180deg, #e7a2b4, #d98a9e);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.6s ease, z-index 0s linear 0.3s;
    z-index: 4;
}

.seal {
    top: 44% !important;
    left: 50% !important;
    width: 54px !important;
    height: 54px;
    margin-left: -27px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #b0304f, #6b1430);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
    color: var(--gold);
    font-size: 1.6rem;
    line-height: 54px;
    z-index: 5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.envelope:hover .seal {
    transform: scale(1.08);
}

.envelope.open {
    animation: none;
}

.envelope.open .seal {
    opacity: 0;
    transform: scale(0.6);
}

.envelope.open .env-flap {
    transform: rotateX(180deg);
    z-index: 0;
}

.envelope.open .env-paper {
    transform: translateY(-62%);
}

/* ---------- Question ---------- */

.frame {
    width: 170px;
    height: 170px;
    margin: 6px auto 4px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, var(--blush) 100%);
    box-shadow: inset 0 0 0 1px rgba(214, 178, 122, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.frame img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.frame-small {
    width: 120px;
    height: 120px;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-top: 26px;
}

.btn {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: transform 0.15s ease, box-shadow 0.15s ease, font-size 0.25s ease, padding 0.25s ease;
}

.btn-yes {
    font-size: 1.3rem;
    padding: 14px 40px;
    color: var(--paper);
    background: linear-gradient(135deg, var(--berry), var(--wine));
    box-shadow: 0 8px 22px rgba(94, 23, 51, 0.4);
}

.btn-yes:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(94, 23, 51, 0.5);
}

.btn-yes:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-no {
    font-size: 1.05rem;
    padding: 11px 26px;
    color: var(--ink-soft);
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(122, 74, 92, 0.45);
}

.btn-no.runaway {
    position: fixed;
    z-index: 50;
    background: var(--paper);
    transition: left 0.25s ease, top 0.25s ease, font-size 0.25s ease;
}

.buttons {
    position: relative;
}

/* Au 5e refus, le Non se pose au milieu du Oui */
.btn-no.on-yes {
    position: absolute;
    left: 50%;
    top: 80%;
    z-index: 2;
    font-size: 0.95rem;
    background: var(--paper);
    transform: translate(-50%, -50%);
    animation: land 0.45s ease both;
}

@keyframes land {
    from { opacity: 0; transform: translate(-50%, -160%) scale(0.6); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 22px;
    text-align: center;
    text-decoration: none;
}

.btn-wa {
    font-size: 1.15rem;
    padding: 14px 24px;
    color: #fff;
    background: linear-gradient(135deg, #2e8b62, #1f6b4b);
    box-shadow: 0 8px 22px rgba(31, 107, 75, 0.35);
}

.btn-wa[hidden] {
    display: none;
}

/* ---------- Calendrier ---------- */

#date-form {
    text-align: left;
}

#date-form h2,
#date-form .small {
    text-align: center;
}

.calendar {
    border-radius: 14px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(214, 178, 122, 0.5);
    padding: 14px 12px 12px;
}

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.cal-nav {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--blush);
    color: var(--wine);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.cal-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.cal-days,
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.cal-days span {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--ink-soft);
    padding-bottom: 4px;
}

.cal-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cal-day:hover:not(:disabled):not(.selected) {
    background: var(--blush);
}

.cal-day.today {
    box-shadow: inset 0 0 0 1.5px var(--gold);
}

.cal-day.selected {
    background: linear-gradient(135deg, var(--berry), var(--wine));
    color: var(--paper);
}

.cal-day:disabled {
    opacity: 0.25;
    cursor: default;
}

.slots {
    list-style: none;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slots li {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(246, 214, 222, 0.45);
    animation: appear 0.35s ease both;
}

.slot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.slot-head span::first-letter {
    text-transform: uppercase;
}

.slot-remove {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.slot-remove:hover {
    background: rgba(255, 255, 255, 0.7);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(122, 74, 92, 0.3);
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chip:hover:not(.selected) {
    box-shadow: inset 0 0 0 1px var(--berry);
}

.chip.selected {
    background: var(--wine);
    color: var(--paper);
    box-shadow: none;
}

.chips-small .chip {
    padding: 6px 13px;
    font-size: 0.98rem;
}

textarea {
    display: block;
    width: 100%;
    margin-top: 22px;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(122, 74, 92, 0.3);
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--ink);
    resize: none;
    outline: none;
}

textarea:focus {
    box-shadow: inset 0 0 0 1.5px var(--berry);
}

.form-error {
    margin-top: 12px;
    text-align: center;
    font-style: italic;
    color: #a3123f;
}

.form-error[hidden] {
    display: none;
}

/* ---------- Fin ---------- */

.recap {
    list-style: none;
    margin: 20px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 500;
}

.recap li::before {
    content: '♥';
    color: var(--rose);
    margin-right: 8px;
}

.recap .recap-idea {
    font-style: italic;
    color: var(--ink-soft);
}

.signature {
    margin-top: 26px;
    font-size: 2.4rem;
    text-align: right;
    padding-right: 10px;
}

/* ---------- Musique ---------- */

.music-toggle {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 100;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(252, 244, 238, 0.14);
    box-shadow: inset 0 0 0 1px rgba(214, 178, 122, 0.5);
    color: var(--gold);
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.music-toggle.off {
    opacity: 0.45;
    text-decoration: line-through;
}

.music-toggle[hidden] {
    display: none;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
    body { font-size: 17px; }
    h1 { font-size: 2.05rem; }
    .card { padding: 30px 18px 24px; }
    .script.big { font-size: 2.7rem; }
    .envelope { width: 270px; height: 180px; }
    .frame { width: 150px; height: 150px; }
    .frame-small { width: 104px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
