/* -------------------- */
/* 全体レイアウト       */
/* -------------------- */
body {
  font-family: "Segoe UI", sans-serif;
  margin: 20px;
  background: #f0f2f5;
  color: #333;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #222;
}

/* -------------------- */
/* パネル               */
/* -------------------- */
.container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.panel {
  flex: 1;
  min-width: 280px;
  background: #fff;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s;
}

.panel h2 {
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 10px;
}

/* -------------------- */
/* キャラクター表示     */
/* -------------------- */
.selected-char {
  width: 100px;
  height: 100px;
  border: 3px solid #666;
  border-radius: 50%;
  background-size: cover;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

/* 選択中のキャラクター枠 */
.selected-char.active {
  border-color: #28a745;
  box-shadow: 0 0 12px rgba(40, 167, 69, 0.6);
  transform: scale(1.2);
}

/* hover 効果を枠のみに適用 */
.selected-char:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(40, 167, 69, 0.4);
}

.left-panel .selected-char {
  border-color: #007bff;
}
.right-panel .selected-char {
  border-color: #e83e8c;
}

.grandparents {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* -------------------- */
/* キャラリスト         */
/* -------------------- */
.char-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 12px;
  background: #fff;
  padding: 15px;
  border-radius: 12px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.char-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid #ccc;
  position: relative;
  cursor: pointer;
  background-size: cover;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.char-icon:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.char-icon.selected {
  border-color: #28a745;
  box-shadow: 0 0 12px rgba(40, 167, 69, 0.6);
}

.score {
  position: absolute;
  bottom: -10px;
  right: -10px;
  background: #e83e8c;
  color: white;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 12px;
}

/* -------------------- */
/* ボタン               */
/* -------------------- */
.controls {
  margin-bottom: 15px;
  text-align: center;
}

.controls button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  margin: 0 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s, transform 0.1s;
}

.controls button:hover {
  transform: scale(1.2);
}

#reset {
  background: #6c757d;
  color: white;
}
#autoselect {
  background: #28a745;
  color: white;
}
#send {
  background: #007bff;
  color: white;
}

/* -------------------- */
/* 結果表示パネル統一 */
/* -------------------- */
.result {
  margin-top: 20px;
  padding: 15px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);

  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
}

.character-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  text-align: center;
  background: #f8f9fa;
  padding: 8px;
  border-radius: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.character-result img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.character-result img:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(40, 167, 69, 0.6);
}

.character-result strong {
  display: block;
  font-size: 14px;
  margin-top: 2px;
}

/* -------------------- */
/* 履歴用               */
/* -------------------- */
.history-item {
  cursor: pointer;
  padding: 4px 6px;
  margin-bottom: 2px;
  background-color: #f0f0f0;
  border-radius: 4px;
}

.history-item:hover {
  background-color: #e0e0ff;
}

/* -------------------- */
/* モーダル用           */
/* -------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  max-height: 80%;
  overflow-y: auto;
  width: 400px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
.modal-close {
  float: right;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
}
.modal-body {
  margin-top: 10px;
}

/* -------------------- */
/* レスポンシブ対応     */
/* -------------------- */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .panel {
    width: 100%;
  }
}
