/* 基本的なリセットと全体設定 */
body {
  margin: 0;
  background-color: #f4f4f4;
  color: #333;
  min-height: 100vh;
}

/* イントロページ */
#intro-page {
  padding: 40px 30px; /* イントロページ固有のパディング */
}

#intro-page h1 {
  font-size: 2em;
  color: var(--accent01);
  margin-bottom: 50px;
  font-weight: bold;
}

.intro-description {
  font-size: 1.1em;
  color: #555;
  margin-bottom: 10px;
}

.intro-sub-description {
  font-size: 0.9em;
  color: #777;
}

#start-quiz-button {
  margin-top: 10px;
  padding: 15px 40px;
  font-size: 1.1em;
  width: 80%; /* 幅を広げる */
  max-width: 350px;
  border-radius: 128px;
}

.intro-stats {
  margin-top: 40px;
  font-size: 1em;
  color: #666;
}

.intro-stats span {
  font-size: 1.8em;
  font-weight: bold;
  color: #0056b3;
}

.container {
  background-color: #fff;
  padding: 0; /* コンテナ自体のパディングは0にし、内部で調整 */
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 1200px;
  text-align: center;
  flex-direction: column;
  min-height: 500px; /* ある程度の高さを確保 */
}

/* クイズエリア */
#quiz-area {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
#quiz-main-title {
  font-size: 1.5em;
  color: #0056b3;
  margin: 20px 0 10px 0;
  font-weight: bold;
}

/* クイズヘッダー */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid #eee;
}

.quiz-title-container {
  text-align: left;
  font-size: 1em;
  margin: 0;
}

#quiz-sub-text {
  font-size: 0.9em;
  color: #666;
  margin: 5px 0 0 0;
}

/* クイズボディ */
.quiz-body {
  flex-grow: 1;
  padding: 20px 30px;
  text-align: left;
  display: flex; /* 横並びにする */
  gap: 20px; /* 要素間のスペース */
}

.question-sentence {
  flex: 3; /* 問題文エリアが1の比率で幅を取る */
  font-size: 0.9em;
  line-height: 1.6;
}

.selection-list {
  flex: 4; /* 選択肢リストが2の比率で幅を取る */
  list-style: none;
  padding: 0;
  margin: 0;
}

.selection-item {
  margin-bottom: 10px;
}

.selection-check {
  display: none; /* ラジオボタンを非表示にする */
}

.selection-label {
  display: block;
  background-color: #e9ecef;
  border: 1px solid #ced4da;
  padding: 15px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  line-height: 1.5;
  text-align: left;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.selection-label:hover {
  background-color: #d6d8db;
  border-color: #a8b0b7;
}

.selection-label.selected {
  background-color: #0056b3;
  color: #fff;
  border-color: #0056b3;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

/* クイズフッター */
.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center; /* ボタンとプログレスバーを中央揃え */
  padding: 15px 30px;
  border-top: 1px solid #eee;
  background-color: #f9f9f9;
}

.quiz-navigation-buttons {
  display: flex;
  gap: 10px; /* ボタン間のスペース */
}

.timer-progress {
  display: flex;
  gap: 4px;
}

.progress-item {
  width: 20px;
  height: 10px;
  border-radius: 2px;
  background-color: #ccc;
}

.progress-item.green {
  background-color: #28a745;
}

.progress-item.yellow {
  background-color: #ffc107;
}

.progress-item.opacity {
  opacity: 0.4;
}

.button {
  background-color: #0056b3;
  color: #fff;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  transition: 0.5s;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

.button.primary {
  background-color: #0056b3;
}

.button.secondary {
  background-color: #6c757d;
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.2);
}

.button.secondary:hover {
  background-color: #5a6268;
  box-shadow: 0 6px 12px rgba(108, 117, 125, 0.3);
}

.button:hover {
  opacity: 0.8;
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
  transition: 0.5s;
}
button:focus {
  outline: none;
}

/* 結果表示エリア */
#result-area {
  padding: 30px;
  text-align: center;
  min-height: 300px; /* 最小の高さを確保 */
  max-width: 1200px; /* 幅を広げる */
  margin: 0 auto; /* 中央寄せ */
}

/* 新しい結果表示エリアのスタイル */
.result-title {
  font-size: 2em;
  color: #333;
  margin-bottom: 30px;
  font-weight: bold;
}

.result-section {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 25px;
  margin-bottom: 25px;
  text-align: left;
}

.result-section h3 {
  font-size: 1.4em;
  color: #0056b3;
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 10px;
}

/* 受検情報 */
.exam-info .info-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}

