/* ===== 기본 리셋 & 페이지 배경 ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 은은한 다크 그라데이션 배경 */
  background: radial-gradient(circle at 50% 0%, #1f2937, #0b1120);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", sans-serif;
  color: #e5e7eb;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 게임 전체 레이아웃 ===== */
.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
  width: 100%;
  max-width: 432px;
}

h1 {
  font-size: 28px;
  letter-spacing: 1px;
}

/* ===== 점수판 ===== */
.scoreboard {
  display: flex;
  gap: 24px;
  font-size: 16px;
  color: #9ca3af;
}
.scoreboard strong {
  color: #f9fafb;
  font-size: 18px;
}

/* ===== 캔버스 ===== */
.canvas-wrap {
  position: relative;
  width: 100%;
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;          /* 항상 정사각형 유지 */
  background: #0f172a;
  border: 2px solid #1e293b;
  border-radius: 12px;
  display: block;
}

/* ===== 캔버스 위에 겹치는 안내창(시작/게임오버) ===== */
.overlay {
  position: absolute;
  inset: 0;                      /* 캔버스를 꽉 채움 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(8, 12, 24, 0.82);
  border-radius: 12px;
  text-align: center;
  padding: 16px;
}
/* hidden 클래스가 붙으면 안내창을 숨김 */
.overlay.hidden {
  display: none;
}
#overlayTitle {
  font-size: 26px;
  font-weight: 700;
}
#overlayDesc {
  font-size: 15px;
  color: #9ca3af;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
}

#startBtn {
  margin-top: 8px;
  padding: 12px 28px;
  background: #22c55e;
  color: #06210f;
  transition: transform 0.08s ease, background 0.15s ease;
}
#startBtn:hover { background: #16a34a; }
#startBtn:active { transform: scale(0.96); }

/* ===== 모바일 터치 방향 버튼 ===== */
.touch-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.touch-row {
  display: flex;
  gap: 8px;
}
.touch-pad button {
  width: 64px;
  height: 56px;
  font-size: 22px;
  background: #1e293b;
  color: #e5e7eb;
}
.touch-pad button:active {
  background: #334155;
}

/* 데스크톱(마우스+키보드 환경)에선 터치패드 숨김 */
@media (hover: hover) and (pointer: fine) {
  .touch-pad {
    display: none;
  }
}
