* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  background-color: #f4f6f9;
  color: #333;
  font-family: sans-serif;
}

.container {
  width: 100%;
  max-width: 650px;
  margin: 40px auto;
  padding: 30px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

h1 {
  font-size: 25px;
  margin-bottom: 10px;
}

h2 {
  font-size: 20px;
  line-height: 1.6;
}

h3 {
  font-size: 17px;
}

.description {
  color: #666;
  margin-bottom: 25px;
}

.section-button,
.question-button {
  display: block;
  width: 100%;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: white;
  text-align: left;
  cursor: pointer;
}

.section-button:hover,
.question-button:hover {
  background-color: #edf4ff;
}

.section-button strong,
.question-button strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

.section-button span,
.question-button span {
  color: #777;
  font-size: 13px;
}

.back-button {
  padding: 9px 14px;
  margin-bottom: 20px;
  border: none;
  border-radius: 6px;
  background-color: #e9edf2;
  cursor: pointer;
}

#progress {
  color: #777;
  font-size: 14px;
}

#answer-inputs {
  margin: 25px 0;
}

.answer-input {
  width: 100%;
  padding: 13px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 16px;
}

.main-button {
  display: block;
  width: 100%;
  padding: 15px;
  margin-top: 20px;
  border: none;
  border-radius: 8px;
  background-color: #2563eb;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.main-button:disabled {
  background-color: #bfc5ce;
  color: #f5f5f5;
  cursor: not-allowed;
}

.judgment-button:disabled {
  background-color: #bfc5ce;
  color: #f5f5f5;
  cursor: not-allowed;
  opacity: 1;
}

#result-area {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #ddd;
}

#correct-answers {
  padding: 15px;
  background-color: #f1f5f9;
  border-radius: 8px;
  line-height: 1.8;
}

#explanation {
  line-height: 1.8;
}

.judgment-area {
  margin-top: 25px;
}

.judgment-area p {
  font-weight: bold;
}

.judgment-button {
  width: 48%;
  padding: 14px;
  margin: 5px 1% 5px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: white;
  font-size: 16px;
  cursor: pointer;
}

.judgment-button.selected {
  background-color: #2563eb;
  border-color: #2563eb;
  color: white;
}

[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }
  .container {
    margin: 15px auto;
    padding: 20px;
  } 
  h1 {
    font-size: 21px;
  }
  h2 {
    font-size: 18px;
  }
}

/* 成績表示画面 */
.score-area {
  display: flex;
  gap: 15px;
  margin: 25px 0;
}
.score-item {
  flex: 1;
  padding: 20px;
  background-color: #f1f5f9;
  border-radius: 10px;
  text-align: center;
}
.score-item p {
  margin: 0 0 10px;
  color: #666;
  font-size: 14px;
}
.score-item strong {
  font-size: 25px;
}
#correct-count {
  color: #16a34a;
}
#incorrect-count {
  color: #dc2626;
}
.accuracy-area {
  margin: 30px 0;
  text-align: center;
}
.accuracy-area p {
  color: #666;
}
#accuracy {
  font-size: 42px;
  font-weight: bold;
}
@media (max-width: 400px) {
  .score-area {
    gap: 8px;
  }
  .score-item {
    padding: 15px 8px;
  }
}
#result-message {
  margin: 15px 0 25px;
  color: #666;
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
}

/* スマホでの操作性を改善 */
@media (max-width: 600px) {

  /* 大問・問題選択ボタン */
  .section-button,
  .question-button {
    padding: 16px;
    min-height: 65px;
  }
  /* 解答入力欄 */
  .answer-input {
    padding: 15px;
    font-size: 16px;
  }
  /* 解答・次へボタン */
  .main-button {
    min-height: 50px;
    padding: 15px;
  }
  /* 正解・不正解ボタン */
  .judgment-button {
    min-height: 50px;
    font-size: 16px;
  }
  /* 成績表示 */
  .score-item strong {
    font-size: 22px;
  }
  #accuracy {
    font-size: 36px;
  }
}
#original-section-title {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 12px;
  background-color: #e8eef7;
  color: #345078;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
}
