/* ==============================
   CSS Variables
============================== */
:root {
  --bg: #ffffff;
  --fg: #1e293b;
  --primary: #2563eb;
  --primary-fg: #ffffff;
  --secondary: #f1f5f9;
  --muted: #64748b;
  --accent: #ea580c;
  --accent-fg: #ffffff;
  --danger: #dc2626;
  --border: #e2e8f0;
}

/* ==============================
   Reset & Base
============================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Sans JP", "Segoe UI", Arial, sans-serif;
  background: var(--secondary);
  color: var(--fg);
  line-height: 1.6;
  
}

/* ==============================
   SVG Icon (inline helper)
============================== */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

/* ==============================
   Site Header
============================== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;

  position: sticky;
    top: 0;
    z-index: 101; /* 他のコンテンツ（画像やボタン）の下に隠れないように最前面へ */

    /* 固定したときの後ろの見た目（背景色など） */
    background-color: #ffffff; 
    border-bottom: 2px solid #f1f5f9;
    padding: 10px 20px;
    
    /* 下に影をつけて、浮いている感じを出すとオシャレです */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);


}

.site-header, .hero {
  pointer-events: none; /* ヘッダーやヒーロー自体のクリック判定を消す */
}

/* その中にある「実際に押したいボタン」だけ判定を復活させる */
.logo-area, .trial-button, .hero-inner, select, button, a {
  pointer-events: auto;
}


.layout-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.home-link {
  font-size: 0.85rem;
  color: var(--muted);
}

.trial-button {
  background: var(--primary);
  color: var(--primary-fg);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.trial-button:hover {
  opacity: 0.9;
}

/* ==============================
   Hero
============================== */
.hero {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  padding: 15px 0;
  position: sticky; /* スクロール時に固定 */
  top: 60px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 左側：Unitタイトル */
.hero-left h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
}

#unitSubtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-top: 4px;
}

/* 右側：2段構成 */
.hero-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

/* 1段目（Level & Unit選択）と 2段目（Buttons）を横に並べる */
.hero-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

/* ラベルとセレクトのセット */
.select-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.select-group label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.select-group select {
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  font-size: 0.9rem;
  background: white;
  color: var(--fg);
  cursor: pointer;
}

/* 2段目：ナビゲーションボタン */
.page-nav {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  min-width: 80px;
  text-align: center;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==============================
   Content Area
============================== */
#content {
  display: flex;
  justify-content: center;
  align-items: flex-start;  /* ← center をやめる */
  padding: 10px 20px;
  position: relative;
  z-index: 50; /* ヘッダー(100)よりは下ですが、他の浮遊要素より上に */
}

.content-area {
  max-width: 720px;
  margin: 30px auto;
  padding: 0 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 1rem;
}

/* ==============================
   Line Card
============================== */
.line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  flex-wrap: wrap;
}

.line:hover {
  background: #f8fbff;
}

