/* 基本レイアウト */
body {
  /* 背景画像 + ダークオーバーレイ（画像は project の public ディレクトリに置いてください） */
  background-color: #000;
  background-image:
    linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)),
    url('background.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  /* fixed はデスクトップでの視覚効果用。モバイルではスクロールに切替 */
  background-attachment: fixed;

  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin: 0;
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial;
  /* フッター高さ分の余白（Safe Area 対応） */
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* モバイル等タッチ端末では fixed を無効化（パフォーマンス向上） */
@media (pointer: coarse) {
  body {
    background-attachment: scroll;
  }
}

/* 汎用ボタン */
button {
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #007bff;
  color: #fff;
  cursor: pointer;
}
button:active {
  transform: translateY(1px);
}

/* フッターに固定して中央に配置 */
.tts-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  padding: calc(10px + env(safe-area-inset-bottom)) 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 1000;
  touch-action: manipulation;
}

/* 内側ラッパーで幅を制御 */
.tts-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* フッター内のボタン（タッチしやすく） */
.tts-footer .tts-footer-inner button {
  padding: 12px 16px;
  min-height: 44px;
  min-width: 64px;
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #007bff;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* 小さい画面ではフォントとパディングを調整 */
@media (max-width: 480px) {
  .tts-footer-inner {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .tts-footer .tts-footer-inner button {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 10px;
    min-height: 48px;
  }
}

/* optional: focus と active の視認性向上 */
.tts-footer .tts-footer-inner button:focus {
  outline: 3px solid rgba(0, 123, 255, 0.25);
  outline-offset: 2px;
}
.tts-footer .tts-footer-inner button:active {
  transform: translateY(1px);
}

/* フローティングテキスト（背景なし・大きめテキスト） */
.tts-float {
  position: fixed;
  pointer-events: none;
  background: transparent; /* 背景の四角い部分を削除 */
  color: #ffffff;
  font-size: 50px; /* 大きめフォント */
  font-weight: 600;
  line-height: 1;
  padding: 0; /* 余白は無し */
  border-radius: 0;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity, top, left;
  animation: tts-fade-up 1000ms cubic-bezier(.2,.9,.3,1) forwards;
  z-index: 2000;
  /* 見やすくするためのテキストシャドウ（背景が透過でも読めるように） */
  text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 10px rgba(0,200,255,0.06);
}

/* アニメーション（上下移動のみ。左右は JS 側で位置を決める） */
@keyframes tts-fade-up {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  30% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tts-float {
    animation: none;
    opacity: 1;
    transform: none;
  }
}