.exam-info .info-item:last-child {
  border-bottom: none;
}

.exam-info .info-label {
  font-weight: bold;
  color: #555;
}

.exam-info .info-value {
  color: #333;
}

/* 総合成績 */
.overall-performance .performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.overall-performance .grid-item {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
}

.overall-performance .grid-label {
  font-size: 0.9em;
  color: #6c757d;
  margin-bottom: 5px;
  display: block;
}

.overall-performance .grid-value {
  font-size: 1.8em;
  font-weight: bold;
  color: #007bff;
}

.overall-performance .judgment-legend p {
  font-size: 0.9em;
  color: #555;
  margin: 5px 0;
}

.overall-performance .disclaimer {
  font-size: 0.8em;
  color: #888;
  margin-top: 20px;
}

/* 問題別成績 */
.question-performance .question-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.question-performance .question-table th,
.question-performance .question-table td {
  border: 1px solid #e9ecef;
  padding: 12px 15px;
  text-align: center;
}

.question-performance .question-table th {
  background-color: #f0f0f0;
  font-weight: bold;
  color: #333;
}

.question-performance .question-table tbody tr:nth-child(odd) {
  background-color: #fdfdfd;
}

.question-performance .question-table tbody tr:hover {
  background-color: #f0f8ff;
}

/* SVGアイコンのスタイル */
.lucide {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.incorrect {
  color: #dc3545; /* 赤色 */
}

.correct {
  color: #28a745; /* 緑色 */
}

.icon {
  color: #6c757d; /* 灰色 */
}

/* 結果ボタン */
.result-buttons {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.result-buttons .button {
  padding: 12px 25px;
  font-size: 1em;
}

/* アコーディオンのスタイル */
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f0f0f0;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  border-radius: 8px 8px 0 0; /* 上部だけ角丸 */
  transition: background-color 0.3s ease;
}

.accordion-header:hover {
  background-color: #e0e0e0;
}

.accordion-header.active {
  background-color: #d0d0d0;
}

.accordion-header h3 {
  margin: 0;
  font-size: 1em;
  color: #333;
}

.accordion-icon {
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
  transform: rotate(90deg); /* 開いたときに回転 */
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px; /* 下部だけ角丸 */
  padding: 0 20px; /* 初期パディングは0 */
}

.accordion-content.active {
  max-height: 500px; /* コンテンツの高さに合わせて調整 */
  padding: 20px; /* 開いたときにパディングを追加 */
}

.accordion-content p {
  margin-bottom: 10px;
}

.accordion-content p:last-child {
  margin-bottom: 0;
}

/* 新しいアコーディオン関連のスタイル */
.question-summary-row {
  cursor: pointer;
}

.question-summary-row:hover {
  background-color: #f0f8ff;
}

.question-detail-row {
  display: table-row;
}

.question-detail-row td {
  padding: 0;
  border: none;
}

.question-detail-content {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 15px;
  text-align: left;
  font-size: 0.9em;
  line-height: 1.6;
}

.question-detail-content p {
  margin-bottom: 8px;
}

.question-detail-content p:last-child {
  margin-bottom: 0;
}

.chevron-cell {
  width: 30px; /* Adjust width for chevron icon */
}

.lucide.rotated {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

/* --- ここからレスポンシブ対応スタイル --- */
@media (max-width: 768px) {
  body {
    padding: 0;
    background-color: #fff; /* 背景を白に */
  }

  .container {
    padding: 20px 15px;
    min-height: auto;
    box-shadow: none; /* 影を削除 */
    border-radius: 0;
  }

  #intro-page h1,
  .result-title {
    font-size: 1.8em;
  }

  .intro-description {
    font-size: 1.1em;
  }

  #start-quiz-button {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
  }

  /* クイズエリア */
  .quiz-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
  }

  .quiz-body {
    flex-direction: column;
    gap: 25px;
    padding: 15px;
  }

  .quiz-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 15px;
    padding: 15px;
  }

  .quiz-navigation-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* 結果表示エリア */
  #result-area {
    padding: 20px 15px;
  }

  .overall-performance .performance-grid {
    grid-template-columns: 1fr;
  }

  .result-section {
    padding: 20px;
    box-shadow: none;
    border: 1px solid #eee;
  }

  .result-buttons {
    flex-direction: column;
  }

  .result-buttons .button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  #intro-page h1,
  .result-title {
    font-size: 1.6em;
  }

  .selection-label,
  .button {
    font-size: 1em;
    padding: 12px 15px;
  }

  .quiz-navigation-buttons {
    grid-template-columns: 1fr;
  }
}
