/* ---------------------------------
   Global Colors（dictation-test と共通）
---------------------------------- */
:root {
  --bg: #f7f9fc;
  --text-main: #1a1a1a;
  --text-sub: #666;
  --white: #fff;
  --accent: #3B82F6;
  --accent-dark: #2563EB;
  --accent-soft: #e8f0ff;
  --border: #e2e8f0;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  --radius: 16px;
}

/* ---------------------------------
   Base
---------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.7;
}

/* container 相当（dictation の .container に合わせる） */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-title {
  font-size: 1.7rem;
  margin: 4px 0 8px;
  font-weight: 700;
}

/* メインカード（dictation の .sentence / .section に近づける） */
.app-main {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 16px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ---------------------------------
   画面切り替え
---------------------------------- */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ---------------------------------
   スタート画面テキスト（dictation の .description 風）
---------------------------------- */
.lead-text {
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--text-sub);
}

.start-info {
  margin: 0 0 20px;
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--text-sub);
}

.start-info li {
  margin-bottom: 4px;
}

/* ---------------------------------
   ボタン（dictation の .btn, .btn.primary, .btn.secondary に合わせる）
---------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 20px;
  margin-top: 6px;
  font-size: 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid transparent;
  transition:
    background 0.2s,
    transform 0.1s,
    color 0.2s,
    box-shadow 0.15s ease;
}

/* メインボタン */
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* サブボタン */
.btn-secondary {
  background: var(--white);
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* disable */
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------------------------------
   クイズ画面ヘッダー
---------------------------------- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-sub);
}

.quiz-progress {
  font-weight: 600;
  color: var(--text-main);
}

.quiz-timer {
  padding: 4px 12px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.85rem;
}

/* ---------------------------------
   クイズ本体
---------------------------------- */
.quiz-body {
  margin-bottom: 16px;
}

.quiz-word {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin: 12px 0 4px;
}

.quiz-level-tag {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-bottom: 18px;
}

/* 選択肢 */
.options-list {
  display: grid;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fafb;
  text-align: left;
  font-size: 0.98rem;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    transform 0.05s ease,
    box-shadow 0.1s ease;
}

.option-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

.option-btn:disabled {
  cursor: default;
}

/* 正誤表示（色は dictation の result.correct / incorrect に近づける） */
.option-btn.correct {
  background: #ecfdf3;
  border-color: #16a34a;
}

.option-btn.incorrect {
  background: #fef2f2;
  border-color: #dc2626;
}

/* フッター（次の問題ボタン） */
.quiz-footer {
  margin-top: 16px;
}

/* ---------------------------------
   結果画面
---------------------------------- */
.result-heading {
  text-align: center;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.4rem;
  font-weight: 700;
}

.result-main {
  text-align: center;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.result-level {
  font-size: 1.5rem;
  font-weight: 700;
}

.result-description {
  text-align: center;
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-sub);
}

.result-score {
  text-align: center;
  margin-bottom: 16px;
}

.result-detail {
  margin-bottom: 20px;
}

.result-subheading {
  font-size: 1rem;
  margin-bottom: 8px;
}

/* レベル別正答テーブル */
.result-breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.result-breakdown th,
.result-breakdown td {
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
  text-align: center;
}

.result-breakdown th {
  font-weight: 600;
  color: var(--text-main);
}

/* ---------------------------------
   Responsive（dictationと同じノリ）
---------------------------------- */
@media (min-width: 768px) {
  .app-container {
    padding: 40px 20px 60px;
  }

  .app-title {
    font-size: 1.9rem;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: 16px 12px 20px;
    border-radius: 14px;
  }

  .quiz-word {
    font-size: 1.6rem;
  }
}

/* ---------------------------------
   Back Home Button（dictation と統一）
---------------------------------- */
.back-home-container {
  margin-top: 32px;
  text-align: center;
}

.back-home-btn {
  display: inline-flex;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, transform 0.1s ease;
}

.back-home-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
