/* bodyをflexで中央配置 */
body {
  margin: 0;
  padding: 0;
  font-family: 'DotGothic16', sans-serif;
  background: #000;
  display: flex;
  justify-content: center;  /* 横中央 */
  align-items: center;      /* 縦中央 */
  height: 100vh;
}

/* タイトル画面 */
#titleScreen {
  width: 480px;
  height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;

  /* 背景画像を追加 */
  background: url('images/title.png') no-repeat center center;
  background-size: cover;
}

#titleScreen h1 {
  color: #fff;
  margin-bottom: 20px;
}

#startButton {
  padding: 12px 24px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  background: #1d6eb0;
  color: #fff;
  border: none;
}

#soundToggle {
  margin-top: 16px;
  padding: 8px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  background:#c78787;
  color: #fff;
  border: 2px solid #fff;
}

/* ゲーム画面 */
#gameScreen {
  width: 480px;
  height: 640px;
  position: relative;
}

/* canvas */
#game {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: #000;
}

/* 移動ボタン */
#controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8vw;
  z-index: 10;
}

#controls button {
  width: 70px;
  height: 70px;
  font-size: 28px;
  opacity: 0.5;
  background: rgba(85,85,85,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s;
}

#controls button:active {
  opacity: 0.9;
}

/* ゲーム終了ボタン */
#endButtons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

#endButtons button {
  padding: 12px 24px;
  font-size: 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0.8;
  background: rgba(72, 177, 222, 1);
  color: #fff;
  transition: opacity 0.2s;
}

#endButtons button:hover {
  opacity: 1.0;
}

/* チュートリアルオーバーレイ */
#tutorialOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 30;
}

#tutorialSlide {
  width: 80%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#tutorialSlide img {
  width: 100%;
  border-radius: 12px;
}

#tutorialControls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

#tutorialControls button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background: rgba(72, 177, 222, 1);
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s;
}

#tutorialControls button:hover {
  opacity: 1.0;
}

#tutorialPage {
  color: #fff;
  font-size: 16px;
  min-width: 50px;
  text-align: center;
}

/* 画面が小さい場合のレスポンシブ対応 */
@media screen and (max-width: 480px), screen and (max-height: 640px){
  #gameScreen {
    width: 90vw;
    height: auto;
  }
  #titleScreen {
    width: 90vw;
    height: calc(90vw * (640 / 480));
  }
  #game {
    width: 100%;
    height: auto;
  }
}

/* ニックネーム入力エリア */
#nicknameArea {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 25;
  width: 80%;
}

#nicknameInput {
  width: 100%;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  box-sizing: border-box;
  text-align: center;
}

#submitRanking {
  padding: 10px 24px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background: rgba(72,177,222,1);
  color: #fff;
  cursor: pointer;
}