/* ==========================================================================
   トレーニング関連ページ専用スタイル
   preparation.html, training.html用
   ========================================================================== */

/* ==========================================================================
   マイクテスト・準備ページ
   ========================================================================== */
/* 統一: base.cssの.narrow-mainクラスを使用 */

/* ==========================================================================
   トレーニングページ
   ========================================================================== */
/* 統一: base.cssの.narrow-mainクラスを使用 */

/* 基音コントロール（ボタン + プログレスバー） */
.base-note-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.base-note-control .btn {
  flex: 0 0 33.333%;
  min-width: 140px;
}

.progress-section-inline {
  flex: 1;
}

/* モバイル時の縦並びレイアウト */
@media (max-width: 768px) {
  .base-note-control {
    flex-direction: column;
    gap: 1rem;
  }
  
  .base-note-control .btn {
    flex: none;
    width: 100%;
  }
  
  .progress-section-inline {
    width: 100%;
  }
}

/* 表示制御クラス（JavaScript動的制御用） */
.range-adjustment-hidden {
  display: none !important;
}

.range-adjustment-visible {
  display: block !important;
}

.range-controls-collapsed {
  display: none !important;
}

.range-controls-expanded {
  display: block !important;
}

/* レンジ説明テキストの下マージン */
.range-description {
  margin-bottom: 1rem;
}

/* テストセクション */
.test-section {
  margin-bottom: 0;
  transition: all 0.5s ease;
}

/* マイク許可ボタン下マージン */
#permission-section #request-mic-btn {
  margin-bottom: 1rem;
}

.test-section.hidden {
  display: none;
}

/* 音域テストセクション表示修正 */
#range-test-section:not(.hidden) {
  display: block !important;
}

/* メインステータス・サブ情報表示 */
.main-status-display {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.sub-info-display {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

/* セクションヘッダー */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

/* セクション説明 */
.section-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  margin-bottom: 24px;
}

/* 連続する説明文の間隔を詰める */
.section-description + .section-description {
  margin-top: -16px;
}

/* セクション説明（サブ） */
.section-description-sub {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  margin-top: -16px;
  margin-bottom: 16px;
}

/* テキストセクションタイトル */
.text-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

/* === アラート系CSS（base.cssに移行完了） === */
/* アラート基本定義はbase.cssを参照 */

/* モバイルでボタンの順序を調整 - より特定的なセレクタ */
@media (max-width: 767px) {
  .range-info-container + .flex.gap-3.mt-4,
  .success-alert + .flex.gap-3.mt-4 {
    flex-direction: column-reverse !important;
    gap: 12px !important;
  }

  .range-info-container + .flex.gap-3.mt-4 button,
  .success-alert + .flex.gap-3.mt-4 button {
    width: 100% !important;
  }
}

/* ネストしたglass-card（range-saved-display）の専用スタイル */
#range-saved-display.glass-card {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* iPadでの追加対応 */
@media (max-width: 1024px) {
  #range-saved-display.glass-card {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: none !important;
  }
}