/* Voice-type left border */
.line.voice-male   { border-left: 4px solid #3b82f6; }
.line.voice-female  { border-left: 4px solid #ec4899; }
.line.voice-child   { border-left: 4px solid #f59e0b; }

/* Playing highlight */
.line.playing                { background: #dbeafe !important; border-color: #3b82f6 !important; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.line.playing.voice-female   { background: #fce7f3 !important; border-color: #ec4899 !important; box-shadow: 0 0 0 2px rgba(236,72,153,.15); }
.line.playing.voice-child    { background: #fef3c7 !important; border-color: #f59e0b !important; box-shadow: 0 0 0 2px rgba(245,158,11,.15); }

/* ==============================
   Speak Button
============================== */
.speak-btn {
  font-size: 1rem;
  background: #eaf2ff;
  border: 1px solid #c7dcff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.2s;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.speak-btn:hover { background: #d8e9ff; }

.speak-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}









/* Pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.speak-btn.active .icon {
  animation: pulse 1s ease-in-out infinite;
}

/* ==============================
   Text Wrap
============================== */
.text-wrap {
  flex: 1;
  min-width: 0;
}

.speaker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.message {
  flex: 1;                 /* 空白をすべて埋める */
  text-align: left;
  line-height: 1.5;
}

/* 🔥 ボタンの塊：右端に固定し、ボタン同士をくっつける */
.line-btn-group {
  display: flex;
  gap: 8px;                /* 再生とペンの距離（お好みで調整） */
  flex-shrink: 0;          /* ボタンが縮まないようにする */
  margin-left: auto;       /* 明示的に右寄せを強調 */
}



.voice-male-text   { color: #3b82f6; }
.voice-female-text  { color: #ec4899; }
.voice-child-text   { color: #d97706; }

/* Badge */
.voice-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.voice-badge.male   { background: #dbeafe; color: #1d4ed8; }
.voice-badge.female  { background: #fce7f3; color: #be185d; }
.voice-badge.child   { background: #fef3c7; color: #b45309; }

/* Sentence */
.sentence {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
}

.sentence.hidden-text {
  color: transparent;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
  user-select: none;
}

/* ==============================
   Dictation Button
============================== */
.dictation-btn {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669); /* 緑系グラデ */
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

.dictation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16,185,129,0.35);
  background: linear-gradient(135deg, #059669, #047857);
}

.dictation-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(16,185,129,0.25);
}

/* 小さいサイズ用バリエーション */
.dictation-btn-small {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 10px;
}


/* Dictation Input */
.dictation-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dictation-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}


/* 英文を隠すためのスタイル */
.message.blur {
  filter: blur(5px);
  user-select: none; /* コピペ防止 */
}

.dictation-btn-mini {
  font-size: 1.1rem; /* アイコンを少し見やすく */
  font-weight: 600;
  width: 36px;       /* 正方形に近い形に */
  height: 36px;
  margin-left: 8px;
  border-radius: 10px; /* 少しだけ角を落とす */
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(16,185,129,0.2);
  flex-shrink: 0;    /* 潰れないように固定 */
}

.dictation-btn-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(16,185,129,0.3);
  background: linear-gradient(135deg, #059669, #047857);
}

.dictation-btn-mini:active {
  transform: translateY(0);
}


/* シンプルで洗練されたグレー系のチェックボタン */
.check-btn {
  margin-top: 0px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  
  /* 白背景に落ち着いたグレーの境界線 */
  background: #ffffff;
  border: 1.5px solid #94a3b8; /* 青みがかった上品なグレー */
  color: #475569; /* 文字色も同系の濃いグレー */
  
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ホバー時に浮き出す演出 */
.check-btn:hover {
  transform: translateY(-2px);
  background: #f8fafc; /* ごく薄いグレーで反応を出す */
  border-color: #64748b; /* 境界線を少し濃く */
  color: #1e293b; /* 文字色をクッキリさせる */
  box-shadow: 0 5px 12px rgba(148, 163, 184, 0.3); /* グレー系の影で浮かせる */
}

.check-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(148, 163, 184, 0.2);
}



/* ツールチップの土台（ボタン共通） */
.play-btn-small, .play-btn-large, .dictation-btn, .dictation-btn-mini {
  position: relative; /* ツールチップの基準点にする */
}

/* ホバー時に表示される文字の設定 */
[data-tooltip]::after {
  content: attr(data-tooltip); /* 属性に入れた文字を表示 */
  position: absolute;
  bottom: 120%;      /* ボタンの上に表示 */
  left: 50%;
  transform: translateX(-50%);
  background-color: #334155; /* 濃いグレー */
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;        /* 普段は隠す */
  visibility: hidden;
  transition: opacity 0.3s, bottom 0.3s; /* ふわっと動かす */
  pointer-events: none; /* ツールチップ自体は邪魔しない */
  z-index: 100;
}

/* ホバーした瞬間の動き */
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: 130%; /* 少し上に浮き上がる */
}

/* 小さな三角（矢印）をつける場合 */
[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #334155;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  z-index: 100;
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}



/* ==============================
   Control Area 
============================== */
.control-area {
  max-width: 100%;
  display: flex;
  justify-content: flex-end;   /* ← 右寄せ */
  align-items: center;
  gap: 24px;

  background: #ffffff;
  padding: 8px 24px;
  border-radius: 0px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  margin-bottom: 10px;
}


/* ===== 右側まとめ ===== */
.control-right {
  display: flex;
  align-items: center;
  gap: 5px;
}


.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* ラベル */
.control-title {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

/* セレクト */
.control-group select {
  padding: 6px 10px;
  font-size: 14px;

  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f9fafb;

  transition: all 0.2s ease;
}


/* hover */
.control-group select:hover {
  border-color: #9ca3af;
}

/* focus（重要：プロ感出る） */
.control-group select:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.15);
}


/* ==============================
   再生ボタンの基本スタイル（紺色）
   ============================== */
#startSequentialBtn { /* 連続再生ボタンのIDやクラスを指定 */
    display: inline-flex !;
    align-items: center ;
    justify-content: center ;
    width: 40px ;
    height: 40px ;
    min-width: 40px ; 
    min-height: 40px ;
    background-color: #001f3f ; /* 紺色 */
    border: none ;
    border-radius: 4px ;
    cursor: pointer ;
    transition: background-color 0.3s ease;
    padding: 0 ;
    flex-shrink: 0 ;
}

.play-btn-small {
    flex-shrink: 0 !important;
    width: 36px;
    height: 36px;
    flex-shrink: 0; /* ← これが重要！ */
    background-color: #779cd0;
    border: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}



/* アイコンの基本形（白い▶） */
.icon-play {
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid white; /* 白い三角 */
    margin-left: 2px; /* 中心調整 */
}

.play-btn-large {
  display: inline-flex; 
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  width: auto;    
  min-width: 80px;
  margin-right: 10px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background-color: #779cd0; /* 紺色 */
  transition: all 0.2s ease;
  align-items: center;     /* 縦中央 */
  justify-content: center; /* 横中央 */
}

.play-btn-large .icon-play,
.play-btn-large .icon-stop {
  font-size: 24px;       /* 同じサイズ */
  display: inline-block;  /* 幅を維持 */
  text-align: center;
}

.play-btn-large:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  background-color: #1e3a8a;
}


/* ===== Play All Button ===== */
#playAllBtn {
  background-color: #001f3f;   /* 紺 */
  color: white;

  border: none;
  border-radius: 12px;

  padding: 10px 20px;
  min-width: 140px;
  height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;                     /* アイコンと文字の間 */

  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* 再生中は▶を隠す */
#playAllBtn.playing .icon-play {
  display: none;
}

/* 再生中だけ■を表示 */
#playAllBtn .icon-stop {
  display: none;
}

#playAllBtn.playing .icon-stop {
  display: inline-block;
}

/* 再生中は文字消すなら */
#playAllBtn.playing .label {
  display: none;
}

