/* =========================================================
   選択式クイズ 共通スタイル
   理系漢字クイズ / 理系の常識クイズ / 真の理系クイズ で共用。
   スマホ縦持ちを基準に、640px以上でPC向けへ広げる。
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", YuGothic,
               "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", Arial,
               "メイリオ", Meiryo, sans-serif;
  color: #2e2e2e;
  background: #f4f5f7;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

h1, h2, p, ol, ul { margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

.is_hidden { display: none !important; }

/* ---------------- ヘッダー ---------------- */

.page_head {
  background: #2b3245;
  color: #fff;
  text-align: center;
  padding: 26px 16px 22px;
}

.page_title { font-size: 1.45rem; font-weight: 700; letter-spacing: 0.02em; }
.page_sub { font-size: 0.8rem; color: #aab2c6; margin-top: 4px; }

/* ---------------- 器 ---------------- */

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px 12px 0;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 24px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

/* ---------------- スタート画面 ---------------- */

.lead {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.rules { list-style: none; }

.rules li {
  position: relative;
  padding-left: 34px;
  font-size: 0.86rem;
  line-height: 1.7;
  margin-bottom: 10px;
  color: #4a4a4a;
}

.rule_no {
  position: absolute;
  left: 0;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2b3245;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---------------- ボタン ---------------- */

.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 40px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  margin-top: 18px;
}

.btn_primary { background: #f5c94d; color: #3a3a3a; box-shadow: 0 4px 0 #d8ac2c; }
.btn_primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8ac2c; }
.btn_ghost { background: #fff; color: #5a6172; border: 1px solid #ccd1dd; }
.btn_twitter { background: #1da1f2; color: #fff; }

/* ---------------- 進捗 ---------------- */

.progress { margin-bottom: 22px; }

.progress_text {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.progress_bar {
  height: 6px;
  border-radius: 6px;
  background: #e7e9ef;
  overflow: hidden;
}

.progress_fill {
  height: 100%;
  width: 0;
  background: #f5c94d;
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ---------------- 出題 ---------------- */

.question {
  text-align: center;
  font-size: 1.5rem;
  line-height: 1.9;
  font-weight: 700;
  margin: 8px 0 26px;
  word-break: break-word;
}

/* 読ませたい漢字を強調する */
.question .kanji {
  color: #c0392b;
  border-bottom: 3px solid #f5c94d;
  padding: 0 2px;
}

.choices { display: grid; gap: 12px; }

.choice {
  width: 100%;
  padding: 16px 12px;
  border: 2px solid #d5d8e0;
  border-radius: 12px;
  background: #fff;
  color: #2e2e2e;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}

.choice:active { transform: translateY(2px); }
.choice:disabled { cursor: default; }
.choice.is_selected { border-color: #f5c94d; background: #fff8e1; }

.quiz_nav { margin-top: 20px; }
.quiz_nav .btn { margin-top: 0; font-size: 0.85rem; padding: 10px 16px; }

/* ---------------- 結果 ---------------- */

.result_score {
  text-align: center;
  font-size: 3rem;
  font-weight: 700;
  color: #2b3245;
  line-height: 1.2;
}

.score_unit {
  display: block;
  font-size: 0.85rem;
  color: #8a92a8;
  font-weight: 400;
  margin-top: 2px;
}

.result_summary {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #c0392b;
  margin-top: 14px;
  line-height: 1.6;
}

.result_detail {
  font-size: 0.86rem;
  line-height: 1.9;
  color: #4a4a4a;
  margin-top: 12px;
}

.review_title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 26px 0 10px;
  padding-top: 18px;
  border-top: 1px solid #ececec;
}

.review { list-style: none; }

.review_item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  line-height: 1.6;
}

.review_item.is_ok { background: #f4f8f4; }
.review_item.is_ng { background: #fdf3f2; }

.review_mark {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.6;
}

.is_ok .review_mark { color: #3a9d5d; }
.is_ng .review_mark { color: #c0392b; }

.review_body { flex: 1 1 auto; min-width: 0; }
.review_head { font-weight: 700; }
.review_note { font-size: 0.78rem; color: #8a6a68; margin-top: 2px; }

.result_actions { margin-top: 24px; }

/* ---------------- その他のクイズ ---------------- */

.ads_wrap { margin: 20px 0; text-align: center; }

.others { margin-top: 8px; }

.others_title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2b3245;
  margin-bottom: 12px;
}

.others_list { list-style: none; }
.others_list li { margin-bottom: 12px; }

.others_list a {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.others_list img { width: 100%; height: 128px; object-fit: cover; display: block; }

.others .text {
  padding: 8px 12px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #3a3a3a;
}

/* ---------------- 導線・フッター ---------------- */

.back_to_menu { text-align: center; margin: 26px 0 28px; }

.back_to_menu a {
  display: inline-block;
  padding: 10px 24px;
  border: 1px solid #ccc;
  border-radius: 30px;
  color: #555;
  font-size: 0.85rem;
  background: #fff;
}

.foot {
  background: #2b3245;
  color: #fff;
  text-align: center;
  padding: 22px 16px 26px;
}

.foot_title { font-size: 0.95rem; font-weight: 700; }
.foot_detail { font-size: 0.72rem; color: #aab2c6; margin-top: 6px; }

/* =========================================================
   PC / タブレット
   ========================================================= */

@media screen and (min-width: 640px) {
  .page_head { padding: 34px 16px 28px; }
  .page_title { font-size: 1.9rem; }
  .page_sub { font-size: 0.9rem; }

  .wrap { padding: 24px 20px 0; }
  .card { padding: 30px 34px; }

  .lead { font-size: 1.25rem; }
  .rules li { font-size: 0.92rem; }

  .question { font-size: 1.9rem; margin: 12px 0 30px; }
  .choices { grid-template-columns: 1fr 1fr; }
  .choice { font-size: 1.25rem; padding: 18px 12px; }

  .btn { width: auto; min-width: 280px; margin-left: auto; margin-right: auto; }
  .quiz_nav .btn { min-width: 0; }

  .result_score { font-size: 3.6rem; }
  .result_detail { font-size: 0.92rem; }

  .result_actions { display: flex; gap: 14px; justify-content: center; }
  .result_actions .btn { margin-top: 0; min-width: 220px; }

  .others_list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .others_list li { margin-bottom: 0; }
}

/* ---------------- 正誤のフィードバック ---------------- */

.choice.is_correct {
  border-color: #3a9d5d;
  background: #eef7f0;
  color: #2b6b41;
}

.choice.is_wrong {
  border-color: #c0392b;
  background: #fdf0ee;
  color: #a5271b;
}

.feedback {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 16px;
  min-height: 1.6em;
  line-height: 1.6;
}

.feedback.is_ok { color: #3a9d5d; }
.feedback.is_ng { color: #c0392b; }

.review_answer { font-size: 0.8rem; color: #5a6172; margin-top: 2px; }

/* 問題文は改行を保つ（選択肢が長い設問があるため） */
.question { white-space: pre-wrap; }

/* 文章題（理系の常識クイズ / 真の理系クイズ）は、漢字クイズより控えめに */
.question.is_sentence {
  font-size: 1.02rem;
  line-height: 1.9;
  text-align: left;
  margin: 4px 0 22px;
}

.question.is_sentence ~ .choices .choice {
  font-size: 0.95rem;
  padding: 14px 14px;
  line-height: 1.6;
  text-align: left;
}

@media screen and (min-width: 640px) {
  .question.is_sentence { font-size: 1.12rem; }
  .question.is_sentence ~ .choices .choice { font-size: 1rem; }
}

/* ---------------------------------------------------------------
   数式（連立方程式）
   元ブログは MathJax を読み込んでいたが、使っている式が1つだけなので
   中括弧を枠線で描いて自前で組んでいる。
   --------------------------------------------------------------- */

.math_area {
  margin: 2px 0 22px;
  display: flex;
  justify-content: center;
}

.math_sys {
  display: inline-flex;
  align-items: stretch;
  gap: 12px;
}

/* 中括弧。行数に合わせて縦に伸びるよう SVG で描く */
.math_brace {
  flex: none;
  width: 13px;
  color: #4a5164;
}

.math_brace svg {
  display: block;
  width: 100%;
  height: 100%;
}

.math_rows {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.math_row {
  font-family: "Times New Roman", "Hiragino Mincho ProN", serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.4;
  color: #2b3040;
  white-space: nowrap;
}

@media screen and (min-width: 640px) {
  .math_row { font-size: 1.4rem; }
}

/* =========================================================
   理解度チェック（大学化学のまとめ の記事に対応した /chemicalNN）
   その場で解説を読ませるため、自動では次へ進まない
   ========================================================= */

.page_kicker {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #8fa0c4;
  margin-bottom: 6px;
}

/* 答えた直後に出る解説 */
.note {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f4f7fc;
  border-left: 3px solid #5a7fd4;
  border-radius: 0 8px 8px 0;
  font-size: 0.86rem;
  line-height: 1.9;
  color: #3d4657;
  text-align: left;
}

#next_btn { margin-top: 14px; }

/* 解答一覧の中の解説 */
.review_exp {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #d7dce6;
  font-size: 0.78rem;
  line-height: 1.8;
  color: #5a6172;
}

/* 元記事へ戻る導線 */
.source_link {
  display: block;
  margin-top: 16px;
  font-size: 0.82rem;
  color: #3a63c0;
  text-decoration: underline;
  text-align: center;
}

@media screen and (min-width: 640px) {
  .page_kicker { font-size: 0.76rem; }
  .note { font-size: 0.92rem; }
}

/* 構造式などの図 */
/* 図は格子で並べる。列数は枚数に応じて quiz.js が決める。
   flex の伸長に任せると、行に1枚だけ余ったときにそれだけ大きくなってしまう。 */
.figure_area {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  justify-content: center;
}

.figure_area.cols_1 { grid-template-columns: minmax(0, 300px); }
.figure_area.cols_2 { grid-template-columns: repeat(2, minmax(0, 240px)); }
.figure_area.cols_3 { grid-template-columns: repeat(3, minmax(0, 170px)); }

.figure_panel {
  background: #fbfcfe;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  padding: 10px 8px 8px;
  min-width: 0;
}

/* 比較のもとになる図は、横いっぱいに大きく出す */
.figure_panel.is_wide { grid-column: 1 / -1; }
.figure_panel.is_wide svg { max-width: 240px; margin: 0 auto; }

.figure_panel svg.chair { width: 100%; height: auto; display: block; }

.figure_cap {
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #5a6172;
  text-align: center;
}

.figure_panel svg.fischer { width: 100%; height: auto; display: block; }

.figure_panel svg.skeleton,
.figure_panel svg.orbital,
.figure_panel svg.mo { width: 100%; height: auto; display: block; }

.figure_panel svg.stereo { width: 100%; height: auto; display: block; }