/* メーターグループ */
.meter-group {
  margin-bottom: 20px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

.meter-value {
  color: #ffffff;
  font-weight: 600;
}

/* プログレスバー（オレンジ） */
.progress-bar.progress-orange .progress-fill {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* 結果カード */
.result-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.result-card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 16px;
}

.range-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.range-info-row:last-child {
  border-bottom: none;
}

.range-info-row span:first-child {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.range-info-value {
  color: #ffffff;
  font-weight: 600;
  font-size: 1.1rem;
}

.range-instruction-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.range-test-left i {
  color: rgba(59, 130, 246, 0.8) !important;
}


.range-info-container {
  margin-bottom: 0;
}

.range-info-container + .flex {
  margin-top: 24px;
}

/* レスポンシブ対応：モバイルは縦並び、タブレット以上は横並び */
@media (min-width: 768px) {
  .md\:flex-row {
    flex-direction: row;
  }
}

/* テストステータス */
.test-status {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
  margin-bottom: 16px;
}

/* マイク認識セクション */
.mic-recognition-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* preparation.html専用: 音声テスト・結果ボタンのモバイル対応 */
@media (max-width: 768px) {
  .flex.gap-3.mt-4 {
    flex-direction: column;
    gap: 1rem;
  }

  /* 音域テストレイアウトのモバイル対応 */
  .range-test-layout {
    position: static;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 20px 0;
  }

  .range-test-left {
    position: static;
    transform: none;
    order: 1;
  }

  .voice-range-display-container {
    position: static;
    order: 2;
  }

  .range-test-right {
    position: static;
    transform: none;
    width: auto;
    height: auto;
    order: 3;
  }

  /* 音域テストレイアウトのモバイル対応 */
  .range-test-layout-flex {
    justify-content: center;
    gap: 0.75rem;
  }

  .range-instruction-text {
    font-size: 0.875rem;
  }
  
  
}

/* ==========================================================================
   ステップインジケーター
   ========================================================================== */
.step-indicator {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem auto;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}


.step-indicator.active {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.step-indicator.completed {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: white;
}

.step-connector {
  flex: 0 0 40px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}


.step-connector.active {
  background: linear-gradient(90deg, #10b981, #3b82f6);
}


/* ==========================================================================
   音声指示セクション
   ========================================================================== */
.voice-instruction {
  position: relative;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 24px;
  margin: 24px 0;
  text-align: center;
  overflow: visible; /* リップルの広がりを表示するため */
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  }
}

.voice-instruction-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.voice-instruction-icon.success {
  background: #22c55e;
}


.voice-instruction-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  margin: 0;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.voice-instruction-pulse {
  /* HTMLのpulse要素を完全に無効化 */
  display: none !important;
  visibility: hidden !important;
}


/* 波紋エフェクト（元のシンプル実装） */
.voice-instruction::before,
.voice-instruction::after {
  content: '';
  position: absolute;
  top: calc(32px + 24px); /* アイコン中心位置 */
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(59, 130, 246, 0.6);
  transform: translate(-50%, -50%);
  animation: ripple 3s linear infinite;
  pointer-events: none;
}

.voice-instruction::after {
  animation-delay: 1.5s;
}

/* リップルアニメーション停止用クラス */
.voice-instruction.ripple-stopped::before,
.voice-instruction.ripple-stopped::after {
  animation: none !important;
  display: none !important;
}

@keyframes ripple {
  0% {
    width: 64px;
    height: 64px;
    opacity: 0.5;
  }
  100% {
    width: 400px;
    height: 400px;
    opacity: 0;
  }
}

/* ==========================================================================
   音域テストセクション
   ========================================================================== */


/* 現在テスト中の音表示 */
.current-test-note {
  margin-bottom: 32px;
  text-align: center;
}

.test-note-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ==========================================================================
   音域調整UI（12音階モード専用・トグル式）
   ========================================================================== */

/* メインコンテナ */
.range-adjustment {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* トグルヘッダー部分 */
.range-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 0;
  min-height: auto;
}

.range-toggle-header:hover {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.5rem;
  margin: -0.5rem;
  transition: all 0.2s ease;
}

.range-toggle-header .heading-sm {
  margin: 0 0 0.25rem 0;
}

.range-toggle-header .btn {
  padding: 0.25rem;
  min-height: auto;
  height: auto;
  width: auto;
  min-width: auto;
}

/* 説明文 */
.range-description {
  margin: 0;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
}

/* 調整コントロール部分 */
.range-controls {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* 調整ボタングループ */
.range-controls-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0;
}

.range-controls .flex {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.75rem !important;
  justify-content: center;
  margin-bottom: 0;
}

/* 音域インジケーター */
.range-indicator {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  min-width: 100px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
  transition: all 0.3s ease;
}

.range-indicator:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.2));
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.range-indicator span {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.025em;
}

/* 音域調整ボタン */
.range-adjust-btn {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.range-adjust-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.range-adjust-btn:active {
  transform: translateY(0);
}

/* 音域テストボタン部分 */
.range-test-buttons {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.range-test-buttons .flex {
  justify-content: center !important;
}

/* 音域テストボタン */
.range-test-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.range-test-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(96, 165, 250, 0.5);
  color: #60a5fa;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .range-controls-group {
    flex-direction: column;
    gap: 1rem;
  }
  
  .range-adjust-btn,
  .range-test-btn {
    width: 100%;
  }
}

/* ==========================================================================
   プログレス関連（bolt-new-designから移植）
   ========================================================================== */
/* .progress-section定義はbase.cssを使用（重複削除） */

/* トレーニング専用進行バーセクション */
.progress-section-training {
  margin-bottom: 1.5rem !important;
}

.section-header-training {
  margin-bottom: 1rem;
}

.section-header-training .heading-md {
  margin-bottom: 0;
}

.range-adjustment {
  display: none;
}

.range-controls {
  display: none;
}

.range-controls .btn i {
  flex-shrink: 0;
}


@media (max-width: 768px) {
  #range-down span,
  #range-up span {
    display: none;
  }
  
  .mobile-hide {
    display: none;
  }
  
  #range-down,
  #range-up {
    min-width: 44px;
    padding: 0.75rem;
  }
  
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}

