@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@500;700&display=swap');

:root {
  --primary-color: #4CAF50;
  --bg-color: #f0f8f1;
  --grid-line: #a0d8ef;
  --text-main: #333;
}

body {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  padding: 20px;
}

.quest-container {
  max-width: 700px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

h1 { text-align: center; color: var(--primary-color); }
h2 {
  background: #e8f5e9;
  padding: 10px 15px;
  border-left: 5px solid var(--primary-color);
  border-radius: 4px;
}

.stage { margin-bottom: 40px; }
.hidden { display: none !important; }

/* 筆算グリッド（方眼紙風） */
.hissan-grid {
  display: inline-block;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  border: 1px solid var(--grid-line);
  padding: 10px 20px 10px 10px;
  margin: 15px 0;
  font-size: 24px;
  font-weight: bold;
}

.row {
  display: flex;
  height: 40px;
  align-items: center;
}

.row span, .cell-input {
  width: 40px;
  text-align: center;
}

.border-bottom {
  border-bottom: 2px solid var(--text-main);
}

.cell-input {
  border: 2px solid #ccc;
  border-radius: 4px;
  height: 34px;
  font-size: 24px;
  font-weight: bold;
  font-family: inherit;
  color: #333;
  background: white;
}
.cell-input:focus { border-color: var(--primary-color); outline: none; }
.cell-input.correct { border-color: var(--primary-color); background: #e8f5e9; }
.cell-input.wrong { border-color: #f44336; background: #ffebee; }

.ghost { color: #aaa; border: 1px dashed #ccc; border-radius: 4px; }

/* コントロールとボタン */
.controls { display: flex; gap: 10px; margin-top: 15px; }
button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  transition: transform 0.1s;
}
button:active { transform: scale(0.95); }
.hint-btn { background: #ffeb3b; color: #555; }
.check-btn { background: var(--primary-color); color: white; }

.hint-box {
  background: #fff9c4;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  border: 2px dashed #fbc02d;
}

.result-message {
  margin-top: 10px;
  font-weight: bold;
  font-size: 18px;
}

/* 選択肢（ア・イ） */
.choices { display: flex; gap: 20px; justify-content: center; margin-top: 20px;}
.choice-card {
  border: 3px solid #ccc;
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.choice-card:hover { border-color: var(--primary-color); background: #f0f8f1; }
.choice-card h3 { margin: 0 0 10px 0; text-align: center; }

/* まとめボックス */
.summary-box {
  border: 3px solid var(--primary-color);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  font-size: 18px;
}
#summary-input {
  font-size: 18px;
  padding: 5px 10px;
  width: 200px;
  border: 2px solid #ccc;
  border-radius: 4px;
}

/* 練習問題用 */
.practice-item { margin-bottom: 20px; }
.practice-formula { font-size: 22px; font-weight: bold; margin-bottom: 10px; }
.practice-input-area { display: flex; align-items: center; gap: 10px; }
.ans-input { font-size: 20px; padding: 5px 10px; width: 120px; border: 2px solid #ccc; border-radius: 4px;}