/* 게임 컨테이너 */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin: 2rem auto;
  max-width: 450px;
  position: relative;
  gap: 2rem;
}

/* 게임 보드 */
.game-board {
  position: relative;
  margin: 0 auto;
  width: 350px;
  height: 350px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas 포커스 스타일 */
.game-container canvas {
  outline: none;
}

.game-container canvas:focus {
  box-shadow: 0 0 0 3px rgba(143, 122, 102, 0.3);
}

.score-container {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 450px;
  margin: 0.5rem 0; /* 여백 줄임 */
}

.score-info {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background-color: #bbada0;
  text-align: center;
  color: #776e65;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  width: 100%;
  max-width: 320px;
}

.score-value {
  font-size: 18px;
  font-weight: bold;
  color: #f9f6f2;
}

.score-divider {
  margin: 0 0.5rem;
  color: #eee4da;
  font-weight: bold;
}

.controls {
  display: flex;
  gap: 0.8rem;
  margin: 2rem 0;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  max-width: 450px;
}

.control-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  background-color: #8f7a66;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.control-btn:hover {
  background-color: #776e65;
}

.control-btn:active {
  background-color: #6d5d52;
}

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

.modal-content {
  background-color: #faf8ef;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.modal-content h3 {
  margin-bottom: 1rem;
  color: #776e65;
}

.modal-content button {
  background-color: #8f7a66;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.modal-content button:hover {
  background-color: #776e65;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .game-container {
    max-width: 320px;
    margin: 0.5rem auto; /* 여백 추가 축소 */
  }
  
  .game-board {
    width: 300px;
    height: 300px;
    margin-top: 0.5rem; /* 여백 추가 */
  }

  .score-container {
    max-width: 320px;
  }

  .score-info {
    padding: 0.5rem;
    max-width: 300px;
    font-size: 14px;
  }
  
  .score-value {
    font-size: 16px; /* 모바일에서 폰트 크기 추가 축소 */
  }
  
  .score-divider {
    margin: 0 0.3rem;
  }
  
  .controls {
    max-width: 300px;
    gap: 0.5rem;
    margin: 0.8rem 0; /* 여백 추가 축소 */
  }
  
  .control-btn {
    font-size: 12px;
    padding: 0.5rem 0.8rem;
  }
}

/* 더 작은 화면에 대한 추가 미디어 쿼리 */
@media (max-width: 350px) {
  .game-container {
    max-width: 280px;
  }
  
  .game-board {
    width: 280px;
    height: 280px;
  }
  
  .score-info {
    padding: 0.4rem;
    max-width: 280px;
    font-size: 13px;
  }
  
  .score-value {
    font-size: 15px;
  }
  
  .controls {
    max-width: 280px;
  }
  
  .control-btn {
    font-size: 11px;
    padding: 0.4rem 0.6rem;
  }
}
