/* ロールプレイ練習ページのスタイル
 * モバイルファースト設計
 * 吹き出しUI、選択肢カード、進捗バーを含む
 */

/* ========================================
   シナリオ選択ページ
======================================== */

.roleplay-list-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.page-header .page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text, #1a1a2e);
  margin-bottom: 0.75rem;
}

.page-header .page-description {
  color: var(--color-text-muted, #555);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
}

.loading-text {
  text-align: center;
  color: var(--color-text-muted, #888);
  padding: 2rem;
}

.error-text {
  text-align: center;
  color: #c0392b;
  padding: 2rem;
}

/* シナリオカードグリッド */
.scenario-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 600px) {
  .scenario-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .scenario-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* シナリオカード */
.scenario-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.scenario-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.scenario-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* CEFRレベルバッジ */
.cefr-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cefr-a1 {
  background: #e8f5e9;
  color: #2e7d32;
}

.cefr-a2 {
  background: #e3f2fd;
  color: #059669;
}

.cefr-b1 {
  background: #fff8e1;
  color: #f57f17;
}

.cefr-b2 {
  background: #fce4ec;
  color: #ad1457;
}

.scenario-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

.scenario-description {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  flex: 1;
  margin: 0;
}

.scenario-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.scenario-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #f0f0f5;
  border-radius: 10px;
  font-size: 0.75rem;
  color: #555;
}

.scenario-start-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--color-primary, #10b981);
  color: #fff;
  transition: background 0.2s ease;
}

.scenario-start-btn:hover {
  background: var(--color-primary-dark, #059669);
  text-decoration: none;
}

/* ========================================
   ロールプレイ実行ページ
======================================== */

.roleplay-detail-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
}

/* ヘッダー */
.roleplay-header {
  margin-bottom: 1.5rem;
}

.roleplay-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.btn-back {
  font-size: 0.85rem;
  color: var(--color-primary, #10b981);
  text-decoration: none;
  white-space: nowrap;
}

.btn-back:hover {
  text-decoration: underline;
}

.roleplay-scenario-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

/* 進捗バー */
.progress-container {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary, #10b981);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: #888;
  text-align: right;
  margin: 0;
}

/* ナレーション */
.narration-box {
  background: #f8f8fc;
  border-left: 4px solid #9e9ee0;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.narration-text {
  font-size: 0.9rem;
  color: #555;
  font-style: italic;
  margin: 0;
}

/* 話者セクション */
.speaker-section {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.speaker-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 60px;
}

.avatar-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #e8eaf6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.speaker-name {
  font-size: 0.75rem;
  color: #666;
  text-align: center;
  font-weight: 600;
}

/* 吹き出し */
.speech-bubble {
  background: #fff;
  border: 2px solid #c5cae9;
  border-radius: 12px 12px 12px 0;
  padding: 1rem 1.2rem;
  position: relative;
  flex: 1;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 14px;
  border: 6px solid transparent;
  border-right-color: #c5cae9;
}

.speaker-line {
  font-size: 1rem;
  line-height: 1.6;
  color: #1a1a2e;
  margin: 0 0 0.75rem 0;
}

.btn-tts {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid #9e9ee0;
  border-radius: 20px;
  background: #fff;
  color: #4a4a8a;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.btn-tts:hover {
  background: #e8eaf6;
  color: #1a1a6e;
}

.translation-toggle {
  margin-top: 0.6rem;
}

.translation-toggle summary {
  font-size: 0.8rem;
  color: #888;
  cursor: pointer;
  user-select: none;
}

.speaker-line-jp {
  font-size: 0.85rem;
  color: #666;
  margin: 0.3rem 0 0 0;
  padding: 0.5rem;
  background: #f8f8f8;
  border-radius: 6px;
}

/* 選択肢セクション */
.choices-section {
  margin-bottom: 1.5rem;
}

.choices-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.choices-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* 選択肢カード */
.choice-card {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.1s ease;
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
}

.choice-card:hover {
  border-color: var(--color-primary, #10b981);
  background: #f0f6ff;
  transform: translateX(4px);
}

.choice-card.selected {
  border-color: var(--color-primary, #10b981);
  background: #e8f0fe;
}

.choice-card.disabled {
  cursor: default;
  opacity: 0.7;
}

.choice-card.disabled:hover {
  transform: none;
  border-color: #e0e0e0;
  background: #fff;
}

.choice-card.disabled.selected:hover {
  border-color: var(--color-primary, #10b981);
  background: #e8f0fe;
}

.choice-text-section {
  flex: 1;
}

.choice-text-en {
  font-size: 0.95rem;
  color: #1a1a2e;
  line-height: 1.5;
  margin: 0 0 0.2rem 0;
}

.choice-text-jp {
  font-size: 0.8rem;
  color: #888;
  margin: 0;
}

.btn-tts-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #f8f8f8;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.btn-tts-choice:hover {
  background: #e8eaf6;
}

/* フィードバック */
.feedback-box {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.feedback-content {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.feedback-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.feedback-text {
  font-size: 0.9rem;
  color: #2e7d32;
  line-height: 1.5;
  margin: 0;
}

/* 結果画面 */
.result-area {
  display: none;
}

.result-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.result-ending-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.result-ending-type {
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

.result-summary {
  text-align: left;
  margin-bottom: 1.5rem;
}

.result-summary h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.75rem;
}

.chosen-expressions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chosen-expressions-list li {
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  background: #f5f5f5;
  border-radius: 6px;
  color: #333;
}

.result-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ローディング */
.loading-area {
  text-align: center;
  padding: 3rem 1rem;
  color: #888;
}

/* ボタン共通スタイル（フォールバック） */
.button-primary {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--color-primary, #10b981);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}

.button-primary:hover {
  background: var(--color-primary-dark, #059669);
}

.button-secondary {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  background: #f0f0f5;
  color: #444;
  border: 1px solid #ddd;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}

.button-secondary:hover {
  background: #e0e0e8;
  text-decoration: none;
}
