/* style.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Arial Rounded MT Bold", "Arial", sans-serif;
  background: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #333;
  overflow-y: auto;
}

.container {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 10px 15px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 10px;
}

h1 {
  color: #e67e22;
  font-size: 1.5rem;
  margin-bottom: 5px;
}

/* 게임 컨테이너 - 핵심 수정: 정사각형 유지 */
.game-container {
  position: relative;
  width: 100%;
  /* 높이를 width와 동일하게 설정하여 정사각형 유지 */
  height: 0;
  padding-bottom: 100%; /* 1:1 비율 */
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  border: 2px solid #e67e22;
  margin: 0 auto;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: none;
}

.stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  gap: 8px;
}

.stat-box {
  background: white;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  flex: 1;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: bold;
  color: #e67e22;
}

.stat-label {
  font-size: 0.7rem;
  color: #7f8c8d;
  margin-top: 2px;
}

.time-bar {
  width: 100%;
  height: 12px;
  background: #ecf0f1;
  border-radius: 6px;
  margin-top: 8px;
  overflow: hidden;
}

.time-progress {
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
  border-radius: 6px;
  transition: width 0.3s ease;
  width: 100%;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

button {
  background: #e67e22;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
}

button:active {
  transform: translateY(0);
}

.share-btn {
  background: #3498db;
}

.share-btn:hover {
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.instructions {
  background: white;
  padding: 12px;
  border-radius: 10px;
  margin-top: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  font-size: 0.8rem;
  line-height: 1.4;
}

.instructions h3 {
  color: #e67e22;
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  color: #e67e22;
  padding: 15px 25px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: bold;
  z-index: 10;
  display: none;
  text-align: center;
  border: 2px solid #e67e22;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  animation: popIn 0.3s ease-out;
}

.message.game-over {
  background: rgba(255, 255, 255, 0.95);
  color: #e74c3c;
  border-color: #e74c3c;
  font-size: 1.4rem;
}

.start-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  color: #e67e22;
  padding: 20px 30px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  border: 2px solid #e67e22;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

#startMessageBtn {
  background: #e67e22;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
}

@keyframes popIn {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* 모바일 최적화 */
@media (max-width: 380px) {
  h1 {
    font-size: 1.3rem;
  }

  .stat-box {
    padding: 8px 10px;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  button {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .instructions {
    font-size: 0.75rem;
  }
}