.progress-marker {
  position: absolute;
  top: -4px;
  right: 20%;
  font-size: 1.2rem;
  z-index: 2;
}

/* ==========================================================================
   ドレミガイド（bolt-new-designから移植）
   ========================================================================== */
.doremi-guide {
  text-align: center;
  margin-top: 0;
  margin-bottom: 0;
}

.note-circles {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
  max-width: 580px;
  margin: 0 auto 24px auto;
}

/* プログレス四角 */
.progress-squares {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  width: 100%;
}

.progress-square {
  flex: 1;
  height: 10px;
  background: #60a5fa; /* 元の青に戻す */
  border-radius: 2px;
  opacity: 1;
  transition: none;
  border: 1px solid transparent; /* 常にborderを確保してレイアウトずれを防止 */
  box-sizing: border-box; /* borderを含めて10pxに */
}

/* 【v4.0.13】CSS Animation方式: 基音再生中のDOM操作を完全排除 */
/* countdown-activeクラスが追加されるとアニメーション開始 */
.progress-squares.countdown-active .progress-square {
  animation: square-consume 100ms ease-out forwards;
  animation-play-state: running;
}

/* 各ブロックの遅延（通常モード: クリック音と同期） */
/* 基音(0ms) → 間 → ポ(1400ms)=ブロック1消灯 → ポ(2100ms)=ブロック2消灯 → ドレミ(2800ms) */
.progress-squares.countdown-active .progress-square:nth-child(1) {
  animation-delay: 1400ms;
}
.progress-squares.countdown-active .progress-square:nth-child(2) {
  animation-delay: 2100ms;
}

/* フル/さんはいモード: クリック音と同期（1400ms, 2100ms） */
/* 基音(0ms) → 間 → ポ(1400ms)=ブロック1 → ポ(2100ms)=ブロック2 → ドレミ(2800ms) */
.progress-squares.countdown-full .progress-square:nth-child(1),
.progress-squares.countdown-sanhai .progress-square:nth-child(1) {
  animation-delay: 1400ms;
}
.progress-squares.countdown-full .progress-square:nth-child(2),
.progress-squares.countdown-sanhai .progress-square:nth-child(2) {
  animation-delay: 2100ms;
}

@keyframes square-consume {
  from {
    opacity: 1;
    background: #60a5fa;
    border-color: transparent;
  }
  to {
    opacity: 1; /* 消えた時もopacity 1に変更 */
    background: rgba(255, 255, 255, 0.12); /* 音量バー背景と同じ */
    border-color: rgba(255, 255, 255, 0.15); /* 音量バー背景と同じ */
  }
}

/* 旧方式（互換性のため残す） */
.progress-square.consumed {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  opacity: 0.3;
}

/* ==========================================================================
   タイミング練習チュートリアルモーダル
   ========================================================================== */

.tutorial-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  text-align: left;
}

