@charset "utf-8";
/* CSS Document */
* {
  box-sizing: border-box;
}
header {
  padding: 0 40px;
}
.headerInner {
  /* display: flex;
  justify-content: space-between;
  align-items: center; */
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 10px 0;
}
h1 {
    color: #333;
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 10px;
    text-align: center;
}
h2 {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 10px;
}

/* 問題の範囲カテゴリ表示 */
.question-category {
    background-color: #e8f4f8;
    color: #2c5aa0;
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

.question-number {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding: 8px 0;
}

/* 語群選択式穴埋め問題のスタイル */
.fill-area {
    margin-bottom: 20px;
}

.fill-text {
    font-size: 16px;
    line-height: 1.8;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
}

.fill-text .question-category {
    margin-bottom: 15px;
    margin-top: -5px;
}

.blank-slot {
    display: inline-block;
    background-color: #e3f2fd;
    border: 2px solid #1976d2;
    border-radius: 4px;
    padding: 2px 8px;
    margin: 0 2px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.blank-slot.filled {
    background-color: #bbdefb;
    border-color: #0d47a1;
}

.blank-slot.correct {
    background-color: #c8e6c9;
    border-color: #388e3c;
    color: #1b5e20;
}

.blank-slot.incorrect {
    background-color: #ffcdd2;
    border-color: #d32f2f;
    color: #b71c1c;
}

.word-area {
    margin-bottom: 20px;
}

.word-area h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.word-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .word-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .word-btn {
        padding: 10px 12px;
        font-size: 15px;
    }
    
    .fill-text {
        font-size: 15px;
        padding: 12px;
        line-height: 1.6;
    }
    
    .blank-slot {
        padding: 3px 6px;
        font-size: 14px;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .status-item {
        padding: 10px;
    }
    
    .question-category {
        font-size: 13px;
        padding: 6px 10px;
        margin-bottom: 10px;
    }
}

.word-btn {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: all 0.3s ease;
}

.word-btn:hover:not(.used) {
    background-color: #e3f2fd;
    border-color: #1976d2;
}

.word-btn.used {
    background-color: #f5f5f5;
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
    opacity: 0.6;
}

.answer-status {
    margin-bottom: 20px;
}

.answer-status h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.status-item .label {
    font-weight: bold;
    color: #333;
    min-width: 25px;
}

.status-item .answer {
    flex-grow: 1;
    color: #666;
    font-size: 14px;
}

.clear-btn {
    padding: 2px 6px;
    font-size: 12px;
    border: 1px solid #f44336;
    background-color: #fff;
    color: #f44336;
    border-radius: 3px;
    cursor: pointer;
}

.clear-btn:hover {
    background-color: #f44336;
    color: #fff;
}

.submit-area {
    text-align: center;
    margin-bottom: 20px;
}

#submit-answer {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background-color: #4caf50;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-answer:enabled:hover {
    background-color: #45a049;
}

#submit-answer:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.detailed-result {
    margin-top: 15px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 6px;
}

.result-item {
    padding: 5px 0;
    font-size: 14px;
}

.result-item.correct {
    color: #388e3c;
}

.result-item.incorrect {
    color: #d32f2f;
}
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}
nav ul {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  align-items: center;
  list-style: none;
}
.answerList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  & button {
    text-align: left;
    text-indent: -1em;
    padding-left: 2em;
    &.blue {
      background-color: #226c76;
      color: #fff;
    }
    &.red {
      background-color: #d2691d;
      color: #fff;
    }
  }
}
.nextBtns {
  display: none;
  & button {
    margin-bottom: 20px;
  }
}
.nextBtnsWrap {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
}

#explanation-txt {
  margin-top: -10px;
  font-size: 14px;
}
#explanation-txt.hidden {
  display: none;
}
/* 穴埋め問題の空欄部分スタイル */
.blank {
  display: inline-block;
  border: 1px solid #333;
  padding: 2px 6px;
  border-radius: 2px;
  background-color: #fff;
  cursor: pointer;
  margin: 0 2px;
  min-width: 5em;
  text-align: center;
}
.blank.blue {
  background-color: #226c76!important;
  color: #fff!important;
}
.blank.red {
  background-color: #d2691d!important;
  color: #fff!important;
}
/* 回答前後の空欄スタイル */
.blank.unanswered {
  /* 未回答: デフォルト背景 */
  background-color: #fff;
}
.blank.answered {
  /* 回答済み: 薄い黄色で強調 */
  background-color: #fff9b0;
}

/* 語群結合問題スタイル */
#matchArea {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 20px 0;
}

.group-section {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
}

.group-title {
  color: #333;
  font-size: 18px;
  font-weight: bold;
  margin: 0 0 15px 0;
  text-align: center;
  background-color: #e9ecef;
  padding: 8px;
  border-radius: 4px;
}

.group-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-item {
  display: flex;
  align-items: flex-start;
  background-color: #fff;
  border: 2px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 10px;
}

.group-item:hover {
  border-color: #007bff;
  background-color: #f0f8ff;
}

.group-item.selected {
  border-color: #007bff;
  background-color: #e7f3ff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.group-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.item-number {
  font-weight: bold;
  color: #007bff;
  min-width: 35px;
  flex-shrink: 0;
}

.item-text {
  color: #333;
  line-height: 1.4;
}

/* マッチング表示エリア */
.matching-section {
  background-color: #fff;
  border: 2px solid #007bff;
  border-radius: 8px;
  padding: 15px;
}

.matching-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-row {
  display: flex;
  align-items: center;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  gap: 10px;
}

.match-a {
  font-weight: bold;
  color: #007bff;
  min-width: 50px;
  text-align: center;
}

.match-arrow {
  color: #666;
  font-size: 18px;
  font-weight: bold;
}

.match-b {
  flex: 1;
  min-height: 24px;
  display: flex;
  align-items: center;
}

.match-placeholder {
  color: #999;
  font-style: italic;
}

.matched-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #e7f3ff;
  border: 1px solid #007bff;
  border-radius: 4px;
  padding: 4px 8px;
  width: 100%;
}

.remove-match {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.remove-match:hover {
  background-color: #c82333;
}

/* 解答ボタンエリア */
#answerArea {
  margin: 20px 0;
  text-align: center;
}

.answer-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.clear-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clear-btn:hover {
  background-color: #545b62;
}

