:root {
  --primary-color: #4CAF50;
  --bg-color: #f4fbf4;
  --text-color: #333;
  --group-color: #e0f2f1;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Meiryo", sans-serif;
  background-color: #e8f5e9;
  color: var(--text-color);
  display: flex;
  justify-content: center;
  padding: 10px;
  margin: 0;
}

#app-container {
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  padding: 24px;
  max-width: 800px;
  width: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #ccc;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.header h1 { color: var(--primary-color); margin: 0; font-size: 24px; }
.progress { font-weight: bold; background: #eee; padding: 6px 12px; border-radius: 12px; }

.question-box {
  background-color: var(--bg-color);
  border-left: 6px solid var(--primary-color);
  padding: 16px;
  font-size: 20px;
  margin-bottom: 16px;
  border-radius: 4px;
  line-height: 1.8;
}

rt { font-size: 12px; color: #666; }

.controls { display: flex; gap: 12px; margin-bottom: 16px; }

.btn {
  padding: 10px 16px; font-size: 16px; font-weight: bold;
  border: none; border-radius: 8px; cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.95); }

.hint-btn { background-color: #ffca28; color: #333; }
.reset-btn { background-color: #e0e0e0; color: #333; }
.check-btn { background-color: var(--primary-color); color: white; width: 100%; margin-top: 16px; font-size: 20px; padding: 16px;}
.next-btn { background-color: #2196F3; color: white; width: 100%; margin-top: 16px; font-size: 20px; padding: 16px; animation: popIn 0.5s; }

.hint-box {
  background-color: #fffde7; border: 2px dashed #fbc02d;
  padding: 16px; border-radius: 8px; margin-bottom: 20px; font-size: 18px; line-height: 1.6;
}

.hidden { display: none !important; }

.area-label { font-weight: bold; color: #555; margin-bottom: 8px; }

.pool-area {
  min-height: 80px; background-color: #fafafa; border: 2px solid #ddd;
  border-radius: 12px; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px;
}

.groups-area { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; justify-content: center;}

.group-box {
  min-width: 70px; min-height: 80px; background-color: var(--group-color);
  border: 3px solid #b2dfdb; border-radius: 12px;
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center;
  gap: 4px; padding: 10px; position: relative;
}

.group-box::before {
  content: attr(data-label);
  position: absolute; top: -12px; background: #b2dfdb; color: #004d40;
  font-size: 12px; padding: 2px 8px; border-radius: 8px; font-weight: bold;
}

.item {
  width: 32px; height: 32px; font-size: 24px;
  display: flex; justify-content: center; align-items: center;
  cursor: pointer; transition: transform 0.2s; user-select: none;
}
.item:hover { transform: scale(1.2); }

.equation-box { background-color: #e3f2fd; padding: 20px; border-radius: 12px; text-align: center; }

.type-check {
  background: white; padding: 12px; border-radius: 8px; display: inline-block;
  margin-bottom: 16px; font-weight: bold; font-size: 18px; border: 2px solid #90caf9;
}
.type-check label { margin: 0 10px; cursor: pointer; }
.type-check input { transform: scale(1.5); margin-right: 6px; }

.equation-text { font-size: 26px; font-weight: bold; margin-bottom: 8px;}
.small-notice { font-size: 14px; color: #d32f2f; margin-top: 8px; font-weight: normal; }

.ans-input {
  width: 60px; font-size: 24px; text-align: center; padding: 4px;
  border: 2px solid #2196f3; border-radius: 8px; margin: 0 4px;
}

.message {
  margin-top: 20px; padding: 16px; border-radius: 8px; text-align: center;
  font-size: 22px; font-weight: bold; animation: popIn 0.5s;
}
.message.success { background-color: #c8e6c9; color: #2e7d32; }
.message.error { background-color: #ffcdd2; color: #c62828; }

@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }