/* =========================================
   共通：背景（桜柄・問題ページ用）
========================================= */
body {
  background-color: #fff0f4; /* 桜の下地 */
  background-image: url("sakura.png"); /* ←①で選んだ桜 */
  background-repeat: repeat;
  background-size: auto;
}

/* =========================================================
   全体
========================================================= */
* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #FFFBEA;  /* ペールイエロー */
  color: #333;
}

/* =========================================================
   ヘッダー
========================================================= */
.site-header {
  background-color: #FFFBEA;
  border-bottom: 1px solid #e0e0e0;
}

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-logo {
  width: 70px;
  height: auto;
  display: block;
}

.site-brand-text {
  display: flex;
  flex-direction: column;
}

.site-brand-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.site-brand-subtitle {
  font-size: 0.9rem;
  color: #555;
}

.site-nav {
  display: flex;
  gap: 0.5rem;
}

.site-nav-link {
  font-size: 0.85rem;
  text-decoration: none;
  color: #1e60a8;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}

.site-nav-link:hover {
  background-color: #e7f0ff;
}

/* =========================================================
   クイズ画面全体
========================================================= */
.quiz-main {
  padding: 1rem;
}

.quiz-container {
  max-width: 960px;
  margin: 0 auto;
  background-color: #ffffff;
  border-radius: 16px;
  border: 1px solid #dddddd;
  padding: 1.1rem 1rem 1.4rem;
}

/* メタ情報 */
.quiz-meta {
  margin-bottom: 0.7rem;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
}

.quiz-category-name {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

/* =========================================================
   問題カード
========================================================= */
.quiz-card {
  background-color: #ffffff;
  border: 3px solid #1e60a8;  /* カテゴリカラーは JS で上書き */
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1.8rem;
}

.quiz-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
}

.quiz-label {
  flex: 0 0 55px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
}

.quiz-text {
  flex: 1 1 auto;
  font-size: 1.0rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* =========================================================
   意味欄（カード風・青グレー）
========================================================= */
#meaning-row {
  background-color: #F2F6FF;
  border: 1px solid #C9D6F3;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.4rem;
}

#meaning {
  font-size: 1.05rem;
  white-space: pre-wrap;
  line-height: 1.7;
}

/* =========================================================
   解答表示
========================================================= */
.answer-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: #d40000;
  letter-spacing: 1px;
  line-height: 1.6;
}

/* =========================================================
   ボタン
========================================================= */
.quiz-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.quiz-buttons button {
  flex: 1 1 140px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid #1e60a8;
  background-color: #ffffff;
  color: #1e60a8;
  cursor: pointer;
}

/* 「次の問題」ボタンだけ色を変える */
#next-question-btn {
  background-color: #007bff;
  border-color: #0066d6;
  color: #ffffff;
  font-weight: 600;
}

#next-question-btn:hover {
  background-color: #0066d6;
}

/* hover 共通 */
.quiz-buttons button:hover {
  opacity: 0.95;
}

/* メッセージ */
.quiz-message {
  font-size: 0.8rem;
  color: #c00000;
}

/* =========================================================
   フッター（© 表示）
========================================================= */
.site-footer {
  margin-top: 2rem;
  padding: 1.6rem 1rem;
  text-align: center;
  background-color: #FFFBEA;
}

.footer-text {
  display: inline-block;
  color: #d40000;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.8px;
}

/* ©だけ極端に小さくならないように補正 */
.footer-text::first-letter {
  font-size: 1.15rem;
}

/* =========================================================
   スマホ向け
========================================================= */
@media (max-width: 600px) {

  .site-header-inner {
    padding: 0.5rem 0.8rem;
  }

  .site-logo {
    width: 56px;
  }

  .quiz-container {
    padding: 0.9rem 0.8rem 1.1rem;
  }

  .quiz-card {
    padding: 0.9rem 0.8rem;
  }

  .quiz-label {
    flex-basis: 52px;
    font-size: 0.75rem;
  }

  .quiz-text {
    font-size: 0.95rem;
  }

  #meaning {
    font-size: 0.95rem;
  }

  .answer-text {
    font-size: 1.4rem;
  }

  .quiz-buttons button {
    flex: 1 1 120px;
  }

  .footer-text {
    font-size: 1.0rem;
  }
}
/* 接続語：選択肢だけ薄青背景にする */
.quiz-container[data-category="setsuzokugo"] #meaning {
  background: none;
}

