/* Avatar picker modal — 16 武將選單 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.modal .modal-body {
  position: relative;
  background: #111118;
  border: 1px solid #2a2a35;
  border-radius: 10px;
  padding: 18px;
  max-width: 480px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  overflow: auto;
  color: #e4e4e7;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.modal .modal-body h3 {
  margin: 0 0 12px;
  color: #f4f4f5;
  font-size: 16px;
}

.avatar-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.avatar-filter button {
  padding: 6px 14px;
  background: #1e1e26;
  color: #94a3b8;
  border: 1px solid #2a2a35;
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.avatar-filter button:hover { background: #2a2a35; color: #e4e4e7; }
.avatar-filter button.active {
  background: #4f46e5;
  color: #fff;
  border-color: #6366f1;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 420px) {
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
}
.avatar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: #1e1e26;
  border: 1px solid #2a2a35;
  border-radius: 8px;
  cursor: pointer;
  color: #e4e4e7;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.avatar-cell:hover {
  background: #2a2a35;
  border-color: #6366f1;
  transform: translateY(-1px);
}
.avatar-cell svg,
.avatar-cell img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #0a0a10;
}
.avatar-cell-name {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

#avatarClose {
  padding: 8px 18px;
  background: #2a2a35;
  color: #e4e4e7;
  border: 1px solid #3a3a45;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
#avatarClose:hover { background: #3a3a45; }

.avatar-picker-err {
  color: #fca5a5;
  padding: 12px;
  text-align: center;
  grid-column: 1 / -1;
}
