:root {
  --primary: #00796b;
  --secondary: #e0f2f1;
  --accent: #ff9800;
  --text: #333;
  --border: #ccc;
  --correct: #4caf50;
  --error: #f44336;
}

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background-color: #f5f7fa;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 20px;
}

.app-container {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  overflow: hidden;
}

header {
  background: var(--primary);
  color: white;
  padding: 20px;
  text-align: center;
}

header h1 { margin: 0 0 15px 0; font-size: 1.5rem; }

.progress-bar-container {
  background: rgba(255,255,255,0.3);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

#progress-bar {
  background: #fff;
  width: 0%;
  height: 100%;
  transition: width 0.5s ease;
}

.stage {
  padding: 30px;
  border-bottom: 2px dashed var(--secondary);
  transition: opacity 0.3s;
}

.stage.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.stage-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.badge {
  background: var(--primary);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
}
.badge.target { background: #d84315; }

h2 { margin: 0; font-size: 1.3rem; color: var(--primary); }

/* 入力欄のデザイン */
input[type="text"] {
  width: 70px;
  padding: 5px;
  font-size: 1.1rem;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
}
input[type="text"]:focus { outline: none; border-color: var(--primary); background: var(--secondary); }
input.correct { border-color: var(--correct); background-color: #e8f5e9; }
input.wrong { border-color: var(--error); background-color: #ffebee; }

/* 数直線のデザイン */
.number-line-wrapper { margin: 30px 0; }
.labels { display: flex; justify-content: space-between; font-weight: bold; font-size: 1.2rem; padding: 0 5px; margin-bottom: -5px;}
.number-line {
  position: relative;
  height: 40px;
  border-bottom: 3px solid var(--text);
  display: flex;
}
.number-line.interactive { cursor: pointer; }
.tick {
  flex: 1;
  border-right: 1px solid var(--text);
  height: 15px;
  margin-top: 25px;
}
.tick.major { height: 25px; margin-top: 15px; border-right: 2px solid var(--text); }
.tick.last { border-right: none; }

.marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 24px;
  color: var(--accent);
  font-weight: bold;
  pointer-events: none;
  animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.marker::after {
  content: '↑';
  display: block;
}
.marker span {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

@keyframes pop {
  0% { transform: translateX(-50%) scale(0); }
  100% { transform: translateX(-50%) scale(1); }
}

.feedback-msg { text-align: center; height: 24px; font-weight: bold; color: var(--correct); margin-top: 10px; }

/* キャラクターグリッド */
.character-grid, .practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}
.char-card, .p-item {
  background: var(--secondary);
  padding: 15px;
  border-radius: 8px;
  border-left: 5px solid var(--primary);
}
.char-icon { font-weight: bold; margin-bottom: 10px; color: var(--primary); }

.formula-box, .summary-box {
  background: #fff3e0;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid #ffcc80;
}
.summary-box { background: #e8eaf6; border-color: #9fa8da; text-align: center; }
.summary-title { font-weight: bold; color: #3f51b5; margin-bottom: 10px; }
.summary-box input { width: 120px; }

/* ボタン類 */
.controls { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }
button {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}
button:active { transform: scale(0.95); }
.btn-check { background: var(--primary); color: white; }
.btn-check:hover { opacity: 0.9; }
.btn-hint { background: #ffeb3b; color: #333; }

.hint-box {
  display: none;
  background: #fffde7;
  padding: 15px;
  border-left: 4px solid #fbc02d;
  border-radius: 4px;
  margin-top: 15px;
  font-size: 0.95rem;
}