#playAllBtn:disabled {
  cursor: not-allowed !important; /* 立ち入り禁止マークを強制 */
  pointer-events: auto !important; /* disabledでもマウスイベントを拾ってカーソルを変えるために必要 */
}



/* ==============================
   再生中のスタイル（赤色 ＋ ■）
   ============================== */
.playing,
.playing#startSequentialBtn {
    background-color: #ff4136 !important; /* 再生中は赤 */
}

/* アイコンの切り替え（白い■） - 停止アイコン用 */
.icon-stop {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: white; /* 白い四角 */
    border: none;
}

/* ホバー時の微調整 */
.play-btn-small:hover:not(:disabled) {
    opacity: 0.8;
    transform: translateY(-1px);
    background-color:#1e3a8a;
}

/* 無効化時のスタイル（JSのdisableSingleButtonsに対応） */
.play-btn-small:disabled, 
.dictation-btn-mini:disabled {
  cursor: not-allowed !important;
}


/* ヒントのグリッドレイアウト */
.hint-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 0px;
    margin-bottom: 20px;
    width: 100%;
    position: relative;
    z-index: 200;
}

.hint-grid.single-column {
  grid-template-columns: 1fr;
}
.hint-grid.two-column {
  grid-template-columns: repeat(2, 1fr);
}


.hint-grid.single-column .hint-text {
  text-align: left;
}

