body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background-color: #f4f8e9;
  color: #333;
  line-height: 1.6;
}
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
header {
  background-color: #4CAF50;
  color: white;
  padding: 15px;
  border-radius: 8px 8px 0 0;
  text-align: center;
}
h1 { margin: 0; font-size: 1.5rem; }
.objective { margin: 5px 0 0 0; font-weight: bold; }
h2 {
  color: #d84315;
  border-bottom: 3px solid #ffcc80;
  padding-bottom: 5px;
}
.step-section {
  padding: 20px 0;
  border-bottom: 2px dashed #eee;
}
.problem-box {
  background: #e8f5e9;
  padding: 15px;
  border-radius: 8px;
}
.figure-container {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}
.square-figure {
  width: 100px;
  height: 100px;
  border: 2px solid #333;
  position: relative;
}
.side-label {
  position: absolute;
  top: 50%;
  left: -45px;
  transform: translateY(-50%);
  font-weight: bold;
}
input[type="text"] {
  font-size: 1.2rem;
  padding: 5px;
  border: 2px solid #ccc;
  border-radius: 4px;
  text-align: center;
}
.num-input {
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
}
.carry-input {
  width: 25px;
  height: 25px;
  font-size: 1rem;
  color: #e53935;
  border-color: #ffcdd2;
}
.feedback { font-weight: bold; margin-left: 10px; }
.correct { color: #43a047; }
.incorrect { color: #e53935; }

/* 筆算レイアウト */
.hissan-board {
  display: inline-block;
  font-family: monospace;
  font-size: 2rem;
  padding: 20px;
  background: #fff;
  border: 2px solid #bcaaa4;
  border-radius: 8px;
  text-align: right;
  position: relative;
}
.row {
  display: flex;
  justify-content: flex-end;
  letter-spacing: 15px;
  padding-right: 15px;
}
.digit { width: 30px; text-align: center; }
.operator { width: 30px; text-align: left; }
.border-bottom { border-bottom: 3px solid #333; margin-bottom: 10px; padding-bottom: 5px; }
.carry-row {
  position: absolute;
  top: 75px;
  right: 65px;
}
.answer-row { margin-top: 10px; }

/* ボタンとヒント */
button {
  background-color: #ff9800;
  color: white;
  border: none;
  padding: 10px 15px;
  font-size: 1rem;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: bold;
}
button:hover { background-color: #f57c00; }
.hint-btn { background-color: #03a9f4; }
.hint-btn:hover { background-color: #0288d1; }
.hint-content {
  background: #e1f5fe;
  padding: 10px;
  border-left: 4px solid #03a9f4;
  margin-top: 10px;
  font-size: 0.95rem;
}
.hidden { display: none; }
.explanation-box {
  background: #fff3e0;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  border: 1px solid #ffcc80;
}

/* 練習問題グリッド */
.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}
.practice-item {
  background: #fafafa;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}
.practice-item .equation { font-size: 1.5rem; font-weight: bold; margin-bottom: 10px; }
.completion-message {
  text-align: center;
  font-size: 1.5rem;
  color: #d84315;
  background: #fbe9e7;
  padding: 20px;
  border-radius: 10px;
  margin-top: 30px;
  font-weight: bold;
}