/* 共通の最大幅を定義（例: 700px） */
:root {
  --card-max-width: 700px;
}


/* 全体 */
body {
  font-family: sans-serif;
margin: 0 /*auto 40px;*/
/*padding: 15px 20px;*/
}
.type-select,.level-select-banner{
  text-align: center;
}
.type-select-image{
  display: flex;
    flex-direction: row;
    justify-content: center;
}
h1 {
  font-size: 1.8rem;
  margin-bottom: 24px;

}




/* STEP1/STEP2 共通 */
.level-select {
  margin-bottom: 30px;
}
.type-select button,
.level-select button {
  font-size: 1rem;
  margin: 10px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
    background: #ffffff;
  transition: opacity 0.2s;
    display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;       /* 幅が足りなくなったら折り返す */
  gap: 16px;             /* ボタン間の余白 */
}
.type-select button:hover,
.level-select button:hover {
  opacity: 0.8;
}

/* クイズ部分 */
.quiz { 
  text-align: center; 
    position: relative;
  padding-bottom: 80px;    /* 決定ボタンぶんの余白 */
  min-height: 300px;       /* お好みで高さ調整 */
  
}
.question {
  position: relative;
  display: flex;                /* フレックスにして内包テキストを縦横中央 */
  align-items: center;
  justify-content: center;

  max-width: var(--card-max-width);
  margin: 24px auto;
  padding: 24px 20px;
  min-height: 120px;            /* 高さを少し増やして余裕を */
  border: 2px solid #000;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);

  text-align: center;           /* 複数行でも中央寄せ */
  font-size: 1.3rem;
  line-height: 1.4;
  font-weight: 400;
  color: #222;
}

.question::before,
.question::after {
  content: '';
  position: absolute;
  top: -18px;                   /* 高さに合わせて少し上げる */
  width: 1.8em;                 /* 大きめに */
  height: 1.8em;
  border: 2px solid #000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;              /* フォントサイズも大きく */
  font-weight: bold;
  color: #000;
  line-height: 1;
  box-shadow: -2px -2px 0 rgba(0,0,0,0.05);
}

/* 「問」ラベル */
.question::before {
  content: '問';
  left: 12px;
  border-bottom-right-radius: 2px;
}

/* 「題」ラベル：間隔も広めに */
.question::after {
  content: '題';
  left: calc(12px + 1.8em + 12px);  /* ラベル幅＋余白12px */
  border-bottom-right-radius: 2px;
}

/* 選択肢ボタンを問題カードとトーンをそろえたカード風に */
.option-btn {
  /* レイアウト */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 20px;
  margin: 8px 0;
    max-width: var(--card-max-width);

  /* 枠線＆背景 */
  border: 2px solid #000;
  border-radius: 4px;
  background: #fff;
  
  /* 影で浮き上がり感 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  
  /* タイポグラフィ */
  font-size: 1.1rem;
  font-weight: 400;
  color: #222;
  text-align: center;
  
  /* トランジション */
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

/* 選択状態 */
.option-btn.selected {
  border-color: #4A90E2;    /* 青いアクセント */
  background: #E8F0FE;      /* 薄いブルー背景 */
}

/* ホバー時 */
.option-btn:hover {
  background: #f5f5f5;
  transform: translateY(-2px);
}

/* フォーカス時（キーボード操作対応） */
.option-btn:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

/* グリッド間隔も調整 */
.options {
  width: 100%;
  max-width: var(--card-max-width);
  margin: 0 auto 80px;    /* 下は決定ボタン用スペース */
  display: grid;
  gap: 16px;
  
  /* ここではまだカラムは指定しないで、modeごとに上書き */
  justify-items: center;
}

/* 選択式（4択）のときの .options */
.options.choice-mode {
  /* 4択なら2列レイアウト */
  grid-template-columns: 1fr 1fr;
  height: 200px;
}

/* 記述式のときの .options */
.options.text-mode {
  /* 記述式なら1列にしてテキストボックスを中央寄せ */
  grid-template-columns: 1fr;
  height: 80px;
}


/* 決定ボタン */
.actions { 
  margin-top: 10px; 
  position: absolute;
  bottom: 20px;            /* 下からの余白 */
  left: 0;
  width: 100%;
  text-align: center;
}
/* 決定ボタンをカード風＆モダンに */
.actions button {
  display: inline-block;
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
border: 2px solid #000;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;

}

/* ホバー時 */
.actions button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* アクティブ（押下）時 */
.actions button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

/* 無効時 */
.actions button:disabled {
  background: #aaa;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}


/* 記述式入力 */
/* 記述式入力ボックスをカード風に */
.text-input {
  display: block;
  width: 100%;
  max-width: 600px;           /* お好みで調整 */
  margin: 0 auto 16px;        /* 中央寄せ＆下部マージン */
  padding: 16px 20px;         /* ボタンと揃える */
  
  /* 枠線＆背景 */
  border: 2px solid #000;
  border-radius: 4px;
  background: #fff;
  
  /* 影で浮き上がり感 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);

  /* タイポグラフィ */
  font-size: 1.1rem;
  font-weight: 400;
  color: #222;
  line-height: 1.4;
  
  /* トランジション */
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

/* フォーカス時 */
.text-input:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.3);
}

/* ホバー時（PCのみ） */
.text-input:hover {
  background: #f5f5f5;
}
/* グリッド全幅＋中央寄せ */
.options > input.text-input {
  grid-column: 1 / -1;
  width: 80%;
  max-width: 400px;
  margin: 2vh auto 20px;
  display: block;
  max-height: 3vh;
}

/* 結果 */
#result {
  font-size: 1.1rem;
  /*margin-top: -30px;*/
  padding: 0 20px;
  text-align: center;
  
}
#result p { font-weight: bold; padding-top: 30px;}
#result ul {
  list-style: none;
  padding: 16px;
  margin: 20px auto;
  max-width: 600px;
