html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  background: #8ed8f8;
}

#game-container, #game-container canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  pointer-events: none;
  z-index: 10;
}
#hearts {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  letter-spacing: 2px;
}
#hearts .lost {
  filter: grayscale(1);
  opacity: 0.35;
}
#score {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 60, 120, 0.5), 0 0 12px rgba(0, 60, 120, 0.3);
}

/* ---------- 画面（タイトル / ゲームオーバー） ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(3px);
  z-index: 20;
  text-align: center;
  overflow-y: auto;
}
.hidden { display: none !important; }

.game-title {
  margin: 0;
  font-size: clamp(2.4rem, 11vw, 4rem);
  line-height: 1.15;
  color: #ff8c1a;
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 rgba(60, 120, 200, 0.35);
  letter-spacing: 0.06em;
}
.howto {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  line-height: 1.8;
  color: #345;
}

.big-btn {
  font-family: inherit;
  font-size: clamp(1.3rem, 5.5vw, 1.7rem);
  font-weight: bold;
  color: #fff;
  background: linear-gradient(180deg, #ffb03a, #ff8c1a);
  border: none;
  border-radius: 999px;
  padding: 0.7em 2.2em;
  cursor: pointer;
  box-shadow: 0 5px 0 #d96f00, 0 8px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.08s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #d96f00; }
.big-btn:disabled {
  background: #bbb;
  box-shadow: 0 5px 0 #999;
  cursor: wait;
}
.big-btn.secondary {
  background: linear-gradient(180deg, #5bc0ff, #2b8fe0);
  box-shadow: 0 5px 0 #1a6cb0, 0 8px 14px rgba(0, 0, 0, 0.2);
}
.big-btn.secondary:active { box-shadow: 0 1px 0 #1a6cb0; }

.ranking-box {
  background: #fff;
  border-radius: 16px;
  padding: 14px 26px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  min-width: min(280px, 80vw);
}
.ranking-box h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: #666;
}
.ranking-box ol {
  margin: 0;
  padding-left: 1.6em;
  text-align: left;
  font-size: 1.1rem;
  color: #234;
}
.ranking-box li { margin: 4px 0; }
.ranking-box li.me { color: #ff8c1a; font-weight: bold; }
.ranking-box li.empty { list-style: none; margin-left: -1.6em; color: #999; }
.ranking-box li .pts { float: right; margin-left: 1.2em; font-weight: bold; }

/* ---------- ゲームオーバー ---------- */
#gameover-screen h1 {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  color: #2b8fe0;
  text-shadow: 2px 2px 0 #fff;
}
.result-score {
  margin: 0;
  font-size: clamp(3rem, 14vw, 4.6rem);
  font-weight: bold;
  color: #ff8c1a;
  text-shadow: 3px 3px 0 #fff;
}
.result-score .unit { font-size: 0.45em; color: #888; }

#register-area {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#player-name {
  font-family: inherit;
  font-size: 1.3rem;
  text-align: center;
  width: 9em;
  padding: 0.5em;
  border: 3px solid #5bc0ff;
  border-radius: 12px;
  outline: none;
}
