body{overscroll-behavior: contain;}

/* 컬러 변수 설정 */
:root {
    /* 백그라운드 */
    --back_main : #1D1D1D;
    --back_header : #141414;
    --back_point : #2E333C;

    /* 메인컬러 */
    --main_color : #504BFF;
    --main_color2 : #567fd3;
    --sub_color1 : #7E36FF;
    --sub_color2 : #9662D8;

    /* 보더컬러 */
    --bord_main : #9FA4A8;
    --bord_sub : #474C52;

    /* 폰트컬러 */
    --font_main : #FFFFFF;
    --font_sub1 : #EAEBED;
    --font_sub2 : #9FA4AB;
    --font_dis : #666666;

    /* 블랙컬러 */
    --black_main : #333;
    --black_dim : rgba(0, 0, 0, 0.7);

    /* 그라데이션컬러 (프로그래스바) */
    --grad_color : linear-gradient(90deg, rgb(176, 64, 255) 0%, rgb(176, 64, 255) 90%, rgb(248, 192, 255) 100%);
}

.game_logo {
    margin-top: 30px;
    width: 100%; max-width: 400px;
}

.game_body {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    padding-top: 49px;
}
.game_body p {
    line-height: 1.6;
}
.game_body p span {
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin: 0 0.2rem;
    word-break: keep-all;
    overflow-wrap: break-word;
}
.game_body p:first-child span {
    background: #FFF;
}
.game_body p:nth-child(2) span {
    background: #ffd400;
}
.game_body p:nth-child(3) span {
    background: #51d539;
}

.game_title{
    display: flex;
    flex-direction: column;
    position: relative;
    top: 20px;
    width: 100%;
}

hr {
    width: 100%; 
}

.start-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.game_help {
    background: #B9B7FF;
    display: flex;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    gap: 10px;
    flex-direction: column;
    margin: 20px auto;
    padding: 2rem;
    border-radius: 1rem;
    color: var(--black_main);
}

#board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: column;
}

#answer {
    font-size: 21px;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
}

#retry {
    left: 35%;
    top: 30px;
}

.rows {
    display: flex;
}

