* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  touch-action: none;
  user-select: none;
}

/* ========== スタート画面 ========== */
#startScreen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 100;
}

#startScreen h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: #fff;
  text-shadow: 0 0 30px rgba(100, 200, 255, 0.6);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

#startScreen .sub {
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  color: #aad4f5;
  margin-bottom: 3rem;
}

.difficulty-btns {
  display: flex;
  gap: 2rem;
}

.diff-btn {
  padding: 1rem 3rem;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: bold;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.1em;
}

#btnEasy {
  background: linear-gradient(135deg, #56ab2f, #a8e063);
  color: #fff;
  box-shadow: 0 4px 20px rgba(86, 171, 47, 0.5);
}
#btnEasy:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(86, 171, 47, 0.7);
}

#btnHard {
  background: linear-gradient(135deg, #e05555, #f09060);
  color: #fff;
  box-shadow: 0 4px 20px rgba(224, 85, 85, 0.5);
}
#btnHard:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(224, 85, 85, 0.7);
}

/* ========== ゲーム画面 ========== */
#gameScreen {
  position: fixed;
  inset: 0;
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#gameUI {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
}

#uiLeft {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 14px;
  padding: 0.7rem 1.3rem;
  color: #fff;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.8;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

#uiLeft span {
  font-weight: bold;
  color: #ffe066;
}

/* ========== 終了・クリア画面共通 ========== */
#endScreen,
#clearScreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
}

#clearScreen canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 201;
}

.end-panel,
.clear-panel {
  position: relative;
  z-index: 202;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  padding: 2.5rem 3.5rem;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  animation: popIn 0.5s cubic-bezier(.36, 2, .6, 1) forwards;
  min-width: min(400px, 85vw);
}

.end-panel h2,
.clear-panel h2 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: #2255aa;
  margin-bottom: 0.8rem;
}

.clear-panel h2 {
  color: #e07020;
  text-shadow: 0 2px 16px rgba(255, 180, 50, 0.4);
}

#endScore,
#endTime,
#clearScore,
#clearTime {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: #333;
  margin-bottom: 0.5rem;
}

#endScore span,
#endTime span,
#clearScore span,
#clearTime span {
  font-weight: bold;
  font-size: 1.3em;
  color: #e05555;
}

#endMessage {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: #555;
  margin-bottom: 1.5rem;
}

.clear-panel p:nth-child(2) {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: #e07020;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.end-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.end-btn {
  padding: 0.7rem 1.8rem;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.05em;
}

#retryBtn, #clearRetryBtn {
  background: linear-gradient(135deg, #56ab2f, #a8e063);
  color: #fff;
  box-shadow: 0 3px 14px rgba(86, 171, 47, 0.4);
}
#retryBtn:hover, #clearRetryBtn:hover {
  transform: scale(1.05);
}

#titleBtn, #clearTitleBtn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  box-shadow: 0 3px 14px rgba(102, 126, 234, 0.4);
}
#titleBtn:hover, #clearTitleBtn:hover {
  transform: scale(1.05);
}

@keyframes popIn {
  0%   { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ========== 的：倒れるアニメーション ========== */
.target-squash {
  animation: squash 0.3s ease-out forwards;
}

@keyframes squash {
  0%   { transform: scaleY(1);   opacity: 1; }
  40%  { transform: scaleY(0.2) scaleX(1.3); opacity: 0.8; }
  100% { transform: scaleY(0);   opacity: 0; }
}

/* ========== ロゴ ========== */
#shimada-logo {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  width: 180px;
  opacity: 0.7;
  pointer-events: none;
}

/* ========== モード選択ボタン（追加） ========== */
.mode-btns {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
}

.mode-btn {
  padding: 0.75rem 2rem;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: bold;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.08);
  color: #aad4f5;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;letter-spacing: 0.05em;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.mode-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px rgba(102, 126, 234, 0.5);
}

.mode-desc {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  color: #88bbdd;
  margin-bottom: 2rem;
  min-height: 1.4em;
}



/*ここから追加*/
#gameUI {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#uiLeft {
  position: absolute;
  bottom: 20px;
  left: 20px;
  pointer-events: auto;
}

#gazeSetting {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  pointer-events: auto;
}

#gazeSetting input {
  width: 180px;
}