/* kidscalstyles.css */
@import url('https://fonts.googleapis.com/css2?family=Dongle:wght@300&family=Gamja+Flower&family=Gowun+Dodum&display=swap');
* {
    box-sizing: border-box;
}

body {
    font-family: "Gowun Dodum", sans-serif;
    background-color: #f0f8ff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    margin: 0;
    min-height: 100vh;
    overflow-y: auto;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    font-size: 24px;
}

.display-area, .result-area {
    width: 100%;
    max-width: 500px;
    min-height: 120px;
    border: 2px solid;
    border-radius: 10px;
    background-color: #ffffff;
    margin-bottom: 10px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
}

.display-area {
    border-color: #4CAF50;
}

.result-area {
    border-color: #ffa500;
    font-size: 18px;
    color: #333;
    display: flex;
    flex-direction: row; /* 한 줄로 표시 */
    align-items: center;
    flex-wrap: wrap; /* 필요 시 행바꿈 */
}

.buttons-row {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
}

.button {
    width: 80px;
    height: 100px;
    margin: 5px;
    border: none;
    border-radius: 10px;
    background-color: #ffcccb;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.button img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.button .fruit-name {
    margin-top: 5px;
    font-size: 14px;
    color: #333;
}

.button.operator {
    width: 80px;
    height: 80px;
    background-color: #add8e6;
    font-size: 24px;
    padding: 0;
    justify-content: center;
}

.button.operator.backspace {
    background-color: #f08080; /* 백스페이스 버튼 색상 변경 */
}

.button.operator:active {
    background-color: #ddd;
}

.button:active {
    background-color: #ddd;
}

.fruit-count {
    position: absolute;
    top: 5px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.display-area img {
    width: 30px;
    height: 30px;
    margin: 2px;
    object-fit: contain;
    border: 2px solid transparent; /* 기본 테두리 */
}

.display-area img:last-child {
    border: 2px solid #ff0000; /* 마지막 과일 강조 테두리 */
}

.result-area img, .result-area .fruit-result img {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    object-fit: contain;
}

.result-area .fruit-result {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.result-area .fruit-result:last-child {
    margin-right: 0;
}

/* 연산자 기호 스타일링 */
.display-area span.operator-symbol {
    font-size: 24px;
    margin: 0 5px;
}

/* 결과 창의 과일 아이콘과 개수 정렬 */
.result-area .fruit-result {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.result-area .fruit-result img {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

/* 반응형 디자인 */
@media (max-width: 600px) {
    .button {
        width: 70px;
        height: 90px;
    }

    .button.operator {
        width: 70px;
        height: 70px;
        font-size: 20px;
    }

    .result-area img, .display-area img {
        width: 25px;
        height: 25px;
    }

    h1 {
        font-size: 20px;
    }
}

@media (max-width: 400px) {
    .button {
        width: 60px;
        height: 80px;
    }

    .button.operator {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }

    .result-area img, .display-area img {
        width: 20px;
        height: 20px;
    }

    h1 {
        font-size: 18px;
    }
}

/* 모바일 세로 화면 최적화 */
@media (orientation: portrait) and (max-width: 600px) {
    .buttons-row {
        max-width: 100%;
    }
}
