html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  /* スマホ：引っぱってスクロール・拡大・長押しのメニュー・文字の選択・タップの色を出さない */
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
}

/* スマホの「ミート」「強振」ボタン（位置と大きさは main.js が決める） */
.swing-btn {
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: #fff;
  font-weight: bold;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  touch-action: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  z-index: 5;
}

.swing-btn.contact {
  background: radial-gradient(circle at 35% 30%, rgba(120, 210, 255, 0.95), rgba(30, 110, 200, 0.9));
}

.swing-btn.power {
  background: radial-gradient(circle at 35% 30%, rgba(255, 190, 110, 0.95), rgba(220, 90, 30, 0.9));
}

.swing-btn.down {
  transform: scale(0.92);
  filter: brightness(1.25);
}

.swing-btn[hidden] {
  display: none;
}

canvas {
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#hud {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

#notice {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 40%;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  color: #222;
  font: 16px/1.6 sans-serif;
  text-align: center;
}

#mute {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 22px;
  line-height: 44px;
  cursor: pointer;
}

/* スタート画面・結果画面（3D の球場の上に重ねる） */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(4, 10, 24, 0.55);
  color: #fff;
  font-family: sans-serif;
  overflow-y: auto;
  touch-action: pan-y; /* 横画面などで収まらないときは、たてにスクロールできる */
  -webkit-overflow-scrolling: touch;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.screen[hidden] {
  display: none;
}

.panel {
  width: 100%;
  max-width: 420px;
  margin: auto;
  text-align: center;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: min(30px, 7vw); /* スマホの幅でも1行に収まる大きさ */
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 26px;
}

.lead {
  margin: 0 0 16px;
  font-size: 15px;
  color: #d8e4ff;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modes button,
button.big {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 10px 18px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  background: rgba(20, 40, 90, 0.85);
  color: #fff;
  font: bold 18px sans-serif;
  cursor: pointer;
}

.modes button:hover,
.modes button:focus-visible,
button.big:hover,
button.big:focus-visible {
  background: rgba(50, 90, 180, 0.95);
  outline: none;
}

.modes button .sub {
  margin-left: 10px;
  text-align: right;
  line-height: 1.35;
  white-space: pre-line;
  font-size: 12px;
  font-weight: normal;
  color: #b8c8ee;
}

/* まだ解放していないモード */
.modes button.locked {
  cursor: default;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(20, 30, 50, 0.7);
  color: #8a96b0;
}

.modes button.locked .sub {
  color: #8a96b0;
}

/* 結果画面のクリアの表示 */
.clear {
  margin: 4px 0 10px;
  font: bold 17px sans-serif;
  color: #c8d4ee;
}

.clear.ok {
  color: #ffd84a;
}

button.big {
  justify-content: center;
  margin-top: 18px;
}

.howto {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #c8d4ee;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stats div {
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.stats b {
  display: block;
  font-size: 24px;
}

.stats span {
  font-size: 12px;
  color: #c8d4ee;
}

.log {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.log li {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 15px;
}

.log li .hr {
  color: #ffd84a;
  font-weight: bold;
}

.log li .hit {
  color: #7cf0a0;
  font-weight: bold;
}

/* スタート画面の設定（審判の声） */
.settings {
  margin: 14px 0 0;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(10, 20, 45, 0.6);
  text-align: left;
  font-size: 14px;
}

.settings summary {
  cursor: pointer;
  font-weight: bold;
  padding: 4px 0;
}

.settings label {
  display: block;
  margin: 8px 0 4px;
}

.settings .row {
  display: flex;
  gap: 8px;
}

.settings select {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  font-size: 14px;
  border-radius: 8px;
}

.settings button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(20, 40, 90, 0.9);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.settings .note {
  margin: 6px 0 2px;
  font-size: 12px;
  color: #b8c8ee;
}

.settings label.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* FPS の表示（画面の左下。設定でオン） */
#fps {
  position: absolute;
  left: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #b8ffb8;
  font: 12px/1.5 monospace;
  pointer-events: none;
  z-index: 6;
}

#fps[hidden] {
  display: none;
}