.tile {
    /* box */
    border: 2px solid var(--font_main);
    width: 50px;
    height: 50px;
    margin: 2.5px;
    border-radius: 4px;

    /* text */
    color: var(--font_main);
    font-size: 36px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

.correct {
    background: linear-gradient(
        43deg, #51d539, #39d5bf);
    color: white;
    border-color: #31ffff !important;
    transition-duration: 0.5s;
    animation: twinkle 1.5s;
    animation-iteration-count: infinite;
}

.present {
    background: linear-gradient(136deg, #ffd400, #ffb400);
    color: white;
    border-color: white;
    transition-duration: 0.5s;
}

.absent {
    background-color:#9fa4a84f !important;
    color: white;
    border-color: white;
    transition-duration: 0.5s;
    box-shadow: inset 2px 4px 10px #ffffffa3;
}

.invalid {
    /* Start the shake animation and make the animation last for 0.5 seconds */
    animation: shake 0.2s;
    /* When the animation is finished, start again */
    animation-iteration-count: 2;
    
}

@keyframes twinkle {
    0% { filter: brightness(1); text-shadow: none;}
    50% {
        filter: brightness(1.1);
        text-shadow: 0px 0px 3px white;}
    100% { filter: brightness(1); text-shadow: none;}
}

@keyframes shake {
    0% { transform: translateX(0) }
    25% { transform: translateX(5px) }
    50% { transform: translateX(-5px) }
    75% { transform: translateX(5px) }
    100% { transform: translateX(0) }
   }

.remove {
    display: none;
}

.game_btn {
    position: relative;
    float: left;
    width: 120px;
    padding: 0;
    margin: 10px 20px 10px 20px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    line-height: 50px;
    color: #FFF;
    border-radius: 5px;
    transition: all 0.2s ;
    background: #95DD73;
    box-shadow: 0px 5px 0px 0px #4bad51;
}

.game_btn:hover {
    margin-top: 15px;
    margin-bottom: 5px;
    box-shadow: 0px 0px 0px 0px #4bad51;
}

.key-container {
    width: 365px;
    display: flex;
    flex-wrap: wrap;
    margin-left: 0.5rem;
}

.key-container button {
    width: 28px;
    height: 58px;
    border-radius: 4px;
    border: none;
    background-color: var(--back_point);
    margin: 4px;
    box-shadow: inset 1px 3px 5px #ffffff17;
}

.key-container button:nth-child(11) {
    margin-left: 20px;
}

.key-container button:nth-child(20),
.key-container button:nth-child(28) {
    width: 46px;
    background: var(--main_color);
}

.keyboard { 
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* 모달 */
.modal-wrap{
    background-color:rgba(0,0,0,.3);
    justify-content:center;
    align-items:center;
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    display:none;
    padding:15px;
    z-index: 9999;
}
.modal{
    position: relative;
    width:100%;
    max-width:400px;
    background-color:#ffffff;
    border-radius:10px;
    background-color:var(--font_main);
    box-shadow: 5px 10px 10px 1px rgba(0,0,0,.3);
}
.modal-head{
    width:100%;
    height:max-content;
    display:flex;
    align-items:center;
    justify-content:center;
    padding-block: 1rem;
}
.head-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -3px;
    text-align: center;
    color: var(--black_main);
}

.modal-body{
    width:100%;
    background-color:var(--font_main);
    color: var(--font_dis);
}

.body-content{
    width: 100%;
    padding: 30px;
    display: flex;
    justify-content: center;
    font-size: 25px;
    font-weight: 600;
}

.modal-foot{
    width:100%;
    height:50px;
}

.modal-btn{
    display: inline-flex;
    width: 100%;
    height: max-content;
    float: left;
    align-items: center;
    color: var(--font_main);
    cursor: pointer;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.modal-btn.confirm{
    border-right:1px solid var(--main_color);
    background: #B9B7FF;
    color: var(--black_main);
    padding-block: 1rem;
    border: 4px solid var(--font_main);
    border-radius: 0 0 10px 10px;
}

#fail-modal > .modal::after {
    content: "";
    display: block;
    position: absolute;
    width: 5.5rem;
    height: 5.5rem;
    z-index: 2;
    top: -45px;
    left: -18px;
    background-image: url(../image/wordle_fail.png);
    background-size: 100%;
}
#success-modal > .modal::after {
    content: "";
    display: block;
    position: absolute;
    width: 5.5rem;
    height: 5.5rem;
    z-index: 2;
    top: -45px;
    left: -18px;
    background-image: url(../image/wordle_success.png);
    background-size: 100%;
}
@media screen and (min-width: 801px) {
    .modal-wrap {
        padding-right: 300px;
    }
}
@media screen and (min-width: 600px) {
    .tile {
        /* box */
        border: 2px solid var(--font_main);
        width: 65px;
        height: 65px;
        margin: 2.5px;
        border-radius: 4px;
    
        /* text */
        color: var(--font_main);
        font-size: 36px;
        font-weight: bold;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .key-container {
        width: 500px;
        display: flex;
        flex-wrap: wrap;
    }

    .key-container button {
        width: 42px;
        height: 58px;
        border-radius: 4px;
        border: none;
        background-color: var(--back_point);
        margin: 4px;
    }

    .key-container button:nth-child(11) {
        margin-left: 27px;
    }

    .key-container button:nth-child(20),
    .key-container button:nth-child(28) {
        width: 67px;
    }
}
@media screen and (max-width: 380px) {
    .key-container button{
        width: 27px;
    }
}
@media screen and (max-width: 360px) {
     .key-container button{
    width: 6.6vw;
}
.key-container button:nth-child(1) {
    
    margin-left: 15px;
}
.key-container button:nth-child(11) {
    margin-left: 30px;
}
}
.white_txt, .yellow_txt, .green_txt{padding-inline: 4px;}
.white_txt{background:#fff;}
.yellow_txt{background:#ddc747;}
.green_txt{background:#95DD73;}