:root {
  --bg-color: #f0f2f5;
  --text-color: #333;
  --primary-color: #4a90e2;
  --secondary-color: #6c757d;
  --normal-target: #3498db;
  --rare-target: #f1c40f;
  --bomb-target: #e74c3c;
  --danger-color: #e74c3c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation; /* スマホでの操作遅延を無効化 */
}

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden; /* スクロール防止 */
  user-select: none; /* テキスト選択防止 */
  -webkit-user-select: none;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* 画面共通スタイル */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
}

.screen.active {
  display: flex;
}

/* タイトル画面・リザルト画面のレイアウト */
#title-screen, #result-screen {
  justify-content: center;
  align-items: center;
  background-color: #fff;
  padding: 20px;
  text-align: center;
}

h1 {
  font-size: 3rem;
  margin-bottom: 2rem;
  color: var(--primary-color);
  letter-spacing: 2px;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  padding: 15px 30px;
  font-size: 1.2rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s, background-color 0.2s;
}

.btn:active {
  transform: scale(0.95);
}

.btn-secondary {
  background-color: var(--secondary-color);
  margin-top: 1rem;
}

.btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.ranking-container {
  margin-top: 2rem;
  width: 100%;
  max-width: 400px;
  background: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

#ranking-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

#ranking-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
}
#ranking-list li:last-child {
  border-bottom: none;
}

/* プレイ画面ヘッダー */
#play-header {
  height: 60px;
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  z-index: 10;
}

/* プレイ領域 */
#play-area {
  flex-grow: 1;
  position: relative;
  background-color: #e0e6ed;
  overflow: hidden;
  cursor: crosshair; /* エイム用カーソル */
}

/* ターゲット共通スタイル */
.target {
  position: absolute;
  border-radius: 50%;
  cursor: crosshair;
  transform: translate(-50%, -50%); /* 中央を基準に配置 */
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

.target:active {
  transform: translate(-50%, -50%) scale(0.9);
}

.target-normal {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle at 30% 30%, #5dade2, var(--normal-target));
}

.target-rare {
  width: 35px;
  height: 35px;
  background: radial-gradient(circle at 30% 30%, #f7dc6f, var(--rare-target));
}

.target-bomb {
  width: 70px;
  height: 70px;
  background: radial-gradient(circle at 30% 30%, #f1948a, var(--bomb-target));
}

/* ターゲット削除時のアニメーション */
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.target.popping {
  animation: pop 0.2s ease-out forwards;
}

/* スコアポップアップ表示のアニメーション */
.score-popup {
  position: absolute;
  font-weight: bold;
  font-size: 1.5rem;
  color: var(--primary-color);
  pointer-events: none;
  animation: floatUp 0.8s ease-out forwards;
  z-index: 20;
}

.score-popup.penalty {
  color: var(--danger-color);
}

@keyframes floatUp {
  0% { transform: translate(-50%, -50%); opacity: 1; }
  100% { transform: translate(-50%, -150%); opacity: 0; }
}

/* リザルト画面スタイル */
.result-score {
  font-size: 2rem;
  font-weight: bold;
  margin: 20px 0;
  color: var(--primary-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 20px auto;
}

input[type="text"] {
  padding: 12px;
  font-size: 1.2rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  text-align: center;
}

input[type="text"]:focus {
  border-color: var(--primary-color);
}

#register-message {
  height: 20px;
  margin-bottom: 10px;
  color: var(--primary-color);
  font-weight: bold;
}