.tutorial-step-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.tutorial-step-badge {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.tutorial-step-badge-active {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.tutorial-step-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--white);
}

.tutorial-step-desc {
  font-size: 0.875rem;
  color: var(--white-80);
  line-height: 1.6;
  margin: 0;
}

.tutorial-step-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.625rem;
  font-size: 0.8125rem;
  color: #fde68a;
}

/* スライド形式チュートリアル */
.tutorial-dialog {
  max-width: 400px;
  padding: 1.5rem;
}

.tutorial-slide-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  margin: 0 0 1rem 0;
}

/* ポイントリスト */
.tutorial-point-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.tutorial-point {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
  color: var(--white-90);
  line-height: 1.5;
}

/* 測定の注意（青系） */
.tutorial-step-warning-info {
  color: #93c5fd;
}

.tutorial-slide {
  display: none;
}

.tutorial-slide.active {
  display: block;
}

/* キャプチャ画像 */
.tutorial-step-capture {
  margin-top: 0.75rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-step-capture img {
  display: block;
  width: 100%;
  height: auto;
}

/* スライドナビゲーション */
.tutorial-slide-nav {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.tutorial-dots {
  display: flex;
  gap: 0.5rem;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.tutorial-dot.active {
  background: rgba(139, 92, 246, 0.8);
}

.tutorial-next-btn {
  width: 100%;
}

.tutorial-slide-actions {
  width: 100%;
}

.tutorial-slide-actions .btn {
  width: 100%;
}

.tutorial-slide-nav .btn-primary {
  width: 100%;
}

.tutorial-slide-nav .alert-dialog-checkbox {
  margin: 0;
}

/* フロー図 */
.tutorial-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.tutorial-flow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.tutorial-flow-item-active {
  padding: 0.375rem 0.5rem;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
}

.tutorial-flow-label {
  font-size: 0.75rem;
  color: var(--white-60);
}

.tutorial-flow-arrow {
  color: var(--white-40);
}


/* チュートリアルモーダル内の調整 */
#timing-tutorial-modal .alert-dialog-checkbox {
  margin-top: 1rem;
}

/* 「音を聴いてみる」ボタンのパルスグロー */
#btn-tutorial-practice {
  animation: tutorial-pulse 2s ease-in-out infinite;
}

#btn-tutorial-practice:disabled {
  animation: none;
}

@keyframes tutorial-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(96, 165, 250, 0.3);
  }
}

/* やり直しボタン（プログレスバー横・session-badgeと高さを揃える） */
.btn-restart-session {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-restart-session svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.btn-restart-session:hover,
.btn-restart-session:active {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

/* トレーニングヘルプ行 */
.training-help-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 480px) {
  .training-help-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .training-help-row > button {
    width: 100%;
    justify-content: center;
  }
}

/* training-help-row内ボタン共通スタイル */
.training-help-row > button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.375rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.training-help-row > button svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.training-help-row > button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

/* 常時表示グローバルナビ（トラブルシュート＋ホーム）*/
#preparation-bottom-nav {
  margin-bottom: 3rem;
}

/* 展開可能ボタン: 詳細展開時 — 全幅表示 */
.training-help-row > button.is-expanded {
  width: 100%;
  white-space: normal;
  gap: 1rem;
  padding: 0.5rem 1rem;
}

.training-help-row > button .volume-label-detail,
.training-help-row > button .troubleshoot-label-detail {
  text-align: left;
  line-height: 1.4;
}

/* 展開時にhelp-rowを折り返し可能にする */
.training-help-row:has(.is-expanded) {
  flex-wrap: wrap;
}

/* モバイル時は2行配置（上4下4） */
@media (max-width: 768px) {
  .note-circles {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    justify-items: center;
  }
}

.note-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  position: relative;
  overflow: visible;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.note-circle.current {
  background: linear-gradient(135deg, #ff69b4, #ff1493);
  color: #ffd700;
  transform: scale(1.4);
  box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
}

.note-circle.completed {
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.6), rgba(255, 20, 147, 0.4));
  color: #ffffff;
  border-color: rgba(255, 105, 180, 0.4);
  box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
}