.quiz-container[data-category="setsuzokugo"] #meaning::after {
  content: "";
  display: block;
  margin-top: 0.6em;
  padding: 0.6em 0.8em;
  background-color: #f2f6ff;
  border-radius: 6px;
}
/* 接続語：空所文＋選択肢の体裁 */
.sz-blank{
  margin: 0;
  padding: 0;
  line-height: 1.35;   /* ← 行間を詰める */
}

.sz-choices{
  margin-top: 10px;    /* ← 空所文に“引っ付けたい”なら 6〜10px 推奨 */
  padding: 10px 12px;
  background: #f2f6ff; /* 薄い青 */
  border-radius: 8px;
  line-height: 1.35;
}

/* 「選択肢：」だけ少し強調（任意） */
.sz-choices-label{
  font-weight: 700;
}
/* ===== 接続語：外側の枠は不要（選択肢だけ枠）===== */
body[data-cat="setsuzokugo"] #meaning-row{
  background: none !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* meaning本体にカード風指定がある場合を無効化 */
body[data-cat="setsuzokugo"] #meaning{
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

/* 【　】文：詰めて左揃え */
body[data-cat="setsuzokugo"] .sz-blank{
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35;
}

/* 選択肢：ここだけ枠（薄青） */
body[data-cat="setsuzokugo"] .sz-choices{
  margin-top: 10px;
  padding: 10px 12px;
  background: #f2f6ff;
  border: 1px solid #d6e3ff;
  border-radius: 8px;
  line-height: 1.35;
}
/* =========================================
   接続語（setsuzokugo）専用 微調整
   - 空所文：枠なし・行頭/行間を整える
   - 選択肢：枠あり・狭い端末は2×2 / 広い端末は1×4
   - 「問題」ラベルはJSで非表示
========================================= */

/* まず、meaning側の外枠（薄青カード）を無効化して枠を消す */
body[data-cat="setsuzokugo"] #meaning-row{
  background: none !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

body[data-cat="setsuzokugo"] #meaning{
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

/* 空所文（【 】文）：行頭と行間 */
body[data-cat="setsuzokugo"] .sz-blank{
  text-align: left;
  text-indent: 0;
  margin: 6px 0 0 0;
  padding: 0;
  line-height: 1.35;
}

/* 選択肢：ここだけ枠（薄青） */
body[data-cat="setsuzokugo"] .sz-choices{
  margin-top: 10px;
  padding: 10px 12px;
  background: #f2f6ff;
  border: 1px solid #d6e3ff;
  border-radius: 8px;
}

