[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 横画面固定 */
@media (orientation: portrait) {
  body::before {
    content: '横向きにしてください';
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    color: #fff;
    font-size: 1.2rem;
    z-index: 9999;
  }
}

#title-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.title-text {
  font-size: 2.5rem;
  margin: 0;
}

.tap-hint {
  opacity: 0.8;
  font-size: 1rem;
}

#howto-btn,
#howto-close {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 1rem;
}

#game-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

#howto-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.howto-content {
  background: #1a1a1a;
  width: min(90vw, 480px);
  height: min(80vh, 600px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
}

.howto-content iframe {
  flex: 1;
  border: 0;
  background: #fff;
}

#mute-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  right: calc(env(safe-area-inset-right) + 12px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 1.2rem;
  z-index: 15;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  z-index: 5;
}

/* タッチ操作ボタン（左右） */
#touch-controls {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
  z-index: 10;
}

.ctrl-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ゲーム中ボタン（リトライ・ホーム） */
#game-controls {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: calc(env(safe-area-inset-left) + 8px);
  display: flex;
  gap: 8px;
  z-index: 15;
}

.game-ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