/* 波紋エフェクト */
@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/* 下行モード: 青紫系グラデーション */
.note-circle.current[data-direction="descending"] {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #ffd700;
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
}

.note-circle.completed[data-direction="descending"] {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.6), rgba(59, 130, 246, 0.4));
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
}

.note-circle.current[data-direction="descending"]::before {
  background: rgba(96, 165, 250, 0.3);
}

.note-circle.current[data-direction="descending"]::after {
  background: rgba(96, 165, 250, 0.2);
}

.note-circle.current::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  border-radius: 50%;
  background: rgba(255, 105, 180, 0.3);
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  animation: ripple 1.5s infinite;
}

.note-circle.current::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 140%;
  border-radius: 50%;
  background: rgba(255, 105, 180, 0.2);
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  animation: ripple 1.5s infinite 0.75s;
}

/* ==========================================================================
   音域テスト専用 - 完全オリジナルクラス
   ========================================================================== */

/* 音域テストレイアウト - 単一要素中央配置 */
.range-test-layout-flex {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 20px auto;
}

.range-test-item {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 旧版レイアウト（互換性のため残す） */
.range-test-layout {
  position: relative;
  margin: 20px auto;
  width: 160px;
  height: 160px;
}

.range-test-left {
  position: absolute;
  left: -120px;
  top: 60%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.range-test-right {
  position: absolute;
  right: -100px;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-range-display-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 160px;
  height: 160px;
}

/* SVG円形プログレス */
.voice-stability-svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.voice-progress-circle {
  transition: stroke-dashoffset 0.1s ease;
}

/* 確定時のアニメーション */
.voice-stability-svg.completed .voice-progress-circle {
  stroke: #10b981;
  animation: voice-completion-pulse 0.5s ease-out;
}

@keyframes voice-completion-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
  }
}

/* 音程表示バッジ */
.voice-note-badge {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 2;
  /* transform競合防止: transition: allからtransformを除外 */
  transition: background 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

.voice-note-badge.measuring {
  animation: voice-badge-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
  /* Safari: コンポジターレイヤー昇格でグラスカードへのリペイント波及を防止 */
  will-change: transform;
}

.voice-note-badge.confirmed {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.voice-note-badge.confirming-animation {
  animation: voice-badge-confirm 0.6s ease-out;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.6) !important;
}

@keyframes voice-badge-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.7);
  }
}

@keyframes voice-badge-confirm {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.8);
  }
  100% {
    transform: scale(1);
    background: linear-gradient(135deg, #f59e0b, #d97706);
  }
}

.voice-note-text {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.voice-freq-text {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}


.note-name {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.note-frequency {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.test-instruction {
  background: rgba(239, 68, 68, 0.1);  /* 赤色背景に変更 */
  border: 1px solid rgba(239, 68, 68, 0.2);  /* 赤色ボーダーに変更 */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* preparation.html用の大きな.test-instruction */
#range-test-section .test-instruction {
  width: 48px;
  height: 48px;
  margin: 0;
  background: rgba(239, 68, 68, 0.15);  /* 赤色背景（やや濃いめ） */
  border: 1px solid rgba(239, 68, 68, 0.3);  /* 赤色ボーダー（やや濃いめ） */
}

#range-test-section .text-sub-title {
  text-align: center !important;  /* センター寄せに変更 */
  margin: 0;
}

/* モバイル版でテキストサイズ調整 */
@media (max-width: 768px) {
  #range-test-section .text-sub-title {
    font-size: 1rem;
    text-align: center !important;  /* モバイルでもセンター寄せ */
  }
}

/* マイクステータスアイコンのスタイル */
.mic-status-container {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

/* 待機状態（白のグラス効果） */
.mic-status-container.standby {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
  /* Safari 18 backdrop-filterバグ回避 */
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.mic-status-container.standby i {
  color: white;
  width: 36px;
  height: 36px;
}

/* 録音状態（赤のグラス効果 + パルスアニメーション） */
.mic-status-container.recording {
  background: rgba(239, 68, 68, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  /* Safari 18 backdrop-filterバグ回避 */
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  animation: pulseGlow 2s ease-in-out infinite;
}

.mic-status-container.recording i {
  color: #ef4444;
  width: 36px;
  height: 36px;
}

/* パルスアニメーション（グローが広がったり縮んだり） */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3),
                0 0 40px rgba(239, 68, 68, 0.2);
  }
  50% {
    box-shadow: 0 4px 30px rgba(239, 68, 68, 0.5),
                0 0 60px rgba(239, 68, 68, 0.4),
                0 0 80px rgba(239, 68, 68, 0.2);
  }
}

/* パルスリング（追加エフェクト） */
.mic-status-container.recording::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(239, 68, 68, 0.5);
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}

