:root {
  --primary: #00897b;
  --secondary: #ffb300;
  --bg-color: #f0fdf4;
  --card-bg: #ffffff;
  --text-main: #333333;
  --ami-color: #fce4ec;
  --riku-color: #e3f2fd;
}

body {
  font-family: 'Hiragino Maru Gothic ProN', 'Meiryo', sans-serif;
  background-color: #e0e0e0;
  margin: 0;
  padding: 15px;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 900px;
  background: var(--bg-color);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--primary);
  color: white;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 { margin: 0; font-size: 22px; }
.step-indicator { background: rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 20px; font-weight: bold; }

/* ---------------- Visualizer ---------------- */
.visualizer {
  background: #ffffff;
  padding: 20px 25px;
  border-bottom: 4px solid #b2dfdb;
}

.area-label { font-weight: bold; color: #555; display: flex; align-items: center; justify-content: space-between; }
.btn-small { background: #eeeeee; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-family: inherit;}

.pool {
  min-height: 50px; background: #fafafa; border: 2px dashed #ccc; border-radius: 10px;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}

.groups {
  display: flex; flex-wrap: wrap; gap: 15px; margin-top: 10px; min-height: 90px;
}

.group-box {
  background: #e0f2f1; border: 3px solid #80cbc4; border-radius: 12px;
  padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; justify-content: center;
  width: 100px; transition: transform 0.2s;
}
.group-box.full { background: #b2dfdb; border-color: #00897b; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

.item {
  width: 28px; height: 28px; background: #ff5252; border-radius: 50%;
  box-shadow: inset -2px -2px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  cursor: pointer; transition: transform 0.1s;
}
.item:hover { transform: scale(1.1); }
.item-slot { width: 28px; height: 28px; background: rgba(255,255,255,0.7); border-radius: 50%; }

/* ---------------- Lesson Flow ---------------- */
.lesson-flow { padding: 25px; }

.step-card {
  background: var(--card-bg); border-radius: 12px; padding: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05); animation: fadeIn 0.5s ease-out;
}

.step-card h2 { color: var(--primary); margin-top: 0; border-bottom: 2px dashed #b2dfdb; padding-bottom: 10px; }
.question-text { font-size: 18px; font-weight: bold; line-height: 1.6; }
.hint-text { color: #f57c00; font-weight: bold; font-size: 15px; background: #fff3e0; padding: 10px; border-radius: 8px; display: inline-block;}

.character-box { padding: 15px; border-radius: 10px; margin-bottom: 15px; font-size: 18px; border: 2px solid transparent;}
.character-box.ami { background: var(--ami-color); border-color: #f8bbd0; }
.character-box.riku { background: var(--riku-color); border-color: #90caf9; }

input[type="text"] {
  width: 60px; height: 40px; font-size: 20px; text-align: center;
  border: 2px solid #ccc; border-radius: 8px; outline: none; font-family: inherit;
}
input[type="text"]:focus { border-color: var(--secondary); background: #fff8e1; }

.answer-box, .summary-box {
  background: #f5f5f5; padding: 20px; border-radius: 12px; text-align: center; font-size: 24px; font-weight: bold; margin: 20px 0;
}
select { font-size: 20px; padding: 5px 10px; font-weight: bold; border: 2px solid var(--primary); border-radius: 8px; }

.btn-check {
  display: block; width: 100%; background: var(--primary); color: white;
  border: none; padding: 15px; font-size: 18px; font-weight: bold; border-radius: 8px; cursor: pointer;
  box-shadow: 0 4px 0 #00695c; transition: transform 0.1s;
}
.btn-check:active { transform: translateY(4px); box-shadow: 0 0 0 #00695c; }

/* ---------------- Tables & Grids ---------------- */
.calc-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 20px; font-weight: bold; }
.calc-table td { padding: 12px; border-bottom: 2px solid #eeeeee; text-align: center; }
.calc-table tr { cursor: pointer; transition: background 0.2s; }
.calc-table tr:hover { background: #f1f8e9; }
.highlight-row { background: #e8f5e9; }

.practice-grid { display: grid; grid-template-columns: 1fr; gap: 15px; margin: 20px 0; }
.practice-item { background: #fafafa; border: 2px solid #e0e0e0; padding: 15px; border-radius: 8px; font-size: 20px; font-weight: bold; cursor: pointer;}
.practice-item:hover { border-color: var(--primary); background: #e0f2f1;}

.msg { margin-top: 20px; padding: 15px; border-radius: 8px; font-weight: bold; font-size: 16px; line-height: 1.5; white-space: pre-wrap; }
.msg.error { background: #ffebee; color: #c62828; border-left: 5px solid #f44336; }
.msg.success { background: #e8f5e9; color: #2e7d32; border-left: 5px solid #4caf50; }

.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }