@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');

html,body{
    height: 100%;
}

body{
    margin: 0;
    display: grid;
    place-items: center;
    font-family: 'Ubuntu';
    background: #37353b;
}

button{
    font-family: inherit;
    cursor: pointer;
    background: #1a1a1a;
    color: #f9f9f9;
    border: 0;
    border-radius: 8px;
    padding: 20px 36px;
    font-size: 16px;
}

/* 遮罩 */
.modal-background{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(1,1);
    background: rgba(0, 0, 0, 0.5);
    transition: 0.5s;
}

/* 如果open情況下 顯示modal-background */
body.open .modal-background{
    visibility: visible;
    opacity: 1;
    animation: background-in 3s both;
}

.modal{
    position: fixed;
    top: 50%;
    left: 50%;
    background:#37353b;
    color: #f9f9f9;
    padding: 48px 40px;
    border-radius: 12px;
    width: 300px;
    translate: -50% -50%;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

body.open .modal{
    opacity: 1;
    visibility:visible;
    animation: modal-in 3s both;
}


h2{
    margin: 0 0 8px;
    font-weight: 400;
    font-size: 21pz;
}

p{
    margin: 0;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes background-in {
    /* scale 元素變形 (寬,高)*/
    0%{
        scale: 0 0.005;
    }
    33%{
        scale: 1 0.005;
    }
    66%,100%{
        scale: 1 1;
    }
}

@keyframes modal-in {
    0%,33%{
        opacity: 0;
        visibility: hidden;
        translate: -50% -10%;
    }
    100%{
        opacity: 1;
        visibility: visible;
    }
}