:root {
  --primary: #00897b;
  --bg-color: #f4fbf9;
  --text-main: #333;
  --tape-color: #ff7043;
  --accent: #ffb300;
  --line-color: #555;
  --highlight: #ff4081;
}

body {
  margin: 0; padding: 0;
  font-family: 'Hiragino Maru Gothic ProN', 'Rounded M+ 1c', sans-serif;
  background-color: var(--bg-color); color: var(--text-main);
}

header {
  background-color: var(--primary); color: white;
  text-align: center; padding: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
header h1 { margin: 0; font-size: 1.5rem; }
header p { margin: 5px 0 0 0; font-size: 1rem; }

.tabs { display: flex; justify-content: center; gap: 10px; margin: 20px; flex-wrap: wrap;}
.tab-btn {
  padding: 10px 20px; font-size: 1.1rem; font-weight: bold;
  border: 2px solid #ccc; border-radius: 8px; background-color: #fff; color: #555;
  cursor: pointer; box-shadow: 0 4px 0 #ccc; transition: all 0.1s;
}
.tab-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #ccc; }
.tab-btn.active { background-color: var(--accent); border-color: #f57c00; color: white; box-shadow: 0 4px 0 #f57c00; }

main { max-width: 850px; margin: 0 auto; padding: 0 15px 40px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

h2 {
  font-size: 1.3rem; border-left: 5px solid var(--primary);
  padding-left: 10px; margin-top: 30px; line-height: 1.5;
}
.instruction { background: #fff; padding: 15px; border-radius: 8px; border: 1px solid #ddd; margin-bottom: 20px;}
.instruction p { margin: 0; line-height: 1.5; font-size: 1.1rem;}

.control-panel {
  background: white; padding: 20px; border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 20px; border: 2px solid #e0e0e0;
}
.slider-group { font-size: 1.2rem; }
input[type="range"] { width: 100%; height: 20px; margin-top: 10px; cursor: pointer;}

/* テープ図（0〜2m用） */
.simulator-area {
  background: white; padding: 40px 20px; border-radius: 10px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05); margin-bottom: 20px; border: 2px solid #e0e0e0;
}
.tape-wrapper-large { position: relative; width: 100%; padding-bottom: 20px; }
.tape-labels-top { display: flex; justify-content: space-between; font-weight: bold; font-size: 1.2rem; margin-bottom: 5px; position: relative;}
.label-0 { position: absolute; left: 0; transform: translateX(-50%); }
.label-1 { position: absolute; left: 50%; transform: translateX(-50%); color: var(--highlight);}
.label-2 { position: absolute; left: 100%; transform: translateX(-50%); }

.tape-ruler-large {
  width: 100%; height: 50px; background-color: #fff; border: 2px solid #333;
  display: flex; position: relative; box-sizing: border-box;
}
/* 1mの区切り線 */
.tape-ruler-large::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  border-left: 3px solid var(--highlight); z-index: 2;
}
.tape-mark { border-right: 1px dashed #999; height: 100%; box-sizing: border-box; z-index: 1;}
.tape-diagram-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background-color: var(--tape-color); transition: width 0.3s ease-in-out; opacity: 0.8; z-index: 0;
}
.tape-fraction-display {
  text-align: center; font-size: 1.5rem; font-weight: bold; margin-top: 15px; color: var(--tape-color);
  min-height: 40px;
}

/* 数直線 */
.number-line-area, .quiz-section {
  background: white; padding: 40px 20px 20px; border-radius: 10px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05); margin-bottom: 20px; border: 2px solid #e0e0e0;
}
.number-line-container {
  width: 90%; margin: 0 auto; height: 60px; position: relative; border-bottom: 3px solid var(--line-color);
}
.nl-tick {
  position: absolute; bottom: 0; width: 2px; height: 15px; background-color: var(--line-color); transform: translateX(-50%);
}
.nl-tick.main { height: 25px; width: 3px; }
.nl-label-top {
  position: absolute; bottom: 35px; left: 0; transform: translateX(-50%);
  font-size: 1.2rem; font-weight: bold;
}
.nl-label-bottom {
  position: absolute; top: 15px; left: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
}
.nl-point-name { font-weight: bold; color: var(--highlight); margin-bottom: 5px; font-size: 1.2rem;}

/* 分数入力コンポーネント */
.fraction-inputs-row { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 15px; }
.input-group { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 1.1rem; }
.practice-inputs { justify-content: center; gap: 20px; }
.practice-inputs > div { display: flex; flex-direction: column; align-items: center; gap: 5px; background: #fafafa; padding: 10px; border-radius: 8px; border: 1px solid #ddd;}
.point-label { font-size: 1.2rem; font-weight: bold; color: var(--highlight); }

.fraction-input { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; gap: 4px;}
.fraction-input.small .num-input { width: 45px; height: 35px; font-size: 1.3rem;}
.fraction-line { width: 100%; height: 2px; background-color: var(--text-main); }
.num-input { width: 50px; height: 45px; font-size: 1.5rem; text-align: center; border: 2px solid #ccc; border-radius: 5px;}
.small-input { width: 45px; height: 35px; font-size: 1.2rem; }

.inline-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: 1em; line-height: 1; font-weight: bold;}
.inline-frac .top { border-bottom: 2px solid currentColor; padding: 0 2px; }
.inline-frac .bottom { padding: 0 2px; }

/* ボタン類 */
.action-btn {
  padding: 10px 25px; font-size: 1.2rem; font-weight: bold; background-color: #29b6f6; color: white;
  border: none; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 0 #0288d1;
}
.action-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #0288d1; }
.result-message { font-size: 1.2rem; font-weight: bold; margin-top: 10px; min-height: 24px;}
.correct { color: #e91e63; }
.wrong { color: #1976d2; }

/* キャラクターふきだし */
.character-box {
  display: flex; align-items: flex-start; gap: 15px;
  background: white; padding: 15px; border-radius: 15px; border: 2px solid #a5d6a7;
  position: relative; margin-top: 20px;
}
.char-icon { width: 60px; height: 60px; }
.char-text { flex: 1; }
.char-text p { margin: 0; font-size: 1.1rem; line-height: 1.6; }