/* 「選択肢：」は1行 */
body[data-cat="setsuzokugo"] .sz-choices-label{
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ここがキモ：改行(\n)を活かしつつ、端末幅で自然に折り返す */
body[data-cat="setsuzokugo"] .sz-choices-items{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;        /* 縦・横の間隔 */
  white-space: pre-line;/* \n を改行として認識 */
  line-height: 1.35;
}

/* 改行で分かれた各行を「アイテム」扱いにしたいので、疑似的に分割表示 */
body[data-cat="setsuzokugo"] .sz-choices-items{
  /* pre-lineの改行を活かすとテキスト塊になるため、実用上は
     \n を JS で " / " に戻してもOK。
     ただ、現状でも折返しは自然に出るのでまずはこれで運用。 */
}
/* 接続語：選択肢カードは必要最小の高さに */
body[data-cat="setsuzokugo"] .sz-choices{
  margin-top: 10px;
  padding: 12px 12px;
  background: #f2f6ff;
  border: 1px solid #d6e3ff;
  border-radius: 8px;
}

/* ラベルは上に固定 */
body[data-cat="setsuzokugo"] .sz-choices-label{
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ★ここが本体：狭い画面は2列、広い画面は4列 */
body[data-cat="setsuzokugo"] .sz-choices-items{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

/* 各選択肢：デフォルトは2列（50% - gap） */
body[data-cat="setsuzokugo"] .sz-choice{
  flex: 0 0 calc(50% - 6px);
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #d6e3ff;
  border-radius: 8px;
  line-height: 1.2;
  box-sizing: border-box;
}

/* 画面が広いときは4列 */
@media (min-width: 700px){
  body[data-cat="setsuzokugo"] .sz-choice{
    flex: 0 0 calc(25% - 9px);
  }
}
body[data-cat="setsuzokugo"] .sz-blank{
  line-height: 1.35;
  margin-top: 4px;
}
/* 接続語：文章パートの行頭を揃える（中央寄せの影響を消す） */
body[data-cat="setsuzokugo"] #question,
body[data-cat="setsuzokugo"] .sz-blank{
  text-align: left !important;   /* 中央寄せを殺す */
  margin-left: 0 !important;
  padding-left: 0 !important;
  text-indent: 0 !important;
}

/* 接続語：文章パートを同じ幅の箱に入れて左端を統一 */
body[data-cat="setsuzokugo"] #question-row,
body[data-cat="setsuzokugo"] #meaning-row{
  padding-left: 0 !important;
}

/* もし #question 自体に左右paddingがある場合も無効化 */
body[data-cat="setsuzokugo"] #question{
  display: block;
  width: 100%;
  box-sizing: border-box;
}
body[data-cat="setsuzokugo"] .question-card,
body[data-cat="setsuzokugo"] .quiz-card,
body[data-cat="setsuzokugo"] .card{
  text-align: left !important;
}
/* ================================
   接続語：レイアウト専用調整
   ================================ */

/* 問題・意味行を1カラム化（左インデント除去） */
body[data-cat="setsuzokugo"] .quiz-row {
  display: block;
}

/* 念のためラベル自体も非表示 */
body[data-cat="setsuzokugo"] .quiz-label {
  display: none;
}

/* 問題文・空所文の行頭を完全に揃える */
body[data-cat="setsuzokugo"] .quiz-text {
  padding-left: 0;
  margin-left: 0;
}

/* 【　】行の上余白を詰める */
body[data-cat="setsuzokugo"] .sz-blank {
  margin-top: 0.3em;
}
/* ===== 問題文（文章パート） ===== */
.question-text {
  margin: 0;
  padding: 0;
  line-height: 1.7;
  white-space: pre-wrap; /* 改行は活かす */
}
/* ===== 問題文（文章パート） ===== */
#question {
  margin: 0;
  padding: 0;
  line-height: 1.7;
  white-space: pre-wrap; /* 改行は活かす */
}
/* ===== 接続語：選択肢（枠） ===== */
.sz-choices {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: #eef5ff;
  border: 1px solid #c7d7ee;
  border-radius: 8px;
}
/* ===== 選択肢の並び（自動折り返し） ===== */
.sz-choices-items {
  display: flex;
  flex-wrap: wrap;          /* 端末幅に任せる */
  gap: 0.4rem 1rem;         /* 縦 横の間隔 */
}

/* 各選択肢 */
.sz-choice {
  white-space: nowrap;      /* 1語は分断しない */
}
/* ===== 接続語：選択肢（枠） ===== */
.sz-choices {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: #eef5ff;
  border: 1px solid #c7d7ee;
  border-radius: 8px;
}

/* ===== 選択肢の並び（自動折り返し） ===== */
.sz-choices-items {
  display: flex;
  flex-wrap: wrap;          /* 端末幅に任せる */
  gap: 0.4rem 1rem;         /* 縦 横の間隔 */
}

/* 各選択肢 */
.sz-choice {
  white-space: nowrap;      /* 1語は分断しない */
}

/* スマホでは2×2に近づける（任意） */
@media (max-width: 480px) {
  .sz-choice {
    width: calc(50% - 0.5rem);
  }
}
