:root {
    --bg-color: #fbecdd;
    --board-bg: #fff0f5;
    --primary-color: #ff6b6b;
    --text-color: #4a4a4a;
    --cell-size: 50px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Jua', sans-serif;
    user-select: none;
    /* 드래그 방지 */
}

body {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
}

.game-container {
    background-color: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 500px;
    /* 모바일 폭에 맞게 최대 너비 조정 */
    height: 100vh;
    /* 전체 화면 높이 사용 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* 세로 중앙 정렬 */
}


header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    text-shadow: 2px 2px 0px #ffe3e3;
    margin: 0;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.header-btns {
    position: absolute;
    right: 0;
    display: flex;
    gap: 10px;
}


.icon-btn:hover {
    transform: scale(1.2);
}


.info-panel {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.score-box,
.timer-box {
    background-color: #f1f8ff;
    padding: 10px 20px;
    border-radius: 15px;
    min-width: 100px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.score-box span:last-child,
.timer-box span:last-child {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.game-board {
    display: grid;
    /* grid-template-columns/rows는 JS에서 설정 */
    gap: 4px;
    background-color: var(--board-bg);
    padding: 10px;
    border-radius: 10px;
    margin: 0 auto;

    width: 100%;
    aspect-ratio: 1 / 1;
    /* 정사각형 비례 유지 */
    max-width: 500px;
    max-height: 500px;

    border: 4px solid #ffdde1;

    /* 작은 보드일 때 중앙 정렬 */
    justify-content: center;
    align-content: center;
}

.cell {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.cell:hover {
    transform: scale(1.05);
}

.cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

.cell.selected {
    background-color: #ffe3e3;
    border: 2px solid var(--primary-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(0.95);
    }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#restart-btn,
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

#restart-btn:hover,
.primary-btn:hover {
    background-color: #ff5252;
}

/* 설정 모달 스타일 */
.setting-item {
    margin: 20px 0;
    text-align: left;
}

.setting-item label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
}

.setting-item input[type=range] {
    width: 100%;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.io-select {
    width: 100%;
    padding: 8px;
    font-size: 1rem;
    border-radius: 5px;
    border: 2px solid #ddd;
    font-family: 'Jua', sans-serif;
    color: var(--text-color);
}


/* 7x7 그리드에서 cell-size 조절을 위한 미디어 쿼리 필요시 추가 */