border: 2px solid #000;
    border-radius: 4px;
  background: #fafafa;
  text-align: left;
  font-size: 1rem;
}
#result li {
  margin: 8px 0;
}
.chart-container {
  width: 33%;
  max-width: 200px;
  margin: 20px auto;
}
.chart-container canvas {
  width: 100% !important;
  height: auto   !important;
  display: block;
}
#result .chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
  font-size: 0.9rem;
}
#result .chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
#result .legend-box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.result-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  
}
.result-buttons button {
  padding: 14px 10px;
  min-width: 20vw;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
border: 2px solid #000;
    border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;

}
.result-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.result-buttons button:active {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}
.result-buttons button:disabled {
  background: #aaa;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 「もう一度挑戦」ボタンの色をグリーン系に */
#restartBtn {
  background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
}

/* 「形式選択へ」ボタンの色をオレンジ系に */
#changeTypeBtn {
  background: linear-gradient(135deg, #FF8C00 0%, #FFB347 100%);
}


/* バナーボタン共通 */
.banner-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 10px;
  cursor: pointer;
}
.banner-btn img {
  display: block;
  max-width: 280px;    /* お好みでサイズ調整 */
  width: 100%;
  height: auto;
  border-radius: 8px;  /* 任意で角丸 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid #000;
    border-radius: 4px;
}
.banner-btn:hover img {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
/* テキストの余白調整 */
.type-select-banner p,
.level-select-banner p {
  margin: 0 0 16px;
  
  /*font-size: 1.5rem;*/
}


/* テキストの余白調整 */
.type-select p {
  margin-bottom: 16px;
}
/* レベル選択の画像バナーボタン */
.level-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 10px;
  cursor: pointer;
  
}
.level-btn img {
  display: block;
  max-width: 250px;    /* お好みで調整 */
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 10px;
border: 2px solid #000;
    border-radius: 4px;
}
.level-btn:hover img {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* テキスト（pタグ）との余白調整 */
.level-select p {
  margin-bottom: 16px;
}
.section-title {
  font-size: 2.3rem;
  position: relative;
  display: inline-block;
  padding-bottom: 0.2em;
  margin-bottom: 1.5em;
  font-weight: bold;
  letter-spacing: 0.02em;
}
.section-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #00b7e6 60%, #45a6d7 100%);
  border-radius: 2px;
  margin-top: 0.4em;
}

/* 戻るボタン */
.back {
  display: inline-block;
  margin-bottom: 18px;
  padding: 0.6em 1.6em;
  border-radius: 2em;
  border: 1.5px solid #81d0cb;
  background: #fff;
  color: #23a69a;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border 0.14s;
  font-size: 1.02em;
  box-shadow: 0 2px 10px 0 #01bbef12;
}
.back:hover, .back:focus {
  background: #e0f5ff;
  color: #008cd1;
  border-color: #008cd1;
}

@media (max-width: 767px) {
#result ul {
font-size: 10px;
    max-height: 30vh;
        padding: 5px 16px;
        
}
.type-select-image{
    flex-direction: column;
}
}
/* レスポンシブ：画面幅600px以下で縦並びに */
@media (max-width: 600px) {
  .level-select {
    flex-direction: column;
  }

.question {
  height: 100px;            /* 高さを少し増やして余裕を */
  font-size: 14px;
}

/* 選択式（4択）のときの .options */
.options.choice-mode {
  /* 4択なら2列レイアウト */
  height: 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.option-btn {

  font-size: 13px;
}
}