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

body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    position: relative;
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 16px 12px;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

.title {
    font-size: 1.6rem;
    color: #831843;
    text-align: center;
}

.cat-wrapper {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(131, 24, 67, 0.1);
    overflow: hidden;
    flex-shrink: 0;
}

.cat-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.question {
    font-size: 1.05rem;
    color: #9d174d;
    text-align: center;
    line-height: 1.4;
    padding: 0 8px;
}

.buttons {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    min-height: 56px;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-yes {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-yes:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.5);
    transform: scale(1.03);
}

.btn-no {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

.btn-no:hover {
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.5);
}

.btn-no.running {
    position: fixed;
    z-index: 10;
    transition: none;
}

.btn-restart {
    background: transparent;
    color: #9d174d;
    border: 2px solid #9d174d;
    padding: 10px 24px;
    font-size: 0.95rem;
    cursor: pointer;
}

.success-text {
    font-size: 1.2rem;
    color: #831843;
    text-align: center;
    line-height: 1.6;
    padding: 0 8px;
    max-width: 400px;
}

/* --- Envelope Screen --- */
.envelope {
    position: relative;
    width: 260px;
    margin: 0 auto;
    perspective: 800px;
}

.envelope-flap {
    width: 100%;
    height: 90px;
    background: linear-gradient(180deg, #fce7f3, #f9a8d4);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
    position: relative;
    z-index: 2;
}

.envelope-flap.open {
    transform: rotateX(180deg);
}

.envelope-body {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #fff0f3, #fce7f3);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(131, 24, 67, 0.12);
    position: relative;
    overflow: hidden;
}

.envelope-body.open {
    overflow: visible;
}

.envelope-letter {
    position: absolute;
    top: 12%;
    left: 10%;
    width: 80%;
    height: 76%;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.6s ease 0.3s;
    z-index: 1;
}

.envelope-letter.slide-up {
    transform: translateY(-130%);
}

.envelope-letter-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.envelope-seal {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    z-index: 5;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 1px 3px rgba(131, 24, 67, 0.2));
}

.envelope-seal.fade {
    opacity: 0;
}

.envelope-form {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.date-input {
    padding: 12px 16px;
    border: 2px solid rgba(157, 23, 77, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    color: #831843;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    outline: none;
    transition: border-color 0.3s ease;
}

.date-input:focus {
    border-color: rgba(157, 23, 77, 0.5);
}

@keyframes envelope-shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-6px); }
    30%, 60%, 90% { transform: translateX(6px); }
}

.envelope.shake {
    animation: envelope-shake 0.5s ease;
}

@media (min-width: 520px) {
    .container {
        padding: 32px 24px;
    }

    .screen {
        gap: 20px;
    }

    .cat-wrapper {
        width: 260px;
        height: 260px;
    }

    .title {
        font-size: 2.2rem;
    }

    .question {
        font-size: 1.3rem;
        line-height: 1.5;
    }

    .buttons {
        min-height: 80px;
    }

    .envelope {
        width: 300px;
    }

    .envelope-flap {
        height: 100px;
    }

    .envelope-body {
        height: 170px;
    }

    .envelope-seal {
        top: 100px;
    }
}
