/* リセット・基本設定 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* ヘッダー */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 60px;
}

.header-title h1 {
  font-size: 20px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 12px;
  padding: 10px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.header-icon-btn:hover,
.header-icon-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.95);
}

/* モード選択 */
.mode-selector {
  padding: 12px 20px;
}

.mode-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 4px;
  gap: 4px;
}

.mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 12px;
  font-weight: 500;
}

.mode-option.active {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mode-option .material-icons {
  font-size: 24px;
}

/* 音声レベル表示 */
.audio-visual {
  padding: 8px 20px;
}

.level-indicator {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px;
}

.level-meter {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.level-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #4caf50, #ffc107, #f44336);
  transition: width 0.1s ease;
  border-radius: 3px;
}

/* メインコントロール */
.main-control {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.status-display {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  font-weight: 500;
}

.record-button {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  position: relative;
}

.record-button:active {
  transform: scale(0.95);
}

.record-button.recording {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  animation: pulse 2s infinite;
}

.record-button .material-icons {
  font-size: 28px;
}

.button-text {
  font-size: 13px;
  font-weight: 500;
}

@keyframes pulse {
  0% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(211, 47, 47, 0.4);
  }
  70% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 20px rgba(211, 47, 47, 0);
  }
  100% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(211, 47, 47, 0);
  }
}

/* 文字起こしモード用ボタンコンテナ */
.transcribe-buttons-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

/* 新しいボタンレイアウト */
.buttons-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* 翻訳モード切り替えボタン */
.trans-mode-button {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  flex-shrink: 0;
}

.trans-mode-button:active {
  transform: scale(0.95);
}

