@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
    --pink: #ff496d;
    --pink-dark: #e83159;
    --pink-light: #fff1f4;
    --text: #30232a;
    --muted: #927d86;
    --white: #ffffff;
    --border: #f4dfe5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 10%,
            #ffe0e8 0,
            transparent 35%),
        radial-gradient(circle at 90% 90%,
            #ffe3ec 0,
            transparent 35%),
        #fff8fa;
    overflow-x: hidden;
}

button {
    font: inherit;
    cursor: pointer;
    border: 0;
}

button:focus-visible {
    outline: 3px solid #a82a49;
    outline-offset: 4px;
}

.hidden {
    display: none !important;
}

.container {
    width: min(100% - 32px, 580px);
    min-height: 100vh;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 48px 0;
    position: relative;
    z-index: 1;
}

/* Конверт */

.envelope-screen {
    width: 100%;
    text-align: center;
    animation: fadeIn 0.8s ease;
}

.envelope {
    width: 260px;
    height: 180px;
    margin: 0 auto 38px;
    position: relative;
    perspective: 800px;
}

.envelope-body {
    position: absolute;
    inset: 0;
    background: #ffb6c6;
    border-radius: 8px;
    box-shadow: 0 18px 45px #e89aaa55;
}

.envelope-body::before,
.envelope-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

.envelope-body::before {
    left: 0;
    border-width: 90px 130px 0;
    border-color: #ff8da9 transparent transparent;
}

.envelope-body::after {
    right: 0;
    border-width: 0 130px 90px;
    border-color: transparent transparent #ff9eb5;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 130px solid transparent;
    border-right: 130px solid transparent;
    border-top: 100px solid #ff7597;
    transform-origin: top;
    transition: transform 0.8s ease;
    z-index: 5;
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.envelope-letter {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 15px;
    height: 140px;
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    font-family: 'Playfair Display', serif;
    font-size: 19px;
    transition: transform 0.8s ease;
}

.envelope.open .envelope-letter {
    transform: translateY(-85px);
}

.letter-heart {
    font-size: 25px;
}

.envelope-seal {
    position: absolute;
    left: 50%;
    top: 75px;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    background: var(--pink);
    font-size: 25px;
    z-index: 6;
    box-shadow: 0 5px 15px #d94a6b55;
}

.envelope-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    margin: 0 0 12px;
}

.envelope-subtitle {
    color: var(--muted);
    margin-bottom: 28px;
}

/* Кнопки */

.primary-button,
.secondary-button {
    padding: 15px 25px;
    border-radius: 14px;
    font-weight: 700;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.primary-button {
    background: var(--pink);
    color: white;
    box-shadow: 0 7px 20px #ff496d35;
}

.primary-button:hover {
    background: var(--pink-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px #ff496d55;
}

.secondary-button {
    background: #eeeeef;
    color: #77717a;
}

.secondary-button:hover {
    background: #e5e3e6;
}

/* Карточка письма */

.letter-card {
    width: 100%;
    background: white;
    border: 1px solid #f8e6eb;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 80px #d88da51c;
    animation: cardIn 0.6s ease;
}

.letter-top,
.letter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #b39ba4;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
}

.letter-top {
    margin-bottom: 20px;
}

.letter-top span:last-child {
    font-size: 24px;
    color: var(--pink);
}

.progress {
    height: 4px;
    border-radius: 20px;
    background: #f7e8ec;
    margin-bottom: 35px;
    overflow: hidden;
}

.progress-bar {
    width: 20%;
    height: 100%;
    border-radius: 20px;
    background: var(--pink);
    transition: width 0.4s ease;
}

.step-content {
    min-height: 360px;
    animation: fadeIn 0.4s ease;
}

.step-number {
    color: var(--pink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
}

.step-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(28px, 6vw, 38px);
    line-height: 1.2;
    margin: 0 0 15px;
}

.step-description {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 30px;
}

.button-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.button-row button {
    flex: 1;
    min-width: 120px;
}

.yes-button {
    background: var(--pink);
    color: white;
    box-shadow: 0 8px 22px #ff496d40;
}

.no-button {
    background: #ededee;
    color: #8b858a;
    position: relative;
    z-index: 10;
    transition: left 0.2s, top 0.2s;
}

.no-button.running {
    position: fixed;
}

/* Выборы */

.option-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: white;
    text-align: left;
    color: var(--text);
    transition: 0.2s ease;
}

.option:hover {
    border-color: #ff9eb5;
    background: #fff8fa;
    transform: translateY(-2px);
}

.option.selected {
    border: 2px solid var(--pink);
    background: #fff4f7;
    box-shadow: 0 4px 15px #ff496d12;
}

.option-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: #fff0f4;
    border-radius: 14px;
    font-size: 25px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.option-description {
    font-size: 13px;
    color: var(--muted);
}

.option-check {
    color: var(--pink);
    font-size: 20px;
    opacity: 0;
}

.option.selected .option-check {
    opacity: 1;
}

.step-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.step-actions button {
    flex: 1;
}

/* Дата */

.date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.date-option {
    border: 1px solid var(--border);
    background: white;
    border-radius: 16px;
    padding: 20px 12px;
    text-align: center;
    color: var(--text);
    position: relative;
}

.date-option.recommended::before {
    content: "РЕКОМЕНДУЕМ";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--pink);
    color: white;
    border-radius: 20px;
    padding: 4px 9px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.date-option.selected {
    border: 2px solid var(--pink);
    background: #fff4f7;
}

.date-day {
    font-size: 27px;
    font-weight: 700;
    margin-bottom: 5px;
}

.date-label {
    font-size: 13px;
    color: var(--muted);
}

/* Финальный экран */

.final-heart {
    text-align: center;
    font-size: 70px;
    margin: 15px 0 25px;
    animation: heartbeat 1.2s infinite;
}

.final-message {
    font-family: 'Playfair Display', serif;
    font-size: 30px;
    line-height: 1.3;
    text-align: center;
}

.final-summary {
    margin: 25px 0;
    padding: 18px;
    border-radius: 16px;
    background: #fff5f8;
    line-height: 1.9;
    font-size: 14px;
}

.final-summary strong {
    color: var(--pink-dark);
}

/* Фон */

.background-hearts {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.floating-heart {
    position: absolute;
    bottom: -50px;
    color: #ff9eb5;
    opacity: 0.35;
    animation: floatUp linear forwards;
}

.privacy-note {
    margin-top: 25px;
    font-size: 11px;
    color: #b5a0a8;
    text-align: center;
    max-width: 320px;
    line-height: 1.6;
}

.letter-footer {
    border-top: 1px solid #f7e8ec;
    padding-top: 20px;
    margin-top: 25px;
    letter-spacing: 0;
    font-weight: 500;
}

.letter-footer span:last-child {
    font-size: 20px;
}

/* Анимации */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.15);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.1);
    }
}

@keyframes floatUp {
    to {
        transform: translateY(-110vh) rotate(360deg);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .container {
        width: min(100% - 20px, 580px);
        padding: 25px 0;
    }

    .letter-card {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .step-content {
        min-height: 380px;
    }

    .step-title {
        font-size: 29px;
    }

    .envelope {
        transform: scale(0.9);
        margin-bottom: 25px;
    }

    .envelope-title {
        font-size: 27px;
    }

    .button-row {
        flex-direction: column;
    }

    .button-row button {
        width: 100%;
        min-height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
.no-button.running {
    position: fixed;
    z-index: 100;
    transition:
        left 0.25s ease,
        top 0.25s ease;
}

.no-button {
    user-select: none;
    -webkit-user-select: none;
}