/* 個別のカードデザイン */
.hint-card {
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.hint-card.playing {
  background: #e0f2fe;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}

.hint-text {
    flex: 1;
    font-size: 1.6rem; /* 基本は大きく */
    color: #1e3b2a;
    text-align: center;
    line-height: 1.2;
    min-width: 0;
}

.hint-card:hover {
    background: #f8fbff;
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.hint-card:active {
    transform: scale(0.95);
}

.exercise-instruction {
    margin: 0;
    font-size: 1.8rem; /* ここで一括管理 */
    font-weight: 700;
    color: var(--fg);
    line-height: 1.3;
    flex: 1;
}

/* 指示文とボタンを包むコンテナ */
.instruction-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
    padding-bottom: 0px;
    border-bottom: 2px solid #f1f5f9;
}


.hint-section-title {
    font-size: 1.6rem;      /* 指示文と同じサイズ */
    font-weight: 700;       /* しっかり太字 */
    color: #0c8a3ad9;
    margin-top: 10px;       /* 上に余白 */
    margin-bottom: 0px;    /* 下（カードとの間）に余白 */
    padding-left: 10px;     /* 左側に少しアクセント用の余白 */
    border-left: 5px solid #0c8a3ad9;/* 紺色の縦線を入れて「見出し」感を出す */
    line-height: 1.2;
}




/* 画像を包むコンテナ */
.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}

/* 各画像の枠 */
.image-wrapper {
    position: relative; /* これが数字の基準点になります */
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #FFFFFF;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

.image-number-badge {
    position: absolute;
    top: 8px;     /* 上からの距離 */
    left: 8px;    /* 左からの距離 */
    width: 32px;
    height: 32px;
    background-color: #68c273; /* 紺色（ボタンと統一） */
    color: white;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%; /* 丸くする */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* 画像より上に表示 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


/* 画像そのものの設定 */
.exercise-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 画像の比率を保ったまま枠に収める */
    padding: 10px;
}




/* ==============================
   Select & Label
============================== */
.control-label {
  font-size: 0.85rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-select {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);

  font-size: 0.85rem;
  background: white;
  color: var(--fg);

  min-width: 180px;
  transition: border 0.2s, box-shadow 0.2s;
}

.control-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,141,253,0.15);
}