.trans-mode-button:hover {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.trans-mode-button .material-icons {
  font-size: 16px;
}

.trans-mode-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 新しい翻訳モード選択ボタン群 */
.translation-mode-selector {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center; /* 全体を縦方向中央寄せ */
}

/* 日英・英日ボタンを縦に配置するコンテナ */
.lang-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trans-mode-btn {
  min-width: 70px;
  height: 44px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

/* 自動ボタンは通常サイズで中央寄せ */
.trans-mode-btn[data-mode="auto"] {
  min-width: 85px;
  height: 44px; /* 他のボタンと同じ高さ */
  align-self: center; /* 縦方向の中央寄せ */
}

/* アクティブ状態 */
.trans-mode-btn.active {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

/* ホバー効果 */
.trans-mode-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* タッチ効果 */
.trans-mode-btn:active {
  transform: scale(0.96) translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 日英・英日ボタンのフラグ表示 */
.trans-mode-btn .trans-flag {
  font-size: 16px;
  line-height: 1;
}

.trans-mode-btn .trans-arrow {
  font-size: 12px;
  font-weight: bold;
  margin: -2px 2px;
  opacity: 0.8;
}

/* 自動ボタンのアイコン */
.trans-mode-btn .material-icons {
  font-size: 20px;
  margin-bottom: -2px;
}

/* ラベルテキスト */
.trans-mode-btn .trans-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: -1px;
}

/* 自動ボタンのラベル */
.trans-mode-btn[data-mode="auto"] .trans-label {
  font-size: 10px;
}

/* 非常に小さな画面での追加調整 */
@media (max-width: 320px) {
  .buttons-layout {
    gap: 8px;
  }

  .translation-mode-selector {
    gap: 4px;
  }

  .trans-mode-btn {
    min-width: 50px;
    height: 35px;
    border-radius: 8px;
  }

  .trans-mode-btn[data-mode="auto"] {
    min-width: 60px;
    height: 35px; /* 他のボタンと同じ高さ */
    align-self: center; /* 縦方向の中央寄せ */
  }

  .trans-mode-btn .trans-label {
    font-size: 8px;
  }

  .trans-mode-btn[data-mode="auto"] .trans-label {
    font-size: 7px;
  }

  .trans-mode-btn .material-icons {
    font-size: 14px;
  }
}/* アクティブ時のラベル色 */
.trans-mode-btn.active .trans-label {
  color: #1976d2;
}

/* 日英ボタンの特別スタイル */
.trans-mode-btn[data-mode="ja2en"].active {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(244, 67, 54, 0.05) 100%), 
              rgba(255, 255, 255, 0.95);
  border-color: rgba(244, 67, 54, 0.3);
}

.trans-mode-btn[data-mode="ja2en"].active .trans-label {
  color: #d32f2f;
}

/* 英日ボタンの特別スタイル */
.trans-mode-btn[data-mode="en2ja"].active {
  background: linear-gradient(135deg, rgba(63, 81, 181, 0.1) 0%, rgba(63, 81, 181, 0.05) 100%), 
              rgba(255, 255, 255, 0.95);
  border-color: rgba(63, 81, 181, 0.3);
}

.trans-mode-btn[data-mode="en2ja"].active .trans-label {
  color: #3f51b5;
}

/* 自動ボタンの特別スタイル */
.trans-mode-btn[data-mode="auto"].active {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%), 
              rgba(255, 255, 255, 0.95);
  border-color: rgba(76, 175, 80, 0.3);
}

.trans-mode-btn[data-mode="auto"].active .trans-label {
  color: #4caf50;
}

.trans-mode-btn[data-mode="auto"].active .material-icons {
  color: #4caf50;
}

/* 翻訳モードボタンのアニメーション効果 */
@keyframes modeActivate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.trans-mode-btn.active {
  animation: modeActivate 0.3s ease;
}

/* ボタン選択時の波紋効果 */
.trans-mode-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.trans-mode-btn:active::before {
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: width 0.15s ease, height 0.15s ease, opacity 0.15s ease;
}

/* ホバー時の光る効果 */
.trans-mode-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.trans-mode-btn:hover::after {
  opacity: 1;
}

/* 精度切り替えボタン */
.perf-mode-button {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  flex-shrink: 0;
}

/* 高速モード（オレンジ系） */
.perf-mode-button.high-speed {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.perf-mode-button.high-speed:hover {
  background: linear-gradient(135deg, #F57C00 0%, #E65100 100%);
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.3);
}

/* 高精度モード（緑系） */
.perf-mode-button.high-accuracy {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

.perf-mode-button.high-accuracy:hover {
  background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.3);
}

.perf-mode-button:active {
  transform: scale(0.95);
}

.perf-mode-button:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.perf-mode-button .material-icons {
  font-size: 16px;
}

.perf-mode-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* レコードボタンの調整（翻訳ボタンと並ぶ時） */
.transcribe-buttons-container .record-button {
  flex-shrink: 0;
}

/* PTTボタン専用スタイル */
.ptt-buttons-container {
  display: flex;
  flex-direction: row; /* 左右配置に変更 */
  gap: 16px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  justify-content: center;
}

.ptt-button {
  flex: 1; /* 両方のボタンが同じ幅を持つ */
  min-width: 140px;
  max-width: 150px;
  height: 80px;
  border-radius: 20px;
  border: none;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  /* Safari向けのタッチ最適化 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  /* ポインターイベントをサポート */
  pointer-events: auto;
  /* Safariでのタッチ反応性を向上 */
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.ptt-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 0, 0, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
}

.ptt-button:hover::before {
  opacity: 1;
}

.ptt-button.japanese {
  background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.ptt-button.english {
  background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.ptt-button:active {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ptt-button.recording {
  animation: ptt-pulse 1.8s infinite ease-in-out;
  transform: scale(1.02);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25), 0 6px 15px rgba(0, 0, 0, 0.15);
}

.ptt-button.japanese.recording {
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  box-shadow: 0 12px 35px rgba(46, 125, 50, 0.4), 0 6px 15px rgba(0, 0, 0, 0.15);
}

.ptt-button.english.recording {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  box-shadow: 0 12px 35px rgba(21, 101, 192, 0.4),
    0 6px 15px rgba(0, 0, 0, 0.15);
}

.ptt-button .material-icons {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.ptt-button .button-text {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

@keyframes ptt-pulse {
  0% {
    transform: scale(1.02);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1.02);
  }
}

/* 字幕エリア */
.transcript-area {
  flex: 1;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  min-height: 0; /* フレックス子要素の重要な設定 */
}

.transcript-section {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  flex: 1;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.section-title {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

/* セクションタイトルとボタンのグループ */
.section-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ヘッダー内の精度切り替えボタン */
.header-perf-button {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  min-width: 44px;
  height: 32px;
  font-size: 10px;
  font-weight: 600;
}

/* ヘッダー高速モード（オレンジ系） */
.header-perf-button.high-speed {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.header-perf-button.high-speed:hover,
.header-perf-button.high-speed:active {
  background: linear-gradient(135deg, #F57C00 0%, #E65100 100%);
  transform: scale(0.95);
  box-shadow: 0 3px 8px rgba(255, 152, 0, 0.25);
}

/* ヘッダー高精度モード（緑系） */
.header-perf-button.high-accuracy {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

.header-perf-button.high-accuracy:hover,
.header-perf-button.high-accuracy:active {
  background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%);
  transform: scale(0.95);
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.25);
}

.header-perf-button:hover,
.header-perf-button:active {
  transform: scale(0.95);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.header-perf-button .material-icons {
  font-size: 14px;
  line-height: 1;
}

.header-perf-text {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.clear-btn {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.clear-btn:hover,
.clear-btn:active {
  background: rgba(0, 0, 0, 0.1);
  color: #d32f2f;
}

.transcript-content {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  line-height: 1.5;
  font-size: 16px;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  scroll-behavior: smooth;
  min-height: 0; /* 重要: オーバーフローを正しく動作させる */
}

/* スクロールバーのスタイルを改善 */
.transcript-content::-webkit-scrollbar {
  width: 8px;
}

.transcript-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.transcript-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.transcript-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* 音量コントロール */
.volume-section {
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.volume-control .material-icons {
  color: white;
  font-size: 20px;
}

/* 音声読み上げボタン */
.voice-playback-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 12px;
  padding: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

.voice-playback-btn:hover,
.voice-playback-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.95);
}

.voice-playback-btn.disabled {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.voice-playback-btn.disabled .material-icons {
  color: white;
}

.voice-playback-btn.disabled:hover,
.voice-playback-btn.disabled:active {
  background: linear-gradient(135deg, #b71c1c 0%, #8f0000 100%);
  transform: scale(0.95);
  box-shadow: 0 6px 16px rgba(211, 47, 47, 0.4);
}

.voice-playback-btn .material-icons {
  font-size: 20px;
  transition: all 0.3s ease;
}

.volume-slider {
  flex: 1;
  max-width: 200px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.volume-value {
  color: white;
  font-size: 12px;
  font-weight: 500;
  min-width: 40px;
  text-align: right;
}

/* 設定パネル */
.settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.settings-panel.active {
  transform: translateY(0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-header h3 {
  color: white;
  font-size: 20px;
  font-weight: 600;
}

.close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 12px;
  padding: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover,
.close-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

.settings-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: white;
}

.setting-group {
  margin-bottom: 24px;
}

.setting-group h4 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.setting-group h5 {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}

.setting-item {
  margin-bottom: 16px;
}

.setting-item label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.setting-select,
.number-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  color: #333;
  transition: border-color 0.2s ease;
}

.setting-select:focus,
.number-input:focus {
  outline: none;
  border-color: #1976d2;
}

/* 設定切り替えスイッチ */
.setting-toggle {
  position: relative;
  display: flex;
  align-items: center;
}

.setting-checkbox {
  display: none;
}

.setting-toggle-label {
  position: relative;
  width: 48px;
  height: 24px;
  background: #ddd;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-checkbox:checked + .setting-toggle-label {
  background: #1976d2;
}

.setting-checkbox:checked + .setting-toggle-label .toggle-slider {
  transform: translateX(24px);
}

.vad-detail-panel {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}

/* ストリーミング表示用のスタイル */
.transcript-content .streaming {
  opacity: 0.9;
  background: linear-gradient(
    90deg,
    rgba(25, 118, 210, 0.1) 0%,
    rgba(25, 118, 210, 0.05) 50%,
    transparent 100%
  );
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 2px;
  position: relative;
  animation: streamingPulse 1.5s ease-in-out infinite;
}

.transcript-content .streaming::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: #1976d2;
  animation: cursorBlink 1s infinite;
  margin-left: 2px;
  vertical-align: middle;
}

@keyframes streamingPulse {
  0%,
  100% {
    background: linear-gradient(
      90deg,
      rgba(25, 118, 210, 0.1) 0%,
      rgba(25, 118, 210, 0.05) 50%,
      transparent 100%
    );
  }
  50% {
    background: linear-gradient(
      90deg,
      rgba(25, 118, 210, 0.15) 0%,
      rgba(25, 118, 210, 0.1) 50%,
      rgba(25, 118, 210, 0.05) 100%
    );
  }
}

@keyframes cursorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* レスポンシブ調整 */
@media (max-height: 600px) {
  .mobile-header {
    padding: 8px 16px;
    min-height: 50px;
  }

  .header-title h1 {
    font-size: 18px;
  }

  .transcript-section {
    min-height: 140px;
    flex: 1;
  }

  .main-control {
    padding: 8px 20px;
  }

  .record-button {
    width: 85px;
    height: 85px;
  }

  .trans-mode-button {
    width: 60px;
    height: 60px;
  }

  /* PTT用精度ボタンの小画面調整 */
  .header-perf-button {
    min-width: 40px;
    height: 28px;
    padding: 3px 6px;
    gap: 2px;
  }

  .header-perf-button .material-icons {
    font-size: 12px;
  }

  .header-perf-text {
    font-size: 9px;
  }

  .trans-mode-button .material-icons {
    font-size: 14px;
  }

  .trans-mode-text {
    font-size: 10px;
  }

  .perf-mode-button {
    width: 60px;
    height: 60px;
  }

  .perf-mode-button .material-icons {
    font-size: 14px;
  }

  .perf-mode-text {
    font-size: 10px;
  }

  .audio-visual {
    padding: 6px 20px;
  }
}

/* 横画面レイアウトの改善 */
@media (orientation: landscape) {
  .transcript-area {
    flex-direction: row;
    gap: 12px;
  }

  .transcript-section {
    min-height: 140px;
    flex: 1;
  }

  .main-control {
    padding: 8px 20px;
  }

  .record-button {
    width: 85px;
    height: 85px;
  }

  .audio-visual {
    padding: 6px 20px;
  }
}

/* 超コンパクトデバイス対応 */
@media (max-height: 500px) {
  .audio-visual {
    padding: 4px 16px;
  }

  .level-indicator {
    padding: 6px;
  }

  .level-meter {
    height: 4px;
  }

  .mode-selector {
    padding: 4px 16px;
  }

  .main-control {
    padding: 6px 16px;
  }

  .transcript-section {
    min-height: 100px;
  }

  .section-header {
    padding: 6px 10px;
  }

  .trans-mode-button {
    width: 50px;
    height: 50px;
  }

  .trans-mode-button .material-icons {
    font-size: 12px;
  }

  .trans-mode-text {
    font-size: 9px;
  }

  .perf-mode-button {
    width: 50px;
    height: 50px;
  }

  .perf-mode-button .material-icons {
    font-size: 12px;
  }

  .perf-mode-text {
    font-size: 9px;
  }

  .transcribe-buttons-container {
    gap: 8px;
  }

  .transcript-content {
    padding: 8px;
    font-size: 14px;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .transcript-section {
    background: rgba(33, 33, 33, 0.95);
    color: #fff;
  }

  .section-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .section-title {
    color: #fff;
  }

  .transcript-content {
    color: #fff;
  }

  .settings-content {
    background: #1f1f1f;
    color: #fff;
  }

  .setting-group h4 {
    color: #fff;
    border-bottom-color: #333;
  }

  .setting-item label {
    color: #fff;
  }

  .setting-select,
  .number-input {
    background: #333;
    color: #fff;
    border-color: #555;
  }

  .vad-detail-panel {
    background: #2a2a2a;
  }
}

/* PTTボタンのレスポンシブ対応 */
@media (max-height: 700px) {
  .ptt-button {
    height: 70px;
    min-width: 120px;
    max-width: 130px;
  }

  .ptt-button .material-icons {
    font-size: 24px;
  }

  .ptt-button .button-text {
    font-size: 12px;
  }

  .ptt-buttons-container {
    gap: 12px;
    max-width: 280px;
  }
}

@media (max-width: 360px) {
  .ptt-buttons-container {
    gap: 8px;
    max-width: 100%;
    padding: 0 10px;
  }

  .ptt-button {
    min-width: 110px;
    max-width: 120px;
    height: 65px;
  }

  /* 新しい翻訳モードボタンのレスポンシブ対応 */
  .buttons-layout {
    gap: 12px;
  }

  .translation-mode-selector {
    gap: 6px;
  }

  .trans-mode-btn {
    min-width: 60px;
    height: 38px;
    border-radius: 10px;
  }

  /* 自動ボタンは小さな画面でも適切なサイズに */
  .trans-mode-btn[data-mode="auto"] {
    min-width: 70px;
    height: 38px; /* 他のボタンと同じ高さ */
    align-self: center; /* 縦方向の中央寄せ */
  }

  .trans-mode-btn .trans-flag {
    font-size: 14px;
  }

  .trans-mode-btn .material-icons {
    font-size: 16px;
  }

  .trans-mode-btn .trans-label {
    font-size: 9px;
  }

  .trans-mode-btn[data-mode="auto"] .trans-label {
    font-size: 8px;
  }

  .ptt-button .button-text {
    font-size: 11px;
  }

  .transcribe-buttons-container {
    gap: 8px;
    max-width: 100%;
  }

  .trans-mode-button {
    width: 55px;
    height: 55px;
  }

  .trans-mode-button .material-icons {
    font-size: 12px;
  }

  /* 小画面でのPTT用精度ボタン調整 */
  .section-title-group {
    gap: 6px;
  }

  .header-perf-button {
    min-width: 36px;
    height: 26px;
    padding: 2px 5px;
    gap: 2px;
  }

  .header-perf-button .material-icons {
    font-size: 10px;
  }

  .header-perf-text {
    font-size: 8px;
  }

  .trans-mode-text {
    font-size: 9px;
  }

  .perf-mode-button {
    width: 55px;
    height: 55px;
  }

  .perf-mode-button .material-icons {
    font-size: 12px;
  }

  .perf-mode-text {
    font-size: 9px;
  }

  .record-button {
    width: 80px;
    height: 80px;
  }
}

/* ランドスケープモードでの調整 */
@media (orientation: landscape) and (max-height: 500px) {
  .ptt-buttons-container {
    gap: 10px;
    max-width: 300px;
  }

  .ptt-button {
    height: 55px;
    min-width: 100px;
    max-width: 110px;
  }

  /* 新しい翻訳モードボタンのランドスケープ対応 */
  .buttons-layout {
    gap: 10px;
  }

  .translation-mode-selector {
    gap: 6px;
  }

  .trans-mode-btn {
    min-width: 60px;
    height: 40px;
    border-radius: 10px;
  }

  /* 自動ボタンのランドスケープ対応 */
  .trans-mode-btn[data-mode="auto"] {
    min-width: 70px;
    height: 40px; /* 他のボタンと同じ高さ */
    align-self: center; /* 縦方向の中央寄せ */
  }

  .trans-mode-btn .trans-flag {
    font-size: 14px;
  }

  .trans-mode-btn .material-icons {
    font-size: 16px;
  }

  .trans-mode-btn .trans-label {
    font-size: 9px;
  }

  .trans-mode-btn[data-mode="auto"] .trans-label {
    font-size: 8px;
  }

  .trans-mode-btn .trans-label {
    font-size: 9px;
  }

  .ptt-button .material-icons {
    font-size: 20px;
  }

  .ptt-button .button-text {
    font-size: 10px;
  }
}
