* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #1a1a2e;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.4rem;
}

.sub {
  color: #aaa;
  margin-bottom: 24px;
}

#nameInput {
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #0f0f1e;
  color: #eee;
  width: 80%;
  max-width: 320px;
  margin-bottom: 16px;
}

button {
  font-size: 1.1rem;
  padding: 14px 32px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

button:active {
  filter: brightness(0.9);
}

.error {
  color: #ff6b6b;
  min-height: 1.2em;
}

.count {
  font-size: 2rem;
  font-weight: bold;
  margin: 12px 0;
}

.countdown {
  font-size: 3rem;
  font-weight: bold;
  color: #ffd23f;
}

.hint {
  color: #888;
  font-size: 0.9rem;
  margin-top: 24px;
}

/* --- ゲーム画面 --- */
#screen-game {
  padding: 0;
  justify-content: flex-start;
}

#hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  z-index: 10;
}

#gameContainer {
  flex: 1;
  width: 100%;
  overflow: hidden;
  position: relative;
}

#gameContainer canvas {
  display: block;
  margin: 0 auto;
}

#controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px;
  pointer-events: none;
  z-index: 20;
}

.control-zone {
  pointer-events: auto;
}

#joystickZone {
  width: 140px;
  height: 140px;
  position: relative;
}

#joystickBase {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  position: relative;
}

#joystickThumb {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  position: absolute;
  top: 33px;
  left: 33px;
  transition: top 0.05s linear, left 0.05s linear;
}

#bombBtn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  font-size: 2rem;
  background: radial-gradient(circle at 35% 35%, #555, #111);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 結果画面 --- */
#resultRankings {
  list-style: none;
  padding: 0;
  width: 90%;
  max-width: 360px;
  max-height: 50vh;
  overflow-y: auto;
}

#resultRankings li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}

#resultRankings li.me {
  background: rgba(255, 210, 63, 0.25);
  font-weight: bold;
}

#resultRankings li.place-1 {
  background: linear-gradient(90deg, rgba(255, 210, 63, 0.4), rgba(255, 210, 63, 0.1));
}