.test-instruction-green {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ミュート状態（グレー背景） */
.test-instruction-gray {
  background: rgba(107, 114, 128, 0.2);
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.test-instruction-gray i {
  color: #6b7280 !important;
}

/* 録音中状態（赤背景 + パルスアニメーション） */
.test-instruction-red {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: instruction-glow 2s ease-in-out infinite;
}

.test-instruction-red i {
  color: #ef4444 !important;
}

.test-instruction.measuring {
  animation: instruction-glow 2s ease-in-out infinite;
}

@keyframes instruction-glow {
  0%, 100% {
    background: rgba(239, 68, 68, 0.15);  /* 赤色に変更 */
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  }
  50% {
    background: rgba(239, 68, 68, 0.3);  /* 赤色に変更 */
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
  }
}

.test-instruction p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 500;
}

/* 検出メーター */
.detection-meters {
  margin-bottom: 24px;
}

.detection-meters .meter-group {
  margin-bottom: 16px;
}



/* ==========================================================================
   ガイド付き初回トレーニング
   ========================================================================== */

/* 基音再生ボタンのハイライト（パルスアニメーション） */
/* 基音再生ボタンのゆっくり明滅（目立つグロー） */
.guided-highlight {
  animation: guidedBtnGlow 2s ease-in-out infinite !important;
}

@keyframes guidedBtnGlow {
  0%, 100% {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: brightness(1);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 32px rgba(59, 130, 246, 0.8), 0 0 64px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: brightness(1.25);
    transform: scale(1.02);
  }
}

/* STEP 3: UI解説 — スクロール禁止 */
.guided-tour-no-scroll {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  top: 0 !important;
}

/* STEP 3: UI解説 — ハイライト対象要素（蛍光グリーン + パルス） */
/* outline方式: padding/marginでレイアウトがズレない */
.guided-tour-highlight {
  position: relative;
  z-index: 10;
  outline: 3px solid rgba(34, 211, 153, 0.8);
  outline-offset: 8px;
  border-radius: 8px;
  animation: guidedTourPulse 1.5s ease-in-out infinite;
}

@keyframes guidedTourPulse {
  0%, 100% { outline-color: rgba(34, 211, 153, 0.8); box-shadow: 0 0 16px rgba(34, 211, 153, 0.4); }
  50% { outline-color: rgba(34, 211, 153, 1); box-shadow: 0 0 24px rgba(34, 211, 153, 0.6), 0 0 48px rgba(34, 211, 153, 0.2); }
}

/* AdviceBoard テキスト切替アニメーション */
.advice-board-text-transitioning .advice-board-title,
.advice-board-text-transitioning .advice-board-subtitle {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ドレミガイド: 測定中ステータス */
.test-status-measuring {
  color: rgba(255, 105, 180, 0.9) !important;
  font-style: normal !important;
  font-weight: 600;
  animation: measuringPulse 1s ease-in-out infinite;
}

@keyframes measuringPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* マイクバッジ: 拡大+ステータステキスト対応 */
.mic-badge-expanded.test-instruction {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.mic-badge-expanded .mic-status-text {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* ==========================================================================
   フッター（700px制限）
   ========================================================================== */
.footer-base {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}