:root {
  --main-blue: #3498db;
  --dark-blue: #2980b9;
  --main-green: #2ecc71;
  --accent-red: #e74c3c;
  --accent-orange: #e67e22;
  --unit-gold: #f1c40f;
  --text-dark: #333;
  --bg-color: #f4f7f6;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Meiryo", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  margin: 0;
  padding: 20px;
}

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

header {
  border-bottom: 4px solid var(--main-green);
  padding-bottom: 10px;
  margin-bottom: 25px;
}

.page-title-group { display: flex; align-items: center; }
.page-num {
  background: #9b59b6; color: white; font-size: 20px; font-weight: bold;
  padding: 5px 15px; border-radius: 8px 8px 0 8px; margin-right: 15px;
}
h1 { margin: 0; font-size: 24px; color: #2c3e50; }
.subtitle { margin: 10px 0 0 0; font-size: 16px; color: #7f8c8d; font-weight: bold; }

.mission-card {
  background: white; border: 2px solid #ecf0f1; border-radius: 10px;
  padding: 25px; margin-bottom: 30px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.alert-bg { background: #fdfefe; border-color: #3498db; }

.section-title {
  color: var(--dark-blue); font-size: 20px; border-bottom: 2px solid var(--main-blue);
  padding-bottom: 8px; margin-top: 0; line-height: 1.4;
}

.interactive-workspace {
  background: #f8f9fa; border-radius: 10px; padding: 20px; text-align: center;
  border: 2px dashed var(--main-blue); margin-bottom: 20px;
}
.instruction { font-weight: bold; color: var(--accent-orange); margin-top: 0; font-size: 18px;}

/* タブボタン */
.tab-buttons { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;}
.tab-btn {
  background: #fff; border: 2px solid var(--main-blue); color: var(--main-blue);
  padding: 10px 20px; font-size: 16px; font-weight: bold; border-radius: 25px;
  cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { background: var(--main-blue); color: #fff; }

/* ツール1: 魔法のマシーン */
.prefix-machine {
  background: #fff; border: 2px solid #bdc3c7; border-radius: 10px; padding: 20px;
  display: flex; flex-direction: column; align-items: center;
}
.machine-controls { display: flex; gap: 15px; margin-bottom: 20px; }
.prefix-btn {
  padding: 12px 20px; font-size: 18px; font-weight: bold; border-radius: 10px; cursor: pointer; border: none;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2); transition: transform 0.1s, box-shadow 0.1s; color: white;
}
.prefix-btn:active { transform: translateY(4px); box-shadow: none; }
.k-btn { background: #e74c3c; box-shadow: 0 4px 0 #c0392b; }
.m-btn { background: #9b59b6; box-shadow: 0 4px 0 #8e44ad; }

.machine-display {
  background: #ecf0f1; width: 100%; padding: 20px; border-radius: 10px; font-size: 24px; font-weight: bold;
}
.arrow-down { margin: 10px 0; font-size: 30px; }
.result-unit { color: var(--accent-red); min-height: 35px; }

/* ツール2: 単位関係図 */
.unit-diagram { background: #fff; padding: 15px; border-radius: 10px; }
.diagram-row { display: flex; align-items: center; justify-content: center; gap: 5px; }
.unit-box {
  border: 2px solid #bdc3c7; padding: 10px; border-radius: 8px; font-weight: bold; width: 60px; text-align: center;
}
.highlight { background: #dff9fb; border-color: #3498db; }
.empty-box { border: none; background: transparent; }
.arrow-box { font-size: 14px; font-weight: bold; color: #7f8c8d; text-align: center; width: 60px; }
.arrow-box span { color: #e74c3c; }

/* はかりエリア */
.scale-container { display: flex; justify-content: center; margin-bottom: 15px; position: relative;}
#review-scale { filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.2)); }
input[type=range] { width: 80%; margin: 10px 0 20px 0; cursor: pointer; }
.current-weight-display { font-size: 22px; font-weight: bold; }
.hit-message { color: var(--accent-red); font-size: 20px; min-height: 30px; margin-top: 5px; }

/* 練習エリア（缶詰と単位） */
.practice-area { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 20px;}
.practice-item { flex: 1; min-width: 280px; background: #fdfefe; border: 1px solid #bdc3c7; border-radius: 10px; padding: 15px; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
.item-name { margin: 0 0 15px 0; color: #2c3e50; border-bottom: 2px dashed #bdc3c7; padding-bottom: 5px; font-size: 18px;}

/* 缶詰の図 */
.visual-can { width: 100%; margin: 15px 0; }
.can-total { background: #f1c40f; padding: 5px; font-weight: bold; border-radius: 5px 5px 0 0; border: 2px solid #f39c12; border-bottom: none;}
.can-parts { display: flex; height: 50px; }
.can-metal { background: #95a5a6; width: 30%; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; border-radius: 0 0 0 5px; border: 2px solid #7f8c8d;}
.can-content { background: #e67e22; width: 70%; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; border-radius: 0 0 5px 0; border: 2px solid #d35400; border-left: none;}

/* 単位選択リスト */
.unit-select-list { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-left: 10px; }

/* 共通パーツ */
.question-box { background: #eafaf1; padding: 15px 20px; border-radius: 10px; }
.input-row-multi { font-size: 18px; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap;}
input[type="text"] { font-family: inherit; font-size: 18px; text-align: center; border: 2px solid #bdc3c7; border-radius: 5px; padding: 8px; transition: all 0.3s; }
input[type="text"]:focus { border-color: var(--main-blue); outline: none; background: #eef7ff; }
.correct-input { background-color: #d4edda !important; border-color: #28a745 !important; color: #155724; font-weight: bold;}
.table-input { width: 60px; }
.large-input { width: 90px; }
.mt-10 { margin-top: 10px; }
.hint-btn { background: #fff; border: 2px solid #f1c40f; padding: 5px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; color: #d35400;}
.hint-box { display: none; background: #fff9c4; border-radius: 5px; padding: 10px; margin-top: 10px; font-size: 15px; font-weight: bold; color: #333;}
.character-insight { background: #fff3cd; border: 2px solid #ffc107; padding: 15px; border-radius: 20px; display: inline-block; font-weight: bold; text-align: left; }
.notebook-section { background: #fdfefe; border: 3px dashed var(--accent-red); padding: 25px; border-radius: 15px; margin-top: 30px; }
.notebook-section h2 { margin-top: 0; color: var(--accent-red); }
.notebook-section ul { font-weight: bold; color: #2c3e50; line-height: 1.8;}