.check-btn {
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.check-btn:hover {
  background-color: #218838;
}

.check-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* 結果表示エリア */
.result-area {
  background-color: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.result-title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin: 0 0 15px 0;
}

.result-title.correct {
  color: #28a745;
}

.result-title.incorrect {
  color: #dc3545;
}

.result-summary {
  text-align: center;
  font-size: 16px;
  margin-bottom: 20px;
  color: #666;
}

.correct-matches h4 {
  color: #333;
  margin: 0 0 10px 0;
}

.match-result {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 6px;
}

.correct-match {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

.incorrect-match {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

.match-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.a-item, .b-item {
  padding: 4px 8px;
  border-radius: 4px;
}

.a-item {
  background-color: #e7f3ff;
  border: 1px solid #007bff;
}

.b-item.correct {
  background-color: #d4edda;
  border: 1px solid #28a745;
}

.arrow {
  font-weight: bold;
  color: #666;
}

.user-answer {
  font-size: 14px;
  color: #dc3545;
  margin-left: 20px;
  font-style: italic;
}

.explanation {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.explanation h4 {
  color: #333;
  margin: 0 0 10px 0;
}

.explanation p {
  color: #555;
  line-height: 1.6;
}

/* セレクトボックス方式の語群結合問題スタイル */
.select-match-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}

.match-instructions {
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 20px;
}

.match-instructions p {
  margin: 0;
  color: #2c5aa0;
  font-weight: 500;
}

.select-match-item {
  background-color: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  transition: border-color 0.2s ease;
}

.select-match-item:hover {
  border-color: #007bff;
}

.a-group-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 10px;
}

.a-group-item .item-number {
  font-weight: bold;
  color: #007bff;
  min-width: 40px;
  flex-shrink: 0;
}

.a-group-item .item-text {
  color: #333;
  line-height: 1.4;
  flex: 1;
}

.select-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.b-group-select {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.b-group-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.b-group-select.correct {
  border-color: #28a745;
  background-color: #d4edda;
}

.b-group-select.incorrect {
  border-color: #dc3545;
  background-color: #f8d7da;
}

.b-group-select option.disabled-option {
  color: #999;
  background-color: #f5f5f5;
  font-style: italic;
}

.b-group-select option:disabled {
  opacity: 0.5;
}

.match-status {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-text {
  color: #666;
  font-size: 14px;
}

.status-text.selected {
  color: #007bff;
  font-weight: 500;
}

.match-status.correct .status-text {
  color: #28a745;
}

.match-status.incorrect .status-text {
  color: #dc3545;
}

.clear-single {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.clear-single:hover {
  background-color: #c82333;
}

.check-btn.ready {
  background-color: #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

/* 結果表示用スタイル */
.answer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-item {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.correct-answer {
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.incorrect-answer {
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.answer-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.a-part {
  background-color: #e7f3ff;
  border: 1px solid #007bff;
  padding: 4px 8px;
  border-radius: 4px;
  flex: 1;
}

.correct-b-part {
  background-color: #d4edda;
  border: 1px solid #28a745;
  padding: 4px 8px;
  border-radius: 4px;
  flex: 1;
}

.arrow {
  font-weight: bold;
  color: #666;
}

.user-selection {
  font-size: 13px;
  color: #dc3545;
  font-style: italic;
  margin-left: 20px;
}

/* モバイル対応 */
@media (max-width: 768px) {
  #matchArea {
    gap: 15px;
  }
  
  .group-section {
    padding: 10px;
  }
  
  .group-item {
    padding: 8px;
    font-size: 14px;
  }
  
  .match-row {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 5px;
  }
  
  .match-a {
    min-width: auto;
  }
  
  .match-pair {
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }
  
  .answer-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .clear-btn, .check-btn {
    width: 200px;
  }
  
  /* セレクトボックス方式のモバイル対応 */
  .select-match-item {
    padding: 12px;
  }
  
  .a-group-item {
    flex-direction: column;
    gap: 8px;
  }
  
  .a-group-item .item-number {
    min-width: auto;
  }
  
  .answer-pair {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
}

/* 機能系統図問題用スタイル */
.tree-problem {
  background-color: #fafafa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.functions-group {
  background-color: white;
  padding: 12px 15px;
  border-radius: 6px;
  border-left: 4px solid #2c5aa0;
  margin: 15px 0;
  font-size: 14px;
  line-height: 1.6;
}

.category-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.categoryName {
  font-weight: bold;
  color: #2c5aa0;
}

.product-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.tree-image-container {
  text-align: center;
  margin: 20px 0;
  background-color: white;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.tree-image {
  max-width: 100%;
  height: auto;
  max-height: 400px;
}

.tree-select-area {
  margin-top: 20px;
  background-color: white;
  padding: 15px;
  border-radius: 6px;
}

.tree-select-item {
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e8e8e8;
}

.tree-select-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.func-text {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.func-id {
  font-weight: bold;
  color: #2c5aa0;
  min-width: 55px;
}

.func-description {
  color: #333;
  flex: 1;
}

.select-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.box-label {
  font-size: 14px;
  font-weight: bold;
  color: #555;
  white-space: nowrap;
}

.tree-select {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
  min-width: 180px;
  transition: all 0.3s ease;
}

.tree-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

.tree-select.answered {
  opacity: 0.7;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

.tree-select.correct {
  border-color: #4caf50;
  background-color: #f1f8f6;
}

.tree-select.incorrect {
  border-color: #f44336;
  background-color: #fff5f5;
}

.tree-select option:disabled {
  opacity: 0.5;
  color: #999;
}

.selection-status {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
}

.status-text {
  color: #999;
}

.status-text.selected {
  color: #2c5aa0;
  font-weight: bold;
}

.clear-single {
  background-color: #ff9800;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  padding: 0;
}

.clear-single:hover {
  background-color: #f57c00;
}

#checkAnswer.ready {
  background-color: #4caf50;
  border-color: #45a049;
}

#checkAnswer.ready:hover {
  background-color: #45a049;
}

/* 結果表示 */
.result-summary {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin: 12px 0;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
}

.answer-list {
  margin: 12px 0;
}

.answer-item {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  border-left: 4px solid #ddd;
}

.answer-item.correct-answer {
  background-color: #f1f8f6;
  border-left-color: #4caf50;
}

.answer-item.incorrect-answer {
  background-color: #fff5f5;
  border-left-color: #f44336;
}

.answer-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.func-part {
  font-weight: bold;
  color: #333;
  flex: 1;
  min-width: 150px;
}

.arrow {
  color: #2c5aa0;
  font-weight: bold;
  font-size: 18px;
}

.correct-part {
  color: #4caf50;
  font-weight: bold;
  flex: 1;
  min-width: 150px;
}

.user-selection {
  color: #f44336;
  font-size: 13px;
  margin-top: 4px;
  padding-left: 12px;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .tree-image {
    max-height: 300px;
  }
  
  .select-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  
  .box-label {
    display: block;
    margin-bottom: 4px;
  }
  
  .tree-select {
    min-width: 100%;
    width: 100%;
  }
  
  .selection-status {
    min-width: 100%;
  }
  
  .answer-pair {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .arrow {
    align-self: flex-start;
    margin-left: 12px;
  }
}