*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Poppins',sans-serif;
}

body{
    background:linear-gradient(135deg,#d9c7ff,#ffe5ef);
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    overflow-x:hidden;
    padding:20px;
}

.hidden{
    display:none;
}

/* ---------------- Welcome Screen ---------------- */

#welcomeScreen{
    text-align:center;
    animation:fadeIn 1.2s ease;
}

#welcomeScreen h1{
    font-size:60px;
    color:#673ab7;
    margin-bottom:10px;
}

.tagline{
    font-size:22px;
    color:#555;
    margin-bottom:60px;
    line-height:1.5;
}

.tap{
    margin-top:35px;
    color:#777;
    font-size:18px;
}

/* ---------------- Envelope ---------------- */

#envelope{
    width:260px;
    height:180px;
    margin:auto;
    position:relative;
    cursor:pointer;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 20px 40px rgba(0,0,0,.2);
    transition:.3s;
    background:#fff;
}

#envelope:hover{
    transform:scale(1.05);
}

.top{
    position:absolute;
    top:0;
    left:0;
    width:0;
    height:0;
    border-left:130px solid transparent;
    border-right:130px solid transparent;
    border-top:90px solid #f6d4df;
    transform-origin:top;
    transition:1s;
    z-index:5;
}

.bottom{
    position:absolute;
    inset:0;
    background:white;
}

.bottom::before{
    content:"";
    position:absolute;
    left:0;
    bottom:0;
    width:0;
    height:0;
    border-left:130px solid transparent;
    border-right:130px solid transparent;
    border-bottom:90px solid #f6d4df;
}

.letter{
    position:absolute;
    width:90%;
    height:145px;
    left:5%;
    top:20px;
    background:white;
    border-radius:10px;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:55px;
    transition:1s;
    z-index:2;
    box-shadow:0 5px 15px rgba(0,0,0,.1);
}

.open .top{
    transform:rotateX(180deg);
}

.open .letter{
    transform:translateY(-120px);
}

/* ---------------- Main App ---------------- */

#app{
    width:90%;
    max-width:850px;
    animation:fadeIn 1s;
}

header{
    margin-bottom:30px;
}

header h1{
    color:#673ab7;
    text-align:center;
}

.card{
    background:white;
    padding:30px;
    border-radius:20px;
    box-shadow:0 20px 40px rgba(0,0,0,.15);
}

label{
    display:block;
    margin-top:18px;
    margin-bottom:8px;
    font-weight:600;
}

input,
textarea{
    width:100%;
    padding:15px;
    border:none;
    border-radius:10px;
    background:#f4f4f4;
    font-size:16px;
    outline:none;
}

textarea{
    height:180px;
    resize:none;
}

.card button{
    width:100%;
    margin-top:25px;
    padding:18px;
    background:#673ab7;
    color:white;
    border:none;
    border-radius:12px;
    cursor:pointer;
    font-size:18px;
    transition:.3s;
}

.card button:hover{
    background:#5b2fb3;
}

/* ---------------- Saved Letters ---------------- */

#letters{
    margin-top:30px;
}

.savedLetter{
    background:white;
    margin-top:20px;
    padding:20px;
    border-radius:15px;
    box-shadow:0 10px 20px rgba(0,0,0,.15);
}

.letterHeader{
    display:flex;
    justify-content:space-between;
    align-items:center;
    cursor:pointer;
}

.letterHeader h3{
    color:#673ab7;
}

.locked{
    margin-top:10px;
    color:#666;
}

.savedLetter button{
    margin-top:15px;
    padding:10px 18px;
    border:none;
    border-radius:8px;
    cursor:pointer;
}

.savedLetter button:disabled{
    background:#ccc;
    color:#555;
}

.deleteBtn{
    background:#ff4d4d;
    color:white;
}

.deleteBtn:hover{
    background:#e53935;
}

/* ---------------- Hidden Letter ---------------- */

.letterContent{
    display:none;
    margin-top:15px;
    line-height:1.6;
    word-wrap:break-word;
}

.letterContent p{
    white-space:pre-wrap;
}

/* ---------------- Animation ---------------- */

@keyframes fadeIn{

    from{
        opacity:0;
        transform:translateY(20px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }

}

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

@media(max-width:600px){

    #welcomeScreen h1{
        font-size:42px;
    }

    .tagline{
        font-size:18px;
    }

    #envelope{
        width:220px;
        height:150px;
    }

    .top{
        border-left:110px solid transparent;
        border-right:110px solid transparent;
        border-top:75px solid #f6d4df;
    }

    .bottom::before{
        border-left:110px solid transparent;
        border-right:110px solid transparent;
        border-bottom:75px solid #f6d4df;
    }

    .letter{
        height:120px;
        font-size:45px;
    }

}