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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #12CF70;
    position: relative;
}

body {
    width: 900px;
    height: 580px;
    background-image: url(./assets/background.png);
    border-radius: 30px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

#start-screen {
    position: relative;
    height: 100%;
    width: 100%;
    flex-direction: column;
    display: flex;
    align-items: center;
}

#title {
    position: absolute;
    display: flex;
    gap: 10px;
    top: 15px;
    left: 50px;
    margin: 0;
    user-select: none;
    font-size: 40px;
    filter: drop-shadow(0px 5px 3px rgba(0, 0, 0, 0.3));
    font-family: "Kanit", sans-serif;
    font-weight: 900;
}

#title-1 {
    margin: 0;
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: white;
    background: linear-gradient(to bottom, #ff6600, #ff9900);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#title-2 {
    margin: 0;
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: white;
    background: linear-gradient(to bottom, #66cc33, #00aa00);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-top: 190px;
}

#start-apple {
    position: relative;
    display: block;
    width: 200px;
    height: 200px;
    /* box-shadow: 5px 5px 5px gray;    이렇게 하면 요소의 사각형 경계에 적용됨 */
    filter: drop-shadow(5px 5px 3px rgba(0, 0, 0, 0.3)); /* 사과 모양을 따라 그림자 적용 */
}

#start-button {
    position: relative;
    height: 200px;
    background: none;
    padding: 0;
    margin: 0;
    border: none;
}

#apple-tree {
    margin-left: 80px;
    display: block;
    width: 350px;
    filter: drop-shadow(5px 5px 3px rgba(0, 0, 0, 0.3));
}

img {
    user-select: none;
}

#start-text {
    position: absolute; /* 이미지 위에 텍스트를 겹치게 */
    font-family: "Montserrat", sans-serif;
    font-size: 50px;
    color: white;
    pointer-events: none;   /* 텍스트 클릭 방지 */
    z-index: 1;
    top: 30%; /* 사과 이미지의 세로 중앙 */
    left: 48%; /* 사과 이미지의 가로 중앙 */
    transform: translate(-50%, -50%); /* 중앙 정렬 보정 */
    user-select: none;
}

#top-bar {
    position: absolute;
    top: -40px;
    width: 94%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

#top-bar p {
    color: #DBF4C1;
    margin: 0;
}

#setting {
    position: absolute;
    bottom: -45px;
    width: 90%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

#setting div {
    display: flex;
}

#setting button {
    background: transparent;
    border-color: #DBF4C1;
    border-style:double;
    padding: 4px;
    width: 60px;
    color: #DBF4C1;
    cursor: pointer;
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
    user-select: none;
}

#bgm-checkbox {
    display: flex;
    align-items: center;
}

#bgm-checkbox input {
    display: inline-block;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

#bgm-checkbox label {
    display: inline-block;
    color: #DBF4C1;
    margin-left: 5px;
    cursor: pointer;
    user-select: none;
}

#game-screen {
    display: none;
}

/* 애니메이션: 화면 전환 */
.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.5s ease-in forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; display: none; }
    to { opacity: 1; }
}

/* 애니메이션: 시작 버튼 */
.pulse {
    animation: pulseAnimation 0.4s ease-in-out 1;
}

@keyframes pulseAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); } /* 살짝 커지게 */
    100% { transform: scale(1); }
}

#game-board {
    display: grid;
    grid-template-columns: repeat(17, 45px);
    grid-template-rows: repeat(10, 45px);
    gap: 5px;
    width: 850px;
    height: 500px;
    justify-content: center;
    align-items: center;
}

.game-apple {
    position: relative;
    width: 45px;
    height: 45px;
    background-image: url('./assets/gameApple.png');
    background-size: cover;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
    pointer-events: auto;
}

.apple-number {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Montserrat", sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: white;
    pointer-events: none;
    user-select: none;
}

.selected-apple {
    border: 5px solid yellow;
    box-sizing: border-box;
}

#game-over-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    
}

#game-over-modal div {
    background-color: rgba(255, 255, 255, 0.85);
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    font-family: "Montserrat", sans-serif;
    user-select: none;
}

#game-over-modal p {
    margin-top: 0;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 20px;
    color: #865624;
    filter: drop-shadow(0px 5px 3px rgba(0, 0, 0, 0.3));
}

#replay-button {
    background: #10B663;
    border-color: #DBF4C1;
    border-style:double;
    border-radius: 10px;
    padding: 8px;
    width: 70px;
    color: #DBF4C1;
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
    cursor: pointer;
    filter: drop-shadow(0px 5px 3px rgba(0, 0, 0, 0.3));
}

#game-over-text {
    font-family: "Kanit", sans-serif;
    font-size: 80px;
    font-weight: 900;
    filter: drop-shadow(0px 5px 3px rgba(0, 0, 0, 0.3));
    margin: 0;
    -webkit-text-stroke-width: 2px;
    -webkit-text-stroke-color: white;
    background: linear-gradient(to bottom, #ff6600, #ff9900);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}