/* ==============================
   Voice Info Panel
============================== */
.voice-info-panel {
  max-width: 720px;
  margin: 16px auto;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.voice-info-panel h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.voice-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.voice-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.voice-tag.male   { background: #dbeafe; color: #1d4ed8; }
.voice-tag.female  { background: #fce7f3; color: #be185d; }
.voice-tag.child   { background: #fef3c7; color: #b45309; }

.voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.male-dot   { background: #3b82f6; }
.female-dot { background: #ec4899; }
.child-dot  { background: #f59e0b; }

.voice-details {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.8;
}

.voice-details strong {
  color: var(--fg);
}

.voice-pitch {
  font-size: 0.75rem;
  opacity: 0.7;
}

.card {
  width: 92%;
  max-width: 1200px;
  background: white;
  margin: 0 auto 30px;
  padding: 10px 30px;
  box-sizing: border-box;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 10;
}

.controls {
  margin-bottom: 20px;
}

.overview-card {
  max-width: 90%;
  background: white;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  text-align: center;
}

.overview-text {
  line-height: 1.9;
  font-size: 2rem;
  margin-bottom: 20px;
  text-align: left;
}

.overview-play {
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: #1e3a8a;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.2s;
}

.overview-play:hover {
  background: #162c6b;
}

.blur {
  filter: blur(6px);
}

#dictationArea {
  margin-top: 15px;
}

#dictInput {
  width: 100%;
  font-size: 16px;
  padding: 8px;
}

.correct {
  color: black;
}

.wrong {
  color: red;
  font-weight: bold;
}

.conversation-card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.conversation-instruction {
  font-weight: bold;
  margin-bottom: 0px;
  font-size: 2.2rem;
}

.conversation-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 1.8rem;
}



.line-play {
  margin-left: 10px;
}

.speaker {
  display: inline-block;
  padding: 4px 10px;
  margin-right: 10px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: bold;
  color: white;
  min-width: 60px;
  flex-shrink: 0;
}

/* 名前ごとの色 */
.heather { background: #20bf6b; }  
.ryan { background: #a55eea; }      
.mrsmith { background: #4b7bec; }
.mrssmith { background: #e355aa; }
.mary { background: #e08427; }
.pete { background: #2b9a10; }
.linda { background: #92c415; }
.rob { background: #0c1b77; }
.eddie { background: #bb890c; }
.alice { background: #db36de; }
.carla{ background: #219fc2; }
.louise{ background: #d43471; }
.kent{ background: #cc33f2; }


.highlight {
  color: #ea580c;      /* --accent (オレンジ) を使うと統一感が出ます */
  font-weight: bold;   /* 太字にするとより強調されます */
  background: none;    /* 背景はなし */
}

.highlight2 {
  color: #e355aa; /* Mrs. Smithと同じピンク系 */
  font-weight: normal;
  font-size: 1.8rem;
}

/* 薄い水色のマーカー */
.marker-blue {
  background-color: #e0f2fe; /* 薄い空色 */
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-block; /* マーカーを綺麗に乗せるため */
  font-weight: normal;
  font-size: 1.8rem;
}


/* ==============================
   Exercise 2: Question List
   ============================== */
.question-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 30px;
}

.question-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: #f8fafc; /* ごく薄いグレー */
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.question-item:hover {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.question-text {
  font-size: 1.6rem; /* 大きめで見やすく */
  color: var(--fg);
  line-height: 1.2;
  flex: 1;
}

/* 質問リスト内のボタンが大きすぎるのを防ぐ */
.question-item .play-btn-small {
  margin-left: 20px;
}

/* 質問用再生ボタン（少し小さめでもOK） */
.q-play-btn {
  width: 48px;
  height: 48px;
  background-color: var(--navy);
  color: white;
  border: none;
  border-radius: 50%; /* 丸いボタンに */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.q-play-btn:hover {
  transform: scale(1.05);
  background-color: var(--primary);
}


.examples-section-title{
  color:#ff4fa3;
  margin-top:20px;
  margin-bottom:10px;
  font-weight: normal;
  font-size: 1.4rem;
}

.example-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  margin-bottom:20px;
}

.example-card{
  background:#e8f6ff;
  padding:12px 14px;
  border-radius:8px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.example-text{
  font-weight: normal;
  font-size: 1.4rem;
  flex:1;
}

.qa-q .example-text::before{
  content:"Q. ";
  font-weight:bold;
  color:#2b6cb0;
}

.qa-a .example-text::before{
  content:"A. ";
  font-weight:bold;
  color:#d93025;
}

/* =====================
Summary (Unit10)
===================== */

.summary-list{
  margin-top:20px;
}

.summary-block{
  background:#f1f5f9;
  padding:15px;
  margin-bottom:15px;
  border-radius:8px;
  position:relative;
}

.summary-unit{
  color:#2563eb;
  margin-bottom:8px;
  font-size: 1.6rem;
}

.summary-text{
  white-space:pre-wrap;
  font-family:inherit;
  font-size: 1.4rem;
  line-height:1.6;
}

.question-container{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:20px;
}

.exercise-question{
  font-weight:500;
  line-height:1.6;
  font-size: 1.4rem;
}

.underline{
  border-bottom:3px solid #ef4444;
  padding-bottom:2px;
}

.summary-block{
margin-bottom:20px;
}

.summary-unit{
margin-bottom:10px;
}

.summary-line{
display:flex;
align-items:center;
justify-content:space-between;
margin-bottom:6px;
}

.summary-text{
flex:1;
}

.play-btn-small{
margin-left:10px;
}

/* =====================
Words Card
===================== */

.word-card{
background:#ffffff;
border:1px solid #e2e8f0;
border-radius:10px;
padding:12px 15px;
margin-bottom:10px;
box-shadow:0 2px 4px rgba(0,0,0,0.05);
}

.word-header{
display:flex;
align-items:center;
justify-content:space-between;
gap:10px;
}

.word-header button{
  margin-left:6px;
}


.word-text{
flex:1;
font-size:1.5rem;
font-weight:600;
color:#1e293b;
}

.word-meaning{
margin-top:6px;
font-size:1.35rem;
color:#475569;
line-height:1.5;
}

.control-right {
  display: flex;
  flex-direction: column; /* 上段は横並び、全体は縦 */
  gap: 0px;
}

/* 上段：Speed / Voice 横並び、スマホは縦並び */
.controls-row {
  display: flex;       /* Flexbox を有効にする */
  flex-direction: row; /* アイテムを横に並べる */
  justify-content: flex-end; /* 横方向の間隔調整 */
  align-items: center; /* 縦方向の揃え方 */
  gap:10px;
  width: auto; /* 親幅に合わせず、必要な幅だけ */
}

/* 注意書き */
.voice-note {
  font-size: 0.7rem;
  color: #64748b; /* 既存のmutedカラーと統一 */
  margin-top: 2px;
  line-height: 1.3;
}

/* ==============================
   Footer
============================== */
.footer {
  background: #1e293b;
  color: #cbd5e1;
  margin-top: 80px;
  padding-top: 30px;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-logo img {
  height: 28px;
  margin-right: 24px;
}

.footer-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
}

.footer-nav a:hover {
  color: #ffffff;
}

.footer-bottom {
  text-align: center;
  padding: 16px 0;
  margin-top: 20px;
  border-top: 1px solid #334155;
  font-size: 0.78rem;
  color: #64748b;
}


/* ==============================
   TOPに戻るボタン
============================== */
.top-btn {
  position: fixed;
  bottom: 30px;
  right: 20px;
  width: 46px;
  height: 46px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  z-index: 100;
}

.top-btn.show {
  opacity: 1;
  pointer-events: auto;
}

.top-btn.hide {
  opacity: 0;
  pointer-events: none;
}


.top-btn:hover {
  background: #1d4ed8;
}



/* ==============================
   Responsive (Smartphone)
============================== */
@media (max-width: 600px) {

/* ---------- Header ---------- */

.site-header {
  padding: 4px 8px;
}

.layout-bar {
  padding: 0 6px;
}

.logo-text {
  font-size: 0.9rem;
}

.home-link {
  font-size: 0.65rem;
}

.trial-button {
  padding: 4px 8px;
  font-size: 0.65rem;
}


/* ---------- Hero ---------- */

.hero {
  padding: 6px 8px;
  top: 48px;
}

.hero-left {
  max-width: 60%;
  overflow: hidden;
}

.hero-left h1 {
  font-size: 1.2rem;   /* ← Unit名 */
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-row {
  gap: 8px;
}

.hero-inner {
  padding: 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.select-group label {
  font-size: 0.7rem;
}

.select-group select {
  font-size: 0.8rem;
  padding: 2px 6px;
}

/* 個別幅 */
#speedSelect {
  width: 80px;  /* Voice用は広め */
}




#unitSubtitle {
    font-size: 1.0rem;   /* ← 少し大きく */
    line-height: 1.2;
    font-weight: 500;    /* ← 少しだけ強調 */
    opacity: 0.95;       /* ← 薄すぎ防止 */
    margin-top: 2px;
}

 /* =======================
     右側ボタン圧縮
  ======================= */
  .hero-right {
    align-items: flex-end;
    gap: 4px;
  }
  

  .page-nav {
    gap: 4px;
  }

  .ghost-btn {
    min-width: 36px;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 30%;
    touch-action: manipulation;
  }

  /* 🔥 元の文字を完全に消す */
/* 🔥 元の文字を完全に消す */
#prevBtn,
#nextBtn {
  font-size: 0;
  line-height: 0; 
  display: flex;
  align-items: center;
  justify-content: center;
}

#prevBtn::after,
#nextBtn::after {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(1.2);
  line-height: 1;
  font-family: Arial, sans-serif;
}

#prevBtn::after {
  content: "◀";
}

#nextBtn::after {
  content: "▶";
}

.ghost-btn:active {
  transform: scale(0.92);
}

.ghost-btn:hover {
  opacity: 0.7;
}

.controls-row {
  display: flex;       /* Flexbox を有効にする */
  flex-direction: row; /* アイテムを横に並べる */
  justify-content: flex-end; /* 横方向の間隔調整 */
  align-items: center; /* 縦方向の揃え方 */
  gap:10px;
  width: 100%; /* 親幅に合わせず、必要な幅だけ */
}

/* 親をフレックスにして右寄せ */
.control-right {
  display: flex;             /* 子要素をフレックスにする */
  justify-content: flex-end; 
  align-items: center;       /* 高さを中央に揃える */
}


.controls-row select {
    width: auto;               /* 幅を自動調整 */
    box-sizing: border-box;    /* padding を含めた幅に */
}




  
/* ---------- Content ---------- */

#content {
  padding: 6px 6px;
}

.card {
  width: 98%;
  padding: 10px 10px;
}

.line {
  padding: 8px 10px;
  margin-bottom: 6px;
}

.sentence {
  font-size: 0.9rem;
}

.voice-badge {
  font-size: 0.55rem;
}

.speak-btn {
  padding: 6px;
}

/* ---------- Overview (スマホ) ---------- */

.overview-card {
  max-width: 98%;
  padding: 14px;
}

.overview-text {
  font-size: 1.3rem;
  line-height: 1.6;
}

.overview-play {
  padding: 6px 12px;
  font-size: 0.8rem;
}


/* ---------- Conversation (スマホ・コンパクト版) ---------- */

.conversation-card {
  padding: 8px 10px;
}

.conversation-instruction {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.conversation-line {
  font-size: 1.15rem;
  padding: 2px 0;
  margin-bottom: 2px;
}

.speaker {
  font-size: 0.8rem;
  min-width: 44px;
  padding: 2px 6px;
  margin-right: 6px;
}

.line-play {
  margin-left: 6px;
}

.highlight2 {
  font-size: 1.15rem;
}

.marker-blue {
  font-size: 1.15rem;
}

/* ---------- Conversation ボタン間隔（スマホ） ---------- */

.line-btn-group {
  gap: 3px;
}

.dictation-btn-mini {
  margin-left: 3px;
}





/* ---------- Exercise text ---------- */

.exercise-instruction {
  font-size: 1.2rem;
}

.exercise-question {
  font-size: 1.15rem;
  line-height: 1.5;
}

.question-text {
  font-size: 1.2rem;
}

.example-text {
  font-size: 1.1rem;
}

.summary-text {
  font-size: 1.1rem;
}



/* ---------- Hint cards ---------- */

.hint-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.hint-card {
  padding: 6px;
}

.hint-text {
  font-size: 1.1rem;
}


/* ---------- Images ---------- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2列 */
  gap: 6px;
}

.image-wrapper {
  width: 100%;
  aspect-ratio: 4/3;
}

.exercise-img {
  padding: 4px; /* 余白を減らして画像を大きく */
}

/* ---------- Summary (スマホ) ---------- */

.summary-block {
  padding: 8px 10px;
  margin-bottom: 8px;
}

.summary-unit {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.summary-text {
  font-size: 1.05rem;
  line-height: 1.5;
}

.summary-line {
  padding: 4px 8px;
  margin-bottom: 6px;
}

/* ---------- Buttons ---------- */

.play-btn-small {
  width: 32px;
  height: 32px;
}

.dictation-btn-mini {
  width: 32px;
  height: 32px;
}

.play-btn-large {
  padding: 8px 14px;
  font-size: 0.8rem;
}

#playAllBtn {
  height: 36px;
  min-width: 110px;
  font-size: 0.8rem;
}

/* ---------- Conversation ボタン間隔（スマホ） ---------- */

.line-btn-group {
  gap: 4px;
}

.dictation-btn-mini {
  margin-left: 4px;
}


/* ---------- Control area ---------- */

.control-area {
  padding: 6px;
  gap: 10px;
}

.control-group{
  display: flex;             /* 子要素をフレックスにする */
  justify-content: flex-end !important; /* ← ここを center → flex-end に変更 */
  align-items: center;
}

.control-group select {
  font-size: 0.8rem;
  padding: 4px 6px;
}

  /* ディクテーション表示エリア全体をコンパクトに */
  #dictationArea {
    position: relative;
    z-index: 1; /* ヘッダーより低い値 */
    margin-top: 56px;
  }

  /* 入力欄を小さく */
  .dictation-input,
  #dictInput {
    font-size: 16px;
    transform-origin: left top;
    width: 100%;
    box-sizing: border-box;  /* ← これが神 */
  }

  /* チェックボタンも小さく */
  .check-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
  }

  .dictation-input {
    font-size: 16px !important;
    margin-top: 16px; /* または必要に応じて調整 */
  }


/* ---------- Footer (スマホ最適化) ---------- */

.footer {
  margin-top: 40px;
  padding-top: 18px;
}

.footer-bar {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 0 10px;
}

.footer-logo img {
  height: 22px;
  margin-right: 0;
}

.footer-nav {
  justify-content: flex-end;
  gap: 6px 14px; /* 縦 横 */
  width: 100%;
}

.footer-nav a {
  font-size: 0.7rem;
}

.footer-bottom {
  padding: 10px 0;
  font-size: 0.65rem;
}
}






/* iOS Safari での入力時ズームを防止 */
@supports (-webkit-touch-callout: none) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* または、全体的にタッチ操作でのズームを制御 */
html {
  touch-action: manipulation;
}

@-moz-document url-prefix() {
  .dictation-input,
  #dictationArea {
    scroll-margin-top: 60px;
  }
}

.dictation-input,
#dictationArea {
  scroll-margin-top: 60px; /* ヘッダー分のスクロールマージン */
}
